From de56679c11fe838ce78fa26e2640028dd259232c Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Thu, 7 Nov 2024 12:01:07 -0500 Subject: [PATCH] feat(client/windows): call `fetchResource` as a library --- client/electron/webpack_electron_main.mjs | 5 ++- client/package.json | 2 ++ package-lock.json | 43 +++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/client/electron/webpack_electron_main.mjs b/client/electron/webpack_electron_main.mjs index 5eacdd83c1..429ccbd56a 100755 --- a/client/electron/webpack_electron_main.mjs +++ b/client/electron/webpack_electron_main.mjs @@ -17,7 +17,6 @@ import {fileURLToPath} from 'url'; import webpack from 'webpack'; - const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -37,6 +36,10 @@ export default ({sentryDsn, appVersion}) => [ use: 'ts-loader', exclude: /node_modules/, }, + { + test: /\.node$/, + loader: 'node-loader', + }, ], }, resolve: { diff --git a/client/package.json b/client/package.json index 5b0af96015..b2466f2897 100644 --- a/client/package.json +++ b/client/package.json @@ -48,6 +48,7 @@ "cordova-plugin-statusbar": "^2.2.3", "electron-updater": "^5.0.5", "fs-extra": "^11.2.0", + "koffi": "^2.9.1", "lit": "^2.2.2", "ShadowsocksConfig": "github:Jigsaw-Code/outline-shadowsocksconfig#v0.2.1", "socks": "^1.1.10", @@ -105,6 +106,7 @@ "karma-webpack": "^5.0.0", "minimist": "^1.2.6", "node-fetch": "^3.3.0", + "node-loader": "^2.0.0", "node-gyp": "^10.0.1", "postcss": "^7.0.39", "postcss-rtl": "^1.7.3", diff --git a/package-lock.json b/package-lock.json index 79cd9a234a..e36d0c68c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -83,6 +83,7 @@ "cordova-plugin-statusbar": "^2.2.3", "electron-updater": "^5.0.5", "fs-extra": "^11.2.0", + "koffi": "^2.9.1", "lit": "^2.2.2", "ShadowsocksConfig": "github:Jigsaw-Code/outline-shadowsocksconfig#v0.2.1", "socks": "^1.1.10", @@ -141,6 +142,7 @@ "minimist": "^1.2.6", "node-fetch": "^3.3.0", "node-gyp": "^10.0.1", + "node-loader": "^2.0.0", "postcss": "^7.0.39", "postcss-rtl": "^1.7.3", "prettier": "^2.8.0", @@ -23731,6 +23733,12 @@ "node": ">= 0.6" } }, + "node_modules/koffi": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/koffi/-/koffi-2.9.1.tgz", + "integrity": "sha512-LXYOzaiUB8XK7EwbG0tgzhajEr3FLS2RB9oHYbTOiWRQQO+Rgft3xSvd5TFlM3wQ6DMMQG41lvUR5gLgdyWIsA==", + "hasInstallScript": true + }, "node_modules/last-run": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", @@ -26260,6 +26268,25 @@ "npm": ">=6.0.0" } }, + "node_modules/node-loader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-2.0.0.tgz", + "integrity": "sha512-I5VN34NO4/5UYJaUBtkrODPWxbobrE4hgDqPrjB25yPkonFhCmZ146vTH+Zg417E9Iwoh1l/MbRs1apc5J295Q==", + "dev": true, + "dependencies": { + "loader-utils": "^2.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", @@ -40821,10 +40848,12 @@ "karma-coverage-istanbul-reporter": "^3.0.3", "karma-jasmine": "^4.0.1", "karma-webpack": "^5.0.0", + "koffi": "^2.9.1", "lit": "^2.2.2", "minimist": "^1.2.6", "node-fetch": "^3.3.0", "node-gyp": "^10.0.1", + "node-loader": "^2.0.0", "postcss": "^7.0.39", "postcss-rtl": "^1.7.3", "prettier": "^2.8.0", @@ -55616,6 +55645,11 @@ } } }, + "koffi": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/koffi/-/koffi-2.9.1.tgz", + "integrity": "sha512-LXYOzaiUB8XK7EwbG0tgzhajEr3FLS2RB9oHYbTOiWRQQO+Rgft3xSvd5TFlM3wQ6DMMQG41lvUR5gLgdyWIsA==" + }, "last-run": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", @@ -57551,6 +57585,15 @@ "tempfile": "^3.0.0" } }, + "node-loader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-2.0.0.tgz", + "integrity": "sha512-I5VN34NO4/5UYJaUBtkrODPWxbobrE4hgDqPrjB25yPkonFhCmZ146vTH+Zg417E9Iwoh1l/MbRs1apc5J295Q==", + "dev": true, + "requires": { + "loader-utils": "^2.0.0" + } + }, "node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",