@dev-anywhere/proxy 0.9.2 → 0.9.4

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.
Files changed (33) hide show
  1. package/dist/{autostart-C3RNQ65S.js → autostart-G2MSOPL7.js} +2 -2
  2. package/dist/{chunk-KINQESTO.js → chunk-CMADETTC.js} +7 -5
  3. package/dist/chunk-CMADETTC.js.map +1 -0
  4. package/dist/{chunk-74HWO753.js → chunk-EIXVJR3C.js} +3 -3
  5. package/dist/{chunk-V4HDLUAQ.js → chunk-GIFG7KAJ.js} +215 -128
  6. package/dist/chunk-GIFG7KAJ.js.map +1 -0
  7. package/dist/chunk-M34C6LTF.js +344 -0
  8. package/dist/chunk-M34C6LTF.js.map +1 -0
  9. package/dist/{chunk-VHMAUU72.js → chunk-QZ3OZJBG.js} +2 -2
  10. package/dist/{chunk-GFDOVLGL.js → chunk-WLXTXXNY.js} +246 -6
  11. package/dist/chunk-WLXTXXNY.js.map +1 -0
  12. package/dist/{chunk-MLE2OKCM.js → chunk-YYNHKGCH.js} +3 -3
  13. package/dist/{chunk-MLE2OKCM.js.map → chunk-YYNHKGCH.js.map} +1 -1
  14. package/dist/index.js +8 -8
  15. package/dist/index.js.map +1 -1
  16. package/dist/serve.js +3735 -4061
  17. package/dist/serve.js.map +1 -1
  18. package/dist/session-worker.js +3 -3
  19. package/dist/{terminal-7JY6J3XN.js → terminal-UTFRKKZ4.js} +16 -42
  20. package/dist/terminal-UTFRKKZ4.js.map +1 -0
  21. package/dist/terminal-worker.js +222 -284
  22. package/dist/terminal-worker.js.map +1 -1
  23. package/dist/update-runner.js +1 -1
  24. package/package.json +3 -3
  25. package/dist/chunk-77NR262K.js +0 -219
  26. package/dist/chunk-77NR262K.js.map +0 -1
  27. package/dist/chunk-GFDOVLGL.js.map +0 -1
  28. package/dist/chunk-KINQESTO.js.map +0 -1
  29. package/dist/chunk-V4HDLUAQ.js.map +0 -1
  30. package/dist/terminal-7JY6J3XN.js.map +0 -1
  31. /package/dist/{autostart-C3RNQ65S.js.map → autostart-G2MSOPL7.js.map} +0 -0
  32. /package/dist/{chunk-74HWO753.js.map → chunk-EIXVJR3C.js.map} +0 -0
  33. /package/dist/{chunk-VHMAUU72.js.map → chunk-QZ3OZJBG.js.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  import "./chunk-77QVUYU7.js";
15
15
  import {
16
16
  quoteWindowsArgument
17
- } from "./chunk-KINQESTO.js";
17
+ } from "./chunk-CMADETTC.js";
18
18
  import {
19
19
  PROFILE_NAME,
20
20
  isInitialized
@@ -289,4 +289,4 @@ export {
289
289
  runAutostartCommand,
290
290
  startAutostartService
291
291
  };
292
- //# sourceMappingURL=autostart-C3RNQ65S.js.map
292
+ //# sourceMappingURL=autostart-G2MSOPL7.js.map
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // src/common/command-launch.ts
4
+ import { spawn } from "child_process";
5
+ import { win32 as win322 } from "path";
6
+ import { fileURLToPath } from "url";
7
+ import escape from "cross-spawn/lib/util/escape.js";
8
+
3
9
  // src/common/executable.ts
4
10
  import { accessSync, constants, statSync } from "fs";
5
11
  import { posix, win32 } from "path";
@@ -61,10 +67,6 @@ function defaultShell(env = process.env, platform = process.platform) {
61
67
  }
62
68
 
63
69
  // src/common/command-launch.ts
64
- import { spawn } from "child_process";
65
- import { win32 as win322 } from "path";
66
- import { fileURLToPath } from "url";
67
- import escape from "cross-spawn/lib/util/escape.js";
68
70
  function quoteWindowsArgument(value) {
69
71
  if (value.includes("\0")) throw new TypeError("Command arguments cannot contain NUL");
70
72
  let result = '"';
@@ -142,4 +144,4 @@ export {
142
144
  prepareCommandLaunch,
143
145
  spawnCommand
144
146
  };
145
- //# sourceMappingURL=chunk-KINQESTO.js.map
147
+ //# sourceMappingURL=chunk-CMADETTC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/command-launch.ts","../src/common/executable.ts"],"sourcesContent":["import { spawn, type ChildProcess, type SpawnOptions } from \"node:child_process\";\nimport { win32 } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport escape from \"cross-spawn/lib/util/escape.js\";\nimport {\n defaultShell,\n findExecutableCandidates,\n normalizeProcessEnvironment,\n} from \"./executable.js\";\n\nexport interface CommandLaunch {\n command: string;\n args: string[];\n env: NodeJS.ProcessEnv;\n windowsVerbatimArguments?: true;\n /** node-pty accepts an already escaped Windows command line as a string. */\n ptyArgs?: string;\n}\n\n/** Win32 argv quoting, not shell escaping. Use only with CreateProcess-style native execution. */\nexport function quoteWindowsArgument(value: string): string {\n if (value.includes(\"\\0\")) throw new TypeError(\"Command arguments cannot contain NUL\");\n let result = '\"';\n let backslashes = 0;\n for (const char of value) {\n if (char === \"\\\\\") {\n backslashes += 1;\n continue;\n }\n if (char === '\"') result += \"\\\\\".repeat(backslashes * 2 + 1);\n else result += \"\\\\\".repeat(backslashes);\n result += char;\n backslashes = 0;\n }\n return `${result}${\"\\\\\".repeat(backslashes * 2)}\"`;\n}\n\nexport function prepareCommandLaunch(\n command: string,\n args: readonly string[],\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n cwd: string = process.cwd(),\n): CommandLaunch {\n const environment = normalizeProcessEnvironment(env, platform);\n if (platform !== \"win32\") return { command, args: [...args], env: environment };\n const resolved = findExecutableCandidates(command, environment, { platform, cwd })[0] ?? command;\n const batch = /\\.(?:cmd|bat)$/i.test(resolved);\n const cmd = /^cmd(?:\\.exe)?$/i.test(win32.basename(resolved));\n const directory = win32.resolve(cwd);\n if ((batch || cmd) && /^\\\\\\\\(?![?.]\\\\)[^\\\\]+\\\\[^\\\\]+/.test(directory)) {\n throw new Error(\n \"Windows CMD 不支持将网络共享目录作为工作目录,请选择本地目录或已映射的盘符路径。\",\n );\n }\n if (!batch) {\n return { command: resolved, args: [...args], env: environment };\n }\n if ([resolved, ...args].some((value) => /[\\r\\n\\0]/.test(value))) {\n throw new TypeError(\n \"Windows batch commands cannot accept line breaks or NUL in arguments; use a native executable\",\n );\n }\n\n // Share cross-spawn's CMD escaping between pipe-based processes and ConPTY. Pinning the\n // dependency keeps this internal utility's contract explicit; never enable spawn's shell mode.\n const doubleEscape = /node_modules[\\\\/]\\.bin[\\\\/][^\\\\/]+\\.cmd$/i.test(resolved);\n const line = [\n escape.command(win32.normalize(resolved)),\n ...args.map((arg) => escape.argument(arg, doubleEscape)),\n ].join(\" \");\n const shellArgs = [\"/d\", \"/s\", \"/v:off\", \"/c\", `\"${line}\"`];\n return {\n command: defaultShell(environment, platform),\n args: shellArgs,\n env: environment,\n windowsVerbatimArguments: true,\n ptyArgs: shellArgs.join(\" \"),\n };\n}\n\nexport function spawnCommand(\n command: string,\n args: readonly string[],\n options: SpawnOptions = {},\n): ChildProcess {\n if (options.shell) throw new TypeError(\"spawnCommand does not accept shell mode\");\n const cwd = typeof options.cwd === \"object\" ? fileURLToPath(options.cwd) : options.cwd;\n const launch = prepareCommandLaunch(\n command,\n args,\n options.env ?? process.env,\n process.platform,\n cwd,\n );\n return spawn(launch.command, launch.args, {\n ...options,\n env: launch.env,\n ...(process.platform === \"win32\" ? { windowsHide: true } : {}),\n ...(launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),\n });\n}\n","import { accessSync, constants, statSync } from \"node:fs\";\nimport { posix, win32 } from \"node:path\";\n\nexport interface ExecutableLookupOptions {\n platform?: NodeJS.Platform;\n cwd?: string;\n isExecutableFile?: (path: string) => boolean;\n}\n\n/** Matches Node's case-insensitive Windows environment lookup without duplicate PATH keys. */\nexport function environmentValue(\n env: NodeJS.ProcessEnv,\n name: string,\n platform: NodeJS.Platform = process.platform,\n): string | undefined {\n if (platform !== \"win32\") return env[name];\n const key = Object.keys(env)\n .sort()\n .find((key) => key.toLowerCase() === name.toLowerCase());\n return key === undefined ? undefined : env[key];\n}\n\nexport function normalizeProcessEnvironment(\n env: NodeJS.ProcessEnv,\n platform: NodeJS.Platform = process.platform,\n): NodeJS.ProcessEnv {\n if (platform !== \"win32\") return env;\n const normalized: NodeJS.ProcessEnv = {};\n const seen = new Set<string>();\n for (const key of Object.keys(env).sort()) {\n const lower = key.toLowerCase();\n if (seen.has(lower)) continue;\n seen.add(lower);\n if (env[key] !== undefined) normalized[key] = env[key];\n }\n return normalized;\n}\n\nexport function isExecutableFile(\n path: string,\n platform: NodeJS.Platform = process.platform,\n): boolean {\n try {\n if (!statSync(path).isFile()) return false;\n accessSync(path, platform === \"win32\" ? constants.F_OK : constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function findExecutableCandidates(\n name: string,\n env: NodeJS.ProcessEnv,\n options: ExecutableLookupOptions = {},\n): string[] {\n const platform = options.platform ?? process.platform;\n const windows = platform === \"win32\";\n const path = windows ? win32 : posix;\n const probe = options.isExecutableFile ?? ((file) => isExecutableFile(file, platform));\n const hasPath = windows ? /[\\\\/:]/.test(name) : name.includes(\"/\");\n const extensions =\n windows && !win32.extname(name)\n ? (environmentValue(env, \"PATHEXT\", platform) || \".COM;.EXE;.BAT;.CMD\")\n .split(\";\")\n .map((ext) => ext.trim())\n .filter((ext) => /^\\.[a-z0-9]+$/i.test(ext))\n : [\"\"];\n const directories = hasPath\n ? [\"\"]\n : (environmentValue(env, \"PATH\", platform) ?? \"\")\n .split(windows ? \";\" : \":\")\n .map((entry) => (windows ? entry.replace(/^\"(.*)\"$/, \"$1\") : entry))\n .filter(Boolean);\n const seen = new Set<string>();\n const candidates: string[] = [];\n for (const directory of directories) {\n const base = directory ? path.join(directory, name) : name;\n for (const extension of extensions) {\n const file = path.resolve(options.cwd ?? process.cwd(), `${base}${extension}`);\n const key = windows ? file.toLowerCase() : file;\n if (seen.has(key)) continue;\n seen.add(key);\n if (probe(file)) candidates.push(file);\n }\n }\n return candidates;\n}\n\nexport function defaultShell(\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n): string {\n if (platform !== \"win32\") return env.SHELL || \"/bin/sh\";\n return (\n environmentValue(env, \"ComSpec\", platform) ||\n win32.join(\n environmentValue(env, \"SystemRoot\", platform) || \"C:\\\\Windows\",\n \"System32\",\n \"cmd.exe\",\n )\n );\n}\n"],"mappings":";;;AAAA,SAAS,aAAmD;AAC5D,SAAS,SAAAA,cAAa;AACtB,SAAS,qBAAqB;AAC9B,OAAO,YAAY;;;ACHnB,SAAS,YAAY,WAAW,gBAAgB;AAChD,SAAS,OAAO,aAAa;AAStB,SAAS,iBACd,KACA,MACA,WAA4B,QAAQ,UAChB;AACpB,MAAI,aAAa,QAAS,QAAO,IAAI,IAAI;AACzC,QAAM,MAAM,OAAO,KAAK,GAAG,EACxB,KAAK,EACL,KAAK,CAACC,SAAQA,KAAI,YAAY,MAAM,KAAK,YAAY,CAAC;AACzD,SAAO,QAAQ,SAAY,SAAY,IAAI,GAAG;AAChD;AAEO,SAAS,4BACd,KACA,WAA4B,QAAQ,UACjB;AACnB,MAAI,aAAa,QAAS,QAAO;AACjC,QAAM,aAAgC,CAAC;AACvC,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,OAAO,OAAO,KAAK,GAAG,EAAE,KAAK,GAAG;AACzC,UAAM,QAAQ,IAAI,YAAY;AAC9B,QAAI,KAAK,IAAI,KAAK,EAAG;AACrB,SAAK,IAAI,KAAK;AACd,QAAI,IAAI,GAAG,MAAM,OAAW,YAAW,GAAG,IAAI,IAAI,GAAG;AAAA,EACvD;AACA,SAAO;AACT;AAEO,SAAS,iBACd,MACA,WAA4B,QAAQ,UAC3B;AACT,MAAI;AACF,QAAI,CAAC,SAAS,IAAI,EAAE,OAAO,EAAG,QAAO;AACrC,eAAW,MAAM,aAAa,UAAU,UAAU,OAAO,UAAU,IAAI;AACvE,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,yBACd,MACA,KACA,UAAmC,CAAC,GAC1B;AACV,QAAM,WAAW,QAAQ,YAAY,QAAQ;AAC7C,QAAM,UAAU,aAAa;AAC7B,QAAM,OAAO,UA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AAK,QAAQ;AAC9E,QAAM,OAAO;AAAA,IACX,OAAO,QAAQA,OAAM,UAAU,QAAQ,CAAC;AAAA,IACxC,GAAG,KAAK,IAAI,CAAC,QAAQ,OAAO,SAAS,KAAK,YAAY,CAAC;AAAA,EACzD,EAAE,KAAK,GAAG;AACV,QAAM,YAAY,CAAC,MAAM,MAAM,UAAU,MAAM,IAAI,IAAI,GAAG;AAC1D,SAAO;AAAA,IACL,SAAS,aAAa,aAAa,QAAQ;AAAA,IAC3C,MAAM;AAAA,IACN,KAAK;AAAA,IACL,0BAA0B;AAAA,IAC1B,SAAS,UAAU,KAAK,GAAG;AAAA,EAC7B;AACF;AAEO,SAAS,aACd,SACA,MACA,UAAwB,CAAC,GACX;AACd,MAAI,QAAQ,MAAO,OAAM,IAAI,UAAU,yCAAyC;AAChF,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,cAAc,QAAQ,GAAG,IAAI,QAAQ;AACnF,QAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,IACA,QAAQ,OAAO,QAAQ;AAAA,IACvB,QAAQ;AAAA,IACR;AAAA,EACF;AACA,SAAO,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,IACxC,GAAG;AAAA,IACH,KAAK,OAAO;AAAA,IACZ,GAAI,QAAQ,aAAa,UAAU,EAAE,aAAa,KAAK,IAAI,CAAC;AAAA,IAC5D,GAAI,OAAO,2BAA2B,EAAE,0BAA0B,KAAK,IAAI,CAAC;AAAA,EAC9E,CAAC;AACH;","names":["win32","key","win32"]}
@@ -7,13 +7,13 @@ import {
7
7
  TERMINAL_ADMISSION_VERSION,
8
8
  parseTerminalAdmissionResponse,
9
9
  serializeTerminalAdmissionMessage
10
- } from "./chunk-GFDOVLGL.js";
10
+ } from "./chunk-WLXTXXNY.js";
11
11
  import {
12
12
  tryConnectSocket
13
13
  } from "./chunk-DAFUSBKJ.js";
14
14
  import {
15
15
  createIpcReader
16
- } from "./chunk-V4HDLUAQ.js";
16
+ } from "./chunk-GIFG7KAJ.js";
17
17
  import {
18
18
  SOCK_PATH
19
19
  } from "./chunk-YK2XKOP4.js";
@@ -282,4 +282,4 @@ export {
282
282
  requestTerminalAdmission,
283
283
  swapServeSocket
284
284
  };
285
- //# sourceMappingURL=chunk-74HWO753.js.map
285
+ //# sourceMappingURL=chunk-EIXVJR3C.js.map