Skip to content

Commit

Permalink
fix: overide punycode built-in module
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Nov 13, 2024
1 parent 202b549 commit 45bc380
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/config-validator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
// istanbul ignore file
import 'source-map-support/register';
import './punycode.cjs';
import { dequal } from 'dequal';
import { pathExists, readFile } from 'fs-extra';
import { configFileNames } from './config/app-strings';
Expand Down
10 changes: 10 additions & 0 deletions lib/punycode.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* punycode workaround
*
* Load punycode.js module to cache and override node built-in.
*
* See <https://github.com/renovatebot/renovate/issues/32395>
*/
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('punycode/');
require.cache.punycode = require.cache[require.resolve('punycode/')];
1 change: 1 addition & 0 deletions lib/renovate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node

import 'source-map-support/register';
import './punycode.cjs';
import { instrument, shutdown as telemetryShutdown } from './instrumentation'; // has to be imported before logger and other libraries which are instrumentalised
import { logger } from './logger';
import { bootstrap } from './proxy';
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
"parse-link-header": "2.0.0",
"prettier": "3.3.3",
"protobufjs": "7.4.0",
"punycode": "2.3.1",
"redis": "4.7.0",
"remark": "13.0.0",
"remark-github": "10.1.0",
Expand Down Expand Up @@ -300,6 +301,7 @@
"@types/ms": "0.7.34",
"@types/node": "20.17.6",
"@types/parse-link-header": "2.0.3",
"@types/punycode": "2.1.4",
"@types/semver": "7.5.8",
"@types/semver-stable": "3.0.2",
"@types/semver-utils": "1.1.3",
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 45bc380

Please sign in to comment.