egoist / style-inject

Inject style tag to document head.
MIT License
48 stars 23 forks source link

The CDN and Github source is different but same package version? #16

Open subz390 opened 4 years ago

subz390 commented 4 years ago

Hi I think there's a problem with the release.

  1. There's an issue with the yarnpkg CDN source that you've already fixed here in GitHub (three years ogo)
  2. The CDN and the GitHub package versions are the same, yet the source is different.
  3. Unrelated but confusing: GitHub says the latest releast is v0.2.0, yet CDN it's v0.3.0 and the package here in GitHub is v0.3.0?

Different Code - Same v0.3.0 package

yarn add --dev style-inject gets you this version https://registry.yarnpkg.com/style-inject/-/style-inject-0.3.0.tgz#d21c477affec91811cc82355832a700d22bf8dd3

function styleInject(css, ref) {
  if ( ref === void 0 ) ref = {};
  var insertAt = ref.insertAt;

This has the issue of ref.insertAt can be an uncaught inexistant property, which I see you've fixed already in the current GitHub version.

yarn add --dev https://github.com/egoist/style-inject.git gets you also v0.3.0 but it's source is different;

export default function styleInject(css, { insertAt } = {}) {
  if (!css || typeof document === 'undefined') return

Summary

So basically yarn add --dev style-inject or yarn add --dev rollup-plugin-postcss gets the user an old version of the code which in my case failed Closure Compiler tests (I'll submit another issue about that shortly).

More

I also checked other repos and they have the same difference. https://www.jsdelivr.com/package/npm/style-inject https://registry.npmjs.org/style-inject/-/style-inject-0.3.0.tgz