import svelte from "rollup-plugin-svelte"; import esbuild from "rollup-plugin-esbuild"; import html from "@rollup/plugin-html"; import resolve from "@rollup/plugin-node-resolve"; import image from "@rollup/plugin-image"; import sizes from "rollup-plugin-sizes"; import { visualizer } from "rollup-plugin-visualizer"; import postcss from "rollup-plugin-postcss"; import livereload from "rollup-plugin-livereload"; import sveltePreprocess from "svelte-preprocess"; const VIEWS = ["home", "login", "popup", "user"]; const dev = process.env.NODE_ENV !== "production"; const htmlTemplate = ({ attributes, meta, files, publicPath, title }) => { const makeHtmlAttributes = (attributes) => { if (!attributes) { return ""; } const keys = Object.keys(attributes); // eslint-disable-next-line no-param-reassign return keys.reduce( (result, key) => (result += ` ${key}="${attributes[key]}"`), "" ); }; const scripts = (files.js || []) .map(({ fileName }) => { const attrs = makeHtmlAttributes(attributes.script); return ``; }) .join("\n"); const links = (files.css || []) .map(({ fileName }) => { const attrs = makeHtmlAttributes(attributes.link); return ``; }) .join("\n"); const metas = meta .map((input) => { const attrs = makeHtmlAttributes(input); return ``; }) .join("\n"); return `
${metas}