florian-lefebvre / astro-integration-kit

A package that contains utilities to help you build Astro integrations.
https://astro-integration-kit.netlify.app
MIT License
46 stars 8 forks source link

feat: add defineUtility, update utilities and clean plugins #92

Closed florian-lefebvre closed 3 months ago

florian-lefebvre commented 3 months ago

In this PR:

Unfortunately, the PR got way too big so here is how you can review it without losing your sanity:

TODO:

netlify[bot] commented 3 months ago

Deploy Preview for astro-integration-kit ready!

Name Link
Latest commit 8294ef239b2e9d5dd6e1ea86e179e4d06d2cc485
Latest deploy log https://app.netlify.com/sites/astro-integration-kit/deploys/660164da72c2f50008c9c134
Deploy Preview https://deploy-preview-92--astro-integration-kit.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BryceRussell commented 3 months ago

I am currently testing hasVitePluginPlugin in the playground, and it looks like it is not working, but I am still investigating

BryceRussell commented 3 months ago

The overriding issue can be fixed inside defineIntegration.ts by spreading the params after the plugins instead of before:

  return providedHooks[hookName]?.({
-   ...params,
    ...Object.fromEntries(
        plugins.map((plugin) => [
            plugin.name,
            plugin.implementation(params, { name }),
        ]),
    ),
+   ...params,
  } as any);