dsh-plugin-shop 0.8.1-beta.1 → 0.8.1-beta.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/lib/index.js +39 -6
- package/lib/types/host/dsh-cli.d.ts +7 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1059,18 +1059,51 @@ const DSH_PACKAGE = "@deepseek-ai/dsh";
|
|
|
1059
1059
|
* also the unscoped name its plain-string `bin` form would take. */
|
|
1060
1060
|
const DSH_BIN_NAME = "dsh";
|
|
1061
1061
|
/**
|
|
1062
|
+
* A `dshBin` that names a JavaScript entry rather than a program.
|
|
1063
|
+
*
|
|
1064
|
+
* Such a file cannot be spawned anywhere: Windows needs a PE image, and POSIX
|
|
1065
|
+
* needs a shebang plus the exec bit that an entry shipped inside a package
|
|
1066
|
+
* does not reliably carry. The npm-installed CLI's real entry IS one of these
|
|
1067
|
+
* — `bin: { dsh: 'lib/bin.js' }` — so a caller pinning a specific dsh
|
|
1068
|
+
* installation has no other file to name, and {@link resolveDshScript} hands
|
|
1069
|
+
* back exactly this shape for the branch below to run through node.
|
|
1070
|
+
*
|
|
1071
|
+
* Platform-independent on purpose. The `dsh` branch is a Windows workaround
|
|
1072
|
+
* for PATH lookup; this is not a workaround at all but the only correct way
|
|
1073
|
+
* to start a JS entry, and gating it on Windows would leave a POSIX caller
|
|
1074
|
+
* with an ENOEXEC naming a file that is perfectly valid.
|
|
1075
|
+
*
|
|
1076
|
+
* The one thing it gives up is a `.js` entry whose shebang names some other
|
|
1077
|
+
* interpreter. `dshBin` names the dsh CLI, which is a node program, so the
|
|
1078
|
+
* trade is one hypothetical against a shape the CLI actually ships.
|
|
1079
|
+
*/
|
|
1080
|
+
const JS_ENTRY = /\.[cm]?js$/;
|
|
1081
|
+
/**
|
|
1062
1082
|
* The command that starts the dsh CLI with `args`.
|
|
1063
1083
|
*
|
|
1064
|
-
*
|
|
1065
|
-
* on PATH, which on Windows can never succeed. A `dshBin` naming a
|
|
1066
|
-
* file is the caller's explicit choice and is spawned as given —
|
|
1067
|
-
* and reporting the real failure beats silently running something
|
|
1084
|
+
* For the bare name the node route replaces exactly one thing: looking `dsh`
|
|
1085
|
+
* up on PATH, which on Windows can never succeed. A `dshBin` naming a
|
|
1086
|
+
* specific file is the caller's explicit choice and is spawned as given —
|
|
1087
|
+
* honoring it and reporting the real failure beats silently running something
|
|
1088
|
+
* else — with one exception, {@link JS_ENTRY}, where "as given" is not a
|
|
1089
|
+
* runnable command on any platform and node is what the caller must have
|
|
1090
|
+
* meant.
|
|
1068
1091
|
*/
|
|
1069
1092
|
function dshCommand(options) {
|
|
1070
1093
|
const { dshBin, args, platform, execPath, script } = options;
|
|
1071
|
-
if (
|
|
1094
|
+
if (dshBin === DSH_BIN_NAME) {
|
|
1095
|
+
if (platform === "win32" && script !== null) return {
|
|
1096
|
+
command: execPath,
|
|
1097
|
+
args: [script, ...args]
|
|
1098
|
+
};
|
|
1099
|
+
return {
|
|
1100
|
+
command: dshBin,
|
|
1101
|
+
args: [...args]
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
if (JS_ENTRY.test(dshBin)) return {
|
|
1072
1105
|
command: execPath,
|
|
1073
|
-
args: [
|
|
1106
|
+
args: [dshBin, ...args]
|
|
1074
1107
|
};
|
|
1075
1108
|
return {
|
|
1076
1109
|
command: dshBin,
|
|
@@ -35,10 +35,13 @@ export interface DshCommand {
|
|
|
35
35
|
/**
|
|
36
36
|
* The command that starts the dsh CLI with `args`.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
* on PATH, which on Windows can never succeed. A `dshBin` naming a
|
|
40
|
-
* file is the caller's explicit choice and is spawned as given —
|
|
41
|
-
* and reporting the real failure beats silently running something
|
|
38
|
+
* For the bare name the node route replaces exactly one thing: looking `dsh`
|
|
39
|
+
* up on PATH, which on Windows can never succeed. A `dshBin` naming a
|
|
40
|
+
* specific file is the caller's explicit choice and is spawned as given —
|
|
41
|
+
* honoring it and reporting the real failure beats silently running something
|
|
42
|
+
* else — with one exception, {@link JS_ENTRY}, where "as given" is not a
|
|
43
|
+
* runnable command on any platform and node is what the caller must have
|
|
44
|
+
* meant.
|
|
42
45
|
*/
|
|
43
46
|
export declare function dshCommand(options: {
|
|
44
47
|
dshBin: string;
|
package/package.json
CHANGED