iobroker.javascript 9.2.3 → 9.2.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 (32) hide show
  1. package/README.md +6 -14
  2. package/admin/assets/{AiChatPanel-C4zUsNmN.js → AiChatPanel-B4vPXgLz.js} +1 -1
  3. package/admin/assets/{ScriptEditor-C6W68ya0.js → ScriptEditor-CmEeMfC2.js} +1 -1
  4. package/admin/assets/{ScriptEditorVanillaMonaco-DYTcDqp_.js → ScriptEditorVanillaMonaco-C22Gpet7.js} +2 -2
  5. package/admin/assets/{index-crBQrXKG.js → index-7mrTpzQy.js} +1 -1
  6. package/admin/assets/{index-CUau9-il.js → index-BTQOdA7v.js} +28 -28
  7. package/admin/assets/{index-BXfqctma.js → index-Dggem6AX.js} +1 -1
  8. package/admin/assets/{stateHoverProvider-BYBqzJuX.js → stateHoverProvider-DxTNxyYN.js} +1 -1
  9. package/admin/custom/assets/{Components-jfkoGyES.js → Components-CGiJE5Zh.js} +1 -1
  10. package/admin/custom/assets/{index-CS_GBN2m.js → index-B6NrrORQ.js} +1 -1
  11. package/admin/custom/assets/index-CT5PwRfY.js +964 -0
  12. package/admin/custom/assets/{index-ChQotUCl.js → index-DTbSiEk2.js} +1 -1
  13. package/admin/custom/assets/{localSharedImportMap-BeObsVNc.js → localSharedImportMap-ChjFDKsq.js} +1 -1
  14. package/admin/custom/assets/{virtualExposes-wYe_Np-4.js → virtualExposes-D402kVGY.js} +1 -1
  15. package/admin/custom/assets/{virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-BcRVut8U.js → virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-ClQrb2n1.js} +2 -2
  16. package/admin/custom/customComponents.js +1 -1
  17. package/admin/i18n/es.json +77 -77
  18. package/admin/tab.html +1 -1
  19. package/build/lib/debugger.js +1 -1
  20. package/build/lib/debugger.js.map +1 -1
  21. package/build/lib/eventObj.js +10 -2
  22. package/build/lib/eventObj.js.map +1 -1
  23. package/build/lib/inspect.js +3 -3
  24. package/build/lib/inspect.js.map +1 -1
  25. package/build/lib/sandbox.js +169 -62
  26. package/build/lib/sandbox.js.map +1 -1
  27. package/build/main.js +63 -19
  28. package/build/main.js.map +1 -1
  29. package/build/types.d.ts +4 -0
  30. package/io-package.json +14 -14
  31. package/package.json +11 -11
  32. package/admin/custom/assets/index-qs6J40Tp.js +0 -964
@@ -1 +1 @@
1
- {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/lib/inspect.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2DAAgF;AAChF,6CAA2C;AAC3C,uCAAmC;AACnC,yCAA2F;AAC3F,yCAA4C;AAC5C,qCAAqC;AAGrC,sCAAsC;AACtC,8FAAqE;AAGrE,0DAAoC;AAgBpC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAE7D,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,CAAC;AACzC,IAAI,SAAwB,CAAC;AAC7B,IAAI,aAAa,GAAG,EAAE,CAAC,CAAC,eAAe;AACvC,IAAI,eAAe,GAAG,EAAE,CAAC,CAAC,YAAY;AACtC,IAAI,wBAAwB,GAAG,KAAK,CAAC;AAErC,MAAM,YAAa,SAAQ,KAAK;IAC5B,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC/B,CAAC;CACJ;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY,EAAE,UAAkB,IAAI;IAClE,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACb,4BAA4B;QAC5B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,UAAU,GAAG,GAAG,CAAC;IACvB,IAAI,UAAU,GAAG,K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,IAAI,CAAC,CAAC,WAAsD,EAAE,EAAE,CAC7D,UAAU,CAAC,EAAE,GAAG,EAAE,wBAAwB,EAAE,WAAW,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CACpF;aACA,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAClB,UAAU,CAAC;YACP,GAAG,EAAE,wBAAwB;YAC7B,YAAY,EAAE,kCAAkC,CAAU,EAAE;YAC5D,YAAY,EAAE,CAAU;SAC3B,CAAC,CACL,CAAC;IACV,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,IAAmB;IACnC,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;AACL,CAAC","sourcesContent":["/*\n * Copyright Node.js contributors. All rights reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';\nimport { EventEmitter } from 'node:events';\nimport { connect } from 'node:net';\nimport { debuglog as utilDebugLog, inspect, type InspectOptionsStylized } from 'node:util';\nimport { normalize, join } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport type { WriteStream, ReadStream } from 'node:tty';\n\n// @ts-expect-error no types available\nimport InspectClient from 'node-inspect/lib/internal/inspect_client';\nimport type { Debugger, Runtime } from 'node:inspector';\nimport type { REPLServer } from 'node:repl';\nimport createRepl from './debugger';\n// const runAsStandalone = typeof __dirname !== 'undefined';\n\ninterface DebugValue {\n type: 'function' | 'string' | 'boolean' | 'number' | 'object' | 'undefined' | 'null' | 'bigint' | 'symbol';\n description: string;\n value: any;\n}\ninterface DebugVariable {\n name: string;\n value: DebugValue;\n configurable?: boolean;\n enumerable?: boolean;\n isOwn?: boolean;\n writable?: boolean;\n}\nconst breakOnStart = process.argv.includes('--breakOnStart');\n\nconst debuglog = utilDebugLog('inspect');\nlet inspector: NodeInspector;\nlet scriptToDebug = ''; // script.js.yy\nlet instanceToDebug = ''; // adapter.X\nlet alreadyPausedOnFirstLine = false;\n\nclass StartupError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'StartupError';\n }\n}\n\nfunction portIsFree(host: string, port: number, timeout: number = 9999): Promise<void> {\n if (port === 0) {\n // Binding to a random port.\n return Promise.resolve();\n }\n\n const retryDelay = 150;\n let didTimeOut = false;\n\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n didTimeOut = true;\n reject(new StartupError(`Timeout (${timeout}) waiting for ${host}:${port} to be free`));\n }, timeout);\n\n function pingPort(): void {\n if (didTimeOut) {\n return;\n }\n\n const socket = connect(port, host);\n let didRetry = false;\n function retry(): void {\n if (!didRetry && !didTimeOut) {\n didRetry = true;\n setTimeout(pingPort, retryDelay);\n }\n }\n\n socket.on('error', (error: Error) => {\n if ((error as any).code === 'ECONNREFUSED') {\n resolve();\n } else {\n retry();\n }\n });\n socket.on('connect', () => {\n socket.destroy();\n retry();\n });\n }\n pingPort();\n });\n}\n\nfunction runScript(\n script: string,\n scriptArgs: string[] | undefined,\n inspectHost: string,\n inspectPort: number,\n childPrint: (text: string, isError?: boolean) => void,\n): Promise<[ChildProcessWithoutNullStreams, number, string]> {\n script = normalize(script);\n return portIsFree(inspectHost, inspectPort).then(() => {\n return new Promise(resolve => {\n const args = [breakOnStart ? `--inspect-brk=${inspectPort}` : `--inspect=${inspectPort}`].concat(\n [script],\n scriptArgs || [],\n );\n const child = spawn(process.execPath, args);\n child.stdout.setEncoding('utf8');\n child.stderr.setEncoding('utf8');\n child.stdout.on('data', childPrint);\n child.stderr.on('data', text => childPrint(text, true));\n\n let output = '';\n function waitForListenHint(text: string): void {\n output += text;\n const res = /Debugger listening on ws:\\/\\/\\[?(.+?)]?:(\\d+)\\//.exec(output);\n if (res) {\n const host = res[1];\n const port = Number.parseInt(res[2]);\n child.stderr.removeListener('data', waitForListenHint);\n resolve([child, port, host]);\n }\n }\n\n child.stderr.on('data', waitForListenHint);\n });\n });\n}\n\nfunction createAgentProxy(domain: string, client: InspectClient): ProxyConstructor {\n const agent: any = new EventEmitter();\n\n agent.then = (...args: any[]) => {\n // TODO: potentially fetch the protocol and pretty-print it here.\n const descriptor = {\n [inspect.custom](_depth: number, { stylize }: InspectOptionsStylized): string {\n return stylize(`[Agent ${domain}]`, 'special');\n },\n };\n return Promise.resolve(descriptor).then(...args);\n };\n\n return new Proxy(agent, {\n get(target, name: string) {\n if (name in target) {\n return target[name];\n }\n return function callVirtualMethod(params: any) {\n return client.callMethod(`${domain}.${name}`, params);\n };\n },\n });\n}\n\ntype CommandToHostType =\n | 'log'\n | 'paused'\n | 'resumed'\n | 'setValue'\n | 'scope'\n | 'cb'\n | 'sb'\n | 'script'\n | 'ready'\n | 'readyToDebug'\n | 'error'\n | 'finished'\n | 'expressions'\n | 'stopOnException'\n | 'getPossibleBreakpoints';\n\ntype DebuggerContext = {\n url: string;\n scriptId: Runtime.ScriptId;\n reason: string;\n executionContextId: number;\n type: string;\n id: number;\n args: { value: any }[];\n};\n\ntype CommandToHost = {\n cmd: CommandToHostType;\n text?: string;\n expr?: { name: string };\n bp?: Debugger.Location;\n context?: DebuggerContext | null | string;\n error?: Error | string;\n errorContext?: Error;\n id?: Debugger.BreakpointId; // breakpoint ID\n breakpoints?: Debugger.Location[];\n scriptId?: Runtime.ScriptId;\n scopes?: Debugger.Scope[];\n variableName?: string;\n scopeNumber?: number;\n newValue?: string;\n callFrameId?: string;\n expressions?: { name: string; result: any }[];\n script?: string;\n url?: string;\n severity?: 'warn' | 'error';\n ts?: number;\n};\n\ninterface NodeInspectorOptions {\n script?: string | null;\n scriptArgs?: string[];\n isRemote?: boolean;\n host: string;\n port: number;\n}\n\nexport class NodeInspector {\n options: NodeInspectorOptions;\n stdin: ReadStream;\n stdout: WriteStream;\n scripts: Record<string, Promise<{ script: string; scriptId: Runtime.ScriptId }> | null>;\n delayedContext: DebuggerContext | null;\n paused: boolean;\n child: ChildProcessWithoutNullStreams | null;\n _runScript: () => Promise<[ChildProcessWithoutNullStreams | null, number, string]>;\n\n client: InspectClient;\n\n Debugger: InspectClient;\n HeapProfiler: InspectClient;\n Profiler: InspectClient;\n Runtime: InspectClient;\n\n handleDebugEvent: (fullName: string, params: DebuggerContext) => void;\n mainScriptId: Runtime.ScriptId | undefined;\n mainFile: string | undefined;\n repl: REPLServer | undefined;\n\n constructor(options: NodeInspectorOptions, stdin: ReadStream, stdout: WriteStream) {\n this.options = options;\n this.stdin = stdin;\n this.stdout = stdout;\n this.scripts = {};\n this.delayedContext = null;\n\n this.paused = true;\n this.child = null;\n\n if (options.script) {\n this._runScript = runScript.bind(\n null,\n options.script,\n options.scriptArgs,\n options.host,\n options.port,\n this.childPrint.bind(this),\n );\n } else {\n this._runScript = () => Promise.resolve([null, options.port, options.host]);\n }\n\n this.client = new InspectClient();\n\n this.Debugger = createAgentProxy('Debugger', this.client);\n this.HeapProfiler = createAgentProxy('HeapProfiler', this.client);\n this.Profiler = createAgentProxy('Profiler', this.client);\n this.Runtime = createAgentProxy('Runtime', this.client);\n\n this.handleDebugEvent = (\n fullName: string,\n params: {\n url: string;\n scriptId: Runtime.ScriptId;\n reason: string;\n executionContextId: number;\n type: string;\n id: number;\n args: { value: any }[];\n },\n ): void => {\n const [domain, name] = fullName.split('.');\n\n if (domain === 'Debugger' && name === 'scriptParsed') {\n // console.log(`Parsed: ${params.url}`);\n if (\n (scriptToDebug && params.url.includes(scriptToDebug)) ||\n (instanceToDebug && params.url.includes(instanceToDebug))\n ) {\n console.log(`My scriptID: ${params.scriptId}`);\n this.mainScriptId = params.scriptId;\n this.mainFile = params.url.replace('file:///', '');\n // load text of a script\n this.scripts[this.mainScriptId] = this.Debugger.getScriptSource({\n scriptId: this.mainScriptId,\n } as Debugger.GetScriptSourceParameterType).then((script: Debugger.GetScriptSourceReturnType) => ({\n script: script.scriptSource,\n scriptId: this.mainScriptId,\n }));\n\n // sometimes the pause event comes before scriptParsed\n if (this.delayedContext) {\n console.log('Send to debugger: readyToDebug');\n void this.scripts[this.mainScriptId]?.then(data => {\n // console.log('Send to debugger: readyToDebug ' + JSON.stringify(data));\n sendToHost({\n cmd: 'readyToDebug',\n scriptId: this.mainScriptId,\n script: data.script,\n context: this.delayedContext,\n url: this.mainFile,\n });\n this.delayedContext = null;\n });\n }\n }\n return;\n } else if (domain === 'Debugger' && name === 'resumed') {\n this.Debugger.emit(name, params);\n sendToHost({ cmd: 'resumed', context: params });\n return;\n } else if (domain === 'Debugger' && name === 'paused') {\n console.log(`PAUSED!! ${alreadyPausedOnFirstLine}`);\n if (!alreadyPausedOnFirstLine && params.reason === 'exception') {\n // ignore all exceptions by start\n this.Debugger.resume();\n return;\n }\n //console.warn(fullName + ': => \\n' + JSON.stringify(params, null, 2));\n this.Debugger.emit(name, params);\n\n if (!alreadyPausedOnFirstLine) {\n alreadyPausedOnFirstLine = true;\n // sometimes the pause event comes before scriptParsed\n if (this.mainScriptId && this.scripts[this.mainScriptId]) {\n void this.scripts[this.mainScriptId]?.then(data =>\n sendToHost({\n cmd: 'readyToDebug',\n scriptId: data.scriptId,\n script: data.script,\n context: params,\n url: this.mainFile,\n }),\n );\n } else {\n // store context to send it later when script ID will be known\n this.delayedContext = params;\n console.log('PAUSED, but no scriptId');\n }\n } else {\n // this.scripts[params.loca]\n // .then(data =>\n sendToHost({ cmd: 'paused', context: params });\n }\n return;\n }\n\n if (domain === 'Runtime') {\n //console.warn(fullName + ': => \\n' + JSON.stringify(params, null, 2));\n }\n if (domain === 'Runtime' && name === 'consoleAPICalled') {\n const text = params.args[0].value;\n if (instanceToDebug) {\n sendToHost({\n cmd: 'log',\n severity: params.type === 'warning' ? 'warn' : 'error',\n text,\n ts: Date.now(),\n });\n } else if (text.includes(`$$${scriptToDebug}$$`)) {\n console.log(`${fullName} [${params.executionContextId}]: => ${text}`);\n const [severity, _text] = text.split(`$$${scriptToDebug}$$`);\n sendToHost({\n cmd: 'log',\n severity: severity as 'warn' | 'error',\n text: _text,\n ts: params.args[1] && params.args[1].value ? (params.args[1].value as number) : Date.now(),\n });\n } else if (params.type === 'warning' || params.type === 'error') {\n sendToHost({\n cmd: 'log',\n severity: params.type === 'warning' ? 'warn' : 'error',\n text,\n ts: Date.now(),\n });\n }\n return;\n } else if (domain === 'Runtime' && (params.id === 2 || params.executionContextId === 2)) {\n if (name === 'executionContextCreated') {\n console.warn(`${fullName}: =>\\n${JSON.stringify(params, null, 2)}`);\n } else if (name === 'executionContextDestroyed') {\n console.warn(`${fullName}: =>\\n${JSON.stringify(params, null, 2)}`);\n sendToHost({ cmd: 'finished', context: params });\n }\n return;\n } else if (\n domain === 'Runtime' &&\n name === 'executionContextDestroyed' &&\n params.executionContextId === 1\n ) {\n sendToHost({ cmd: 'finished', context: params });\n console.log('Exited!');\n setTimeout(() => process.exit(125), 200);\n } else if (domain === 'Debugger' && name === 'scriptFailedToParse') {\n // ignore\n return;\n }\n\n console.warn(`${fullName}: =>\\n${JSON.stringify(params, null, 2)}`);\n\n /*if (domain in this) {\n this[domain].emit(name, params);\n }*/\n };\n this.client.on('debugEvent', this.handleDebugEvent);\n const startRepl: () => REPLServer = createRepl(this);\n\n // Handle all possible exits\n process.on('exit', () => this.killChild());\n process.once('SIGTERM', process.exit.bind(process, 0));\n process.once('SIGHUP', process.exit.bind(process, 0));\n\n this.run()\n .then(() => startRepl())\n .then(repl => {\n this.repl = repl;\n this.repl.on('exit', () => process.exit(0));\n this.paused = false;\n })\n .then(null, error =>\n process.nextTick(() => {\n throw error;\n }),\n );\n }\n\n suspendReplWhile(fn: () => any): Promise<void> {\n if (this.repl) {\n this.repl.pause();\n }\n this.stdin.pause();\n this.paused = true;\n\n return new Promise(resolve => resolve(fn()))\n .then(() => {\n this.paused = false;\n if (this.repl) {\n this.repl.resume();\n this.repl.displayPrompt();\n }\n this.stdin.resume();\n })\n .then(null, error =>\n process.nextTick(() => {\n throw error;\n }),\n );\n }\n\n killChild(): void {\n this.client.reset();\n if (this.child) {\n this.child.kill();\n this.child = null;\n }\n }\n\n run(): Promise<void> {\n this.killChild();\n\n return this._runScript().then(([child, port, host]) => {\n this.child = child;\n\n let connectionAttempts = 0;\n const attemptConnect = (): void => {\n ++connectionAttempts;\n debuglog('connection attempt #%d', connectionAttempts);\n this.stdout.write('.');\n return this.client.connect(port, host).then(\n () => {\n debuglog('connection established');\n this.stdout.write(' ok');\n },\n (error: unknown): Promise<void> => {\n debuglog('connect failed', error);\n // If it's failed to connect 10 times, then print a failed message\n if (connectionAttempts >= 10) {\n this.stdout.write(' failed to connect, please retry\\n');\n process.exit(1);\n }\n\n return new Promise(resolve => setTimeout(resolve, 500)).then(attemptConnect);\n },\n );\n };\n\n this.print(`connecting to ${host}:${port} ..`, true);\n return attemptConnect();\n });\n }\n\n clearLine(): void {\n if (this.stdout.isTTY) {\n this.stdout.cursorTo(0);\n this.stdout.clearLine(1);\n } else {\n this.stdout.write('\\b');\n }\n }\n\n print(text: string, oneLine: boolean = false): void {\n this.clearLine();\n this.stdout.write(oneLine ? text : `${text}\\n`);\n }\n\n childPrint(text: string, isError?: boolean): void {\n isError &&\n this.print(\n text\n .toString()\n .split(/\\r\\n|\\r|\\n/g)\n .filter((chunk: string) => !!chunk)\n .map((chunk: string) => `< ${chunk}`)\n .join('\\n'),\n );\n if (!this.paused) {\n this.repl?.displayPrompt(true);\n }\n if (/Waiting for the debugger to disconnect\\.\\.\\.\\n$/.test(text)) {\n this.killChild();\n sendToHost({ cmd: 'finished', text });\n }\n }\n}\n\nfunction parseArgv([target, ...args]: string[]): NodeInspectorOptions {\n let host = '127.0.0.1';\n let port = 9229;\n let isRemote = false;\n let script: string | null = target;\n let scriptArgs = args;\n\n const hostMatch = target.match(/^([^:]+):(\\d+)$/);\n const portMatch = target.match(/^--port=(\\d+)$/);\n\n if (hostMatch) {\n // Connecting to remote debugger\n // `node-inspect localhost:9229`\n host = hostMatch[1];\n port = parseInt(hostMatch[2], 10);\n isRemote = true;\n script = null;\n } else if (portMatch) {\n // start debugee on custom port\n // `node inspect --port=9230 script.js`\n port = parseInt(portMatch[1], 10);\n script = args[0];\n scriptArgs = args.slice(1);\n } else if (args.length === 1 && /^\\d+$/.test(args[0]) && target === '-p') {\n // Start debugger against a given pid\n const pid = parseInt(args[0], 10);\n try {\n // Windows does not support UNIX signals. To enable debugging, you can use an undocumented API function\n // https://github.com/node-inspector/node-inspector?tab=readme-ov-file#windows\n // @ts-expect-error undocumented function\n process._debugProcess(pid);\n } catch (e: unknown) {\n if (e && (e as any).code === 'ESRCH') {\n console.error(`Target process: ${pid} doesn't exist.`);\n process.exit(1);\n }\n throw e;\n }\n script = null;\n isRemote = true;\n }\n\n return {\n host,\n port,\n isRemote,\n script,\n scriptArgs,\n };\n}\n\nfunction startInspect(\n argv: string[] = process.argv.slice(2),\n stdin: ReadStream = process.stdin,\n stdout: WriteStream = process.stdout,\n): void {\n /*\n if (argv.length < 1) {\n const invokedAs = runAsStandalone ? 'node-inspect' : `${process.argv0} ${process.argv[1]}`;\n\n console.error(`Usage: ${invokedAs} script.js`);\n console.error(` ${invokedAs} <host>:<port>`);\n console.error(` ${invokedAs} -p <pid>`);\n process.exit(1);\n }\n */\n\n const options = parseArgv(argv);\n inspector = new NodeInspector(options, stdin, stdout);\n\n stdin.resume();\n\n function handleUnexpectedError(e: Error): void {\n if (!(e instanceof StartupError)) {\n console.error('There was an internal error in node-inspect. Please report this bug.');\n console.error(e.message);\n console.error(e.stack);\n } else {\n console.error(e.message);\n }\n inspector.child?.kill();\n process.exit(1);\n }\n\n process.on('uncaughtException', handleUnexpectedError);\n}\n\nfunction extractErrorMessage(stack: string | undefined): string {\n if (!stack) {\n return '<unknown>';\n }\n const m = stack.match(/^\\w+: ([^\\n]+)/);\n return m ? m[1] : stack;\n}\n\nfunction convertResultToError(result: Runtime.RemoteObject): Error {\n const { className, description } = result;\n const err = new Error(extractErrorMessage(description));\n err.stack = description;\n Object.defineProperty(err, 'name', { value: className });\n return err;\n}\n\nprocess.on('message', (message: DebugCommand | string): void => {\n if (typeof message === 'string') {\n try {\n message = JSON.parse(message) as DebugCommand;\n } catch {\n return console.error(`Cannot parse: ${JSON.stringify(message)}`);\n }\n }\n processCommand(message);\n});\n\nsendToHost({ cmd: 'ready' });\n\n// possible commands\n// start - {cmd: 'start', scriptName: 'script.js.myName'} - start the debugging\n// end - {cmd: 'end'} - end the debugging and stop process\n// source - {cmd: 'source', scriptId} - read text of script by id\n// watch - {cmd: 'watch', expressions: ['i']} - add to watch the variable\n// unwatch - {cmd: 'unwatch', expressions: ['i']} - add to watch the variable\n\n// sb - {cmd: 'sb', breakpoints: [{scriptId: 50, lineNumber: 4, columnNumber: 0}]} - set breakpoint\n// cb - {cmd: 'cb', breakpoints: [{scriptId: 50, lineNumber: 4, columnNumber: 0}]} - clear breakpoint\n\n// pause - {cmd: 'pause'} - pause execution\n// cont - {cmd: 'cont'} - resume execution\n// next - {cmd: 'next'} - Continue to next line in current file\n// step - {cmd: 'step'} - Step into, potentially entering a function\n// out - {cmd: 'step'} - Step out, leaving the current function\n\ntype DebugCommandType =\n | 'start'\n | 'end'\n | 'source'\n | 'watch'\n | 'unwatch'\n | 'sb'\n | 'cb'\n | 'pause'\n | 'cont'\n | 'next'\n | 'step'\n | 'out'\n | 'scope'\n | 'setValue'\n | 'expressions'\n | 'stopOnException'\n | 'getPossibleBreakpoints'\n | 'error';\n\ntype DebugCommand = {\n cmd: DebugCommandType;\n scriptName?: string;\n scriptId?: Runtime.ScriptId;\n instance?: number;\n adapterInstance?: string;\n breakpoints?: Debugger.Location[] | Debugger.BreakpointId[];\n expressions?: { name: string }[];\n scopes?: Debugger.Scope[];\n\n variableName?: string;\n scopeNumber?: number;\n newValue?: string;\n callFrameId?: string;\n state?: boolean;\n\n start?: number;\n end?: number;\n};\n\nfunction processCommand(data: DebugCommand): void {\n console.log(`[DEBUGGER]: processCommand: ${JSON.stringify(data)}`);\n\n if (data.cmd === 'start') {\n scriptToDebug = data.scriptName as string;\n // we can request the script by name or iobroker instance to debug\n if (scriptToDebug) {\n startInspect([\n `${__dirname}/../main.js`,\n (data.instance || 0).toString(),\n '--debug',\n '--debugScript',\n scriptToDebug,\n ]);\n } else {\n instanceToDebug = data.adapterInstance as string;\n const [adapter, instance] = instanceToDebug.split('.');\n let file: string | undefined;\n try {\n file = require.resolve(`iobroker.${adapter}`);\n } catch (e: unknown) {\n // try to locate in the same dir\n const dir = normalize(join(__dirname, '..', `iobroker.${adapter}`));\n if (existsSync(dir)) {\n const pack = require(join(dir, 'package.json'));\n if (existsSync(join(dir, pack.main || `${adapter}.js`))) {\n file = join(dir, pack.main || `${adapter}.js`);\n }\n }\n\n if (!file) {\n sendToHost({ cmd: 'error', error: `Cannot locate iobroker.${adapter}`, errorContext: e as Error });\n setTimeout(() => {\n sendToHost({ cmd: 'finished', context: `Cannot locate iobroker.${adapter}` });\n setTimeout(() => process.exit(124), 500);\n }, 200);\n return;\n }\n }\n file = file.replace(/\\\\/g, '/');\n instanceToDebug = file;\n console.log(`Start ${file} ${instance} --debug`);\n startInspect([file, instance, '--debug']);\n }\n } else if (data.cmd === 'end') {\n process.exit();\n } else if (data.cmd === 'source') {\n inspector.Debugger.getScriptSource({ scriptId: data.scriptId } as Debugger.GetScriptSourceParameterType).then(\n (script: Debugger.GetScriptSourceReturnType) =>\n sendToHost({ cmd: 'script', scriptId: data.scriptId, text: script.scriptSource }),\n );\n } else if (data.cmd === 'cont') {\n inspector.Debugger.resume().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'next') {\n inspector.Debugger.stepOver().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'pause') {\n inspector.Debugger.pause().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'step') {\n inspector.Debugger.stepInto().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'out') {\n inspector.Debugger.stepOut().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'sb') {\n console.log(JSON.stringify(data));\n\n void Promise.all(\n (data.breakpoints as Debugger.Location[])?.map((bp: Debugger.Location) =>\n inspector.Debugger.setBreakpoint({\n location: {\n scriptId: bp.scriptId,\n lineNumber: bp.lineNumber,\n columnNumber: bp.columnNumber,\n },\n } as Debugger.SetBreakpointParameterType)\n .then((result: Debugger.SetBreakpointReturnType) => ({\n id: result.breakpointId,\n location: result.actualLocation,\n }))\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot set breakpoint: ${e as Error}`,\n errorContext: e as Error,\n bp,\n }),\n ),\n ) || [],\n ).then(breakpoints => sendToHost({ cmd: 'sb', breakpoints }));\n } else if (data.cmd === 'cb') {\n void Promise.all(\n (data.breakpoints as Debugger.BreakpointId[])?.map(breakpointId =>\n inspector.Debugger.removeBreakpoint({ breakpointId } as Debugger.RemoveBreakpointParameterType)\n .then(() => breakpointId)\n .catch((e: unknown) => {\n console.error(`[DEBUGGER]: Cannot clear breakpoint: ${e as Error}`);\n sendToHost({\n cmd: 'error',\n error: `Cannot clear breakpoint: ${e as Error}`,\n errorContext: e as Error,\n id: breakpointId,\n });\n }),\n ) || [],\n ).then(breakpoints => {\n console.error(`[DEBUGGER]: sent breakpoints ${JSON.stringify(breakpoints)}`);\n sendToHost({ cmd: 'cb', breakpoints });\n });\n } else if (data.cmd === 'watch') {\n void Promise.all(\n data.expressions?.map(expr =>\n inspector.Debugger.watch(expr).catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot watch expr: ${e as Error}`,\n errorContext: e as Error,\n expr,\n }),\n ),\n ) || [],\n ).then(() => console.log('Watch done'));\n } else if (data.cmd === 'unwatch') {\n void Promise.all(\n data.expressions?.map(expr =>\n inspector.Debugger.unwatch(expr).catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot unwatch expr: ${e as Error}`,\n errorContext: e as Error,\n expr,\n }),\n ),\n ) || [],\n ).then(() => console.log('Watch done'));\n } else if (data.cmd === 'scope') {\n void Promise.all(\n data.scopes\n ?.filter(scope => scope?.object?.objectId)\n .map(scope =>\n inspector.Runtime.getProperties({\n objectId: scope.object.objectId,\n generatePreview: true,\n } as Runtime.GetPropertiesParameterType)\n .then((result: { result: DebugVariable[] }) => {\n return { type: scope.type, properties: result };\n })\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot get scopes expr: ${e as Error}`,\n errorContext: e as Error,\n }),\n ),\n ) || [],\n ).then(scopes => sendToHost({ cmd: 'scope', scopes }));\n } else if (data.cmd === 'setValue') {\n inspector.Debugger.setVariableValue({\n variableName: data.variableName,\n scopeNumber: data.scopeNumber,\n newValue: data.newValue,\n callFrameId: data.callFrameId,\n } as Debugger.SetVariableValueParameterType)\n .catch((e: unknown) => {\n console.error(`Cannot setValue \"${data.variableName}\": ${e as Error}`);\n sendToHost({\n cmd: 'setValue',\n variableName: `Cannot setValue: ${e as Error}`,\n errorContext: e as Error,\n });\n })\n .then(() => {\n console.log(`setValue \"${data.variableName}\" successful`);\n sendToHost({\n cmd: 'setValue',\n variableName: data.variableName,\n scopeNumber: data.scopeNumber,\n newValue: data.newValue,\n callFrameId: data.callFrameId,\n });\n });\n } else if (data.cmd === 'expressions') {\n void Promise.all(\n data.expressions?.map(item =>\n inspector.Debugger.evaluateOnCallFrame({\n callFrameId: data.callFrameId,\n expression: item.name,\n objectGroup: 'node-inspect',\n returnByValue: true,\n generatePreview: true,\n } as Debugger.EvaluateOnCallFrameParameterType)\n // @ts-expect-error fix later\n .then(({ result, wasThrown }: Debugger.EvaluateOnCallFrameReturnType) => {\n if (wasThrown) {\n return { name: item.name, result: convertResultToError(result) };\n }\n return { name: item.name, result };\n })\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'expressions',\n variableName: `Cannot setValue: ${e as Error}`,\n errorContext: e as Error,\n }),\n ),\n ) || [],\n ).then(expressions => {\n sendToHost({ cmd: 'expressions', expressions });\n });\n } else if (data.cmd === 'stopOnException') {\n inspector.Debugger.setPauseOnExceptions({\n state: data.state ? 'all' : 'none',\n } as Debugger.SetPauseOnExceptionsParameterType).catch((e: unknown) =>\n sendToHost({\n cmd: 'stopOnException',\n variableName: `Cannot stopOnException: ${e as Error}`,\n errorContext: e as Error,\n }),\n );\n } else if (data.cmd === 'getPossibleBreakpoints') {\n inspector.Debugger.getPossibleBreakpoints({ start: data.start, end: data.end })\n .then((breakpoints: Debugger.GetPossibleBreakpointsReturnType) =>\n sendToHost({ cmd: 'getPossibleBreakpoints', breakpoints: breakpoints.locations }),\n )\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'getPossibleBreakpoints',\n variableName: `Cannot getPossibleBreakpoints: ${e as Error}`,\n errorContext: e as Error,\n }),\n );\n } else {\n console.error(`Unknown command: ${JSON.stringify(data)}`);\n }\n}\n\nfunction sendToHost(data: CommandToHost): void {\n if (data.cmd === 'error') {\n console.error(data.text);\n if (data.expr) {\n console.error(`[EXPRESSION] ${JSON.stringify(data.expr)}`);\n }\n if (data.bp) {\n console.error(`[BP] ${JSON.stringify(data.bp)}`);\n }\n }\n\n if (process.send) {\n process.send(JSON.stringify(data));\n }\n}\n"]}
1
+ {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/lib/inspect.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2DAAgF;AAChF,6CAA2C;AAC3C,uCAAmC;AACnC,yCAA2F;AAC3F,yCAA4C;AAC5C,qCAAqC;AAGrC,sCAAsC;AACtC,8FAAqE;AAGrE,0DAAoC;AAgBpC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAE7D,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,CAAC;AACzC,IAAI,SAAwB,CAAC;AAC7B,IAAI,aAAa,GAAG,EAAE,CAAC,CAAC,eAAe;AACvC,IAAI,eAAe,GAAG,EAAE,CAAC,CAAC,YAAY;AACtC,IAAI,wBAAwB,GAAG,KAAK,CAAC;AAErC,MAAM,YAAa,SAAQ,KAAK;IAC5B,Y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CAAC;QACrD,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;AACL,CAAC","sourcesContent":["/*\n * Copyright Node.js contributors. All rights reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';\nimport { EventEmitter } from 'node:events';\nimport { connect } from 'node:net';\nimport { debuglog as utilDebugLog, inspect, type InspectOptionsStylized } from 'node:util';\nimport { normalize, join } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport type { WriteStream, ReadStream } from 'node:tty';\n\n// @ts-expect-error no types available\nimport InspectClient from 'node-inspect/lib/internal/inspect_client';\nimport type { Debugger, Runtime } from 'node:inspector';\nimport type { REPLServer } from 'node:repl';\nimport createRepl from './debugger';\n// const runAsStandalone = typeof __dirname !== 'undefined';\n\ninterface DebugValue {\n type: 'function' | 'string' | 'boolean' | 'number' | 'object' | 'undefined' | 'null' | 'bigint' | 'symbol';\n description: string;\n value: any;\n}\ninterface DebugVariable {\n name: string;\n value: DebugValue;\n configurable?: boolean;\n enumerable?: boolean;\n isOwn?: boolean;\n writable?: boolean;\n}\nconst breakOnStart = process.argv.includes('--breakOnStart');\n\nconst debuglog = utilDebugLog('inspect');\nlet inspector: NodeInspector;\nlet scriptToDebug = ''; // script.js.yy\nlet instanceToDebug = ''; // adapter.X\nlet alreadyPausedOnFirstLine = false;\n\nclass StartupError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'StartupError';\n }\n}\n\nfunction portIsFree(host: string, port: number, timeout: number = 9999): Promise<void> {\n if (port === 0) {\n // Binding to a random port.\n return Promise.resolve();\n }\n\n const retryDelay = 150;\n let didTimeOut = false;\n\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n didTimeOut = true;\n reject(new StartupError(`Timeout (${timeout}) waiting for ${host}:${port} to be free`));\n }, timeout);\n\n function pingPort(): void {\n if (didTimeOut) {\n return;\n }\n\n const socket = connect(port, host);\n let didRetry = false;\n function retry(): void {\n if (!didRetry && !didTimeOut) {\n didRetry = true;\n setTimeout(pingPort, retryDelay);\n }\n }\n\n socket.on('error', (error: Error) => {\n if ((error as any).code === 'ECONNREFUSED') {\n resolve();\n } else {\n retry();\n }\n });\n socket.on('connect', () => {\n socket.destroy();\n retry();\n });\n }\n pingPort();\n });\n}\n\nfunction runScript(\n script: string,\n scriptArgs: string[] | undefined,\n inspectHost: string,\n inspectPort: number,\n childPrint: (text: string, isError?: boolean) => void,\n): Promise<[ChildProcessWithoutNullStreams, number, string]> {\n script = normalize(script);\n return portIsFree(inspectHost, inspectPort).then(() => {\n return new Promise(resolve => {\n const args = [breakOnStart ? `--inspect-brk=${inspectPort}` : `--inspect=${inspectPort}`].concat(\n [script],\n scriptArgs || [],\n );\n const child = spawn(process.execPath, args);\n child.stdout.setEncoding('utf8');\n child.stderr.setEncoding('utf8');\n child.stdout.on('data', childPrint);\n child.stderr.on('data', text => childPrint(text, true));\n\n let output = '';\n function waitForListenHint(text: string): void {\n output += text;\n const res = /Debugger listening on ws:\\/\\/\\[?(.+?)]?:(\\d+)\\//.exec(output);\n if (res) {\n const host = res[1];\n const port = Number.parseInt(res[2]);\n child.stderr.removeListener('data', waitForListenHint);\n resolve([child, port, host]);\n }\n }\n\n child.stderr.on('data', waitForListenHint);\n });\n });\n}\n\nfunction createAgentProxy(domain: string, client: InspectClient): ProxyConstructor {\n const agent: any = new EventEmitter();\n\n agent.then = (...args: any[]) => {\n // TODO: potentially fetch the protocol and pretty-print it here.\n const descriptor = {\n [inspect.custom](_depth: number, { stylize }: InspectOptionsStylized): string {\n return stylize(`[Agent ${domain}]`, 'special');\n },\n };\n return Promise.resolve(descriptor).then(...args);\n };\n\n return new Proxy(agent, {\n get(target, name: string) {\n if (name in target) {\n return target[name];\n }\n return function callVirtualMethod(params: any) {\n return client.callMethod(`${domain}.${name}`, params);\n };\n },\n });\n}\n\ntype CommandToHostType =\n | 'log'\n | 'paused'\n | 'resumed'\n | 'setValue'\n | 'scope'\n | 'cb'\n | 'sb'\n | 'script'\n | 'ready'\n | 'readyToDebug'\n | 'error'\n | 'finished'\n | 'expressions'\n | 'stopOnException'\n | 'getPossibleBreakpoints';\n\ntype DebuggerContext = {\n url: string;\n scriptId: Runtime.ScriptId;\n reason: string;\n executionContextId: number;\n type: string;\n id: number;\n args: { value: any }[];\n};\n\ntype CommandToHost = {\n cmd: CommandToHostType;\n text?: string;\n expr?: { name: string };\n bp?: Debugger.Location;\n context?: DebuggerContext | null | string;\n error?: Error | string;\n errorContext?: Error;\n id?: Debugger.BreakpointId; // breakpoint ID\n breakpoints?: Debugger.Location[];\n scriptId?: Runtime.ScriptId;\n scopes?: Debugger.Scope[];\n variableName?: string;\n scopeNumber?: number;\n newValue?: string;\n callFrameId?: string;\n expressions?: { name: string; result: any }[];\n script?: string;\n url?: string;\n severity?: 'warn' | 'error';\n ts?: number;\n};\n\ninterface NodeInspectorOptions {\n script?: string | null;\n scriptArgs?: string[];\n isRemote?: boolean;\n host: string;\n port: number;\n}\n\nexport class NodeInspector {\n options: NodeInspectorOptions;\n stdin: ReadStream;\n stdout: WriteStream;\n scripts: Record<string, Promise<{ script: string; scriptId: Runtime.ScriptId }> | null>;\n delayedContext: DebuggerContext | null;\n paused: boolean;\n child: ChildProcessWithoutNullStreams | null;\n _runScript: () => Promise<[ChildProcessWithoutNullStreams | null, number, string]>;\n\n client: InspectClient;\n\n Debugger: InspectClient;\n HeapProfiler: InspectClient;\n Profiler: InspectClient;\n Runtime: InspectClient;\n\n handleDebugEvent: (fullName: string, params: DebuggerContext) => void;\n mainScriptId: Runtime.ScriptId | undefined;\n mainFile: string | undefined;\n repl: REPLServer | undefined;\n\n constructor(options: NodeInspectorOptions, stdin: ReadStream, stdout: WriteStream) {\n this.options = options;\n this.stdin = stdin;\n this.stdout = stdout;\n this.scripts = {};\n this.delayedContext = null;\n\n this.paused = true;\n this.child = null;\n\n if (options.script) {\n this._runScript = runScript.bind(\n null,\n options.script,\n options.scriptArgs,\n options.host,\n options.port,\n this.childPrint.bind(this),\n );\n } else {\n this._runScript = () => Promise.resolve([null, options.port, options.host]);\n }\n\n this.client = new InspectClient();\n\n this.Debugger = createAgentProxy('Debugger', this.client);\n this.HeapProfiler = createAgentProxy('HeapProfiler', this.client);\n this.Profiler = createAgentProxy('Profiler', this.client);\n this.Runtime = createAgentProxy('Runtime', this.client);\n\n this.handleDebugEvent = (\n fullName: string,\n params: {\n url: string;\n scriptId: Runtime.ScriptId;\n reason: string;\n executionContextId: number;\n type: string;\n id: number;\n args: { value: any }[];\n },\n ): void => {\n const [domain, name] = fullName.split('.');\n\n if (domain === 'Debugger' && name === 'scriptParsed') {\n // console.log(`Parsed: ${params.url}`);\n if (\n (scriptToDebug && params.url.includes(scriptToDebug)) ||\n (instanceToDebug && params.url.includes(instanceToDebug))\n ) {\n console.log(`My scriptID: ${params.scriptId}`);\n this.mainScriptId = params.scriptId;\n this.mainFile = params.url.replace('file:///', '');\n // load text of a script\n this.scripts[this.mainScriptId] = this.Debugger.getScriptSource({\n scriptId: this.mainScriptId,\n } as Debugger.GetScriptSourceParameterType).then((script: Debugger.GetScriptSourceReturnType) => ({\n script: script.scriptSource,\n scriptId: this.mainScriptId,\n }));\n\n // sometimes the pause event comes before scriptParsed\n if (this.delayedContext) {\n console.log('Send to debugger: readyToDebug');\n void this.scripts[this.mainScriptId]?.then(data => {\n // console.log(`Send to debugger: readyToDebug ${JSON.stringify(data)}`);\n sendToHost({\n cmd: 'readyToDebug',\n scriptId: this.mainScriptId,\n script: data.script,\n context: this.delayedContext,\n url: this.mainFile,\n });\n this.delayedContext = null;\n });\n }\n }\n return;\n } else if (domain === 'Debugger' && name === 'resumed') {\n this.Debugger.emit(name, params);\n sendToHost({ cmd: 'resumed', context: params });\n return;\n } else if (domain === 'Debugger' && name === 'paused') {\n console.log(`PAUSED!! ${alreadyPausedOnFirstLine}`);\n if (!alreadyPausedOnFirstLine && params.reason === 'exception') {\n // ignore all exceptions by start\n this.Debugger.resume();\n return;\n }\n //console.warn(`${fullName}: => \\n${JSON.stringify(params, null, 2)}`);\n this.Debugger.emit(name, params);\n\n if (!alreadyPausedOnFirstLine) {\n alreadyPausedOnFirstLine = true;\n // sometimes the pause event comes before scriptParsed\n if (this.mainScriptId && this.scripts[this.mainScriptId]) {\n void this.scripts[this.mainScriptId]?.then(data =>\n sendToHost({\n cmd: 'readyToDebug',\n scriptId: data.scriptId,\n script: data.script,\n context: params,\n url: this.mainFile,\n }),\n );\n } else {\n // store context to send it later when script ID will be known\n this.delayedContext = params;\n console.log('PAUSED, but no scriptId');\n }\n } else {\n // this.scripts[params.loca]\n // .then(data =>\n sendToHost({ cmd: 'paused', context: params });\n }\n return;\n }\n\n if (domain === 'Runtime') {\n //console.warn(`${fullName}: => \\n${JSON.stringify(params, null, 2)}`);\n }\n if (domain === 'Runtime' && name === 'consoleAPICalled') {\n const text = params.args[0].value;\n if (instanceToDebug) {\n sendToHost({\n cmd: 'log',\n severity: params.type === 'warning' ? 'warn' : 'error',\n text,\n ts: Date.now(),\n });\n } else if (text.includes(`$$${scriptToDebug}$$`)) {\n console.log(`${fullName} [${params.executionContextId}]: => ${text}`);\n const [severity, _text] = text.split(`$$${scriptToDebug}$$`);\n sendToHost({\n cmd: 'log',\n severity: severity as 'warn' | 'error',\n text: _text,\n ts: params.args[1] && params.args[1].value ? (params.args[1].value as number) : Date.now(),\n });\n } else if (params.type === 'warning' || params.type === 'error') {\n sendToHost({\n cmd: 'log',\n severity: params.type === 'warning' ? 'warn' : 'error',\n text,\n ts: Date.now(),\n });\n }\n return;\n } else if (domain === 'Runtime' && (params.id === 2 || params.executionContextId === 2)) {\n if (name === 'executionContextCreated') {\n console.warn(`${fullName}: =>\\n${JSON.stringify(params, null, 2)}`);\n } else if (name === 'executionContextDestroyed') {\n console.warn(`${fullName}: =>\\n${JSON.stringify(params, null, 2)}`);\n sendToHost({ cmd: 'finished', context: params });\n }\n return;\n } else if (\n domain === 'Runtime' &&\n name === 'executionContextDestroyed' &&\n params.executionContextId === 1\n ) {\n sendToHost({ cmd: 'finished', context: params });\n console.log('Exited!');\n setTimeout(() => process.exit(125), 200);\n } else if (domain === 'Debugger' && name === 'scriptFailedToParse') {\n // ignore\n return;\n }\n\n console.warn(`${fullName}: =>\\n${JSON.stringify(params, null, 2)}`);\n\n /*if (domain in this) {\n this[domain].emit(name, params);\n }*/\n };\n this.client.on('debugEvent', this.handleDebugEvent);\n const startRepl: () => REPLServer = createRepl(this);\n\n // Handle all possible exits\n process.on('exit', () => this.killChild());\n process.once('SIGTERM', process.exit.bind(process, 0));\n process.once('SIGHUP', process.exit.bind(process, 0));\n\n this.run()\n .then(() => startRepl())\n .then(repl => {\n this.repl = repl;\n this.repl.on('exit', () => process.exit(0));\n this.paused = false;\n })\n .then(null, error =>\n process.nextTick(() => {\n throw error;\n }),\n );\n }\n\n suspendReplWhile(fn: () => any): Promise<void> {\n if (this.repl) {\n this.repl.pause();\n }\n this.stdin.pause();\n this.paused = true;\n\n return new Promise(resolve => resolve(fn()))\n .then(() => {\n this.paused = false;\n if (this.repl) {\n this.repl.resume();\n this.repl.displayPrompt();\n }\n this.stdin.resume();\n })\n .then(null, error =>\n process.nextTick(() => {\n throw error;\n }),\n );\n }\n\n killChild(): void {\n this.client.reset();\n if (this.child) {\n this.child.kill();\n this.child = null;\n }\n }\n\n run(): Promise<void> {\n this.killChild();\n\n return this._runScript().then(([child, port, host]) => {\n this.child = child;\n\n let connectionAttempts = 0;\n const attemptConnect = (): void => {\n ++connectionAttempts;\n debuglog('connection attempt #%d', connectionAttempts);\n this.stdout.write('.');\n return this.client.connect(port, host).then(\n () => {\n debuglog('connection established');\n this.stdout.write(' ok');\n },\n (error: unknown): Promise<void> => {\n debuglog('connect failed', error);\n // If it's failed to connect 10 times, then print a failed message\n if (connectionAttempts >= 10) {\n this.stdout.write(' failed to connect, please retry\\n');\n process.exit(1);\n }\n\n return new Promise(resolve => setTimeout(resolve, 500)).then(attemptConnect);\n },\n );\n };\n\n this.print(`connecting to ${host}:${port} ..`, true);\n return attemptConnect();\n });\n }\n\n clearLine(): void {\n if (this.stdout.isTTY) {\n this.stdout.cursorTo(0);\n this.stdout.clearLine(1);\n } else {\n this.stdout.write('\\b');\n }\n }\n\n print(text: string, oneLine: boolean = false): void {\n this.clearLine();\n this.stdout.write(oneLine ? text : `${text}\\n`);\n }\n\n childPrint(text: string, isError?: boolean): void {\n isError &&\n this.print(\n text\n .toString()\n .split(/\\r\\n|\\r|\\n/g)\n .filter((chunk: string) => !!chunk)\n .map((chunk: string) => `< ${chunk}`)\n .join('\\n'),\n );\n if (!this.paused) {\n this.repl?.displayPrompt(true);\n }\n if (/Waiting for the debugger to disconnect\\.\\.\\.\\n$/.test(text)) {\n this.killChild();\n sendToHost({ cmd: 'finished', text });\n }\n }\n}\n\nfunction parseArgv([target, ...args]: string[]): NodeInspectorOptions {\n let host = '127.0.0.1';\n let port = 9229;\n let isRemote = false;\n let script: string | null = target;\n let scriptArgs = args;\n\n const hostMatch = target.match(/^([^:]+):(\\d+)$/);\n const portMatch = target.match(/^--port=(\\d+)$/);\n\n if (hostMatch) {\n // Connecting to remote debugger\n // `node-inspect localhost:9229`\n host = hostMatch[1];\n port = parseInt(hostMatch[2], 10);\n isRemote = true;\n script = null;\n } else if (portMatch) {\n // start debugee on custom port\n // `node inspect --port=9230 script.js`\n port = parseInt(portMatch[1], 10);\n script = args[0];\n scriptArgs = args.slice(1);\n } else if (args.length === 1 && /^\\d+$/.test(args[0]) && target === '-p') {\n // Start debugger against a given pid\n const pid = parseInt(args[0], 10);\n try {\n // Windows does not support UNIX signals. To enable debugging, you can use an undocumented API function\n // https://github.com/node-inspector/node-inspector?tab=readme-ov-file#windows\n // @ts-expect-error undocumented function\n process._debugProcess(pid);\n } catch (e: unknown) {\n if (e && (e as any).code === 'ESRCH') {\n console.error(`Target process: ${pid} doesn't exist.`);\n process.exit(1);\n }\n throw e;\n }\n script = null;\n isRemote = true;\n }\n\n return {\n host,\n port,\n isRemote,\n script,\n scriptArgs,\n };\n}\n\nfunction startInspect(\n argv: string[] = process.argv.slice(2),\n stdin: ReadStream = process.stdin,\n stdout: WriteStream = process.stdout,\n): void {\n /*\n if (argv.length < 1) {\n const invokedAs = runAsStandalone ? 'node-inspect' : `${process.argv0} ${process.argv[1]}`;\n\n console.error(`Usage: ${invokedAs} script.js`);\n console.error(` ${invokedAs} <host>:<port>`);\n console.error(` ${invokedAs} -p <pid>`);\n process.exit(1);\n }\n */\n\n const options = parseArgv(argv);\n inspector = new NodeInspector(options, stdin, stdout);\n\n stdin.resume();\n\n function handleUnexpectedError(e: Error): void {\n if (!(e instanceof StartupError)) {\n console.error('There was an internal error in node-inspect. Please report this bug.');\n console.error(e.message);\n console.error(e.stack);\n } else {\n console.error(e.message);\n }\n inspector.child?.kill();\n process.exit(1);\n }\n\n process.on('uncaughtException', handleUnexpectedError);\n}\n\nfunction extractErrorMessage(stack: string | undefined): string {\n if (!stack) {\n return '<unknown>';\n }\n const m = stack.match(/^\\w+: ([^\\n]+)/);\n return m ? m[1] : stack;\n}\n\nfunction convertResultToError(result: Runtime.RemoteObject): Error {\n const { className, description } = result;\n const err = new Error(extractErrorMessage(description));\n err.stack = description;\n Object.defineProperty(err, 'name', { value: className });\n return err;\n}\n\nprocess.on('message', (message: DebugCommand | string): void => {\n if (typeof message === 'string') {\n try {\n message = JSON.parse(message) as DebugCommand;\n } catch {\n return console.error(`Cannot parse: ${JSON.stringify(message)}`);\n }\n }\n processCommand(message);\n});\n\nsendToHost({ cmd: 'ready' });\n\n// possible commands\n// start - {cmd: 'start', scriptName: 'script.js.myName'} - start the debugging\n// end - {cmd: 'end'} - end the debugging and stop process\n// source - {cmd: 'source', scriptId} - read text of script by id\n// watch - {cmd: 'watch', expressions: ['i']} - add to watch the variable\n// unwatch - {cmd: 'unwatch', expressions: ['i']} - add to watch the variable\n\n// sb - {cmd: 'sb', breakpoints: [{scriptId: 50, lineNumber: 4, columnNumber: 0}]} - set breakpoint\n// cb - {cmd: 'cb', breakpoints: [{scriptId: 50, lineNumber: 4, columnNumber: 0}]} - clear breakpoint\n\n// pause - {cmd: 'pause'} - pause execution\n// cont - {cmd: 'cont'} - resume execution\n// next - {cmd: 'next'} - Continue to next line in current file\n// step - {cmd: 'step'} - Step into, potentially entering a function\n// out - {cmd: 'step'} - Step out, leaving the current function\n\ntype DebugCommandType =\n | 'start'\n | 'end'\n | 'source'\n | 'watch'\n | 'unwatch'\n | 'sb'\n | 'cb'\n | 'pause'\n | 'cont'\n | 'next'\n | 'step'\n | 'out'\n | 'scope'\n | 'setValue'\n | 'expressions'\n | 'stopOnException'\n | 'getPossibleBreakpoints'\n | 'error';\n\ntype DebugCommand = {\n cmd: DebugCommandType;\n scriptName?: string;\n scriptId?: Runtime.ScriptId;\n instance?: number;\n adapterInstance?: string;\n breakpoints?: Debugger.Location[] | Debugger.BreakpointId[];\n expressions?: { name: string }[];\n scopes?: Debugger.Scope[];\n\n variableName?: string;\n scopeNumber?: number;\n newValue?: string;\n callFrameId?: string;\n state?: boolean;\n\n start?: number;\n end?: number;\n};\n\nfunction processCommand(data: DebugCommand): void {\n console.log(`[DEBUGGER]: processCommand: ${JSON.stringify(data)}`);\n\n if (data.cmd === 'start') {\n scriptToDebug = data.scriptName as string;\n // we can request the script by name or iobroker instance to debug\n if (scriptToDebug) {\n startInspect([\n `${__dirname}/../main.js`,\n (data.instance || 0).toString(),\n '--debug',\n '--debugScript',\n scriptToDebug,\n ]);\n } else {\n instanceToDebug = data.adapterInstance as string;\n const [adapter, instance] = instanceToDebug.split('.');\n let file: string | undefined;\n try {\n file = require.resolve(`iobroker.${adapter}`);\n } catch (e: unknown) {\n // try to locate in the same dir\n const dir = normalize(join(__dirname, '..', `iobroker.${adapter}`));\n if (existsSync(dir)) {\n const pack = require(join(dir, 'package.json'));\n if (existsSync(join(dir, pack.main || `${adapter}.js`))) {\n file = join(dir, pack.main || `${adapter}.js`);\n }\n }\n\n if (!file) {\n sendToHost({ cmd: 'error', error: `Cannot locate iobroker.${adapter}`, errorContext: e as Error });\n setTimeout(() => {\n sendToHost({ cmd: 'finished', context: `Cannot locate iobroker.${adapter}` });\n setTimeout(() => process.exit(124), 500);\n }, 200);\n return;\n }\n }\n file = file.replace(/\\\\/g, '/');\n instanceToDebug = file;\n console.log(`Start ${file} ${instance} --debug`);\n startInspect([file, instance, '--debug']);\n }\n } else if (data.cmd === 'end') {\n process.exit();\n } else if (data.cmd === 'source') {\n inspector.Debugger.getScriptSource({ scriptId: data.scriptId } as Debugger.GetScriptSourceParameterType).then(\n (script: Debugger.GetScriptSourceReturnType) =>\n sendToHost({ cmd: 'script', scriptId: data.scriptId, text: script.scriptSource }),\n );\n } else if (data.cmd === 'cont') {\n inspector.Debugger.resume().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'next') {\n inspector.Debugger.stepOver().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'pause') {\n inspector.Debugger.pause().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'step') {\n inspector.Debugger.stepInto().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'out') {\n inspector.Debugger.stepOut().catch((e: unknown) => sendToHost({ cmd: 'error', error: e as Error }));\n } else if (data.cmd === 'sb') {\n console.log(JSON.stringify(data));\n\n void Promise.all(\n (data.breakpoints as Debugger.Location[])?.map((bp: Debugger.Location) =>\n inspector.Debugger.setBreakpoint({\n location: {\n scriptId: bp.scriptId,\n lineNumber: bp.lineNumber,\n columnNumber: bp.columnNumber,\n },\n } as Debugger.SetBreakpointParameterType)\n .then((result: Debugger.SetBreakpointReturnType) => ({\n id: result.breakpointId,\n location: result.actualLocation,\n }))\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot set breakpoint: ${e as Error}`,\n errorContext: e as Error,\n bp,\n }),\n ),\n ) || [],\n ).then(breakpoints => sendToHost({ cmd: 'sb', breakpoints }));\n } else if (data.cmd === 'cb') {\n void Promise.all(\n (data.breakpoints as Debugger.BreakpointId[])?.map(breakpointId =>\n inspector.Debugger.removeBreakpoint({ breakpointId } as Debugger.RemoveBreakpointParameterType)\n .then(() => breakpointId)\n .catch((e: unknown) => {\n console.error(`[DEBUGGER]: Cannot clear breakpoint: ${e as Error}`);\n sendToHost({\n cmd: 'error',\n error: `Cannot clear breakpoint: ${e as Error}`,\n errorContext: e as Error,\n id: breakpointId,\n });\n }),\n ) || [],\n ).then(breakpoints => {\n console.error(`[DEBUGGER]: sent breakpoints ${JSON.stringify(breakpoints)}`);\n sendToHost({ cmd: 'cb', breakpoints });\n });\n } else if (data.cmd === 'watch') {\n void Promise.all(\n data.expressions?.map(expr =>\n inspector.Debugger.watch(expr).catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot watch expr: ${e as Error}`,\n errorContext: e as Error,\n expr,\n }),\n ),\n ) || [],\n ).then(() => console.log('Watch done'));\n } else if (data.cmd === 'unwatch') {\n void Promise.all(\n data.expressions?.map(expr =>\n inspector.Debugger.unwatch(expr).catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot unwatch expr: ${e as Error}`,\n errorContext: e as Error,\n expr,\n }),\n ),\n ) || [],\n ).then(() => console.log('Watch done'));\n } else if (data.cmd === 'scope') {\n void Promise.all(\n data.scopes\n ?.filter(scope => scope?.object?.objectId)\n .map(scope =>\n inspector.Runtime.getProperties({\n objectId: scope.object.objectId,\n generatePreview: true,\n } as Runtime.GetPropertiesParameterType)\n .then((result: { result: DebugVariable[] }) => {\n return { type: scope.type, properties: result };\n })\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'error',\n error: `Cannot get scopes expr: ${e as Error}`,\n errorContext: e as Error,\n }),\n ),\n ) || [],\n ).then(scopes => sendToHost({ cmd: 'scope', scopes }));\n } else if (data.cmd === 'setValue') {\n inspector.Debugger.setVariableValue({\n variableName: data.variableName,\n scopeNumber: data.scopeNumber,\n newValue: data.newValue,\n callFrameId: data.callFrameId,\n } as Debugger.SetVariableValueParameterType)\n .catch((e: unknown) => {\n console.error(`Cannot setValue \"${data.variableName}\": ${e as Error}`);\n sendToHost({\n cmd: 'setValue',\n variableName: `Cannot setValue: ${e as Error}`,\n errorContext: e as Error,\n });\n })\n .then(() => {\n console.log(`setValue \"${data.variableName}\" successful`);\n sendToHost({\n cmd: 'setValue',\n variableName: data.variableName,\n scopeNumber: data.scopeNumber,\n newValue: data.newValue,\n callFrameId: data.callFrameId,\n });\n });\n } else if (data.cmd === 'expressions') {\n void Promise.all(\n data.expressions?.map(item =>\n inspector.Debugger.evaluateOnCallFrame({\n callFrameId: data.callFrameId,\n expression: item.name,\n objectGroup: 'node-inspect',\n returnByValue: true,\n generatePreview: true,\n } as Debugger.EvaluateOnCallFrameParameterType)\n // @ts-expect-error fix later\n .then(({ result, wasThrown }: Debugger.EvaluateOnCallFrameReturnType) => {\n if (wasThrown) {\n return { name: item.name, result: convertResultToError(result) };\n }\n return { name: item.name, result };\n })\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'expressions',\n variableName: `Cannot setValue: ${e as Error}`,\n errorContext: e as Error,\n }),\n ),\n ) || [],\n ).then(expressions => {\n sendToHost({ cmd: 'expressions', expressions });\n });\n } else if (data.cmd === 'stopOnException') {\n inspector.Debugger.setPauseOnExceptions({\n state: data.state ? 'all' : 'none',\n } as Debugger.SetPauseOnExceptionsParameterType).catch((e: unknown) =>\n sendToHost({\n cmd: 'stopOnException',\n variableName: `Cannot stopOnException: ${e as Error}`,\n errorContext: e as Error,\n }),\n );\n } else if (data.cmd === 'getPossibleBreakpoints') {\n inspector.Debugger.getPossibleBreakpoints({ start: data.start, end: data.end })\n .then((breakpoints: Debugger.GetPossibleBreakpointsReturnType) =>\n sendToHost({ cmd: 'getPossibleBreakpoints', breakpoints: breakpoints.locations }),\n )\n .catch((e: unknown) =>\n sendToHost({\n cmd: 'getPossibleBreakpoints',\n variableName: `Cannot getPossibleBreakpoints: ${e as Error}`,\n errorContext: e as Error,\n }),\n );\n } else {\n console.error(`Unknown command: ${JSON.stringify(data)}`);\n }\n}\n\nfunction sendToHost(data: CommandToHost): void {\n if (data.cmd === 'error') {\n console.error(data.text);\n if (data.expr) {\n console.error(`[EXPRESSION] ${JSON.stringify(data.expr)}`);\n }\n if (data.bp) {\n console.error(`[BP] ${JSON.stringify(data.bp)}`);\n }\n }\n\n if (process.send) {\n process.send(JSON.stringify(data));\n }\n}\n"]}