From 90e00fdcac651643d2830bcad2fa5b88f05f4afc Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 26 Feb 2023 18:28:31 +0100 Subject: [PATCH] wip --- app/webpack.config.main.mjs | 3 ++- app/webpack.config.mjs | 4 +++- scripts/build-native.mjs | 4 +++- scripts/generate-icon-metadata.mjs | 4 +++- scripts/prepackage-plugins.mjs | 4 +++- scripts/vars.mjs | 3 ++- tabby-community-color-schemes/webpack.config.mjs | 4 +++- tabby-core/webpack.config.mjs | 4 +++- tabby-electron/webpack.config.mjs | 4 +++- tabby-linkifier/webpack.config.mjs | 4 +++- tabby-local/webpack.config.mjs | 4 +++- tabby-plugin-manager/webpack.config.mjs | 4 +++- tabby-serial/webpack.config.mjs | 4 +++- tabby-settings/webpack.config.mjs | 4 +++- tabby-ssh/webpack.config.mjs | 4 +++- tabby-telnet/webpack.config.mjs | 4 +++- tabby-terminal/webpack.config.mjs | 4 +++- tabby-web-demo/webpack.config.mjs | 4 +++- tabby-web/webpack.config.mjs | 4 +++- web/webpack.config.mjs | 4 +++- 20 files changed, 58 insertions(+), 20 deletions(-) diff --git a/app/webpack.config.main.mjs b/app/webpack.config.main.mjs index 8b10e20f..793f1eb6 100644 --- a/app/webpack.config.main.mjs +++ b/app/webpack.config.main.mjs @@ -1,7 +1,8 @@ import * as path from 'path' import wp from 'webpack' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) const config = { name: 'tabby-main', diff --git a/app/webpack.config.mjs b/app/webpack.config.mjs index 8c7da4a6..bcfa1306 100644 --- a/app/webpack.config.mjs +++ b/app/webpack.config.mjs @@ -1,7 +1,9 @@ import * as fs from 'fs' import * as path from 'path' import wp from 'webpack' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import { AngularWebpackPlugin } from '@ngtools/webpack' import { createEs2015LinkerPlugin } from '@angular/compiler-cli/linker/babel' const linkerPlugin = createEs2015LinkerPlugin({ diff --git a/scripts/build-native.mjs b/scripts/build-native.mjs index ad6e2a82..054a1ee0 100755 --- a/scripts/build-native.mjs +++ b/scripts/build-native.mjs @@ -3,7 +3,9 @@ import { rebuild } from 'electron-rebuild' import * as path from 'path' import * as vars from './vars.mjs' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + if (process.platform === 'win32' || process.platform === 'linux') { process.env.ARCH = ((process.env.ARCH || process.arch) === 'arm') ? 'armv7l' : process.env.ARCH || process.arch diff --git a/scripts/generate-icon-metadata.mjs b/scripts/generate-icon-metadata.mjs index 339877f5..a7b78014 100755 --- a/scripts/generate-icon-metadata.mjs +++ b/scripts/generate-icon-metadata.mjs @@ -3,7 +3,9 @@ import jsYaml from 'js-yaml' import fs from 'node:fs' import path from 'node:path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + const metadata = jsYaml.load(fs.readFileSync(path.resolve(__dirname, '../node_modules/@fortawesome/fontawesome-free/metadata/icons.yml'))) diff --git a/scripts/prepackage-plugins.mjs b/scripts/prepackage-plugins.mjs index 5d314819..2176c1ed 100755 --- a/scripts/prepackage-plugins.mjs +++ b/scripts/prepackage-plugins.mjs @@ -6,7 +6,9 @@ import fs from 'node:fs' import * as vars from './vars.mjs' import log from 'npmlog' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + let target = path.resolve(__dirname, '../builtin-plugins') sh.mkdir('-p', target) diff --git a/scripts/vars.mjs b/scripts/vars.mjs index 4dd9bd76..9f4e2d45 100755 --- a/scripts/vars.mjs +++ b/scripts/vars.mjs @@ -3,7 +3,8 @@ import * as fs from 'fs' import * as semver from 'semver' import * as childProcess from 'child_process' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) const electronInfo = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../node_modules/electron/package.json'))) diff --git a/tabby-community-color-schemes/webpack.config.mjs b/tabby-community-color-schemes/webpack.config.mjs index fc89447e..15219263 100644 --- a/tabby-community-color-schemes/webpack.config.mjs +++ b/tabby-community-color-schemes/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => { diff --git a/tabby-core/webpack.config.mjs b/tabby-core/webpack.config.mjs index befde6cc..a0f14443 100644 --- a/tabby-core/webpack.config.mjs +++ b/tabby-core/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-electron/webpack.config.mjs b/tabby-electron/webpack.config.mjs index 9a695bc8..a00e0af3 100644 --- a/tabby-electron/webpack.config.mjs +++ b/tabby-electron/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-linkifier/webpack.config.mjs b/tabby-linkifier/webpack.config.mjs index 3d7248ca..a79dcb89 100644 --- a/tabby-linkifier/webpack.config.mjs +++ b/tabby-linkifier/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-local/webpack.config.mjs b/tabby-local/webpack.config.mjs index 0f23e306..3aaab772 100644 --- a/tabby-local/webpack.config.mjs +++ b/tabby-local/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-plugin-manager/webpack.config.mjs b/tabby-plugin-manager/webpack.config.mjs index 68c47175..c0fbb3cc 100644 --- a/tabby-plugin-manager/webpack.config.mjs +++ b/tabby-plugin-manager/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-serial/webpack.config.mjs b/tabby-serial/webpack.config.mjs index 5de5a31d..94afefc4 100644 --- a/tabby-serial/webpack.config.mjs +++ b/tabby-serial/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-settings/webpack.config.mjs b/tabby-settings/webpack.config.mjs index 73863ebe..7f6e05a2 100644 --- a/tabby-settings/webpack.config.mjs +++ b/tabby-settings/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-ssh/webpack.config.mjs b/tabby-ssh/webpack.config.mjs index 69c1e163..16ce381b 100644 --- a/tabby-ssh/webpack.config.mjs +++ b/tabby-ssh/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-telnet/webpack.config.mjs b/tabby-telnet/webpack.config.mjs index a3e10c8d..d8d82b0d 100644 --- a/tabby-telnet/webpack.config.mjs +++ b/tabby-telnet/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-terminal/webpack.config.mjs b/tabby-terminal/webpack.config.mjs index 8ea38b00..8fc3d3d0 100644 --- a/tabby-terminal/webpack.config.mjs +++ b/tabby-terminal/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => { diff --git a/tabby-web-demo/webpack.config.mjs b/tabby-web-demo/webpack.config.mjs index f2bd8fc7..3b4735d2 100644 --- a/tabby-web-demo/webpack.config.mjs +++ b/tabby-web-demo/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-web/webpack.config.mjs b/tabby-web/webpack.config.mjs index aa0f510a..52596a62 100644 --- a/tabby-web/webpack.config.mjs +++ b/tabby-web/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/web/webpack.config.mjs b/web/webpack.config.mjs index b30dc485..dadba2d3 100644 --- a/web/webpack.config.mjs +++ b/web/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + const externals = {} for (const key of [