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

punycode deprecation #166

Open
aparajita opened this issue Jul 16, 2024 · 6 comments
Open

punycode deprecation #166

aparajita opened this issue Jul 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@aparajita
Copy link

Describe the bug
When running under node v22.4.1, I get a deprecation warning for punycode.

Current behavior
The following error is printed to the console:

(node:72996) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.

Expected behavior
No error.

Environment

  • commit-and-tag-version version(s): 12.4.1
  • Node/npm version: 22.4.1
  • OS: macOS 14.5 (Apple Silicon)
@aparajita aparajita added the bug Something isn't working label Jul 16, 2024
@TimothyJones
Copy link
Member

Thanks for the report. This is coming via jsdom, where they have an open issue about it. The easiest path is probably to wait for a fix for them - or alternatively, jsdom could be replaced - it's just used to parse some XML in the maven updater.

@aparajita
Copy link
Author

alternatively, jsdom could be replaced - it's just used to parse some XML in the maven updater.

Using jsdom to parse XML seems like overkill. There must be lighter weight XML parsers out there.

In the meantime I fixed it with the following .pnpmfile.cjs:

function readPackage(pkg, context) {
  if (pkg.name === 'jsdom' && pkg.version.startsWith('23.2')) {
    // Replace tough-cookie v4 with v5
    pkg.dependencies = {
      ...pkg.dependencies,
      'tough-cookie': '^5.0.0-rc.3'
    }
    context.log('tough-cookie@4 => tough-cookie@5 in dependencies of jsdom')
  }

  return pkg
}

module.exports = {
  hooks: {
    readPackage
  }
}

@TimothyJones
Copy link
Member

Thanks. It’s helpful to have the pnpmfile on the issue in case it helps others who want to work around it. I’m not super keen to muck with the dependencies of our dependencies in a released version, though.

in the meantime, it’s just a deprecation warning, there’s no loss of functionality until there are breaking changes in a later version of node

Very happy to accept a PR replacing jsdom with something lighter if you have the time

@aparajita
Copy link
Author

I’m not super keen to muck with the dependencies of our dependencies in a released version, though.

The tough-cookie maintainers said v5 is API compatible with v4.

in the meantime, it’s just a deprecation warning

...which should be taken seriously. punycode was deprecated 3 years ago in node 16.

@Mukul1127
Copy link

Mukul1127 commented Jul 28, 2024

alternatively, jsdom could be replaced - it's just used to parse some XML in the maven updater.

Using jsdom to parse XML seems like overkill. There must be lighter weight XML parsers out there.

In the meantime I fixed it with the following .pnpmfile.cjs:

function readPackage(pkg, context) {
  if (pkg.name === 'jsdom' && pkg.version.startsWith('23.2')) {
    // Replace tough-cookie v4 with v5
    pkg.dependencies = {
      ...pkg.dependencies,
      'tough-cookie': '^5.0.0-rc.3'
    }
    context.log('tough-cookie@4 => tough-cookie@5 in dependencies of jsdom')
  }

  return pkg
}

module.exports = {
  hooks: {
    readPackage
  }
}

It may be better to just add this into package.json:

  "pnpm": {
    "overrides": {
      "jsdom>tough-cookie": "^5.0.0-rc.4"
    }
  },

It also works with yarn:

  "resolutions": {
    "jsdom/tough-cookie": "^5.0.0-rc.4"
  }

and for npm:

  "overrides": {
    "tough-cookie": "^5.0.0-rc.4"
  }

@aparajita
Copy link
Author

It may be better to just add this into package.json:

Thanks, I forgot about that config option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants