From c6c2af23212ba1aa8f79316492367605c282f005 Mon Sep 17 00:00:00 2001 From: lendrik-kumar Date: Mon, 9 Dec 2024 22:04:14 +0530 Subject: [PATCH] issue #11475 --- .../backgroundPage/pluginRunnerBackgroundPage.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/app-mobile/components/plugins/backgroundPage/pluginRunnerBackgroundPage.ts b/packages/app-mobile/components/plugins/backgroundPage/pluginRunnerBackgroundPage.ts index b8eaa3b12c7..dc0a3f2b986 100644 --- a/packages/app-mobile/components/plugins/backgroundPage/pluginRunnerBackgroundPage.ts +++ b/packages/app-mobile/components/plugins/backgroundPage/pluginRunnerBackgroundPage.ts @@ -8,7 +8,7 @@ const legacyPluginIds = [ ]; const pathLibrary = require('path'); -const punycode = require('punycode/'); + export const requireModule = (moduleName: string, fromPluginId: string) => { if (moduleName === 'path') { @@ -18,7 +18,10 @@ export const requireModule = (moduleName: string, fromPluginId: string) => { if (legacyPluginIds.includes(fromPluginId)) { if (moduleName === 'punycode') { console.warn('Requiring punycode is deprecated. Please transition to a newer API.'); - return punycode; + return { + toASCII: (domain: string) => new URL(`http://${domain}`).hostname, + toUnicode: (domain: string) => domain, + }; } if (moduleName === 'fs' || moduleName === 'fs-extra') { console.warn('The fs library is unavailable to mobile plugins. A non-functional mock will be returned.'); @@ -36,7 +39,9 @@ export const requireModule = (moduleName: string, fromPluginId: string) => { return {}; } if (moduleName === 'url') { - return { parse: (u: string) => new URL(u) }; + return { + parse: (u: string) => new URL(u), + }; } }