const Transformer = require('@parcel/plugin').Transformer;

module.exports = new Transformer({
  transform({asset}) {
    if (asset.isSource) {
      asset.addDependency({
        specifier: 'foo',
        specifierType: 'esm'
      });
      return [asset];
    }

    const {message} = require('./constants');
    return [
      {
        type: 'js',
        content: message,
      },
    ];
  }
});
