[Gradle, JS] Use default browsers for wasm
^KT-56585 fixed
This commit is contained in:
committed by
Space Team
parent
b7370f0156
commit
2de4f471e9
@@ -51,7 +51,6 @@ tasks {
|
||||
"tc-log-appender.js",
|
||||
"tc-log-error-webpack.js",
|
||||
"webpack-5-debug.js",
|
||||
"detect-correct-browser.js",
|
||||
"package.json",
|
||||
"rollup.config.js",
|
||||
"tsconfig.json",
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const isWsl = require('is-wsl');
|
||||
const {platform, arch} = process;
|
||||
|
||||
function detectArchBinary(binary) {
|
||||
if (typeof binary === 'string' || Array.isArray(binary)) {
|
||||
return binary;
|
||||
}
|
||||
|
||||
const {[arch]: archBinary} = binary;
|
||||
|
||||
if (!archBinary) {
|
||||
throw new Error(`${arch} is not supported`);
|
||||
}
|
||||
|
||||
return archBinary;
|
||||
}
|
||||
|
||||
// Return location of chrome.exe file for a given Chrome directory (available: "Chrome", "Chrome SxS").
|
||||
function getChromeExe(chromeDirName) {
|
||||
// Only run these checks on win32
|
||||
if (process.platform !== 'win32') {
|
||||
return null
|
||||
}
|
||||
let windowsChromeDirectory, i, prefix;
|
||||
const suffix = '\\Google\\' + chromeDirName + '\\Application\\chrome.exe';
|
||||
const prefixes = [process.env.LOCALAPPDATA, process.env.PROGRAMFILES, process.env['PROGRAMFILES(X86)']];
|
||||
|
||||
for (i = 0; i < prefixes.length; i++) {
|
||||
prefix = prefixes[i]
|
||||
try {
|
||||
windowsChromeDirectory = path.join(prefix, suffix)
|
||||
fs.accessSync(windowsChromeDirectory)
|
||||
return windowsChromeDirectory
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
return windowsChromeDirectory
|
||||
}
|
||||
|
||||
function detectPlatformBinary({[platform]: platformBinary}, {wsl}) {
|
||||
if (wsl && isWsl) {
|
||||
return detectArchBinary(wsl);
|
||||
}
|
||||
|
||||
if (!platformBinary) {
|
||||
throw new Error(`${platform} is not supported`);
|
||||
}
|
||||
|
||||
return detectArchBinary(platformBinary);
|
||||
}
|
||||
|
||||
const apps = {};
|
||||
|
||||
function define(browserName, platforms, wsl) {
|
||||
Object.defineProperty(apps, browserName, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: {
|
||||
bin: detectPlatformBinary(platforms, wsl)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
define(
|
||||
'chrome',
|
||||
{
|
||||
darwin: 'google chrome',
|
||||
win32: getChromeExe("Chrome"),
|
||||
linux: ['google-chrome', 'google-chrome-stable']
|
||||
},
|
||||
{
|
||||
wsl: {
|
||||
ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
||||
x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe']
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
define(
|
||||
'chrome canary',
|
||||
{
|
||||
darwin: 'google chrome canary',
|
||||
win32: getChromeExe("Chrome SxS"),
|
||||
linux: ['google-chrome-canary', 'google-chrome-unstable']
|
||||
},
|
||||
{
|
||||
wsl: {
|
||||
ia32: '/mnt/c/Program Files (x86)/Google/Chrome SxS/Application/chrome.exe',
|
||||
x64: ['/mnt/c/Program Files/Google/Chrome SxS/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome SxS/Application/chrome.exe']
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = apps
|
||||
@@ -14,6 +14,7 @@
|
||||
"build": "rimraf lib/* && copyfiles static/* lib && rollup -c rollup.config.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"format-util": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.12.14",
|
||||
@@ -26,8 +27,6 @@
|
||||
"@rollup/plugin-typescript": "^8.3.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"typescript": "^3.7.2",
|
||||
"format-util": "^1.0.5",
|
||||
"tslib": "^2.3.1",
|
||||
"is-wsl": "^2.2.0"
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +97,7 @@ export default [
|
||||
file: 'lib/mocha-kotlin-reporter.js',
|
||||
format: 'cjs'
|
||||
}
|
||||
},
|
||||
{
|
||||
input: './detect-correct-browser.js',
|
||||
output: {
|
||||
file: 'lib/detect-correct-browser.js',
|
||||
format: 'esm'
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
function plugins() {
|
||||
|
||||
@@ -380,11 +380,6 @@ is-core-module@^2.8.1:
|
||||
dependencies:
|
||||
has "^1.0.3"
|
||||
|
||||
is-docker@^2.0.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
|
||||
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
|
||||
|
||||
is-fullwidth-code-point@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||
@@ -402,13 +397,6 @@ is-reference@^1.2.1:
|
||||
dependencies:
|
||||
"@types/estree" "*"
|
||||
|
||||
is-wsl@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"
|
||||
integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==
|
||||
dependencies:
|
||||
is-docker "^2.0.0"
|
||||
|
||||
isarray@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
|
||||
|
||||
Reference in New Issue
Block a user