uri-js icon indicating copy to clipboard operation
uri-js copied to clipboard

Use punycode userland module

Open domdomegg opened this issue 6 months ago • 15 comments

This fixes deprecation warnings about using the punycode node module.

That's because require("punycode") in node is getting the deprecated in-built node module, rather than the NPM package. Adding a trailing slash (as suggested in punycode's README) fixes this.

Fixes https://github.com/garycourt/uri-js/issues/94

Related:

  • https://github.com/eslint/eslint/issues/17720
  • https://github.com/ajv-validator/ajv/issues/2343
  • https://github.com/ajv-validator/ajv/issues/2350

domdomegg avatar Dec 06 '23 13:12 domdomegg

Hi there, just bumping this as it's causing the deprecation warning to show up in popular upstream packages (like eslint)

leanderlee avatar Dec 20 '23 01:12 leanderlee

Unfortunately last commit is 2 years ago...

matschik avatar Dec 22 '23 15:12 matschik

Should probably tag @garycourt in case necessary for his GitHub notification settings

domdomegg avatar Dec 22 '23 17:12 domdomegg

@aramshiva you do not know the circumstances he's currently in - he has not committed in a long time... Maybe he's away or stopped interacting with the website. Do not burden him with something he has not agreed to do. As you say, it is open source - one can fork it, fix it, and also publish it.

I agree that this needs to be resolved, but please be understanding.

andylamp avatar Feb 02 '24 00:02 andylamp

I've published a fork that addresses this issue: https://www.npmjs.com/package/toad-uri-js

Would appreciate if you give it a try!

kibertoad avatar Feb 09 '24 19:02 kibertoad

I've published a fork that addresses this issue: https://www.npmjs.com/package/toad-uri-js

why did you not fork garycourt/uri-js to kibertoad/toad-uri-js

milahu avatar Feb 15 '24 12:02 milahu

@milahu I've done forking of other libraries in the past, it gives a very bad developer experience, as then all PRs default to targetting parent repositories, ending up in creating accidental PRs

kibertoad avatar Feb 15 '24 12:02 kibertoad

aah. still, you should preserve the original git history = 89 commits until a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae

milahu avatar Feb 15 '24 12:02 milahu

@milahu PR restoring git history would be welcome.

kibertoad avatar Feb 15 '24 13:02 kibertoad

please help yourself

fix-git-fork-history.sh
#!/usr/bin/env bash

set -e
set -x

git clone https://github.com/garycourt/uri-js
mv uri-js toad-uri-js
cd toad-uri-js
git branch -M master main || true
git remote add fork https://github.com/kibertoad/toad-uri-js
git fetch fork main
git worktree add fork-main fork/main

# this is the first commit in the fork
# git log --format=fuller
cat >/dev/null <<'EOF'
commit ab2a6cab3b60120db334118640f0417d0c7a7f52
Author:     Igor Savin <[email protected]>
AuthorDate: Fri Feb 9 20:40:20 2024 +0200
Commit:     GitHub <[email protected]>
CommitDate: Fri Feb 9 20:40:20 2024 +0200

    Migrate to vitest (#1)
EOF

git rm -rf dist/
GIT_AUTHOR_DATE="Fri Feb 9 20:20:00 2024 +0200" \
git commit -m "rm dist/"

git -C fork-main checkout fork/main~12
cp fork-main/.gitignore .gitignore
git add .gitignore
GIT_AUTHOR_DATE="Fri Feb 9 20:30:00 2024 +0200" \
git commit -m "up .gitignore"

# now there should be no difference
# -> ready for cherry-pick
git_diff=$(git diff main~0 fork/main~12)
if [[ "$git_diff" != "" ]]; then
  echo "error: diff is not empty:"
  echo "$git_diff"
  exit 1
fi

git cherry-pick  fork/main~12..fork/main

# use author date as committer date
# github shows only the committer date
git rebase a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae --committer-date-is-author-date

# undo the cherry-pick
#git reset --hard main~12

git tag 5.0.0 main~4

git tag 5.0.1 main~0

echo "done. verify:"
echo "git -C toad-uri-js/ log --format=fuller"

milahu avatar Feb 15 '24 16:02 milahu

As this repo is not maintained, you can also nvm install 20 && nvm use 20 to go back to Node v20.11.1 and silence it for now until ajv/eslint/etc update their dependencies

iwasrobbed avatar Mar 08 '24 22:03 iwasrobbed

@ttodua, I wholeheartedly disagree. It is our fault for depending on a library with questionable support and when we accepted the license to use it - it says explicitly that, that it is provided "AS-IS".

Now, the fallacy with OSS entitlement has caused a lot of issues in the past but any author of such package, unless contractually obliged, does not owe us a damn thing. We use the code provided "AS-IS" and with us burdening the associated risks, which include what you are describing.

andylamp avatar Apr 04 '24 22:04 andylamp

does not owe us a damn thing

I am not sure you read my comment well, because i explicitly said that "I don't say he owes something, but", then followed what I said. There is a big gap between concept of "owe" and professional attitude. Hope you now understand. anyway, i've deleted that comment, in order to avoid such no-make-sense continuations

ttodua avatar Apr 04 '24 22:04 ttodua

i've deleted that comment, in order to avoid such no-make-sense continuations

deleting comments is also no "professional attitude"

deleted comment by ttodua from 55 minutes ago

I an not pointing to author (because i don't know his circumtances), but generally speaking, when having a lib published and knowing hundreds of users are dependent on it and you watch how users have been asking for simple help for years - it's not a professional attitude toward your users base. when abandoning project, you'd better declare repo as "archived", so public would have a signal for moving out of it.

to continue the off topic chat:

professional attitude

false hopes are a safe recipe for frustration im pretty sure the license does not promise "professional attitude"

hundreds of users are dependent on it

these people need some detox cure someone should tell them about forks and patches

milahu avatar Apr 04 '24 22:04 milahu

@milahu I think it's better to be a bit calmer. I've replied my to a user on a point that authors 'do not owe' a damn thing, while not personally attacking him, just mentioning my alternative thought. and that user, absolutely in a well manner replied back (thanks @andylamp ). but you started personal (and a bit angry) addressing, making statements like:

deleting comments is also no "professional attitude"

idk where did you hear such a wise lesson. please share to me too. or:

false hopes are a safe recipe for frustration

I don't think you are such an oracle to see who has what hope

these people need some detox cure

and again, stop attacking other people, no one called you for judging illnesses, you'd better concentrate on your problems and for their cures.

and whoever has problems when hearing a free speech and thought and goes on personal ranting, then s/he definitely needs a cure. good luck, bye

ttodua avatar Apr 05 '24 08:04 ttodua

Hi there, I created a replacement for library uri-js

  • Based on Node.js and browser URL api
  • 99% compatible with original URI.js library
  • Solves "The punycode module is deprecated" warning in Node
  • Tested with libraries: ESLint, Webpack, Ajv

https://github.com/andreinwald/uri-js-replace

You can add to package.json of your project:

"overrides": {
    "uri-js": "npm:uri-js-replace"
}

andreinwald avatar Apr 27 '24 14:04 andreinwald