Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency rehype-highlight to v5 #302

Merged
merged 11 commits into from
Aug 15, 2021

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 5, 2021

WhiteSource Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
rehype-highlight 4.1.0 -> 5.0.0 age adoption passing confidence

Release Notes

rehypejs/rehype-highlight

v5.0.0

Compare Source

  • dfa5a4b Use ESM
    • Change:

      // From CommonJS
      var rehypeHighlight = require('rehype-highlight')
      
      // To ESM
      import rehypeHighlight from 'rehype-highlight'

      Learn more about ESM in this guide

  • c87da55 Update lowlight
    • This changes from having all languages registered by default (191) to only having common languages on (35). See https://github.com/wooorm/lowlight#syntaxes for which languages are on by default and which can be added.
      This makes rehype-highlight much faster and viable for use in browsers
    • This removes the light version of the plugin, because the default is now light
    • Updating lowlight also updates highlight.js to v11, which improves results
  • fa5fcf4 Add JSDoc based types
  • 84b5ce2 Fix code being dropped

Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box.

This PR has been generated by WhiteSource Renovate. View repository job log here.

@Belco90
Copy link
Member

Belco90 commented Aug 5, 2021

I may need to handle this one manually since I'm not sure if the breaking changes are affecting current transformations.

@HonkingGoose
Copy link
Collaborator

I'll let you handle it then! 😉

@Belco90
Copy link
Member

Belco90 commented Aug 6, 2021

I've upgraded the whole unified ecosystem but still getting this error:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/mario/Projects/octoclairvoyant/node_modules/rehype-highlight/index.js
require() of ES modules is not supported.
require() of /Users/mario/Projects/octoclairvoyant/node_modules/rehype-highlight/index.js from /Users/mario/Projects/octoclairvoyant/.next/server/pages/comparator.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/mario/Projects/octoclairvoyant/node_modules/rehype-highlight/package.json.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.rehype-highlight (/Users/mario/Projects/octoclairvoyant/.next/server/pages/comparator.js:861:18)
at __webpack_require__ (/Users/mario/Projects/octoclairvoyant/.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///./src/hooks/useProcessDescriptionMdast.ts:4:74)
at Module../src/hooks/useProcessDescriptionMdast.ts (/Users/mario/Projects/octoclairvoyant/.next/server/src_components_RepositoryReleasesChangelog_tsx.js:64:1)
at __webpack_require__ (/Users/mario/Projects/octoclairvoyant/.next/server/webpack-runtime.js:33:43) {

code: 'ERR_REQUIRE_ESM'

I need to investigate this further, no idea what's wrong.

@Belco90
Copy link
Member

Belco90 commented Aug 6, 2021

Alright, issue found: it turns out Webpack v5 used by Next.js is not ready yet for ESM packages. The whole info is in this issue: vercel/next.js#23725

This has been solved in the canary of Next.js (I have confirmed this locally), but I'll wait until it's released in the stable channel to upgrade everything.

I'll leave this PR on hold then until Next.js releases compatibility for ESM packages.

additional.d.ts Show resolved Hide resolved
src/models.ts Show resolved Hide resolved
@HonkingGoose
Copy link
Collaborator

Alright, issue found: it turns out Webpack v5 used by Next.js is not ready yet for ESM packages. The whole info is in this issue: vercel/next.js#23725

This has been solved in the canary of Next.js (I have confirmed this locally), but I'll wait until it's released in the stable channel to upgrade everything.

I'll leave this PR on hold then until Next.js releases compatibility for ESM packages.

Hooray, you found the problem! 😄

Okay, so we need to wait until Next.js updates before we can use the newer version of rehype-highlight.

@Belco90
Copy link
Member

Belco90 commented Aug 11, 2021

It's here! https://nextjs.org/blog/next-11-1

I'll try to get all this upgraded tomorrow.

@HonkingGoose
Copy link
Collaborator

Yay!!!! 😄 I'll go read the blog.

@Belco90
Copy link
Member

Belco90 commented Aug 15, 2021

The whole unified/rehype/remark ecosystem is upgraded and working fine with Next.js v11.1 now. This PR is ready to go!

@HonkingGoose HonkingGoose merged commit bacfdb6 into main Aug 15, 2021
@HonkingGoose HonkingGoose deleted the renovate/rehype-highlight-5.x branch August 15, 2021 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants