architecture-as-code icon indicating copy to clipboard operation
architecture-as-code copied to clipboard

Fix punycode deprecation warning

Open willosborne opened this issue 1 year ago • 1 comments

Bug Report

Running the CALM CLI on my machine gives me the following warning:

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

This indicates one of the transitive dependencies is still using the bundled version of the punycode library, that will be removed eventually. Presumably this will then break the CLI.

Steps to Reproduce:

Run the validate command on Node version 21.7.2

➜  pattern git:(pattern-only-validation) ✗ node --version
v21.7.2
➜  pattern git:(pattern-only-validation) ✗ calm validate -p api-gateway.json
info:    Loading meta schema(s) from [REDACTED]/architecture-as-code/cli/dist/calm/meta
info:    Loading pattern from : api-gateway.json
(node:16102) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
info:    The JSON Schema is valid

Expected Result:

No warning

Actual Result:

Deprecation warning. With the --trace-deprecation flag:

➜ pattern git:(pattern-only-validation) ✗ node --trace-deprecation ../../cli/dist/index.js validate -p api-gateway.json info: Loading meta schema(s) from [REDACTED]/architecture-as-code/cli/dist/calm/meta info: Loading pattern from : api-gateway.json (node:16351) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. at node:punycode:3:9 at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7) at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10) at loadBuiltinModule (node:internal/modules/helpers:104:7) at Module._load (node:internal/modules/cjs/loader:999:17) at Module.require (node:internal/modules/cjs/loader:1230:19) at require (node:internal/modules/helpers:179:18) at Object. ([REDACTED]/architecture-as-code/cli/node_modules/node-fetch/node_modules/whatwg-url/lib/url-state-machine.js:2:18) at Module._compile (node:internal/modules/cjs/loader:1368:14) at Module._extensions..js (node:internal/modules/cjs/loader:1426:10) info: The JSON Schema is valid ➜ pattern git:(pattern-only-validation) ✗

Environment:

OS: Ubuntu 22.04.4 LTS Node version: 21.7.2

willosborne avatar Aug 02 '24 14:08 willosborne

Happy to pick this up! Unable to assign unfortunately

oliviajanejohns avatar Nov 01 '24 15:11 oliviajanejohns

This is still a problem:

$ npm ls punycode
@finos/[email protected] [redacted]/architecture-as-code
├─┬ @finos/[email protected] -> ./cli
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     └── [email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └─┬ [email protected]
│       └─┬ [email protected]
│         └── [email protected] deduped
├─┬ @finos/[email protected] -> ./shared
│ └─┬ [email protected]
│   └─┬ @bundled-es-modules/[email protected]
│     └─┬ [email protected]
│       ├─┬ [email protected]
│       │ └── [email protected] deduped
│       └── [email protected] deduped
└─┬ [email protected] -> ./calm-hub-ui
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected] deduped

markscott-ms avatar Jul 16 '25 18:07 markscott-ms

It's not tr46. https://github.com/jsdom/tr46/issues/63

The issue suggests whatwg-url < 12.0.1 may be the cause, and we have 7.1.0 above.

markscott-ms avatar Jul 16 '25 18:07 markscott-ms

source-map has this issue: https://github.com/mozilla/source-map/issues/515 , and this fix https://github.com/mozilla/source-map/issues/400 as the solution.

Looks like when source-map 0.7.5 release is pushed to NPM, and when tsup updates its dependency, it will solve the punycode deprecation warning.

markscott-ms avatar Jul 16 '25 18:07 markscott-ms

tsup has PR https://github.com/egoist/tsup/pull/1358 to update dependency of source-map to 0.7.6.

markscott-ms avatar Aug 22 '25 20:08 markscott-ms

tsup now has a deprecation notice, encouraging use of tsdown. It is unclear whether tsup PR 1358 will ever get merged.

markscott-ms avatar Aug 28 '25 14:08 markscott-ms