// @flow strict-local

const invariant = require('assert');
const path = require('path');
const {Packager} = require('@parcel/plugin');
const {loadConfig} = require('@parcel/utils');

module.exports = (new Packager({
  async loadConfig({options, config}) {
    let result = await config.getConfigFrom(path.join(options.projectRoot, 'index'), ['foo.config.json']);
    return result && result.contents;
  },
  package({bundle, config}) {
    invariant(config);
    return {contents: config.contents};
  },
}) /*: Packager */);
