@deque/axe-auth 1.1.0-next.428ed670 → 1.1.0-next.46540783
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.
- package/credits.json +11 -0
- package/dist/oauth/openBrowser.d.ts +14 -3
- package/dist/oauth/openBrowser.js +22 -5
- package/package.json +4 -1
package/credits.json
CHANGED
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
"publisher": "Stephen Mathieson",
|
|
28
28
|
"email": "me@stephenmathieson.com"
|
|
29
29
|
},
|
|
30
|
+
"shlex@3.0.0": {
|
|
31
|
+
"name": "shlex",
|
|
32
|
+
"version": "3.0.0",
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"path": "/home/runner/work/axe-mcp-server/axe-mcp-server/node_modules/.pnpm/shlex@3.0.0/node_modules/shlex",
|
|
35
|
+
"licenseText": "MIT License\n\nCopyright (c) 2018 Ryan Govostes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
|
|
36
|
+
"licenseFile": "/home/runner/work/axe-mcp-server/axe-mcp-server/node_modules/.pnpm/shlex@3.0.0/node_modules/shlex/LICENSE",
|
|
37
|
+
"repository": "https://github.com/rgov/node-shlex",
|
|
38
|
+
"publisher": "Ryan Govostes",
|
|
39
|
+
"copyright": "Copyright (c) 2018 Ryan Govostes"
|
|
40
|
+
},
|
|
30
41
|
"ts-dedent@2.2.0": {
|
|
31
42
|
"name": "ts-dedent",
|
|
32
43
|
"version": "2.2.0",
|
|
@@ -7,13 +7,24 @@ export interface OpenBrowserOptions {
|
|
|
7
7
|
platform?: NodeJS.Platform;
|
|
8
8
|
/** Override for `child_process.spawn`. Used by tests. */
|
|
9
9
|
spawnFn?: SpawnFn;
|
|
10
|
+
/**
|
|
11
|
+
* Override for `process.env.BROWSER`. The de-facto convention shared
|
|
12
|
+
* with `xdg-open` and Python's `webbrowser`: when set, it names the
|
|
13
|
+
* command to invoke instead of the platform default. Parsed shlex-style
|
|
14
|
+
* (POSIX shell tokenization) so values like `firefox --new-window` or
|
|
15
|
+
* `/path/with\ spaces/firefox` work as expected. An empty or missing
|
|
16
|
+
* value falls back to the platform default.
|
|
17
|
+
*/
|
|
18
|
+
browserEnv?: string;
|
|
10
19
|
}
|
|
11
20
|
/**
|
|
12
21
|
* Launches the system browser at `url` in a detached child process.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
22
|
+
* Honors `$BROWSER` when set, falling back to the platform default
|
|
23
|
+
* (`open` / `xdg-open` / `cmd start`). Returns synchronously once the
|
|
24
|
+
* child is spawned — completion of the browser load is intentionally
|
|
25
|
+
* not awaited.
|
|
15
26
|
*
|
|
16
27
|
* @param url Absolute URL to open.
|
|
17
|
-
* @param options Platform/spawn overrides; only exposed for tests.
|
|
28
|
+
* @param options Platform/spawn/env overrides; only exposed for tests.
|
|
18
29
|
*/
|
|
19
30
|
export declare function openBrowser(url: string, options?: OpenBrowserOptions): void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.openBrowser = openBrowser;
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const shlex_1 = require("shlex");
|
|
5
6
|
const errors_1 = require("./errors");
|
|
6
7
|
// On Windows `start` is a cmd.exe builtin, not a standalone binary.
|
|
7
8
|
// The empty `""` pair is a positional placeholder for the window
|
|
@@ -26,7 +27,11 @@ function windowsCommand(url) {
|
|
|
26
27
|
args: ["/c", "start", '""', url.replace(/[&|^<>"%\r\n]/g, (c) => `^${c}`)],
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
function browserCommand(platform, url) {
|
|
30
|
+
function browserCommand(platform, url, browserOverride) {
|
|
31
|
+
if (browserOverride && browserOverride.length > 0) {
|
|
32
|
+
const [command, ...extraArgs] = browserOverride;
|
|
33
|
+
return { command, args: [...extraArgs, url] };
|
|
34
|
+
}
|
|
30
35
|
switch (platform) {
|
|
31
36
|
case "darwin":
|
|
32
37
|
return { command: "open", args: [url] };
|
|
@@ -47,16 +52,28 @@ function browserCommand(platform, url) {
|
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
54
|
* Launches the system browser at `url` in a detached child process.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
55
|
+
* Honors `$BROWSER` when set, falling back to the platform default
|
|
56
|
+
* (`open` / `xdg-open` / `cmd start`). Returns synchronously once the
|
|
57
|
+
* child is spawned — completion of the browser load is intentionally
|
|
58
|
+
* not awaited.
|
|
52
59
|
*
|
|
53
60
|
* @param url Absolute URL to open.
|
|
54
|
-
* @param options Platform/spawn overrides; only exposed for tests.
|
|
61
|
+
* @param options Platform/spawn/env overrides; only exposed for tests.
|
|
55
62
|
*/
|
|
56
63
|
function openBrowser(url, options = {}) {
|
|
57
64
|
const platform = options.platform ?? process.platform;
|
|
58
65
|
const spawnFn = options.spawnFn ?? node_child_process_1.spawn;
|
|
59
|
-
const
|
|
66
|
+
const browserEnv = options.browserEnv ?? process.env.BROWSER;
|
|
67
|
+
let browserOverride;
|
|
68
|
+
if (browserEnv && browserEnv.length > 0) {
|
|
69
|
+
try {
|
|
70
|
+
browserOverride = (0, shlex_1.split)(browserEnv);
|
|
71
|
+
}
|
|
72
|
+
catch (cause) {
|
|
73
|
+
throw new errors_1.OAuthFlowError("BROWSER_LAUNCH_FAILED", `Failed to parse $BROWSER (${browserEnv}). Open this URL manually:\n${url}`, { cause });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const { command, args } = browserCommand(platform, url, browserOverride);
|
|
60
77
|
let child;
|
|
61
78
|
try {
|
|
62
79
|
child = spawnFn(command, args, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/axe-auth",
|
|
3
|
-
"version": "1.1.0-next.
|
|
3
|
+
"version": "1.1.0-next.46540783",
|
|
4
4
|
"description": "CLI authentication utility for Deque services",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@napi-rs/keyring": "^1.2.0",
|
|
27
27
|
"remove-trailing-slash": "^0.1.1",
|
|
28
|
+
"shlex": "^3.0.0",
|
|
28
29
|
"ts-dedent": "^2.2.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
32
|
+
"@hono/node-server": "^1.19.14",
|
|
31
33
|
"@types/node": "^22.13.10",
|
|
32
34
|
"c8": "^10.1.3",
|
|
35
|
+
"hono": "^4.12.16",
|
|
33
36
|
"tsx": "^4.20.6",
|
|
34
37
|
"typescript": "^5.9.3"
|
|
35
38
|
},
|