parcel icon indicating copy to clipboard operation
parcel copied to clipboard

feat: add @parcel/optimizer-svgo3 plugin

Open jack0pan opened this issue 1 year ago • 11 comments

↪️ Pull Request

Fix #8701, but svgo 3.0 has breaking changes:

  • Node.js 14+ is required for version
  • stable package is replaced with native stable sort (required node 12+)
  • and some plugins' name was changed

In this major version of parcel:

  1. introduce two new plugins for svgo 3.
  • @parcel/optimizer-htmlnano3
  • @parcel/optimizer-svgo3
  1. use them with config:
{
  "extends": "@parcel/config-default",
  "optimizers": {
    "*.{html,xhtml}": ["@parcel/optimizer-htmlnano3"],
    "*.svg": ["@parcel/optimizer-svgo3"]
  }
}

In the next major of parcel:

  1. remove optimizers/htmlnano-3 and optimizers/svgo-3.
  2. change optimizers/htmlnano and optimizers/svgo to work with svgo 3.

💻 Examples

🚨 Test instructions

✔️ PR Todo

  • [x] Added/updated unit tests for this change
  • [x] Filled out test instructions (In case there aren't any unit tests)
  • [x] Included links to related issues/PRs

jack0pan avatar Jan 31 '23 05:01 jack0pan

Are there any breaking changes in this release?

devongovett avatar Feb 01 '23 04:02 devongovett

Are there any breaking changes in this release?

Add to the comment.

jack0pan avatar Feb 01 '23 05:02 jack0pan

Fix the params of svgo optimizer:

jack0pan avatar Feb 01 '23 06:02 jack0pan

Node.js 14+ is required for version

Parcel (officially) supports Node 12, but since that's EOL we should probably move on anyway.

mischnic avatar Feb 01 '23 08:02 mischnic

I'm more concerned that the plugin names seem to have changed. That would break people's config files.

devongovett avatar Feb 01 '23 13:02 devongovett

Node.js 14+ is required for version

Parcel (officially) supports Node 12, but since that's EOL we should probably move on anyway.

I'm more concerned that the plugin names seem to have changed. That would break people's config files.

All right, wait the next major version?

jack0pan avatar Feb 02 '23 12:02 jack0pan

We have a similar situation here as well: https://github.com/parcel-bundler/parcel/pull/7922

mischnic avatar Feb 02 '23 17:02 mischnic

OK. Let me try.

jack0pan avatar Feb 04 '23 06:02 jack0pan

@devongovett @mischnic Please review this pr.

jack0pan avatar Feb 19 '23 13:02 jack0pan

Hey sorry @jack0pan. We haven't yet figured out what we want to do here. Introducing a whole bunch of new plugins that users must manually upgrade isn't ideal. Ideally new projects would automatically get the new version while existing projects would stick with the version they have until they decide to upgrade. I'm not sure if there is a way to do that. One idea was proposed in https://github.com/parcel-bundler/parcel/pull/7922#issuecomment-1100140323

Bump a major version on @parcel/transformer-mdx. Change the dependency range in @parcel/config-default to e.g. ^2.4.1 || ^3.0.0. This way, existing projects will continue to work with the old version and would need to manually update the version installed in their projects, but new projects would automatically get the latest when auto installed. I think this is more optimal, but I have not tested whether it will actually work at the moment or whether we need to make changes to support it.

I still have not tested what package managers do in this case. Would be good to figure it out though because this is going to keep happening.

devongovett avatar Feb 21 '23 04:02 devongovett

  • [ ] https://github.com/jhines2k7/parcel...

srbaeza-ai avatar Jan 31 '24 11:01 srbaeza-ai