/** @typedef {import('@web/dev-server-core').Plugin} Plugin */

// eslint-disable-next-line no-undef
const systemVariables = { ...process.env }

export default /** @type Plugin */ ({
  name: 'api-store',

  serve(context) {
    if (context.path === '/demo/env.js') {
      const data = {
        systemVariables,
      }
      return `export default ${JSON.stringify(data)}`
    }
    return undefined
  },
})
