@docusaurus/core 3.7.0-canary-6262 → 3.7.0-canary-6263
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,10 @@ const tslib_1 = require("tslib");
|
|
|
14
14
|
// See https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/openBrowser.js
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
const child_process_1 = require("child_process");
|
|
17
|
+
const util_1 = require("util");
|
|
17
18
|
const open_1 = tslib_1.__importDefault(require("open"));
|
|
19
|
+
const logger_1 = require("@docusaurus/logger");
|
|
20
|
+
const execPromise = (0, util_1.promisify)(child_process_1.exec);
|
|
18
21
|
// Not sure if we need this, but let's keep a secret escape hatch
|
|
19
22
|
// CRA/react-dev-utils supported BROWSER/BROWSER_ARGS
|
|
20
23
|
const BrowserEnv = process.env.DOCUSAURUS_BROWSER;
|
|
@@ -33,30 +36,45 @@ async function tryOpenWithAppleScript({ url, browser, }) {
|
|
|
33
36
|
return false;
|
|
34
37
|
}
|
|
35
38
|
if (shouldTryOpenChromiumWithAppleScript) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
async function getBrowsersToTry() {
|
|
40
|
+
// Will use the first open browser found from list
|
|
41
|
+
const supportedChromiumBrowsers = [
|
|
42
|
+
'Google Chrome Canary',
|
|
43
|
+
'Google Chrome Dev',
|
|
44
|
+
'Google Chrome Beta',
|
|
45
|
+
'Google Chrome',
|
|
46
|
+
'Microsoft Edge',
|
|
47
|
+
'Brave Browser',
|
|
48
|
+
'Vivaldi',
|
|
49
|
+
'Chromium',
|
|
50
|
+
];
|
|
51
|
+
// Among all the supported browsers, retrieves to stdout the active ones
|
|
52
|
+
const command = `ps cax -o command | grep -E "^(${supportedChromiumBrowsers.join('|')})$"`;
|
|
53
|
+
const result = await execPromise(command);
|
|
54
|
+
const activeBrowsers = result.stdout.toString().trim().split('\n');
|
|
55
|
+
// This preserves the initial browser order
|
|
56
|
+
// We open Google Chrome Canary in priority over Google Chrome
|
|
57
|
+
return supportedChromiumBrowsers.filter((b) => activeBrowsers.includes(b));
|
|
58
|
+
}
|
|
59
|
+
async function tryBrowser(browserName) {
|
|
48
60
|
try {
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
(
|
|
52
|
-
(0, child_process_1.execSync)(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
|
|
61
|
+
// This command runs the openChrome.applescript (copied from CRA)
|
|
62
|
+
const command = `osascript openChrome.applescript "${encodeURI(url)}" "${browserName}"`;
|
|
63
|
+
await execPromise(command, {
|
|
53
64
|
cwd: __dirname,
|
|
54
|
-
stdio: 'ignore',
|
|
55
65
|
});
|
|
56
66
|
return true;
|
|
57
67
|
}
|
|
58
68
|
catch (err) {
|
|
59
|
-
|
|
69
|
+
console.error(`Failed to open browser ${browserName} with AppleScript`, err);
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const browsers = await logger_1.PerfLogger.async('getBrowsersToTry', () => getBrowsersToTry());
|
|
74
|
+
for (let browser of browsers) {
|
|
75
|
+
const success = await logger_1.PerfLogger.async(browser, () => tryBrowser(browser));
|
|
76
|
+
if (success) {
|
|
77
|
+
return true;
|
|
60
78
|
}
|
|
61
79
|
}
|
|
62
80
|
}
|
|
@@ -80,7 +98,7 @@ function toOpenApp(params) {
|
|
|
80
98
|
};
|
|
81
99
|
}
|
|
82
100
|
async function startBrowserProcess(params) {
|
|
83
|
-
if (await tryOpenWithAppleScript(params)) {
|
|
101
|
+
if (await logger_1.PerfLogger.async('tryOpenWithAppleScript', () => tryOpenWithAppleScript(params))) {
|
|
84
102
|
return true;
|
|
85
103
|
}
|
|
86
104
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/core",
|
|
3
3
|
"description": "Easy to Maintain Open Source Documentation Websites",
|
|
4
|
-
"version": "3.7.0-canary-
|
|
4
|
+
"version": "3.7.0-canary-6263",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docusaurus/babel": "3.7.0-canary-
|
|
37
|
-
"@docusaurus/bundler": "3.7.0-canary-
|
|
38
|
-
"@docusaurus/logger": "3.7.0-canary-
|
|
39
|
-
"@docusaurus/mdx-loader": "3.7.0-canary-
|
|
40
|
-
"@docusaurus/utils": "3.7.0-canary-
|
|
41
|
-
"@docusaurus/utils-common": "3.7.0-canary-
|
|
42
|
-
"@docusaurus/utils-validation": "3.7.0-canary-
|
|
36
|
+
"@docusaurus/babel": "3.7.0-canary-6263",
|
|
37
|
+
"@docusaurus/bundler": "3.7.0-canary-6263",
|
|
38
|
+
"@docusaurus/logger": "3.7.0-canary-6263",
|
|
39
|
+
"@docusaurus/mdx-loader": "3.7.0-canary-6263",
|
|
40
|
+
"@docusaurus/utils": "3.7.0-canary-6263",
|
|
41
|
+
"@docusaurus/utils-common": "3.7.0-canary-6263",
|
|
42
|
+
"@docusaurus/utils-validation": "3.7.0-canary-6263",
|
|
43
43
|
"boxen": "^6.2.1",
|
|
44
44
|
"chalk": "^4.1.2",
|
|
45
45
|
"chokidar": "^3.5.3",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"webpack-merge": "^6.0.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@docusaurus/module-type-aliases": "3.7.0-canary-
|
|
82
|
-
"@docusaurus/types": "3.7.0-canary-
|
|
81
|
+
"@docusaurus/module-type-aliases": "3.7.0-canary-6263",
|
|
82
|
+
"@docusaurus/types": "3.7.0-canary-6263",
|
|
83
83
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
84
84
|
"@types/detect-port": "^1.3.3",
|
|
85
85
|
"@types/react-dom": "^18.2.7",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=18.0"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "f87a715b107175497b8bb2d0ec7b8323c38e1853"
|
|
103
103
|
}
|