dsh-mcp 1.14.0 → 1.14.2
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/CHANGELOG.en.md +28 -0
- package/CHANGELOG.md +28 -0
- package/README.en.md +1 -0
- package/README.md +1 -0
- package/lib/browser-command.js +5 -0
- package/lib/client.js +61 -37
- package/lib/oauth.js +3 -5
- package/package.json +1 -1
- package/scripts/build.mjs +21 -4
- package/src/client/GlobalEnvEditor.module.css +0 -69
- package/src/client/GlobalEnvEditor.tsx +11 -9
- package/src/client/McpSettingsSection.module.css +4 -36
- package/src/client/McpSettingsSection.tsx +14 -13
- package/src/client/ServerForm.module.css +3 -63
- package/src/client/ServerForm.tsx +14 -5
- package/src/client/ServersJsonEditor.module.css +0 -31
- package/src/client/ServersJsonEditor.tsx +3 -2
- package/src/client/ToolControlSection.module.css +2 -6
- package/src/client/ToolControlSection.tsx +4 -2
- package/src/client/controls.module.css +93 -0
package/CHANGELOG.en.md
CHANGED
|
@@ -12,6 +12,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
- **Supported DSH version**: **dsh `0.2.0-rc.2`** — the latest release is developed and verified on `0.2.0-rc.2` (declared in `package.json` → `dsh.supported`); older entries state the version verified at their time. When the DSH and plugin versions do not match, the Settings page reports a diagnosis (check whether the bundle is selected → restart `dsh web` → hard-refresh → upgrade both sides).
|
|
13
13
|
- **Release convention**: every version entry states `- **Supported DSH version**: dsh <version>`, mirrored in the GitHub Release notes. The release body is written in **Chinese** (matching [CHANGELOG.md](CHANGELOG.md)), with heading levels mirroring the entry.
|
|
14
14
|
|
|
15
|
+
## [1.14.2] - 2026-10-29
|
|
16
|
+
|
|
17
|
+
- **Supported DSH version**: **dsh `0.2.0-rc.2`**
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **Windows OAuth authorization page never opens ([#16](https://github.com/ArvinQi/dsh-mcp/issues/16))**: `openBrowser` used to run `spawn("start", [url])` on Windows, but `start` is a `cmd.exe` builtin rather than an executable, so spawning it without a shell only ever produced `ENOENT` — and `child.on("error", () => {})` swallowed that error. The result was that on Windows the authorization page never opened and nothing was reported (both call sites in `lib/oauth.js`, `oauthStart` and `allowBrowserOnMount`, were affected). It now uses `rundll32.exe url.dll,FileProtocolHandler`, passing the authorization URL as **one untouched argument** with no shell involved, so `&` in the query string cannot split the command — which also avoids the command-injection surface of handing the URL back to a shell via `cmd /c start "" <url>`. The macOS (`open`) / Linux (`xdg-open`) openers and the best-effort semantics (error callback, `detached`, `unref`) are unchanged (PR [#17](https://github.com/ArvinQi/dsh-mcp/pull/17), thanks [@Nyarlathoteppppp](https://github.com/Nyarlathoteppppp))
|
|
22
|
+
|
|
23
|
+
### Notes
|
|
24
|
+
|
|
25
|
+
- New zero-dependency module `lib/browser-command.js`: `browserCommand(url, platform)` returns the "command + argument array" per platform, lifting "which program opens the URL" out of `openBrowser` so it can be asserted
|
|
26
|
+
- New `test/oauth-browser.test.mjs`: asserts that on win32 an authorization URL containing `&` is handed to `rundll32.exe url.dll,FileProtocolHandler` as a single argument, and that the darwin / linux commands are unchanged; the test does not need the DSH module closure, so it also runs in CI's `npm test` (unlike `oauth-flow.test.mjs`, which is skipped there)
|
|
27
|
+
- Only the host-side way of opening the browser changed: the client bundle `lib/client.js` and every Remote interface are untouched, so no rebuild is needed after upgrading
|
|
28
|
+
|
|
29
|
+
## [1.14.1] - 2026-10-20
|
|
30
|
+
|
|
31
|
+
- **Supported DSH version**: **dsh `0.2.0-rc.2`**
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **Plugin styles no longer leak into the host UI, and controls are styled by class only ([#14](https://github.com/ArvinQi/dsh-mcp/issues/14))**: `ServerForm.module.css` and `McpSettingsSection.module.css` each carried an unqualified `button { … }` rule, and several selectors ended in an element (`.field input`, `.row input`, `.actions button`, `.retryRow button`). The client stylesheets are injected into the host's `<head>` verbatim — the build's CSS Modules are an identity class map, not a scoping boundary — so those rules matched **every** matching element in the host page. The DSH composer's attach button (28×28, bottom-left) and send button (34×34, bottom-right) center their SVG with `display: grid; place-items: center` and declare no `padding` of their own; the leaked `padding: 5px 12px` shrank their content box from 16px / 22px to 4px / 10px, the 14px / 16px icon overflowed horizontally and was aligned to the start edge, so the icon drifted right inside the circle (measured +5.0 px and +3.0 px). **No style targets an element any more** (`button` / `input` / `select` / `textarea` / `label` / `p` are all gone): the base control styles now live in the new `src/client/controls.module.css` as classes — `.button` (with `:hover` / `:focus-visible` / `:disabled`), `.buttonSmall`, `.primary`, `.control` (shared by `<input>` / `<select>` / `<textarea>`), `.controlMono` and `.checkbox`. Components import that module for the class **names** only; their own sheets keep layout plus the `.active` / `.danger` / `.dangerButton` / `.moduleTitle` modifiers, all matched by class. Because an identity class map makes class names global, the shared classes are defined exactly once, in `controls.module.css`; specificity no longer needs tricks (the previous `:where()` wrappers are gone) — within that one sheet `.primary` follows `.button`, and the component sheets are injected after it
|
|
36
|
+
|
|
37
|
+
### Notes
|
|
38
|
+
|
|
39
|
+
- `test/client-style-scope.test.mjs` was rewritten: (1) every selector of `src/client/*.module.css` must be a pure class chain (an element selector, `*` or `:root` fails); (2) the bundle is loaded through the shell's loader wire format and the stylesheets it actually injects are checked the same way; (3) the shared classes must be defined once, `controls.module.css` must be injected first, and the `.primary` / `.buttonSmall` / `.controlMono` rules must follow their base classes; (4) every `<button>` in the `.tsx` sources must carry `controls.button` so a missed class cannot silently render an unstyled control. It fails against the pre-fix build
|
|
40
|
+
- `scripts/build.mjs` strips CSS comments before computing the identity class map, so class names mentioned only in a comment no longer become dead keys; the build header now states that injected styles are global, that every rule must be a pure class selector, and that shared control classes live in `controls.module.css`
|
|
41
|
+
- Only the client half changed (the host `lib/index.js` and all Remote interfaces are untouched), so upgrading the plugin and hard-refreshing the DSH page is enough to see the centered icons
|
|
42
|
+
|
|
15
43
|
## [1.14.0] - 2026-10-13
|
|
16
44
|
|
|
17
45
|
- **Supported DSH version**: **dsh `0.2.0-rc.2`**
|
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,34 @@
|
|
|
12
12
|
- **支持版本**:**dsh `0.2.0-rc.2`** —— 最新版本在 `0.2.0-rc.2` 上开发与验证(`package.json` → `dsh.supported` 同步声明);历史版本条目各自声明当时验证的版本。DSH 与插件版本不匹配时,设置页会给出排查诊断(核对 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
|
|
13
13
|
- **发版约定**:每个版本条目都要声明 `- **支持版本**:dsh <版本>`,并在 GitHub Release notes 中同步。Release 正文用**中文**(与本文档一致),标题层级与条目一致。
|
|
14
14
|
|
|
15
|
+
## [1.14.2] - 2026-10-29
|
|
16
|
+
|
|
17
|
+
- **支持版本**:**dsh `0.2.0-rc.2`**
|
|
18
|
+
|
|
19
|
+
### 修复
|
|
20
|
+
|
|
21
|
+
- **Windows OAuth 授权页无法打开([#16](https://github.com/ArvinQi/dsh-mcp/issues/16))**:此前 `openBrowser` 在 Windows 上执行 `spawn("start", [url])`,而 `start` 是 `cmd.exe` 的内置命令、并非可执行文件,不经过 shell 启动只会得到 `ENOENT`,该错误又被 `child.on("error", () => {})` 静默吞掉,于是 Windows 上发起 OAuth 授权时浏览器根本不打开、也没有任何提示(`lib/oauth.js` 里 `oauthStart` 与 `allowBrowserOnMount` 两处调用都受影响)。现改用 `rundll32.exe url.dll,FileProtocolHandler`,授权 URL 作为**单个原样参数**传递、不经过 shell,因此查询参数中的 `&` 不会被拆成命令;同时也避免了 `cmd /c start "" <url>` 那种把 URL 重新交给 shell 解析带来的命令注入面。macOS(`open`)/ Linux(`xdg-open`)的打开方式与「尽力打开」(错误回调、`detached`、`unref`)语义均保持不变(PR [#17](https://github.com/ArvinQi/dsh-mcp/pull/17),感谢 [@Nyarlathoteppppp](https://github.com/Nyarlathoteppppp))
|
|
22
|
+
|
|
23
|
+
### 说明
|
|
24
|
+
|
|
25
|
+
- 新增零依赖模块 `lib/browser-command.js`:`browserCommand(url, platform)` 按平台返回「命令 + 参数数组」,把「用哪个程序打开」从 `openBrowser` 里剥出来以便断言
|
|
26
|
+
- 新增 `test/oauth-browser.test.mjs`:断言 win32 下含 `&` 的授权 URL 作为单个参数交给 `rundll32.exe url.dll,FileProtocolHandler`,且 darwin / linux 的启动命令保持不变;该测试不依赖 DSH 模块闭包,因此在 CI 的 `npm test` 中也会执行(不会像 `oauth-flow.test.mjs` 那样被跳过)
|
|
27
|
+
- 本次只改变宿主侧打开浏览器的方式:客户端包 `lib/client.js` 与所有 Remote 接口未变,升级后无需重新构建产物
|
|
28
|
+
|
|
29
|
+
## [1.14.1] - 2026-10-20
|
|
30
|
+
|
|
31
|
+
- **支持版本**:**dsh `0.2.0-rc.2`**
|
|
32
|
+
|
|
33
|
+
### 修复
|
|
34
|
+
|
|
35
|
+
- **插件样式不再泄漏到宿主界面,控件样式一律改为 class([#14](https://github.com/ArvinQi/dsh-mcp/issues/14))**:`ServerForm.module.css` 与 `McpSettingsSection.module.css` 里各有一条没有父级限定的 `button { … }` 规则,另外还有 `.field input` / `.row input` / `.actions button` / `.retryRow button` 等以元素为右端的选择器;而客户端样式表是原样注入宿主 `<head>` 的——构建的 CSS Modules 只做恒等类名映射,没有任何作用域边界——于是这些规则命中了宿主页面上对应的**每一个**元素。DSH 输入框左下角的加号按钮(28×28)与右下角的发送按钮(34×34)靠 `display: grid; place-items: center` 让图标居中、自身不声明 `padding`,被泄漏的 `padding: 5px 12px` 把内容盒从 16px / 22px 挤到 4px / 10px,14px / 16px 的图标横向溢出、按起始边对齐,图标因此在圆内向右偏移(实测 +5.0 px 与 +3.0 px)。现在**不再有任何以元素为目标的样式**(`button` / `input` / `select` / `textarea` / `label` / `p` 全部消失):基础控件样式集中到新的 `src/client/controls.module.css`,以类名定义——`.button`(连同 `:hover` / `:focus-visible` / `:disabled`)、`.buttonSmall`、`.primary`、`.control`(`<input>` / `<select>` / `<textarea>` 共用)、`.controlMono`、`.checkbox`;各组件只从这个模块取**类名**,自己的样式表保留布局与 `.active` / `.danger` / `.dangerButton` / `.moduleTitle` 等修饰类,也全部只按 class 匹配。因为恒等类名映射下同名类就是全局的,共享类只在 `controls.module.css` 里定义一次;优先级也不再依赖技巧(此前用 `:where()` 压低权重),改为「同一个表内 `.primary` 排在 `.button` 之后 + 组件样式表固定在共享表之后注入」
|
|
36
|
+
|
|
37
|
+
### 说明
|
|
38
|
+
|
|
39
|
+
- 重写 `test/client-style-scope.test.mjs`:① 逐条检查 `src/client/*.module.css` 的选择器,要求是纯 class 链(出现元素选择器 / `*` / `:root` 即失败);② 按宿主加载器格式装载 `lib/client.js`,检查它实际注入的样式表同样没有元素选择器;③ 断言共享控件类只定义一次、`controls.module.css` 排在其它样式表之前,且 `.primary` / `.buttonSmall` / `.controlMono` 规则顺序保证变体覆盖基础类;④ 扫描所有 `.tsx`,每个 `<button>` 必须带 `controls.button`(避免漏类名退回无样式)。用修复前的构建产物跑该测试会失败
|
|
40
|
+
- `scripts/build.mjs` 生成恒等类名表前先剥离 CSS 注释(注释里提到的类名不再成为死 key);构建脚本头部改为说明「注入的样式表是全局的,规则必须是纯 class 选择器,控件共享类集中在 controls.module.css」
|
|
41
|
+
- 本次只有客户端包内容变化(宿主 `lib/index.js` 与所有 Remote 接口未变),升级插件后硬刷新 DSH 页面即可看到图标居中
|
|
42
|
+
|
|
15
43
|
## [1.14.0] - 2026-10-13
|
|
16
44
|
|
|
17
45
|
- **支持版本**:**dsh `0.2.0-rc.2`**
|
package/README.en.md
CHANGED
|
@@ -101,6 +101,7 @@ dsh-mcp/
|
|
|
101
101
|
│ ├── patch-writer.js managed-block writer: disables a declaration on takeover (backup/atomic/idempotent)
|
|
102
102
|
│ ├── mcp-client.js vendored MCP client (from @deepseek-ai/dsh-mcp-client, with tool-list stability extension)
|
|
103
103
|
│ ├── oauth.js MCP OAuth client provider (authorization-code + PKCE, loopback callback, token persistence)
|
|
104
|
+
│ ├── browser-command.js per-platform browser opener: rundll32 on Windows, URL never through a shell (1.14.2)
|
|
104
105
|
│ ├── system-ca.js system CA trust: merges the OS roots into Node's default store (1.14.0)
|
|
105
106
|
│ ├── probe.js vendored connection probe (from mcp-client/src/probe.ts)
|
|
106
107
|
│ ├── transport.js vendored transport factory (from mcp-client/src/transport.ts)
|
package/README.md
CHANGED
|
@@ -107,6 +107,7 @@ dsh-mcp/
|
|
|
107
107
|
│ ├── patch-writer.js 受管块写入器:接管时在 patch 文件里停用声明行(备份/原子/幂等)
|
|
108
108
|
│ ├── mcp-client.js vendored MCP 客户端(源自 @deepseek-ai/dsh-mcp-client,含工具列表稳定扩展)
|
|
109
109
|
│ ├── oauth.js MCP OAuth 客户端提供者(授权码 + PKCE、回环回调、token 持久化)
|
|
110
|
+
│ ├── browser-command.js 按平台选择浏览器打开命令:Windows 走 rundll32,URL 不经过 shell(1.14.2)
|
|
110
111
|
│ ├── system-ca.js 系统证书信任:把操作系统根证书并入 Node 默认库(1.14.0)
|
|
111
112
|
│ ├── probe.js vendored 连接探测(源自 mcp-client/src/probe.ts)
|
|
112
113
|
│ ├── transport.js vendored 传输工厂(源自 mcp-client/src/transport.ts)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Choose a browser opener without passing the URL through a shell. */
|
|
2
|
+
export function browserCommand(url, platform = process.platform) {
|
|
3
|
+
if (platform === "win32") return ["rundll32.exe", ["url.dll,FileProtocolHandler", url]];
|
|
4
|
+
return [platform === "darwin" ? "open" : "xdg-open", [url]];
|
|
5
|
+
}
|
package/lib/client.js
CHANGED
|
@@ -15507,6 +15507,21 @@ function createMcpManagerStore() {
|
|
|
15507
15507
|
});
|
|
15508
15508
|
}
|
|
15509
15509
|
|
|
15510
|
+
// src/client/controls.module.css
|
|
15511
|
+
(function() {
|
|
15512
|
+
if (typeof document !== "undefined") {
|
|
15513
|
+
const existing = document.querySelector('style[data-plugin="dsh-mcp"][data-file="controls.module.css"]');
|
|
15514
|
+
if (!existing) {
|
|
15515
|
+
const style = document.createElement("style");
|
|
15516
|
+
style.setAttribute("data-plugin", "dsh-mcp");
|
|
15517
|
+
style.setAttribute("data-file", "controls.module.css");
|
|
15518
|
+
style.textContent = "/* Shared control styles for the client UI.\n *\n * Every `.module.css` in this package is injected into the host page's <head>\n * verbatim \u2014 the build's class map is the identity, so there is no scoping\n * boundary and a class name is global. Two consequences:\n *\n * 1. Elements are styled by class only, never by tag. A bare `button` /\n * `input` selector would restyle the host shell (issue #14: the composer's\n * icon buttons lost their centering to a leaked `padding: 5px 12px`).\n * 2. Each class below is defined **exactly here**, once. Another stylesheet\n * re-defining `.button` would silently change every control in the plugin,\n * so components import this module only for the class *names* and keep\n * their layout/variant rules in their own file.\n */\n\n.button {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 6px;\n padding: 5px 12px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n\n.button:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.button:focus-visible {\n outline: 2px solid var(--dsw-alias-brand-primary);\n outline-offset: 1px;\n}\n\n.button:disabled {\n cursor: not-allowed;\n opacity: 0.55;\n}\n\n/* Compact action, e.g. the inline \"retry\" button of the global-env editor. */\n.buttonSmall {\n padding: 3px 10px;\n font-size: 12px;\n line-height: 18px;\n}\n\n.primary {\n border-color: var(--dsw-alias-button-primary-fill);\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n\n.primary:hover {\n background: var(--dsw-alias-button-primary-hover);\n}\n\n/* Text controls: one class for <input>, <select> and <textarea>, so no rule\n has to name an element. */\n.control {\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 6px 10px;\n outline: none;\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n resize: vertical;\n}\n\n.control::placeholder {\n color: var(--dsw-alias-label-tertiary);\n}\n\n.control:focus-visible {\n border-color: var(--dsw-alias-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent);\n}\n\n/* Denser monospace variant: the env rows of the global-env editor. */\n.controlMono {\n border-radius: 6px;\n padding: 5px 8px;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n}\n\n.checkbox {\n cursor: pointer;\n}\n";
|
|
15519
|
+
document.head.appendChild(style);
|
|
15520
|
+
}
|
|
15521
|
+
}
|
|
15522
|
+
})();
|
|
15523
|
+
var controls_default = { "button": "button", "buttonSmall": "buttonSmall", "primary": "primary", "control": "control", "controlMono": "controlMono", "checkbox": "checkbox" };
|
|
15524
|
+
|
|
15510
15525
|
// src/client/ServerForm.module.css
|
|
15511
15526
|
(function() {
|
|
15512
15527
|
if (typeof document !== "undefined") {
|
|
@@ -15515,12 +15530,12 @@ function createMcpManagerStore() {
|
|
|
15515
15530
|
const style = document.createElement("style");
|
|
15516
15531
|
style.setAttribute("data-plugin", "dsh-mcp");
|
|
15517
15532
|
style.setAttribute("data-file", "ServerForm.module.css");
|
|
15518
|
-
style.textContent = ".form {\n display: flex;\n flex-direction: column;\n gap: 14px;\n width: 100%;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n\n.titleRow {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.title {\n margin: 0;\n font-size: 15px;\n line-height: 22px;\n font-weight: 600;\n}\n\n.titleActions {\n display: flex;\n gap: 8px;\n}\n\
|
|
15533
|
+
style.textContent = ".form {\n display: flex;\n flex-direction: column;\n gap: 14px;\n width: 100%;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n\n.titleRow {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.title {\n margin: 0;\n font-size: 15px;\n line-height: 22px;\n font-weight: 600;\n}\n\n.titleActions {\n display: flex;\n gap: 8px;\n}\n\n/* Control styling lives in class form in ./controls.module.css; this module\n only keeps its own layout and modifiers, and it must never match an element\n by tag (the sheets are injected into the host page globally, issue #14). */\n\n.danger {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.error {\n margin: 0;\n color: var(--dsw-alias-state-error-primary);\n font-size: 13px;\n line-height: 20px;\n}\n\n.field {\n display: flex;\n flex-direction: column;\n gap: 5px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n\n.hint,\n.muted {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.checkRow {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n cursor: pointer;\n}\n\n.testResult {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n}\n\n.testOk {\n color: var(--dsw-alias-state-success-primary);\n}\n\n.testFail {\n color: var(--dsw-alias-state-error-primary);\n}\n\n.oauthWaiting {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-warn-primary);\n}\n\n.oauthOk {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-success-primary);\n}\n\n.oauthRequired {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-state-warn-primary);\n}\n\n.actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n";
|
|
15519
15534
|
document.head.appendChild(style);
|
|
15520
15535
|
}
|
|
15521
15536
|
}
|
|
15522
15537
|
})();
|
|
15523
|
-
var ServerForm_default = { "form": "form", "titleRow": "titleRow", "title": "title", "titleActions": "titleActions", "
|
|
15538
|
+
var ServerForm_default = { "form": "form", "titleRow": "titleRow", "title": "title", "titleActions": "titleActions", "danger": "danger", "error": "error", "field": "field", "hint": "hint", "muted": "muted", "checkRow": "checkRow", "testResult": "testResult", "testOk": "testOk", "testFail": "testFail", "oauthWaiting": "oauthWaiting", "oauthOk": "oauthOk", "oauthRequired": "oauthRequired", "actions": "actions" };
|
|
15524
15539
|
|
|
15525
15540
|
// src/client/ServerForm.tsx
|
|
15526
15541
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -15635,8 +15650,8 @@ function McpServerForm(props) {
|
|
|
15635
15650
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: ServerForm_default.titleRow, children: [
|
|
15636
15651
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: ServerForm_default.title, children: draft.id === null ? t("newTitle") : t("editTitle") }),
|
|
15637
15652
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: ServerForm_default.titleActions, children: [
|
|
15638
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => actions.cancelEdit(), children: t("backToList") }),
|
|
15639
|
-
draft.id !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: ServerForm_default.danger
|
|
15653
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: controls_default.button, onClick: () => actions.cancelEdit(), children: t("backToList") }),
|
|
15654
|
+
draft.id !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: `${controls_default.button} ${ServerForm_default.danger}`, disabled: busy !== null, onClick: () => void removeServer(), children: busy === "remove" ? t("removing") : t("remove") }) : null
|
|
15640
15655
|
] })
|
|
15641
15656
|
] }),
|
|
15642
15657
|
saveError !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: ServerForm_default.error, role: "alert", children: saveError }) : null,
|
|
@@ -15646,6 +15661,7 @@ function McpServerForm(props) {
|
|
|
15646
15661
|
"input",
|
|
15647
15662
|
{
|
|
15648
15663
|
type: "text",
|
|
15664
|
+
className: controls_default.control,
|
|
15649
15665
|
value: draft.serverName,
|
|
15650
15666
|
placeholder: t("serverNameHint"),
|
|
15651
15667
|
onChange: (event) => update({ serverName: event.currentTarget.value })
|
|
@@ -15657,6 +15673,7 @@ function McpServerForm(props) {
|
|
|
15657
15673
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
15658
15674
|
"select",
|
|
15659
15675
|
{
|
|
15676
|
+
className: controls_default.control,
|
|
15660
15677
|
value: draft.transport,
|
|
15661
15678
|
onChange: (event) => update({ transport: event.currentTarget.value }),
|
|
15662
15679
|
children: [
|
|
@@ -15673,6 +15690,7 @@ function McpServerForm(props) {
|
|
|
15673
15690
|
"input",
|
|
15674
15691
|
{
|
|
15675
15692
|
type: "text",
|
|
15693
|
+
className: controls_default.control,
|
|
15676
15694
|
value: draft.command,
|
|
15677
15695
|
placeholder: t("commandPlaceholder"),
|
|
15678
15696
|
onChange: (event) => update({ command: event.currentTarget.value })
|
|
@@ -15684,6 +15702,7 @@ function McpServerForm(props) {
|
|
|
15684
15702
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
15685
15703
|
"textarea",
|
|
15686
15704
|
{
|
|
15705
|
+
className: controls_default.control,
|
|
15687
15706
|
rows: 3,
|
|
15688
15707
|
value: draft.argsText,
|
|
15689
15708
|
placeholder: t("argsPlaceholder"),
|
|
@@ -15709,6 +15728,7 @@ function McpServerForm(props) {
|
|
|
15709
15728
|
"input",
|
|
15710
15729
|
{
|
|
15711
15730
|
type: "text",
|
|
15731
|
+
className: controls_default.control,
|
|
15712
15732
|
value: draft.cwd,
|
|
15713
15733
|
placeholder: t("cwdPlaceholder"),
|
|
15714
15734
|
onChange: (event) => update({ cwd: event.currentTarget.value })
|
|
@@ -15723,6 +15743,7 @@ function McpServerForm(props) {
|
|
|
15723
15743
|
"input",
|
|
15724
15744
|
{
|
|
15725
15745
|
type: "url",
|
|
15746
|
+
className: controls_default.control,
|
|
15726
15747
|
value: draft.url,
|
|
15727
15748
|
placeholder: t("urlPlaceholder"),
|
|
15728
15749
|
onChange: (event) => update({ url: event.currentTarget.value })
|
|
@@ -15734,6 +15755,7 @@ function McpServerForm(props) {
|
|
|
15734
15755
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
15735
15756
|
"textarea",
|
|
15736
15757
|
{
|
|
15758
|
+
className: controls_default.control,
|
|
15737
15759
|
rows: 2,
|
|
15738
15760
|
value: draft.headersText,
|
|
15739
15761
|
placeholder: t("headersPlaceholder"),
|
|
@@ -15748,6 +15770,7 @@ function McpServerForm(props) {
|
|
|
15748
15770
|
"input",
|
|
15749
15771
|
{
|
|
15750
15772
|
type: "number",
|
|
15773
|
+
className: controls_default.control,
|
|
15751
15774
|
min: 1,
|
|
15752
15775
|
value: draft.toolCallTimeoutMs,
|
|
15753
15776
|
onChange: (event) => update({ toolCallTimeoutMs: event.currentTarget.value })
|
|
@@ -15796,9 +15819,9 @@ function McpServerForm(props) {
|
|
|
15796
15819
|
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: `${ServerForm_default.testResult} ${probe !== void 0 && probe.ok ? ServerForm_default.testOk : ServerForm_default.testFail}`, role: "status", children: probe !== void 0 && probe.ok ? `${t("testOk")} (${probe.tools.length} ${t("toolCount")}, ${test.elapsedMs}ms)` : probe !== void 0 && !probe.ok ? `${t("testFail")}: ${probe.message}` : t("testUnknown") }) : null,
|
|
15797
15820
|
testRunning && draft.transport === "streamable-http" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: ServerForm_default.muted, role: "status", children: t("testBrowserHint") }) : null,
|
|
15798
15821
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: ServerForm_default.actions, children: [
|
|
15799
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: testRunning || busy !== null, onClick: () => void runTest(), children: testRunning ? t("testRunning") : t("test") }),
|
|
15800
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", className:
|
|
15801
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: busy !== null, onClick: () => actions.cancelEdit(), children: t("cancel") })
|
|
15822
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: controls_default.button, disabled: testRunning || busy !== null, onClick: () => void runTest(), children: testRunning ? t("testRunning") : t("test") }),
|
|
15823
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", className: `${controls_default.button} ${controls_default.primary}`, disabled: busy !== null || testRunning, children: busy === "save" ? t("saving") : t("save") }),
|
|
15824
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: controls_default.button, disabled: busy !== null, onClick: () => actions.cancelEdit(), children: t("cancel") })
|
|
15802
15825
|
] })
|
|
15803
15826
|
] });
|
|
15804
15827
|
}
|
|
@@ -15814,12 +15837,12 @@ var import_react2 = require("react");
|
|
|
15814
15837
|
const style = document.createElement("style");
|
|
15815
15838
|
style.setAttribute("data-plugin", "dsh-mcp");
|
|
15816
15839
|
style.setAttribute("data-file", "ServersJsonEditor.module.css");
|
|
15817
|
-
style.textContent = ".panel {\n display: flex;\n flex-direction: column;\n gap: 8px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 10px 14px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.editor {\n width: 100%;\n box-sizing: border-box;\n min-height: 260px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 8px 10px;\n outline: none;\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 12px;\n line-height: 18px;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n resize: vertical;\n}\n\n.editor:focus-visible {\n border-color: var(--dsw-alias-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent);\n}\n\n.hint {\n margin: 0;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.error {\n margin: 0;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n word-break: break-all;\n}\n\n.notice {\n margin: 0;\n color: var(--dsw-alias-state-success-primary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n
|
|
15840
|
+
style.textContent = ".panel {\n display: flex;\n flex-direction: column;\n gap: 8px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 10px 14px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.editor {\n width: 100%;\n box-sizing: border-box;\n min-height: 260px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 8px 10px;\n outline: none;\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 12px;\n line-height: 18px;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n resize: vertical;\n}\n\n.editor:focus-visible {\n border-color: var(--dsw-alias-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent);\n}\n\n.hint {\n margin: 0;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.error {\n margin: 0;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n word-break: break-all;\n}\n\n.notice {\n margin: 0;\n color: var(--dsw-alias-state-success-primary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n";
|
|
15818
15841
|
document.head.appendChild(style);
|
|
15819
15842
|
}
|
|
15820
15843
|
}
|
|
15821
15844
|
})();
|
|
15822
|
-
var ServersJsonEditor_default = { "panel": "panel", "editor": "editor", "hint": "hint", "error": "error", "notice": "notice", "actions": "actions"
|
|
15845
|
+
var ServersJsonEditor_default = { "panel": "panel", "editor": "editor", "hint": "hint", "error": "error", "notice": "notice", "actions": "actions" };
|
|
15823
15846
|
|
|
15824
15847
|
// src/client/ServersJsonEditor.tsx
|
|
15825
15848
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -16000,8 +16023,8 @@ function ServersJsonEditor({ injected, t, onApplied }) {
|
|
|
16000
16023
|
error51 !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: ServersJsonEditor_default.error, role: "alert", children: error51 }) : null,
|
|
16001
16024
|
notice !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: ServersJsonEditor_default.notice, role: "status", children: notice }) : null,
|
|
16002
16025
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: ServersJsonEditor_default.actions, children: [
|
|
16003
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", disabled: busy, onClick: reseed, children: t("serversJsonReseed") }),
|
|
16004
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className:
|
|
16026
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: controls_default.button, disabled: busy, onClick: reseed, children: t("serversJsonReseed") }),
|
|
16027
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: `${controls_default.button} ${controls_default.primary}`, disabled: busy, onClick: apply2, children: busy ? t("serversJsonSaving") : t("serversJsonApply") })
|
|
16005
16028
|
] })
|
|
16006
16029
|
] });
|
|
16007
16030
|
}
|
|
@@ -16017,12 +16040,12 @@ var import_react3 = require("react");
|
|
|
16017
16040
|
const style = document.createElement("style");
|
|
16018
16041
|
style.setAttribute("data-plugin", "dsh-mcp");
|
|
16019
16042
|
style.setAttribute("data-file", "GlobalEnvEditor.module.css");
|
|
16020
|
-
style.textContent = ".panel {\n display: flex;\n flex-direction: column;\n gap: 8px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 10px 14px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.hint,\n.muted {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.row {\n display: grid;\n grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr) auto auto;\n align-items: center;\n gap: 8px;\n}\n\n.
|
|
16043
|
+
style.textContent = ".panel {\n display: flex;\n flex-direction: column;\n gap: 8px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 10px 14px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.hint,\n.muted {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.row {\n display: grid;\n grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr) auto auto;\n align-items: center;\n gap: 8px;\n}\n\n.name {\n width: 100%;\n}\n\n.value {\n width: 100%;\n}\n\n.secretToggle {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n}\n\n.secretToggle.secretOn {\n color: var(--dsw-alias-brand-primary);\n font-weight: 600;\n}\n\n.danger {\n border: 1px solid transparent !important;\n background: transparent !important;\n color: var(--dsw-alias-state-error-primary) !important;\n cursor: pointer;\n}\n\n.overlay {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.4);\n}\n\n.dialog {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: min(520px, calc(100vw - 48px));\n max-height: 80vh;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-overlay);\n box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);\n}\n\n.dialogTitle {\n margin: 0;\n font-size: 15px;\n line-height: 22px;\n font-weight: 600;\n color: var(--dsw-alias-label-primary);\n}\n\n.bulkText {\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 8px 10px;\n outline: none;\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 12px;\n line-height: 18px;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n resize: vertical;\n}\n\n.bulkText:focus-visible {\n border-color: var(--dsw-alias-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent);\n}\n\n.retryRow {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.error {\n margin: 0;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n word-break: break-all;\n}\n\n.notice {\n margin: 0;\n color: var(--dsw-alias-state-success-primary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n";
|
|
16021
16044
|
document.head.appendChild(style);
|
|
16022
16045
|
}
|
|
16023
16046
|
}
|
|
16024
16047
|
})();
|
|
16025
|
-
var GlobalEnvEditor_default = { "panel": "panel", "hint": "hint", "muted": "muted", "row": "row", "name": "name", "value": "value", "secretToggle": "secretToggle", "secretOn": "secretOn", "danger": "danger", "overlay": "overlay", "dialog": "dialog", "dialogTitle": "dialogTitle", "bulkText": "bulkText", "retryRow": "retryRow", "error": "error", "notice": "notice", "actions": "actions"
|
|
16048
|
+
var GlobalEnvEditor_default = { "panel": "panel", "hint": "hint", "muted": "muted", "row": "row", "name": "name", "value": "value", "secretToggle": "secretToggle", "secretOn": "secretOn", "danger": "danger", "overlay": "overlay", "dialog": "dialog", "dialogTitle": "dialogTitle", "bulkText": "bulkText", "retryRow": "retryRow", "error": "error", "notice": "notice", "actions": "actions" };
|
|
16026
16049
|
|
|
16027
16050
|
// src/client/GlobalEnvEditor.tsx
|
|
16028
16051
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -16164,7 +16187,7 @@ function GlobalEnvEditor({ injected, t, onApplied }) {
|
|
|
16164
16187
|
"input",
|
|
16165
16188
|
{
|
|
16166
16189
|
type: "text",
|
|
16167
|
-
className: GlobalEnvEditor_default.name
|
|
16190
|
+
className: `${controls_default.control} ${controls_default.controlMono} ${GlobalEnvEditor_default.name}`,
|
|
16168
16191
|
value: row.name,
|
|
16169
16192
|
placeholder: t("globalEnvName"),
|
|
16170
16193
|
"aria-label": t("globalEnvName"),
|
|
@@ -16175,7 +16198,7 @@ function GlobalEnvEditor({ injected, t, onApplied }) {
|
|
|
16175
16198
|
"input",
|
|
16176
16199
|
{
|
|
16177
16200
|
type: row.secret ? "password" : "text",
|
|
16178
|
-
className: GlobalEnvEditor_default.value
|
|
16201
|
+
className: `${controls_default.control} ${controls_default.controlMono} ${GlobalEnvEditor_default.value}`,
|
|
16179
16202
|
value: row.value,
|
|
16180
16203
|
placeholder: row.secret && row.configured ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : t("globalEnvValue"),
|
|
16181
16204
|
"aria-label": t("globalEnvValue"),
|
|
@@ -16187,6 +16210,7 @@ function GlobalEnvEditor({ injected, t, onApplied }) {
|
|
|
16187
16210
|
"input",
|
|
16188
16211
|
{
|
|
16189
16212
|
type: "checkbox",
|
|
16213
|
+
className: controls_default.checkbox,
|
|
16190
16214
|
checked: row.secret,
|
|
16191
16215
|
"aria-label": t("globalEnvSecret"),
|
|
16192
16216
|
onChange: (event) => update(row.key, { secret: event.currentTarget.checked })
|
|
@@ -16194,18 +16218,18 @@ function GlobalEnvEditor({ injected, t, onApplied }) {
|
|
|
16194
16218
|
),
|
|
16195
16219
|
t("globalEnvSecret")
|
|
16196
16220
|
] }),
|
|
16197
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: GlobalEnvEditor_default.danger
|
|
16221
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${controls_default.button} ${GlobalEnvEditor_default.danger}`, "aria-label": t("globalEnvRemove"), onClick: () => remove(row.key), children: "\u2715" })
|
|
16198
16222
|
] }, row.key)),
|
|
16199
16223
|
loadFailed ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalEnvEditor_default.retryRow, children: [
|
|
16200
16224
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: GlobalEnvEditor_default.error, role: "alert", children: t("globalEnvLoadFailed") }),
|
|
16201
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: reload, children: t("globalEnvRetry") })
|
|
16225
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${controls_default.button} ${controls_default.buttonSmall}`, onClick: reload, children: t("globalEnvRetry") })
|
|
16202
16226
|
] }) : null,
|
|
16203
16227
|
error51 !== null && !loadFailed ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: GlobalEnvEditor_default.error, role: "alert", children: error51 }) : null,
|
|
16204
16228
|
notice !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: GlobalEnvEditor_default.notice, role: "status", children: notice }) : null,
|
|
16205
16229
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalEnvEditor_default.actions, children: [
|
|
16206
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", disabled: busy, onClick: add, children: t("globalEnvAdd") }),
|
|
16207
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", disabled: busy, onClick: () => setBulkOpen(true), children: t("globalEnvBulk") }),
|
|
16208
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className:
|
|
16230
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: controls_default.button, disabled: busy, onClick: add, children: t("globalEnvAdd") }),
|
|
16231
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: controls_default.button, disabled: busy, onClick: () => setBulkOpen(true), children: t("globalEnvBulk") }),
|
|
16232
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${controls_default.button} ${controls_default.primary}`, disabled: busy, onClick: save, children: busy ? t("globalEnvSaving") : t("globalEnvSave") })
|
|
16209
16233
|
] }),
|
|
16210
16234
|
bulkOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: GlobalEnvEditor_default.overlay, onClick: () => setBulkOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalEnvEditor_default.dialog, role: "dialog", "aria-label": t("globalEnvBulk"), onClick: (event) => event.stopPropagation(), children: [
|
|
16211
16235
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: GlobalEnvEditor_default.dialogTitle, children: t("globalEnvBulk") }),
|
|
@@ -16222,8 +16246,8 @@ function GlobalEnvEditor({ injected, t, onApplied }) {
|
|
|
16222
16246
|
}
|
|
16223
16247
|
),
|
|
16224
16248
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: GlobalEnvEditor_default.actions, children: [
|
|
16225
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: () => setBulkOpen(false), children: t("cancel") }),
|
|
16226
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className:
|
|
16249
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: controls_default.button, onClick: () => setBulkOpen(false), children: t("cancel") }),
|
|
16250
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${controls_default.button} ${controls_default.primary}`, onClick: applyBulk, children: t("globalEnvBulkOk") })
|
|
16227
16251
|
] })
|
|
16228
16252
|
] }) }) : null
|
|
16229
16253
|
] });
|
|
@@ -16237,12 +16261,12 @@ function GlobalEnvEditor({ injected, t, onApplied }) {
|
|
|
16237
16261
|
const style = document.createElement("style");
|
|
16238
16262
|
style.setAttribute("data-plugin", "dsh-mcp");
|
|
16239
16263
|
style.setAttribute("data-file", "McpSettingsSection.module.css");
|
|
16240
|
-
style.textContent = ".section {\n display: flex;\n flex-direction: column;\n gap: 14px;\n width: 100%;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n\n.header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\n\n.status,\n.
|
|
16264
|
+
style.textContent = ".section {\n display: flex;\n flex-direction: column;\n gap: 14px;\n width: 100%;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n\n.header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\n\n.status,\n.failureText {\n margin: 0;\n}\n\n.status,\n.failure {\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.failure {\n display: flex;\n align-items: center;\n gap: 10px;\n color: var(--dsw-alias-state-error-primary);\n}\n\n/* Control styling lives in class form in ./controls.module.css; these are the\n section's own variants. No rule may match an element by tag: the sheets are\n injected into the host page globally (issue #14). */\n\n.active {\n border-color: var(--dsw-alias-brand-primary);\n color: var(--dsw-alias-brand-primary);\n background: color-mix(in srgb, var(--dsw-alias-brand-primary) 10%, transparent);\n}\n\n.module {\n display: flex;\n flex-direction: column;\n gap: 8px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 10px 14px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.moduleTitle {\n display: inline-flex !important;\n align-items: center;\n gap: 6px;\n width: fit-content;\n border: none !important;\n background: transparent !important;\n padding: 0 !important;\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n color: var(--dsw-alias-label-primary) !important;\n}\n\n.moduleTitle:hover {\n background: transparent !important;\n}\n\n.caret {\n display: inline-block;\n width: 14px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.configHeader {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.configActions {\n display: flex;\n gap: 8px;\n}\n\n.inlineForm {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 12px 14px;\n background: var(--dsw-alias-bg-layer-2);\n}\n\n.inlineFormItem {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 12px 14px;\n background: var(--dsw-alias-bg-layer-2);\n list-style: none;\n}\n\n.list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.row {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n flex-wrap: wrap;\n gap: 12px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 10px 14px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.rowMain {\n display: flex;\n flex: 1 1 320px;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n}\n\n.rowTitle {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n min-width: 0;\n}\n\n.serverName {\n overflow: hidden;\n font-size: 14px;\n line-height: 20px;\n font-weight: 600;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.badge {\n display: inline-flex;\n align-items: center;\n flex: none;\n min-height: 18px;\n border-radius: 5px;\n padding: 1px 6px;\n font-size: 11px;\n line-height: 16px;\n white-space: nowrap;\n}\n\n.badge.mounting {\n background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent);\n color: var(--dsw-alias-brand-primary);\n}\n\n.badge.live {\n background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 12%, transparent);\n color: var(--dsw-alias-state-success-primary);\n}\n\n.badge.failed {\n background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);\n color: var(--dsw-alias-state-error-primary);\n}\n\n.badge.stopped {\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-tertiary);\n}\n\n.badge.cordis {\n background: color-mix(in srgb, var(--dsw-alias-brand-primary) 12%, transparent);\n color: var(--dsw-alias-brand-primary);\n}\n\n.badge.oauth {\n background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 14%, transparent);\n color: var(--dsw-alias-state-warn-primary);\n}\n\n.badge.oauthMiss {\n background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);\n color: var(--dsw-alias-state-error-primary);\n}\n\n/* The authorization button of an unauthorized OAuth server: red, so the\n missing authorization is visible without any warning text. */\n.dangerButton {\n border-color: var(--dsw-alias-state-error-primary);\n color: var(--dsw-alias-state-error-primary);\n}\n\n.dangerButton:hover {\n background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, transparent);\n}\n\n.note {\n margin: 6px 0 0;\n color: var(--dsw-alias-label-secondary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.warn {\n margin: 6px 0 0;\n color: var(--dsw-alias-state-warn-primary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.path {\n margin: 4px 0 0;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n overflow-wrap: anywhere;\n}\n\n.muted {\n color: var(--dsw-alias-label-tertiary);\n}\n\n.rowMeta {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 14px;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n font-variant-numeric: tabular-nums;\n}\n\n.rowActions {\n display: flex;\n flex: none;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 8px;\n margin-left: auto;\n}\n\n.card {\n display: flex;\n flex-direction: column;\n gap: 0;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n background: var(--dsw-alias-bg-layer-3);\n}\n\n.card > .row {\n border: 0;\n border-radius: 0;\n background: transparent;\n}\n\n.modeRow {\n display: flex;\n align-items: center;\n gap: 18px;\n flex-wrap: wrap;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 10px;\n padding: 8px 14px;\n background: var(--dsw-alias-bg-layer-3);\n font-size: 13px;\n line-height: 20px;\n}\n\n.modeLabel {\n font-weight: 600;\n}\n\n.modeOption {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n}\n\n.modeHint {\n margin: 0;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 18px;\n}\n\n.toolPanel {\n border-top: 1px solid var(--dsw-alias-border-l2);\n padding: 10px 14px;\n}\n\n.toolGrid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));\n gap: 4px 14px;\n max-height: 320px;\n overflow-y: auto;\n}\n\n.toolRow {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n padding: 2px 0;\n font-size: 12px;\n line-height: 18px;\n cursor: pointer;\n}\n\n.toolName {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n";
|
|
16241
16265
|
document.head.appendChild(style);
|
|
16242
16266
|
}
|
|
16243
16267
|
}
|
|
16244
16268
|
})();
|
|
16245
|
-
var McpSettingsSection_default = { "section": "section", "header": "header", "status": "status", "
|
|
16269
|
+
var McpSettingsSection_default = { "section": "section", "header": "header", "status": "status", "failureText": "failureText", "failure": "failure", "active": "active", "module": "module", "moduleTitle": "moduleTitle", "caret": "caret", "configHeader": "configHeader", "configActions": "configActions", "inlineForm": "inlineForm", "inlineFormItem": "inlineFormItem", "list": "list", "row": "row", "rowMain": "rowMain", "rowTitle": "rowTitle", "serverName": "serverName", "badge": "badge", "mounting": "mounting", "live": "live", "failed": "failed", "stopped": "stopped", "cordis": "cordis", "oauth": "oauth", "oauthMiss": "oauthMiss", "dangerButton": "dangerButton", "note": "note", "warn": "warn", "path": "path", "muted": "muted", "rowMeta": "rowMeta", "rowActions": "rowActions", "card": "card", "modeRow": "modeRow", "modeLabel": "modeLabel", "modeOption": "modeOption", "modeHint": "modeHint", "toolPanel": "toolPanel", "toolGrid": "toolGrid", "toolRow": "toolRow", "toolName": "toolName" };
|
|
16246
16270
|
|
|
16247
16271
|
// src/client/McpSettingsSection.tsx
|
|
16248
16272
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -16556,10 +16580,10 @@ function McpSettingsSection(props) {
|
|
|
16556
16580
|
}
|
|
16557
16581
|
if (state.loadState === "error") {
|
|
16558
16582
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: McpSettingsSection_default.failure, children: [
|
|
16559
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", children: t("loadError") }),
|
|
16560
|
-
hostMissing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: McpSettingsSection_default.muted
|
|
16583
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: McpSettingsSection_default.failureText, role: "alert", children: t("loadError") }),
|
|
16584
|
+
hostMissing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: `${McpSettingsSection_default.muted} ${McpSettingsSection_default.failureText}`, children: t("loadErrorHostMissing") }) : null,
|
|
16561
16585
|
loadErrorDetail !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { className: McpSettingsSection_default.muted, children: loadErrorDetail }) : null,
|
|
16562
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: () => {
|
|
16586
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, onClick: () => {
|
|
16563
16587
|
setLoadState("loading");
|
|
16564
16588
|
load();
|
|
16565
16589
|
}, children: t("retry") })
|
|
@@ -16627,7 +16651,7 @@ function McpSettingsSection(props) {
|
|
|
16627
16651
|
"button",
|
|
16628
16652
|
{
|
|
16629
16653
|
type: "button",
|
|
16630
|
-
className: McpSettingsSection_default.moduleTitle
|
|
16654
|
+
className: `${controls_default.button} ${McpSettingsSection_default.moduleTitle}`,
|
|
16631
16655
|
"aria-expanded": envOpen,
|
|
16632
16656
|
onClick: () => setEnvOpen((open) => !open),
|
|
16633
16657
|
children: [
|
|
@@ -16655,13 +16679,13 @@ function McpSettingsSection(props) {
|
|
|
16655
16679
|
"button",
|
|
16656
16680
|
{
|
|
16657
16681
|
type: "button",
|
|
16658
|
-
className: jsonOpen ? McpSettingsSection_default.active :
|
|
16682
|
+
className: jsonOpen ? `${controls_default.button} ${McpSettingsSection_default.active}` : controls_default.button,
|
|
16659
16683
|
"aria-expanded": jsonOpen,
|
|
16660
16684
|
onClick: () => setJsonOpen((open) => !open),
|
|
16661
16685
|
children: t("serversJson")
|
|
16662
16686
|
}
|
|
16663
16687
|
),
|
|
16664
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className:
|
|
16688
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: `${controls_default.button} ${controls_default.primary}`, onClick: beginCreate, children: t("addServer") })
|
|
16665
16689
|
] })
|
|
16666
16690
|
] }),
|
|
16667
16691
|
actionError !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: McpSettingsSection_default.warn, role: "alert", children: [
|
|
@@ -16756,21 +16780,21 @@ function McpSettingsSection(props) {
|
|
|
16756
16780
|
declared && server.oauthHint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: McpSettingsSection_default.warn, children: t("oauthHint") }) : null
|
|
16757
16781
|
] }),
|
|
16758
16782
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: McpSettingsSection_default.rowActions, children: [
|
|
16759
|
-
declared || server.conflict || server.pendingTakeover ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", disabled: isRefreshing, onClick: () => void toggleEnabled(server), children: server.enabled ? t("disable") : t("enabled") }),
|
|
16783
|
+
declared || server.conflict || server.pendingTakeover ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, disabled: isRefreshing, onClick: () => void toggleEnabled(server), children: server.enabled ? t("disable") : t("enabled") }),
|
|
16760
16784
|
oauthNeedsAuth && !server.conflict && !server.pendingTakeover ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
16761
16785
|
"button",
|
|
16762
16786
|
{
|
|
16763
16787
|
type: "button",
|
|
16764
|
-
className: oauthBlocks ? McpSettingsSection_default.dangerButton :
|
|
16788
|
+
className: oauthBlocks ? `${controls_default.button} ${McpSettingsSection_default.dangerButton}` : controls_default.button,
|
|
16765
16789
|
onClick: () => void runOAuth(server),
|
|
16766
16790
|
children: oauthInFlight ? t("oauthInProgress") : t("oauthAuthorize")
|
|
16767
16791
|
}
|
|
16768
16792
|
) : null,
|
|
16769
|
-
declared ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", disabled: isRefreshing, onClick: () => refreshServer(server.serverName), children: isRefreshing ? t("refreshing") : t("refresh") }),
|
|
16770
|
-
declared && server.adoptable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", disabled: adopting.has(server.serverName), onClick: () => void runAdopt(server), children: adopting.has(server.serverName) ? t("adopting") : t("adopt") }) : null,
|
|
16771
|
-
server.adopted ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", disabled: adopting.has(server.serverName), onClick: () => void runAdopt(server), children: adopting.has(server.serverName) ? t("releasing") : t("release") }) : null,
|
|
16772
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: () => toggleExpand(server.serverName), children: isExpanded ? t("toolsCollapse") : t("toolsExpand") }),
|
|
16773
|
-
declared ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: () => beginEdit(server), children: t("edit") })
|
|
16793
|
+
declared ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, disabled: isRefreshing, onClick: () => refreshServer(server.serverName), children: isRefreshing ? t("refreshing") : t("refresh") }),
|
|
16794
|
+
declared && server.adoptable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, disabled: adopting.has(server.serverName), onClick: () => void runAdopt(server), children: adopting.has(server.serverName) ? t("adopting") : t("adopt") }) : null,
|
|
16795
|
+
server.adopted ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, disabled: adopting.has(server.serverName), onClick: () => void runAdopt(server), children: adopting.has(server.serverName) ? t("releasing") : t("release") }) : null,
|
|
16796
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, onClick: () => toggleExpand(server.serverName), children: isExpanded ? t("toolsCollapse") : t("toolsExpand") }),
|
|
16797
|
+
declared ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: controls_default.button, onClick: () => beginEdit(server), children: t("edit") })
|
|
16774
16798
|
] })
|
|
16775
16799
|
] }),
|
|
16776
16800
|
isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: McpSettingsSection_default.toolPanel, children: tools === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: McpSettingsSection_default.muted, children: toolsError ?? t("toolsLoading") }) : serverToolList.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: McpSettingsSection_default.muted, children: t("toolsEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: McpSettingsSection_default.toolGrid, children: serverToolList.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: McpSettingsSection_default.toolRow, title: tool.name, children: [
|
package/lib/oauth.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
startAuthorization,
|
|
22
22
|
} from "@modelcontextprotocol/client";
|
|
23
23
|
import { credentialRef } from "@deepseek-ai/dsh-credentials";
|
|
24
|
+
import { browserCommand } from "./browser-command.js";
|
|
24
25
|
import { hostText } from "./host-locales.js";
|
|
25
26
|
import { systemFetch } from "./system-ca.js";
|
|
26
27
|
|
|
@@ -93,11 +94,8 @@ export function oauthCredentialRefs(serverId) {
|
|
|
93
94
|
|
|
94
95
|
/** Open the system browser to one URL, best effort. */
|
|
95
96
|
function openBrowser(url) {
|
|
96
|
-
const command =
|
|
97
|
-
|
|
98
|
-
: process.platform === "win32" ? "start"
|
|
99
|
-
: "xdg-open";
|
|
100
|
-
const child = spawn(command, [url], { detached: true, stdio: "ignore" });
|
|
97
|
+
const [command, args] = browserCommand(url);
|
|
98
|
+
const child = spawn(command, args, { detached: true, stdio: "ignore" });
|
|
101
99
|
child.on("error", () => {});
|
|
102
100
|
child.unref();
|
|
103
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.2",
|
|
4
4
|
"description": "MCP 管理界面 + tool search:可视化配置/启停/刷新 MCP 服务器与工具勾选,按需检索(tool search)热注入;工具列表稳定命中缓存、不撑爆上下文。DeepSeek Harness plugin: MCP management UI + tool search — stable tool list, cache-friendly, no context bloat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/scripts/build.mjs
CHANGED
|
@@ -9,8 +9,18 @@
|
|
|
9
9
|
* CSS Modules are handled by an esbuild onLoad plugin: each `.module.css` is
|
|
10
10
|
* rewritten to a JS module that (1) injects the stylesheet text into a
|
|
11
11
|
* <style data-plugin="dsh-mcp"> tag and (2) default-exports an identity class
|
|
12
|
-
* map (class name -> class name
|
|
13
|
-
*
|
|
12
|
+
* map (class name -> class name).
|
|
13
|
+
*
|
|
14
|
+
* The identity map means **the stylesheet text is global**: it lands in the
|
|
15
|
+
* host page's <head> and every selector in it can match host DOM. So every
|
|
16
|
+
* rule must be a chain of class selectors, never a bare tag, `*`, or a
|
|
17
|
+
* host-wide pseudo-class like `:root`. Issue #14 is exactly that failure: a
|
|
18
|
+
* bare `button {}` rule restyled every button of the DSH shell and pushed the
|
|
19
|
+
* composer icons off-center. Control styling therefore lives in class form —
|
|
20
|
+
* the shared classes in `src/client/controls.module.css` are defined there
|
|
21
|
+
* once and every component imports that module for the class *names*.
|
|
22
|
+
* `test/client-style-scope.test.mjs` enforces the invariant on the sources and
|
|
23
|
+
* on this build's output.
|
|
14
24
|
*
|
|
15
25
|
* esbuild is resolved from the DSH source checkout (the only place it is
|
|
16
26
|
* installed); the plugin package itself has zero runtime dependencies.
|
|
@@ -73,15 +83,22 @@ function resolveEsbuild(checkout) {
|
|
|
73
83
|
const require = createRequire(resolveEsbuild(CHECKOUT))
|
|
74
84
|
const esbuild = require('esbuild')
|
|
75
85
|
|
|
76
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Identity class map for one CSS module + the stylesheet text, as a JS module.
|
|
88
|
+
*
|
|
89
|
+
* The class names are read from the selectors only (comments are stripped
|
|
90
|
+
* first): a rule's explanatory comment may legitimately name a class that this
|
|
91
|
+
* file does not define, and the identity map must not grow dead keys from it.
|
|
92
|
+
*/
|
|
77
93
|
function cssModuleLoader() {
|
|
78
94
|
return {
|
|
79
95
|
name: 'dsh-mcp-css-modules',
|
|
80
96
|
setup(build) {
|
|
81
97
|
build.onLoad({ filter: /\.module\.css$/ }, (args) => {
|
|
82
98
|
const css = readFileSync(args.path, 'utf8')
|
|
99
|
+
const selectorText = css.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
83
100
|
const classes = [...new Set(
|
|
84
|
-
[...
|
|
101
|
+
[...selectorText.matchAll(/\.([A-Za-z_][A-Za-z0-9_-]*)/g)].map((match) => match[1]),
|
|
85
102
|
)]
|
|
86
103
|
const map = Object.fromEntries(classes.map((name) => [name, name]))
|
|
87
104
|
const file = args.path.split('/').pop()
|