dsh-ccgui 1.0.2 → 1.0.3
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/lib/client.js +20 -1
- package/lib/windows-command.js +26 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -3776,6 +3776,25 @@ var import_react17 = require("react");
|
|
|
3776
3776
|
|
|
3777
3777
|
// src/client/release-notes.ts
|
|
3778
3778
|
var RELEASE_NOTES = [
|
|
3779
|
+
{
|
|
3780
|
+
version: "1.0.3",
|
|
3781
|
+
date: "2026-11-09",
|
|
3782
|
+
sections: [
|
|
3783
|
+
{
|
|
3784
|
+
heading: "\u{1F41B} \u95EE\u9898\u4FEE\u590D",
|
|
3785
|
+
items: [
|
|
3786
|
+
{
|
|
3787
|
+
title: "Windows \u4E0A npx \u7CFB CLI \u8D77\u4E0D\u6765",
|
|
3788
|
+
text: "Node.js \u5B89\u88C5\u5305\u81EA\u5E26\u7684 `npx.cmd` \u628A\u8DEF\u5F84\u5B58\u5728\u53D8\u91CF\u91CC\uFF0C\u63D2\u4EF6\u4E4B\u524D\u89E3\u6790\u4E0D\u51FA\u6765\uFF0CClaude Code\u3001Codex\u3001Kimi\u3001PI \u90FD\u62A5\u300C\u65E0\u6CD5\u5728\u4E0D\u7ECF\u8FC7\u547D\u4EE4\u884C\u7684\u60C5\u51B5\u4E0B\u542F\u52A8 npx.cmd\u300D\u3002\u73B0\u5728\u80FD\u8BA4\u51FA\u8FD9\u79CD\u5199\u6CD5\uFF0C\u7528\u65C1\u8FB9\u7684 `node.exe`\uFF08\u6216 `PATH` \u91CC\u7684 node\uFF09\u76F4\u63A5\u8FD0\u884C `npx-cli.js`\u3002"
|
|
3789
|
+
},
|
|
3790
|
+
{
|
|
3791
|
+
title: "\u5347\u7EA7\u63D0\u793A",
|
|
3792
|
+
text: "\u4E4B\u524D\u4E3A\u4E86\u7ED5\u8FC7\u8FD9\u4E2A\u95EE\u9898\u5728 `cordis.patch.yml` \u91CC\u6539\u6210 `cmd /c npx ...` \u7684\uFF0C\u5347\u7EA7\u540E\u53EF\u4EE5\u5220\u6389\u90A3\u6BB5\u914D\u7F6E\u3001\u6062\u590D\u9ED8\u8BA4\uFF0C\u5426\u5219\u6536\u4E0D\u5230\u4EE5\u540E\u7684\u9002\u914D\u5668\u7248\u672C\u66F4\u65B0\u3002"
|
|
3793
|
+
}
|
|
3794
|
+
]
|
|
3795
|
+
}
|
|
3796
|
+
]
|
|
3797
|
+
},
|
|
3779
3798
|
{
|
|
3780
3799
|
version: "1.0.2",
|
|
3781
3800
|
date: "2026-11-08",
|
|
@@ -3957,7 +3976,7 @@ function createUpdateChecker(fetchFn, current) {
|
|
|
3957
3976
|
|
|
3958
3977
|
// src/client/settings-about.tsx
|
|
3959
3978
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3960
|
-
var PLUGIN_VERSION = true ? "1.0.
|
|
3979
|
+
var PLUGIN_VERSION = true ? "1.0.3" : "\u5F00\u53D1\u7248";
|
|
3961
3980
|
var REPO_URL = "https://github.com/zhukunpenglinyutong/dsh-ccgui";
|
|
3962
3981
|
var VERSION_LABEL = "\u7248\u672C";
|
|
3963
3982
|
var VERSION_VALUE = /^\d/.test(PLUGIN_VERSION) ? `v${PLUGIN_VERSION}` : PLUGIN_VERSION;
|
package/lib/windows-command.js
CHANGED
|
@@ -32,6 +32,12 @@ const NPM_PROG = '%_prog%';
|
|
|
32
32
|
*/
|
|
33
33
|
const SHIM_LAUNCH = /(?:("[^"]*"|[^\s"]+)[ \t]+)?"%~?dp0%?\\([^"]*)"[ \t]+%\*/g;
|
|
34
34
|
const NPM_PROG_VALUE = /SET "_prog=([^"]+)"/g;
|
|
35
|
+
/**
|
|
36
|
+
* The line the `npm.cmd` and `npx.cmd` shipped with Node.js start on: the interpreter and the
|
|
37
|
+
* script both come from variables set earlier in the file.
|
|
38
|
+
*/
|
|
39
|
+
const VARIABLE_LAUNCH = /^[ \t]*"%(\w+)%"[ \t]+"%(\w+)%"[ \t]+%\*/gm;
|
|
40
|
+
const DP0_PREFIX = /^%(?:~dp0|dp0%)\\/i;
|
|
35
41
|
const unquote = (text) => text.replace(/^"(.*)"$/, '$1');
|
|
36
42
|
function extensions(pathExt) {
|
|
37
43
|
return (pathExt ?? DEFAULT_PATHEXT)
|
|
@@ -75,6 +81,25 @@ function readLaunch(shim) {
|
|
|
75
81
|
const fallback = [...shim.matchAll(NPM_PROG_VALUE)].map((match) => match[1]).find((value) => !value?.includes('dp0'));
|
|
76
82
|
return { interpreter: fallback ?? DEFAULT_INTERPRETER, target };
|
|
77
83
|
}
|
|
84
|
+
function assignments(shim, name) {
|
|
85
|
+
return [...shim.matchAll(new RegExp(`SET "${name}=([^"]+)"`, 'gi'))].flatMap((match) => match[1] ?? []);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Node's own `npx.cmd` runs `<dp0>\\node.exe`, else `node`, on the npx script beside it. It also
|
|
89
|
+
* switches to the npx of a globally upgraded npm, which it finds by running node; that switch
|
|
90
|
+
* is skipped, since the bundled npx starts the same packages.
|
|
91
|
+
*/
|
|
92
|
+
function readVariableLaunch(shim) {
|
|
93
|
+
const [last] = [...shim.matchAll(VARIABLE_LAUNCH)].slice(-1);
|
|
94
|
+
if (last?.[1] === undefined || last[2] === undefined)
|
|
95
|
+
return undefined;
|
|
96
|
+
const target = assignments(shim, last[2]).find((value) => DP0_PREFIX.test(value));
|
|
97
|
+
if (target === undefined)
|
|
98
|
+
return undefined;
|
|
99
|
+
// As with npm's `_prog`, the value without dp0 is the fallback; dp0 is tried first anyway.
|
|
100
|
+
const interpreter = assignments(shim, last[1]).find((value) => !DP0_PREFIX.test(value));
|
|
101
|
+
return { interpreter: interpreter ?? DEFAULT_INTERPRETER, target: target.replace(DP0_PREFIX, '') };
|
|
102
|
+
}
|
|
78
103
|
function unsupported(shim) {
|
|
79
104
|
return new Error(`无法在不经过命令行的情况下启动 ${shim}。请在配置里把这个 CLI 的 command 改成 .exe 或它的 node 脚本的完整路径。`);
|
|
80
105
|
}
|
|
@@ -103,7 +128,7 @@ function interpreterArgv(interpreter, shim, lookup, depth) {
|
|
|
103
128
|
}
|
|
104
129
|
function argvForShim(shim, args, lookup, depth) {
|
|
105
130
|
const text = lookup.files.read(shim);
|
|
106
|
-
const launch = text === undefined ? undefined : readLaunch(text);
|
|
131
|
+
const launch = text === undefined ? undefined : (readLaunch(text) ?? readVariableLaunch(text));
|
|
107
132
|
if (launch === undefined)
|
|
108
133
|
throw unsupported(shim);
|
|
109
134
|
const shimDir = win32.dirname(shim);
|