microsoft / vscode-vsce

VS Code Extension Manager
https://code.visualstudio.com/
Other
803 stars 205 forks source link

[DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. #930

Closed RobbyCBennett closed 1 month ago

RobbyCBennett commented 8 months ago

This should be able to be fixed by updating the markdown-it module to 14.0.0.

Issue: https://github.com/markdown-it/markdown-it/issues/967 Release commit: https://github.com/markdown-it/markdown-it/commit/4949a10120d101bdca48bf1b13f9e790d6f2049e

joaomoreno commented 7 months ago

This needs to be filed somewhere else:

➜  vscode-vsce git:(main) npm why punycode
punycode@2.3.0 dev
node_modules/punycode
  punycode@"^2.1.0" from uri-js@4.4.1
  node_modules/uri-js
    uri-js@"^4.2.2" from ajv@6.12.6
    node_modules/ajv
      ajv@"~6.12.6" from @microsoft/tsdoc-config@0.16.2
      node_modules/@microsoft/tsdoc-config
        @microsoft/tsdoc-config@"~0.16.1" from @microsoft/api-extractor@7.36.3
        node_modules/@microsoft/api-extractor
          dev @microsoft/api-extractor@"^7.33.7" from the root project
        @microsoft/tsdoc-config@"~0.16.1" from @microsoft/api-extractor-model@7.27.5
        node_modules/@microsoft/api-extractor-model
          @microsoft/api-extractor-model@"7.27.5" from @microsoft/api-extractor@7.36.3
          node_modules/@microsoft/api-extractor
            dev @microsoft/api-extractor@"^7.33.7" from the root project
RobbyCBennett commented 7 months ago

No, that is a dev dependency. I'm talking about a warning that occurs during runtime (normal dependency.) I've just tested my idea and it works.

Before updating markdown-it:

node ..\vscode-vsce\vsce package

(node:20356) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 DONE  Packaged: C:\Users\RobbyBennett\Desktop\VSCodeQuickSelect\quick-select-1.0.4.vsix (8 files, 13.72KB)

After updating markdown-it:

node ..\vscode-vsce\vsce package

 DONE  Packaged: C:\Users\RobbyBennett\Desktop\VSCodeQuickSelect\quick-select-1.0.4.vsix (8 files, 13.72KB)
mark-wiemer commented 1 month ago

@joaomoreno This should be re-opened. The "somewhere else" was https://github.com/markdown-it/markdown-it/issues/967 and it's been fixed, and this repo now needs to update to markdown-it@^14 to avoid the error.

I'm getting the same error when building my project using vsce@3.0.0.

We can reproduce this issue by:

  1. Installing Node 22
  2. Cloning this repo
  3. Installing dependencies
  4. Running npm run watch:test

The tests pass but an error is logged to the console:

~/repos/vscode-vsce (main)
$ git log -1
2024-08-17 20:16:56
f7ed2e1 Benjamin Christopher Simmonds Merge pull request #1035 from microsoft/benibenj/accessible-wolf (HEAD -> main, tag: v3.0.0, tag: v2.32.1-0, origin/main, origin/HEAD)
[last: 0s]
~/repos/vscode-vsce (main)
$ npm run watch:test
2024-08-17 20:17:00

> @vscode/vsce@0.0.0 watch:test
> npm run test -- --watch

> @vscode/vsce@0.0.0 test
> mocha --watch

(node:4416) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

  collect
    ✔ should catch all files (1115ms)
    ✔ should ignore .git/** (1074ms)
...

The fix looks like a one-liner:

~/repos/vscode-vsce (main)
$ npm i markdown-it@^14
2024-08-17 20:20:14

added 1 package, and changed 5 packages in 5s

63 packages are looking for funding
  run `npm fund` for details
[last: 5s]
~/repos/vscode-vsce (main)
$ npm run watch:test
2024-08-17 20:20:21

> @vscode/vsce@0.0.0 watch:test
> npm run test -- --watch

> @vscode/vsce@0.0.0 test
> mocha --watch

  collect
    ✔ should catch all files (1135ms)
    ✔ should ignore .git/** (1071ms)
...
Fred-Vatin commented 1 month ago

Thanks Mark. The PR needs 2 more approvals to be merged. I suggest the collaborators of this issue to do it so the fix can be published ASAP.