Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 03 Oct 15:17
· 162 commits to main since this release

Minor Changes

  • 70bb7a1: BREAKING CHANGE: addPlugin API changed

    - addPlugin({ name: 'my-plugin', plugin: myPlugin, options: { myFlag: true }, location: 'top' });
    + addPlugin(myPlugin, { myFlag: true }, { location: 'top' });

    This is now type safe and typescript will throw an error if you pass the wrong type.

    function myPlugin({ myFlag = false } = {}) {
      // ...
    }
    
    addPlugin(myPlugin, { myFlag: true }); // ts ok
    addPlugin(myPlugin, { notExisting: true }); // ts error
  • 70bb7a1: BREAKING CHANGE: adjustPluginOptions API changed

    - adjustPluginOptions('my-plugin', { myFlag: true });
    + adjustPluginOptions(myPlugin, { myFlag: true });

    This is now type safe and typescript will throw an error if you pass the wrong type.

    function myPlugin({ myFlag = false } = {}) {
      // ...
    }
    
    adjustPluginOptions(myPlugin, { myFlag: true }); // ts ok
    adjustPluginOptions(myPlugin, { notExisting: true }); // ts error
  • 70bb7a1: Add removePlugin functionality

    export default {
      setupPlugins: [removePlugin(json)],
    };
  • 70bb7a1: BREAKING CHANGE: metaConfigToRollupConfig has been renamed to applyPlugins

    - const finalConfig = metaConfigToRollupConfig(currentConfig, defaultMetaPlugins);
    + const finalConfig = applyPlugins(currentConfig, defaultMetaPlugins);
  • 70bb7a1: BREAKING CHANGE: metaConfigToWebDevServerConfig has been removed

  • 70bb7a1: Plugins can now be classes as well. The options are passed to the constructor.

    /**
     * @typedef {object} MyClassOptions
     * @property {string} lastName
     */
    
    class MyClass {
      /** @type {MyClassOptions} */
      options = {
        lastName: 'initial-second',
      };
    
      /**
       * @param {Partial<MyClassOptions>} options
       */
      constructor(options = {}) {
        this.options = { ...this.options, ...options };
      }
    }
    
    export default {
      setupPlugins: [addPlugin(MyClass)],
    };
    
    // constructor parameters are type safe
    addPlugin(MyClass, { lastName: 'new name' }); // ts ok
    addPlugin(MyClass, { otherProp: 'new name' }); // ts error