const svelte = require("rollup-plugin-svelte"); const typescript = require("@rollup/plugin-typescript"); const { terser } = require("rollup-plugin-terser"); const html = require("@rollup/plugin-html"); const resolve = require("rollup-plugin-node-resolve"); const image = require("@rollup/plugin-image"); const sizes = require("rollup-plugin-sizes"); const visualise = require("rollup-plugin-visualizer"); const postcss = require("rollup-plugin-postcss"); const commonjs = require("@rollup/plugin-commonjs"); const livereload = require("rollup-plugin-livereload"); const { preprocess } = require("./svelte.config"); 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}