diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..0364c94 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Python code** +Relevant Python code to reproduce the problem + +**Javascript code** +Relevant Javascript code to reproduce the problem + +**Expected behavior** +A description of what you expected to happen. + +**Actual behavior** +A description of what actually happened. + +**Other Information (please complete the following information):** + +- OS: [e.g. Windows10] +- Python Version [e.g. 3.6] +- Node Version [e.g. 12] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..104f391 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'enhancement' +assignees: '' +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..6e83ae1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,14 @@ +--- +name: Question +about: A question about python-shell +title: '' +labels: 'question' +assignees: '' +--- + + + +**The Question**: + +**Any relevant python/javascript code:** diff --git a/.gitignore b/.gitignore index 3c3629e..f73a72d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,118 @@ node_modules +npm-debug.log.* +.vscode +personal +*.js +*.js.map +*.d.ts +.nyc_output +coverage +*.code-workspace + +# DEFAULT PYTHON GITIGNORE + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +.static_storage/ +.media/ +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index bceb6d7..0000000 --- a/.jshintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "predef": [], - "browser": false, - "node": true, - "curly": false, - "strict": false, - "expr": true, - "unused": "vars" -} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..483a9c4 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +package-lock.json \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..937375d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "semi": true, + "singleQuote": true +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c81edd9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,48 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Current TS File", + "type": "node", + "request": "launch", + "args": [ + "${relativeFile}" + ], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}", + "protocol": "inspector", + }, + { + "name": "Python", + "type": "python", + "request": "launch", + "stopOnEntry": true, + "python": "${command:python.interpreterPath}", + "program": "${file}", + "cwd": "${workspaceRoot}", + "env": {}, + "envFile": "${workspaceRoot}/.env", + }, + { + "name": "Current TS Tests File", + "type": "node", + "request": "launch", + "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", + "args": [ + "-r", + "ts-node/register", + "${relativeFile}", + "--ui", + "tdd", + "--no-timeouts" + ], + "cwd": "${workspaceRoot}", + "protocol": "inspector" + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e5cc75..ba12f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,74 @@ -## 0.0.3 -* fixed buffering in `PythonShell.receive`, fixing [#1](https://github.com/extrabacon/python-shell/issues/1) +## [5.0.0] - 2023-02-10 -## 0.0.2 -* improved documentation +### BREAKING CHANGES -## 0.0.1 -* initial version -* independent module moved from [extrabacon/pyspreadsheet](https://github.com/extrabacon/pyspreadsheet) +- run and runString now return a promise instead of a using a callback. +- You will need to 1) check the return value, 2) remove the callback argument, and 3) change to a promise +- see readme for usage examples +### Other notes + +- I confirmed that python-shell works with python 3.11 and node v18. + +## [4.0.0] - 2023-02-10 + +### Changed + +- run and runString now return a promise instead of a using a callback. +- This is somewhat backwards compatible with previous behavior + +## [3.0.1] - 2021-10-09 + +### Fixed + +- Previously when you called the kill method the terminated attribute was always set to true, regardless of whether the process was actually killed. Now the terminated boolean is set to true if kill succeeds, false otherwise. [#255](https://github.com/extrabacon/python-shell/issues/255) + +## [3.0.0] - 2021-03-07 + +### Changed + +- **BREAKING** Default python path changed back to `python` on Windows. [#237](https://github.com/extrabacon/python-shell/issues/237) +- **BREAKING** `error` event renamed to `pythonError` event. [#118](https://github.com/extrabacon/python-shell/issues/118) +- **BREAKING** `receive` methods removed in favor of `splitter` arguments in the constructor. This lets the default splitting logic reside in a reuseable stream transformer. Now if you have extra pipes you can reuse `newlineTransformer` to split incoming data into newline-seperated lines. + +### Added + +- `error` event that is fired upon failure to launch process, among other things. [#118](https://github.com/extrabacon/python-shell/issues/118) + +## [1.0.8] + +### Fixed + +- @joaoe fixed a bug with pythonshell not working with unset std streams +- https://github.com/extrabacon/python-shell/milestone/9 + +## [1.0.7] + +### Changed + +- default python path updated to py on windows + +## [1.0.4] + +### Added + +- added getVersionSync + +## [0.0.3] + +### Fixed + +- fixed buffering in `PythonShell.receive`, fixing [#1](https://github.com/extrabacon/python-shell/issues/1) + +## [0.0.2] + +### Changed + +- improved documentation + +## [0.0.1] + +### Added + +- initial version +- independent module moved from [extrabacon/pyspreadsheet](https://github.com/extrabacon/pyspreadsheet) diff --git a/README.md b/README.md index a116dc4..96e1b69 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,20 @@ -# python-shell +# [python-shell](https://www.npmjs.com/package/python-shell) [![Build status](https://ci.appveyor.com/api/projects/status/m8e3h53vvxg5wb2q/branch/master?svg=true)](https://ci.appveyor.com/project/Almenon/python-shell/branch/master) [![codecov](https://codecov.io/gh/extrabacon/python-shell/branch/master/graph/badge.svg)](https://codecov.io/gh/extrabacon/python-shell) + + A simple way to run Python scripts from Node.js with basic but efficient inter-process communication and better error handling. ## Features -+ Reliably spawn Python scripts in a child process -+ Built-in text, JSON and binary modes -+ Custom parsers and formatters -+ Simple and efficient data transfers through stdin and stdout streams -+ Extended stack traces when an error is thrown +- Reliably spawn Python scripts in a child process +- Built-in text, JSON and binary modes +- Custom parsers and formatters +- Simple and efficient data transfers through stdin and stdout streams +- Extended stack traces when an error is thrown + +## Requirements + +First make sure you are able to run `python3` (Mac/Linux) or `python` (Windows) from the terminal. If you are not then you might need to add it to the PATH. If you want to use a version of python not in the PATH you should specify `options.pythonPath`. ## Installation @@ -16,51 +22,63 @@ A simple way to run Python scripts from Node.js with basic but efficient inter-p npm install python-shell ``` -To run the tests: -```bash -npm test +## Documentation + +### Running python code: + +```typescript +import { PythonShell } from 'python-shell'; + +PythonShell.runString('x=1+1;print(x)', null).then((messages) => { + console.log('finished'); +}); ``` -## Documentation +If the script exits with a non-zero code, an error will be thrown. + +Note the use of imports! If you're not using typescript ಠ_ಠ you can [still get imports to work with this guide](https://github.com/extrabacon/python-shell/issues/148#issuecomment-419120209). + +Or you can use require like so: + +```javascript +let { PythonShell } = require('python-shell'); +``` ### Running a Python script: -```js -var PythonShell = require('python-shell'); +```typescript +import { PythonShell } from 'python-shell'; -PythonShell.run('my_script.py', function (err) { - if (err) throw err; +PythonShell.run('my_script.py', null).then((messages) => { console.log('finished'); }); ``` -If the script writes to stderr or exits with a non-zero code, an error will be thrown. +If the script exits with a non-zero code, an error will be thrown. ### Running a Python script with arguments and options: -```js -var PythonShell = require('python-shell'); +```typescript +import { PythonShell } from 'python-shell'; -var options = { +let options = { mode: 'text', pythonPath: 'path/to/python', - pythonOptions: ['-u'], scriptPath: 'path/to/my/scripts', - args: ['value1', 'value2', 'value3'] + args: ['value1', 'value2', 'value3'], }; -PythonShell.run('my_script.py', options, function (err, results) { - if (err) throw err; +PythonShell.run('my_script.py', options).then((messages) => { // results is an array consisting of messages collected during execution - console.log('results: %j', results); + console.log('results: %j', messages); }); ``` ### Exchanging data between Node and Python: -```js -var PythonShell = require('python-shell'); -var pyshell = new PythonShell('my_script.py'); +```typescript +import { PythonShell } from 'python-shell'; +let pyshell = new PythonShell('my_script.py'); // sends a message to the Python script via stdin pyshell.send('hello'); @@ -71,8 +89,10 @@ pyshell.on('message', function (message) { }); // end the input stream and allow the process to exit -pyshell.end(function (err) { +pyshell.end(function (err, code, signal) { if (err) throw err; + console.log('The exit code was: ' + code); + console.log('The exit signal was: ' + signal); console.log('finished'); }); ``` @@ -81,17 +101,20 @@ Use `.send(message)` to send a message to the Python script. Attach the `message Use `options.mode` to quickly setup how data is sent and received between your Node and Python applications. - * use `text` mode for exchanging lines of text - * use `json` mode for exchanging JSON fragments - * use `binary` mode for anything else (data is sent and received as-is) +- use `text` mode for exchanging lines of text ending with a [newline character](http://hayne.net/MacDev/Notes/unixFAQ.html#endOfLine). +- use `json` mode for exchanging JSON fragments +- use `binary` mode for anything else (data is sent and received as-is) + +Stderr always uses text mode. For more details and examples including Python source code, take a look at the tests. ### Error Handling and extended stack traces -An error will be thrown if the process exits with a non-zero exit code or if data has been written to stderr. Additionally, if "stderr" contains a formatted Python traceback, the error is augmented with Python exception details including a concatenated stack trace. +An error will be thrown if the process exits with a non-zero exit code. Additionally, if "stderr" contains a formatted Python traceback, the error is augmented with Python exception details including a concatenated stack trace. Sample error with traceback (from test/python/error.py): + ``` Traceback (most recent call last): File "test/python/error.py", line 6, in @@ -100,8 +123,10 @@ Traceback (most recent call last): print 1/0 ZeroDivisionError: integer division or modulo by zero ``` + would result into the following error: -```js + +```typescript { [Error: ZeroDivisionError: integer division or modulo by zero] traceback: 'Traceback (most recent call last):\n File "test/python/error.py", line 6, in \n divide_by_zero()\n File "test/python/error.py", line 4, in divide_by_zero\n print 1/0\nZeroDivisionError: integer division or modulo by zero\n', executable: 'python', @@ -110,7 +135,9 @@ would result into the following error: args: null, exitCode: 1 } ``` + and `err.stack` would look like this: + ``` Error: ZeroDivisionError: integer division or modulo by zero at PythonShell.parseError (python-shell/index.js:131:17) @@ -130,36 +157,41 @@ Error: ZeroDivisionError: integer division or modulo by zero Creates an instance of `PythonShell` and starts the Python process -* `script`: the path of the script to execute -* `options`: the execution options, consisting of: - * `mode`: Configures how data is exchanged when data flows through stdin and stdout. The possible values are: - * `text`: each line of data (ending with "\n") is emitted as a message (default) - * `json`: each line of data (ending with "\n") is parsed as JSON and emitted as a message - * `binary`: data is streamed as-is through `stdout` and `stdin` - * `formatter`: each message to send is transformed using this method, then appended with "\n" - * `parser`: each line of data (ending with "\n") is parsed with this function and its result is emitted as a message - * `encoding`: the text encoding to apply on the child process streams (default: "utf8") - * `pythonPath`: The path where to locate the "python" executable. Default: "python" - * `pythonOptions`: Array of option switches to pass to "python" - * `scriptPath`: The default path where to look for scripts. Default: "./python" - * `args`: Array of arguments to pass to the script +- `script`: the path of the script to execute +- `options`: the execution options, consisting of: + - `mode`: Configures how data is exchanged when data flows through stdin and stdout. The possible values are: + - `text`: each line of data is emitted as a message (default) + - `json`: each line of data is parsed as JSON and emitted as a message + - `binary`: data is streamed as-is through `stdout` and `stdin` + - `formatter`: each message to send is transformed using this method, then appended with a newline + - `parser`: each line of data is parsed with this function and its result is emitted as a message + - `stderrParser`: each line of logs is parsed with this function and its result is emitted as a message + - `encoding`: the text encoding to apply on the child process streams (default: "utf8") + - `pythonPath`: The path where to locate the "python" executable. Default: "python3" ("python" for Windows) + - `pythonOptions`: Array of option switches to pass to "python" + - `scriptPath`: The default path where to look for scripts. Default is the current working directory. + - `args`: Array of arguments to pass to the script +- `stdoutSplitter`: splits stdout into chunks, defaulting to splitting into newline-seperated lines +- `stderrSplitter`: splits stderr into chunks, defaulting to splitting into newline-seperated lines Other options are forwarded to `child_process.spawn`. PythonShell instances have the following properties: -* `script`: the path of the script to execute -* `command`: the full command arguments passed to the Python executable -* `stdin`: the Python stdin stream, used to send data to the child process -* `stdout`: the Python stdout stream, used for receiving data from the child process -* `stderr`: the Python stderr stream, used for communicating errors -* `childProcess`: the process instance created via `child_process.spawn` -* `terminated`: boolean indicating whether the process has exited -* `exitCode`: the process exit code, available after the process has ended + +- `script`: the path of the script to execute +- `command`: the full command arguments passed to the Python executable +- `stdin`: the Python stdin stream, used to send data to the child process +- `stdout`: the Python stdout stream, used for receiving data from the child process +- `stderr`: the Python stderr stream, used for communicating logs & errors +- `childProcess`: the process instance created via `child_process.spawn` +- `terminated`: boolean indicating whether the process has exited +- `exitCode`: the process exit code, available after the process has ended Example: -```js + +```typescript // create a new instance -var shell = new PythonShell('script.py', options); +let shell = new PythonShell('script.py', options); ``` #### `#defaultOptions` @@ -167,74 +199,160 @@ var shell = new PythonShell('script.py', options); Configures default options for all new instances of PythonShell. Example: -```js + +```typescript // setup a default "scriptPath" PythonShell.defaultOptions = { scriptPath: '../scripts' }; ``` -#### `#run(script, options, callback)` +#### `#run(script, options)` -Runs the Python script and invokes `callback` with the results. The callback contains the execution error (if any) as well as an array of messages emitted from the Python script. - -This method is also returning the `PythonShell` instance. +Runs the Python script and returns a promise. When you handle the promise the argument will be an array of messages emitted from the Python script. Example: -```js + +```typescript // run a simple script -PythonShell.run('script.py', function (err, results) { +PythonShell.run('script.py', null).then((results) => { // script finished }); ``` +#### `#runString(code, options)` + +Runs the Python script and returns a promise. When you handle the promise the argument will be an array of messages emitted from the Python script. + +Example: + +```typescript +// run some simple code +PythonShell.runString('x=1;print(x)', null).then((messages) => { + // script finished +}); +``` + +#### `#checkSyntax(code:string)` + +Checks the syntax of the code and returns a promise. +Promise is rejected if there is a syntax error. + +#### `#checkSyntaxFile(filePath:string)` + +Checks the syntax of the file and returns a promise. +Promise is rejected if there is a syntax error. + +#### `#getVersion(pythonPath?:string)` + +Returns the python version as a promise. Optional pythonPath param to get the version +of a specific python interpreter. + +#### `#getVersionSync(pythonPath?:string)` + +Returns the python version. Optional pythonPath param to get the version +of a specific python interpreter. + #### `.send(message)` Sends a message to the Python script via stdin. The data is formatted according to the selected mode (text or JSON), or through a custom function when `formatter` is specified. Example: -```js + +```typescript // send a message in text mode -var shell = new PythonShell('script.py', { mode: 'text '}); +let shell = new PythonShell('script.py', { mode: 'text' }); shell.send('hello world!'); // send a message in JSON mode -var shell = new PythonShell('script.py', { mode: 'json '}); -shell.send({ command: "do_stuff", args: [1, 2, 3] }); +let shell = new PythonShell('script.py', { mode: 'json' }); +shell.send({ command: 'do_stuff', args: [1, 2, 3] }); ``` -#### `.receive(data)` - -Parses incoming data from the Python script written via stdout and emits `message` events. This method is called automatically as data is being received from stdout. - #### `.end(callback)` Closes the stdin stream, allowing the Python script to finish and exit. The optional callback is invoked when the process is terminated. +#### `.kill(signal)` + +Terminates the python script. A kill signal may be provided by `signal`, if `signal` is not specified SIGTERM is sent. + #### event: `message` -Fires when a chunk of data is parsed from the stdout stream via the `receive` method. If a `parser` method is specified, the result of this function will be the message value. This event is not emitted in binary mode. +After the stdout stream is split into chunks by stdoutSplitter the chunks are parsed by the parser and a message event is emitted for each parsed chunk. This event is not emitted in binary mode. Example: -```js + +```typescript // receive a message in text mode -var shell = new PythonShell('script.py', { mode: 'text '}); +let shell = new PythonShell('script.py', { mode: 'text' }); shell.on('message', function (message) { // handle message (a line of text from stdout) }); // receive a message in JSON mode -var shell = new PythonShell('script.py', { mode: 'json '}); +let shell = new PythonShell('script.py', { mode: 'json' }); shell.on('message', function (message) { // handle message (a line of text from stdout, parsed as JSON) }); ``` +#### event: `stderr` + +After the stderr stream is split into chunks by stderrSplitter the chunks are parsed by the parser and a message event is emitted for each parsed chunk. This event is not emitted in binary mode. + +Example: + +```typescript +// receive a message in text mode +let shell = new PythonShell('script.py', { mode: 'text' }); +shell.on('stderr', function (stderr) { + // handle stderr (a line of text from stderr) +}); +``` + #### event: `close` Fires when the process has been terminated, with an error or not. +#### event: `pythonError` + +Fires when the process terminates with a non-zero exit code. + #### event: `error` -Fires when the process terminates with a non-zero exit code, or if data is written to the stderr stream. +Fires when: + +- The process could not be spawned, or +- The process could not be killed, or +- Sending a message to the child process failed. + +If the process could not be spawned please double-check that python can be launched from the terminal. + +### NewlineTransformer + +A utility class for splitting stream data into newlines. Used as the default for stdoutSplitter and stderrSplitter if they are unspecified. You can use this class for any extra python streams if you'd like. For example: + +```python +# foo.py +print('hello world', file=open(3, "w")) +``` + +```typescript +import { PythonShell, NewlineTransformer, Options } from 'python-shell'; + +const options: Options = { + stdio: ['pipe', 'pipe', 'pipe', 'pipe'], // stdin, stdout, stderr, custom +}; +const pyshell = new PythonShell('foo.py', options); + +const customPipe = pyshell.childProcess.stdio[3]; +customPipe.pipe(new NewlineTransformer()).on('data', (customResult: Buffer) => { + console.log(customResult.toString()); +}); +``` + +## Used By: + +Python-Shell is used by [arepl-vscode](https://github.com/almenon/arepl-vscode), [gitinspector](https://github.com/ejwa/gitinspector), [pyspreadsheet](https://github.com/extrabacon/pyspreadsheet), [AtlantOS Ocean Data QC](https://github.com/ocean-data-qc/ocean-data-qc) and more! ## License diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..20fe5f5 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,48 @@ +# this script based off of https://github.com/tolbertam/mocha-appveyor-reporter/blob/master/appveyor.yml + +branches: + except: + - gh-pages + +image: + - Visual Studio 2022 + - Ubuntu2204 + +environment: + matrix: + - nodejs_version: '18' + PYTHON: "C:\\Python312-x64" + + - nodejs_version: '20' + PYTHON: "C:\\Python312-x64" + + - nodejs_version: '24' + PYTHON: "C:\\Python312-x64" + +install: + - cmd: powershell Install-Product node $env:nodejs_version + - sh: nvm install $nodejs_version + - node --version + - npm install + - npm install codecov -g + - npm install nyc -g + +build: off + +test_script: + - npm run appveyorTest + - nyc report --reporter=json + - codecov -f coverage/coverage-final.json + +cache: + - node_modules -> package.json + +notifications: + - provider: Email + to: + - almenon214@gmail.com + on_build_success: false + +skip_commits: + files: + - '**/*.md' diff --git a/index.js b/index.js deleted file mode 100644 index 484231f..0000000 --- a/index.js +++ /dev/null @@ -1,238 +0,0 @@ -var EventEmitter = require('events').EventEmitter; -var path = require('path'); -var util = require('util'); -var spawn = require('child_process').spawn; - -function toArray(source) { - if (typeof source === 'undefined' || source === null) { - return []; - } else if (!Array.isArray(source)) { - return [source]; - } - return source; -} - -function extend(obj) { - Array.prototype.slice.call(arguments, 1).forEach(function (source) { - if (source) { - for (var key in source) { - obj[key] = source[key]; - } - } - }); - return obj; -} - -/** - * An interactive Python shell exchanging data through stdio - * @param {string} script The python script to execute - * @param {object} [options] The launch options (also passed to child_process.spawn) - * @constructor - */ -var PythonShell = function (script, options) { - - function resolve(type, val) { - if (typeof val === 'string') { - // use a built-in function using its name - return PythonShell[type][val]; - } else if (typeof val === 'function') { - // use a custom function - return val; - } - } - - var self = this; - var errorData = ''; - EventEmitter.call(this); - - options = extend({}, PythonShell.defaultOptions, options); - var pythonPath = options.pythonPath || 'python'; - var pythonOptions = toArray(options.pythonOptions); - var scriptArgs = toArray(options.args); - - this.script = path.join(options.scriptPath || './python', script); - this.command = pythonOptions.concat(this.script, scriptArgs); - this.mode = options.mode || 'text'; - this.formatter = resolve('format', options.formatter || this.mode); - this.parser = resolve('parse', options.parser || this.mode); - this.terminated = false; - this.childProcess = spawn(pythonPath, this.command, options); - - ['stdout', 'stdin', 'stderr'].forEach(function (name) { - self[name] = self.childProcess[name]; - self.parser && self[name].setEncoding(options.encoding || 'utf8'); - }); - - // parse incoming data on stdout - if (this.parser) { - this.stdout.on('data', PythonShell.prototype.receive.bind(this)); - } - - // listen to stderr and emit errors for incoming data - this.stderr.on('data', function (data) { - errorData += ''+data; - }); - - this.childProcess.on('exit', function (code) { - var err; - if (errorData || code !== 0) { - if (errorData) { - err = self.parseError(errorData); - } else { - err = new Error('process exited with code ' + code); - } - err = extend(err, { - executable: pythonPath, - options: pythonOptions.length ? pythonOptions : null, - script: self.script, - args: scriptArgs.length ? scriptArgs : null, - exitCode: code - }); - // do not emit error if only a callback is used - if (self.listeners('error').length || !self._endCallback) { - self.emit('error', err); - } - } - self.exitCode = code; - self.terminated = true; - self.emit('close'); - self._endCallback && self._endCallback(err); - }); -}; -util.inherits(PythonShell, EventEmitter); - -// allow global overrides for options -PythonShell.defaultOptions = {}; - -// built-in formatters -PythonShell.format = { - text: function toText(data) { - if (!data) return ''; - else if (typeof data !== 'string') return data.toString(); - return data; - }, - json: function toJson(data) { - return JSON.stringify(data); - } -}; - -// built-in parsers -PythonShell.parse = { - text: function asText(data) { - return data; - }, - json: function asJson(data) { - return JSON.parse(data); - } -}; - -/** - * Runs a Python script and returns collected messages - * @param {string} script The script to execute - * @param {Object} options The execution options - * @param {Function} callback The callback function to invoke with the script results - * @return {PythonShell} The PythonShell instance - */ -PythonShell.run = function (script, options, callback) { - if (typeof options === 'function') { - callback = options; - options = null; - } - - var pyshell = new PythonShell(script, options); - var output = []; - - return pyshell.on('message', function (message) { - output.push(message); - }).end(function (err) { - if (err) return callback(err); - return callback(null, output.length ? output : null); - }); -}; - -/** - * Parses an error thrown from the Python process through stderr - * @param {string|Buffer} data The stderr contents to parse - * @return {Error} The parsed error with extended stack trace when traceback is available - */ -PythonShell.prototype.parseError = function (data) { - var text = ''+data; - var error; - - if (/^Traceback/.test(text)) { - // traceback data is available - var lines = (''+data).trim().split(/\n/g); - var exception = lines.pop(); - error = new Error(exception); - error.traceback = data; - // extend stack trace - error.stack += '\n ----- Python Traceback -----\n '; - error.stack += lines.slice(1).join('\n '); - } else { - // otherwise, create a simpler error with stderr contents - error = new Error(text); - } - - return error; -}; - -/** - * Sends a message to the Python shell through stdin - * Override this method to format data to be sent to the Python process - * @param {string|Object} data The message to send - * @returns {PythonShell} The same instance for chaining calls - */ -PythonShell.prototype.send = function (message) { - var data = this.formatter ? this.formatter(message) : message; - if (this.mode !== 'binary') data += '\n'; - this.stdin.write(data); - return this; -}; - -/** - * Parses data received from the Python shell stdout stream and emits "message" events - * This method is not used in binary mode - * Override this method to parse incoming data from the Python process into messages - * @param {string|Buffer} data The data to parse into messages - */ -PythonShell.prototype.receive = function (data) { - var self = this; - var parts = (''+data).split(/\n/g); - - if (parts.length === 1) { - // an incomplete record, keep buffering - this._remaining = (this._remaining || '') + parts[0]; - return this; - } - - var lastLine = parts.pop(); - // fix the first line with the remaining from the previous iteration of 'receive' - parts[0] = (this._remaining || '') + parts[0]; - // keep the remaining for the next iteration of 'receive' - this._remaining = lastLine; - - parts.forEach(function (part) { - try { - self.emit('message', self.parser(part)); - } catch(err) { - self.emit('error', extend( - new Error('invalid message: ' + data + ' >> ' + err), - { inner: err, data: part} - )); - } - }); - - return this; -}; - -/** - * Closes the stdin stream, which should cause the process to finish its work and close - * @returns {PythonShell} The same instance for chaining calls - */ -PythonShell.prototype.end = function (callback) { - this.childProcess.stdin.end(); - this._endCallback = callback; - return this; -}; - -module.exports = PythonShell; diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..9569354 --- /dev/null +++ b/index.ts @@ -0,0 +1,535 @@ +import { EventEmitter } from 'events'; +import { + ChildProcess, + spawn, + SpawnOptions, + exec, + execSync, +} from 'child_process'; +import { EOL as newline, tmpdir } from 'os'; +import { join, sep } from 'path'; +import { Readable, Transform, TransformCallback, Writable } from 'stream'; +import { writeFile, writeFileSync } from 'fs'; +import { promisify } from 'util'; + +function toArray(source?: T | T[]): T[] { + if (typeof source === 'undefined' || source === null) { + return []; + } else if (!Array.isArray(source)) { + return [source]; + } + return source; +} + +/** + * adds arguments as properties to obj + */ +function extend(obj: {}, ...args) { + Array.prototype.slice.call(arguments, 1).forEach(function (source) { + if (source) { + for (let key in source) { + obj[key] = source[key]; + } + } + }); + return obj; +} + +/** + * gets a random int from 0-10000000000 + */ +function getRandomInt() { + return Math.floor(Math.random() * 10000000000); +} + +const execPromise = promisify(exec); + +export interface Options extends SpawnOptions { + /** + * if binary is enabled message and stderr events will not be emitted + */ + mode?: 'text' | 'json' | 'binary'; + formatter?: string | ((param: string) => any); + parser?: string | ((param: string) => any); + stderrParser?: string | ((param: string) => any); + encoding?: BufferEncoding; + pythonPath?: string; + /** + * see https://docs.python.org/3.7/using/cmdline.html + */ + pythonOptions?: string[]; + /** + * overrides scriptPath passed into PythonShell constructor + */ + scriptPath?: string; + /** + * arguments to your program + */ + args?: string[]; +} + +export class PythonShellError extends Error { + traceback: string | Buffer; + exitCode?: number; +} + +export class PythonShellErrorWithLogs extends PythonShellError { + logs: any[]; +} + +/** + * Takes in a string stream and emits batches seperated by newlines + */ +export class NewlineTransformer extends Transform { + // NewlineTransformer: Megatron's little known once-removed cousin + private _lastLineData: string; + _transform(chunk: any, encoding: string, callback: TransformCallback) { + let data: string = chunk.toString(); + if (this._lastLineData) data = this._lastLineData + data; + const lines = data.split(newline); + this._lastLineData = lines.pop(); + lines.forEach(this.push.bind(this)); + callback(); + } + _flush(done: TransformCallback) { + if (this._lastLineData) this.push(this._lastLineData); + this._lastLineData = null; + done(); + } +} + +/** + * An interactive Python shell exchanging data through stdio + * @param {string} script The python script to execute + * @param {object} [options] The launch options (also passed to child_process.spawn) + * @param [stdoutSplitter] Optional. Splits stdout into chunks, defaulting to splitting into newline-seperated lines + * @param [stderrSplitter] Optional. splits stderr into chunks, defaulting to splitting into newline-seperated lines + * @constructor + */ +export class PythonShell extends EventEmitter { + scriptPath: string; + command: string[]; + mode: string; + formatter: (param: string | Object) => any; + parser: (param: string) => any; + stderrParser: (param: string) => any; + terminated: boolean; + childProcess: ChildProcess; + stdin: Writable; + stdout: Readable; + stderr: Readable; + exitSignal: string; + exitCode: number; + private stderrHasEnded: boolean; + private stdoutHasEnded: boolean; + private _remaining: string; + private _endCallback: ( + err: PythonShellError, + exitCode: number, + exitSignal: string, + ) => any; + + // starting 2020 python2 is deprecated so we choose 3 as default + static defaultPythonPath = process.platform != 'win32' ? 'python3' : 'python'; + + static defaultOptions: Options = {}; //allow global overrides for options + + /** + * spawns a python process + * @param scriptPath path to script. Relative to current directory or options.scriptFolder if specified + * @param options + * @param stdoutSplitter Optional. Splits stdout into chunks, defaulting to splitting into newline-seperated lines + * @param stderrSplitter Optional. splits stderr into chunks, defaulting to splitting into newline-seperated lines + */ + constructor( + scriptPath: string, + options?: Options, + stdoutSplitter: Transform = null, + stderrSplitter: Transform = null, + ) { + super(); + + /** + * returns either pythonshell func (if val string) or custom func (if val Function) + */ + function resolve(type, val: string | Function) { + if (typeof val === 'string') { + // use a built-in function using its name + return PythonShell[type][val]; + } else if (typeof val === 'function') { + // use a custom function + return val; + } + } + + if (scriptPath.trim().length == 0) + throw Error( + 'scriptPath cannot be empty! You must give a script for python to run', + ); + + let self = this; + let errorData = ''; + EventEmitter.call(this); + + options = extend({}, PythonShell.defaultOptions, options); + let pythonPath: string; + if (!options.pythonPath) { + pythonPath = PythonShell.defaultPythonPath; + } else pythonPath = options.pythonPath; + let pythonOptions = toArray(options.pythonOptions); + let scriptArgs = toArray(options.args); + + this.scriptPath = join(options.scriptPath || '', scriptPath); + this.command = pythonOptions.concat(this.scriptPath, scriptArgs); + this.mode = options.mode || 'text'; + this.formatter = resolve('format', options.formatter || this.mode); + this.parser = resolve('parse', options.parser || this.mode); + // We don't expect users to ever format stderr as JSON so we default to text mode + this.stderrParser = resolve('parse', options.stderrParser || 'text'); + this.terminated = false; + this.childProcess = spawn(pythonPath, this.command, options); + + ['stdout', 'stdin', 'stderr'].forEach(function (name) { + self[name] = self.childProcess[name]; + self.parser && + self[name] && + self[name].setEncoding(options.encoding || 'utf8'); + }); + + // Node buffers stdout&stderr in batches regardless of newline placement + // This is troublesome if you want to recieve distinct individual messages + // for example JSON parsing breaks if it recieves partial JSON + // so we use newlineTransformer to emit each batch seperated by newline + if (this.parser && this.stdout) { + if (!stdoutSplitter) stdoutSplitter = new NewlineTransformer(); + // note that setting the encoding turns the chunk into a string + stdoutSplitter.setEncoding(options.encoding || 'utf8'); + this.stdout.pipe(stdoutSplitter).on('data', (chunk: string) => { + this.emit('message', self.parser(chunk)); + }); + } + + // listen to stderr and emit errors for incoming data + if (this.stderrParser && this.stderr) { + if (!stderrSplitter) stderrSplitter = new NewlineTransformer(); + // note that setting the encoding turns the chunk into a string + stderrSplitter.setEncoding(options.encoding || 'utf8'); + this.stderr.pipe(stderrSplitter).on('data', (chunk: string) => { + this.emit('stderr', self.stderrParser(chunk)); + }); + } + + if (this.stderr) { + this.stderr.on('data', function (data) { + errorData += '' + data; + }); + this.stderr.on('end', function () { + self.stderrHasEnded = true; + terminateIfNeeded(); + }); + } else { + self.stderrHasEnded = true; + } + + if (this.stdout) { + this.stdout.on('end', function () { + self.stdoutHasEnded = true; + terminateIfNeeded(); + }); + } else { + self.stdoutHasEnded = true; + } + + this.childProcess.on('error', function (err: NodeJS.ErrnoException) { + self.emit('error', err); + }); + this.childProcess.on('exit', function (code, signal) { + self.exitCode = code; + self.exitSignal = signal; + terminateIfNeeded(); + }); + + function terminateIfNeeded() { + if ( + !self.stderrHasEnded || + !self.stdoutHasEnded || + (self.exitCode == null && self.exitSignal == null) + ) + return; + + let err: PythonShellError; + if (self.exitCode && self.exitCode !== 0) { + if (errorData) { + err = self.parseError(errorData); + } else { + err = new PythonShellError( + 'process exited with code ' + self.exitCode, + ); + } + err = extend(err, { + executable: pythonPath, + options: pythonOptions.length ? pythonOptions : null, + script: self.scriptPath, + args: scriptArgs.length ? scriptArgs : null, + exitCode: self.exitCode, + }); + // do not emit error if only a callback is used + if (self.listeners('pythonError').length || !self._endCallback) { + self.emit('pythonError', err); + } + } + + self.terminated = true; + self.emit('close'); + self._endCallback && + self._endCallback(err, self.exitCode, self.exitSignal); + } + } + + // built-in formatters + static format = { + text: function toText(data): string { + if (!data) return ''; + else if (typeof data !== 'string') return data.toString(); + return data; + }, + json: function toJson(data) { + return JSON.stringify(data); + }, + }; + + //built-in parsers + static parse = { + text: function asText(data): string { + return data; + }, + json: function asJson(data: string) { + return JSON.parse(data); + }, + }; + + /** + * checks syntax without executing code + * @returns rejects promise w/ string error output if syntax failure + */ + static async checkSyntax(code: string) { + const randomInt = getRandomInt(); + const filePath = tmpdir() + sep + `pythonShellSyntaxCheck${randomInt}.py`; + + const writeFilePromise = promisify(writeFile); + return writeFilePromise(filePath, code).then(() => { + return this.checkSyntaxFile(filePath); + }); + } + + static getPythonPath() { + return this.defaultOptions.pythonPath + ? this.defaultOptions.pythonPath + : this.defaultPythonPath; + } + + /** + * checks syntax without executing code + * @returns {Promise} rejects w/ stderr if syntax failure + */ + static async checkSyntaxFile(filePath: string) { + const pythonPath = this.getPythonPath(); + let compileCommand = `${pythonPath} -m py_compile ${filePath}`; + return execPromise(compileCommand); + } + + /** + * Runs a Python script and returns collected messages as a promise. + * If the promise is rejected, the err will probably be of type PythonShellErrorWithLogs + * @param scriptPath The path to the script to execute + * @param options The execution options + */ + static run(scriptPath: string, options?: Options): Promise { + return new Promise((resolve, reject) => { + let pyshell = new PythonShell(scriptPath, options); + let output = []; + + pyshell + .on('message', function (message) { + output.push(message); + }) + .end(function (err) { + if (err) { + (err as PythonShellErrorWithLogs).logs = output; + reject(err); + } else resolve(output); + }); + }); + } + + /** + * Runs the inputted string of python code and returns collected messages as a promise. DO NOT ALLOW UNTRUSTED USER INPUT HERE! + * @param code The python code to execute + * @param options The execution options + * @return a promise with the output from the python script + */ + static runString(code: string, options?: Options) { + // put code in temp file + const randomInt = getRandomInt(); + const filePath = tmpdir + sep + `pythonShellFile${randomInt}.py`; + writeFileSync(filePath, code); + + return PythonShell.run(filePath, options); + } + + static getVersion(pythonPath?: string) { + if (!pythonPath) pythonPath = this.getPythonPath(); + return execPromise(pythonPath + ' --version'); + } + + static getVersionSync(pythonPath?: string) { + if (!pythonPath) pythonPath = this.getPythonPath(); + return execSync(pythonPath + ' --version').toString(); + } + + /** + * Parses an error thrown from the Python process through stderr + * @param {string|Buffer} data The stderr contents to parse + * @return {Error} The parsed error with extended stack trace when traceback is available + */ + private parseError(data: string | Buffer) { + let text = '' + data; + let error: PythonShellError; + + if (/^Traceback/.test(text)) { + // traceback data is available + let lines = text.trim().split(newline); + let exception = lines.pop(); + error = new PythonShellError(exception); + error.traceback = data; + // extend stack trace + error.stack += + newline + ' ----- Python Traceback -----' + newline + ' '; + error.stack += lines.slice(1).join(newline + ' '); + } else { + // otherwise, create a simpler error with stderr contents + error = new PythonShellError(text); + } + + return error; + } + + /** + * Sends a message to the Python shell through stdin + * Override this method to format data to be sent to the Python process + * @returns {PythonShell} The same instance for chaining calls + */ + send(message: string | Object) { + if (!this.stdin) throw new Error('stdin not open for writing'); + let data = this.formatter ? this.formatter(message) : message; + if (this.mode !== 'binary') data += newline; + this.stdin.write(data); + return this; + } + + /** + * Closes the stdin stream. Unless python is listening for stdin in a loop + * this should cause the process to finish its work and close. + * @returns {PythonShell} The same instance for chaining calls + */ + end( + callback: ( + err: PythonShellError, + exitCode: number, + exitSignal: string, + ) => any, + ) { + if (this.childProcess.stdin) { + this.childProcess.stdin.end(); + } + this._endCallback = callback; + return this; + } + + /** + * Sends a kill signal to the process + * @returns {PythonShell} The same instance for chaining calls + */ + kill(signal?: NodeJS.Signals) { + this.terminated = this.childProcess.kill(signal); + return this; + } + + /** + * Alias for kill. + * @deprecated + */ + terminate(signal?: NodeJS.Signals) { + // todo: remove this next breaking release + return this.kill(signal); + } +} + +// This interface is merged in with the above class definition +export interface PythonShell { + addListener(event: string, listener: (...args: any[]) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: string, listener: (...args: any[]) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + + addListener(event: 'message', listener: (parsedChunk: any) => void): this; + emit(event: 'message', parsedChunk: any): boolean; + on(event: 'message', listener: (parsedChunk: any) => void): this; + once(event: 'message', listener: (parsedChunk: any) => void): this; + prependListener(event: 'message', listener: (parsedChunk: any) => void): this; + prependOnceListener( + event: 'message', + listener: (parsedChunk: any) => void, + ): this; + + addListener(event: 'stderr', listener: (parsedChunk: any) => void): this; + emit(event: 'stderr', parsedChunk: any): boolean; + on(event: 'stderr', listener: (parsedChunk: any) => void): this; + once(event: 'stderr', listener: (parsedChunk: any) => void): this; + prependListener(event: 'stderr', listener: (parsedChunk: any) => void): this; + prependOnceListener( + event: 'stderr', + listener: (parsedChunk: any) => void, + ): this; + + addListener(event: 'close', listener: () => void): this; + emit(event: 'close'): boolean; + on(event: 'close', listener: () => void): this; + once(event: 'close', listener: () => void): this; + prependListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + + addListener( + event: 'error', + listener: (error: NodeJS.ErrnoException) => void, + ): this; + emit(event: 'error', error: NodeJS.ErrnoException): boolean; + on(event: 'error', listener: (error: NodeJS.ErrnoException) => void): this; + once(event: 'error', listener: (error: NodeJS.ErrnoException) => void): this; + prependListener( + event: 'error', + listener: (error: NodeJS.ErrnoException) => void, + ): this; + prependOnceListener( + event: 'error', + listener: (error: NodeJS.ErrnoException) => void, + ): this; + + addListener( + event: 'pythonError', + listener: (error: PythonShellError) => void, + ): this; + emit(event: 'pythonError', error: PythonShellError): boolean; + on(event: 'pythonError', listener: (error: PythonShellError) => void): this; + once(event: 'pythonError', listener: (error: PythonShellError) => void): this; + prependListener( + event: 'pythonError', + listener: (error: PythonShellError) => void, + ): this; + prependOnceListener( + event: 'pythonError', + listener: (error: PythonShellError) => void, + ): this; +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..13e4c11 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2337 @@ +{ + "name": "python-shell", + "version": "5.0.2", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "python-shell", + "version": "5.0.2", + "license": "MIT", + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^24.10.1", + "@types/should": "^13.0.0", + "mocha": "^11.7.5", + "prettier": "^3.6.2", + "should": "^13.2.3", + "ts-node": "^10.9.2", + "typescript": "^5.9.3" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz", + "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "peer": true, + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/should": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/should/-/should-13.0.0.tgz", + "integrity": "sha512-Mi6YZ2ABnnGGFMuiBDP0a8s1ZDCDNHqP97UH8TyDmCWuGGavpsFMfJnAMYaaqmDlSCOCNbVLHBrSDEOpx/oLhw==", + "deprecated": "This is a stub types definition for should.js (https://github.com/shouldjs/should.js). should.js provides its own type definitions, so you don't need @types/should installed!", + "dev": true, + "dependencies": { + "should": "*" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mocha": { + "version": "11.7.5", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz", + "integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==", + "dev": true, + "dependencies": { + "browser-stdout": "^1.3.1", + "chokidar": "^4.0.1", + "debug": "^4.3.5", + "diff": "^7.0.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^10.4.5", + "he": "^1.2.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^9.0.5", + "ms": "^2.1.3", + "picocolors": "^1.1.1", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^9.2.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1", + "yargs-unparser": "^2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "node_modules/prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "dev": true, + "dependencies": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "node_modules/should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "dependencies": { + "should-type": "^1.4.0" + } + }, + "node_modules/should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "dependencies": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "node_modules/should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "node_modules/should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "dev": true, + "dependencies": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "node_modules/should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/workerpool": { + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz", + "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + } + } + }, + "dependencies": { + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + } + }, + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "requires": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true + }, + "@tsconfig/node10": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz", + "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true + }, + "@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "peer": true, + "requires": { + "undici-types": "~7.16.0" + } + }, + "@types/should": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/should/-/should-13.0.0.tgz", + "integrity": "sha512-Mi6YZ2ABnnGGFMuiBDP0a8s1ZDCDNHqP97UH8TyDmCWuGGavpsFMfJnAMYaaqmDlSCOCNbVLHBrSDEOpx/oLhw==", + "dev": true, + "requires": { + "should": "*" + } + }, + "acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true + }, + "acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "requires": { + "acorn": "^8.11.0" + } + }, + "ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "requires": { + "readdirp": "^4.0.1" + } + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + }, + "diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "dev": true + }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "requires": { + "@isaacs/cliui": "^8.0.2", + "@pkgjs/parseargs": "^0.11.0" + } + }, + "js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true + }, + "mocha": { + "version": "11.7.5", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz", + "integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==", + "dev": true, + "requires": { + "browser-stdout": "^1.3.1", + "chokidar": "^4.0.1", + "debug": "^4.3.5", + "diff": "^7.0.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^10.4.5", + "he": "^1.2.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^9.0.5", + "ms": "^2.1.3", + "picocolors": "^1.1.1", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^9.2.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1", + "yargs-unparser": "^2.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "requires": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + } + }, + "picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "dev": true, + "requires": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "requires": { + "should-type": "^1.4.0" + } + }, + "should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "requires": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "dev": true, + "requires": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "dev": true + }, + "signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + } + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, + "typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "peer": true + }, + "undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true + }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "workerpool": { + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz", + "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", + "dev": true + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true + } + } + }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/package.json b/package.json index c0c1084..48f2aa2 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,34 @@ { "name": "python-shell", - "version": "0.0.3", + "version": "5.0.2", "description": "Run Python scripts from Node.js with simple (but efficient) inter-process communication through stdio", "keywords": [ "python" ], "scripts": { - "test": "mocha -R spec" + "test": "tsc -p ./ && mocha -r ts-node/register", + "appveyorTest": "tsc -p ./ && nyc mocha test/*.js", + "compile": "tsc -watch -p ./", + "compileOnce": "tsc -p ./", + "format": "prettier --write ." }, - "dependencies": {}, "devDependencies": { - "should": "^6.0.0", - "mocha": "^2.2.5" + "@types/mocha": "^10.0.1", + "@types/node": "^24.10.1", + "@types/should": "^13.0.0", + "mocha": "^11.7.5", + "prettier": "^3.6.2", + "should": "^13.2.3", + "ts-node": "^10.9.2", + "typescript": "^5.9.3" }, + "files": [ + "*.d.ts", + "*.js", + "*.js.map", + "CHANGELOG.md", + "README.md" + ], "repository": { "type": "git", "url": "http://github.com/extrabacon/python-shell" @@ -25,5 +41,6 @@ }, "engines": { "node": ">=0.10" - } + }, + "license": "MIT" } diff --git a/test/.jshintrc b/test/.jshintrc deleted file mode 100644 index a57f5d3..0000000 --- a/test/.jshintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "predef": ["describe", "it", "before", "after", "beforeEach", "afterEach"], - "browser": false, - "node": true, - "curly": false, - "strict": false, - "expr": true, - "unused": "vars" -} diff --git a/test/python/echo_args.py b/test/python/echo_args.py index e5a8a86..9676d59 100644 --- a/test/python/echo_args.py +++ b/test/python/echo_args.py @@ -2,4 +2,4 @@ # simple argument echo script for v in sys.argv[1:]: - print v + print(v) diff --git a/test/python/echo_hi_then_error.py b/test/python/echo_hi_then_error.py new file mode 100644 index 0000000..b22a4ac --- /dev/null +++ b/test/python/echo_hi_then_error.py @@ -0,0 +1,2 @@ +print('hi') +raise Exception('fibble-fah') \ No newline at end of file diff --git a/test/python/echo_json.py b/test/python/echo_json.py index aa95d68..37b9766 100644 --- a/test/python/echo_json.py +++ b/test/python/echo_json.py @@ -2,4 +2,4 @@ # simple JSON echo script for line in sys.stdin: - print json.dumps(json.loads(line)) + print(json.dumps(json.loads(line))) diff --git a/test/python/echo_text.py b/test/python/echo_text.py index 9dd2901..04e69d0 100644 --- a/test/python/echo_text.py +++ b/test/python/echo_text.py @@ -2,4 +2,4 @@ # simple JSON echo script for line in sys.stdin: - print line[:-1] + print(line[:-1]) diff --git a/test/python/echo_text_with_newline_control.py b/test/python/echo_text_with_newline_control.py new file mode 100644 index 0000000..0ce4fc2 --- /dev/null +++ b/test/python/echo_text_with_newline_control.py @@ -0,0 +1,5 @@ +import sys, json, os + +for line in sys.stdin: + line = line.replace('$', os.linesep) + print(line[:-1], end='') diff --git a/test/python/error.py b/test/python/error.py index b5ebc3f..32f03aa 100644 --- a/test/python/error.py +++ b/test/python/error.py @@ -1,6 +1,6 @@ # simple error script def divide_by_zero(): - print 1/0 + print(1/0) divide_by_zero() diff --git a/test/python/infinite_loop.py b/test/python/infinite_loop.py new file mode 100644 index 0000000..4e03907 --- /dev/null +++ b/test/python/infinite_loop.py @@ -0,0 +1,3 @@ +a = 0 +while(True): + a += 1 diff --git a/test/python/stderrLogging.py b/test/python/stderrLogging.py new file mode 100644 index 0000000..919d43f --- /dev/null +++ b/test/python/stderrLogging.py @@ -0,0 +1,21 @@ +# logging example taken from https://docs.python.org/3/howto/logging-cookbook.html +# Note that logging logs to stderr by default + +import logging + +# set up logging to file - see previous section for more details +logging.basicConfig(level=logging.DEBUG) + +# Now, we can log to the root logger, or any other logger. First the root... +logging.info('Jackdaws love my big sphinx of quartz.') + +# Now, define a couple of other loggers which might represent areas in your +# application: + +logger1 = logging.getLogger('log1') +logger2 = logging.getLogger('log2') + +logger1.debug('Quick zephyrs blow, vexing daft Jim.') +logger1.info('How quickly daft jumping zebras vex.') +logger2.warning('Jail zesty vixen who grabbed pay from quack.') +logger2.error('The five boxing wizards jump quickly.') \ No newline at end of file diff --git a/test/test-python-shell.js b/test/test-python-shell.js deleted file mode 100644 index 4898617..0000000 --- a/test/test-python-shell.js +++ /dev/null @@ -1,244 +0,0 @@ -var should = require('should'); -var PythonShell = require('..'); - -describe('PythonShell', function () { - - PythonShell.defaultOptions = { - scriptPath: './test/python' - }; - - describe('#ctor(script, options)', function () { - it('should spawn a Python process', function (done) { - var pyshell = new PythonShell('exit-code.py'); - pyshell.command.should.eql(['test/python/exit-code.py']); - pyshell.terminated.should.be.false; - pyshell.end(function (err) { - if (err) return done(err); - pyshell.terminated.should.be.true; - done(); - }); - }); - it('should spawn a Python process with options', function (done) { - var pyshell = new PythonShell('exit-code.py', { - pythonOptions: '-u' - }); - pyshell.command.should.eql(['-u', 'test/python/exit-code.py']); - pyshell.end(done); - }); - it('should spawn a Python process with script arguments', function (done) { - var pyshell = new PythonShell('echo_args.py', { - args: ['hello', 'world'] - }); - pyshell.command.should.eql(['test/python/echo_args.py', 'hello', 'world']); - pyshell.end(done); - }); - }); - - describe('#run(script, options)', function () { - it('should run the script and return output data', function (done) { - PythonShell.run('echo_args.py', { - args: ['hello', 'world'] - }, function (err, results) { - if (err) return done(err); - results.should.be.an.Array.and.have.lengthOf(2); - results.should.eql(['hello', 'world']); - done(); - }); - }); - it('should try to run the script and fail appropriately', function (done) { - PythonShell.run('unknown_script.py', function (err, results) { - err.should.be.an.Error; - err.exitCode.should.be.exactly(2); - done(); - }); - }); - it('should run the script and fail with an extended stack trace', function (done) { - PythonShell.run('error.py', function (err, results) { - err.should.be.an.Error; - err.exitCode.should.be.exactly(1); - err.stack.should.containEql('----- Python Traceback -----'); - done(); - }); - }); - }); - - describe('.send(message)', function () { - it('should send string messages when mode is "text"', function (done) { - var pyshell = new PythonShell('echo_text.py', { - mode: 'text' - }); - var output = ''; - pyshell.stdout.on('data', function (data) { - output += ''+data; - }); - pyshell.send('hello').send('world').end(function (err) { - if (err) return done(err); - output.should.be.exactly('hello\nworld\n'); - done(); - }); - }); - it('should send JSON messages when mode is "json"', function (done) { - var pyshell = new PythonShell('echo_json.py', { - mode: 'json' - }); - var output = ''; - pyshell.stdout.on('data', function (data) { - output += ''+data; - }); - pyshell.send({ a: 'b' }).send(null).send([1, 2, 3]).end(function (err) { - if (err) return done(err); - output.should.be.exactly('{"a": "b"}\nnull\n[1, 2, 3]\n'); - done(); - }); - }); - it('should use a custom formatter', function (done) { - var pyshell = new PythonShell('echo_text.py', { - formatter: function (message) { - return message.toUpperCase(); - } - }); - var output = ''; - pyshell.stdout.on('data', function (data) { - output += ''+data; - }); - pyshell.send('hello').send('world').end(function (err) { - if (err) return done(err); - output.should.be.exactly('HELLO\nWORLD\n'); - done(); - }); - }); - it('should write as-is when mode is "binary"', function (done) { - var pyshell = new PythonShell('echo_binary.py', { - mode: 'binary' - }); - var output = ''; - pyshell.stdout.on('data', function (data) { - output += ''+data; - }); - pyshell.send(new Buffer('i am not a string')).end(function (err) { - if (err) return done(err); - output.should.be.exactly('i am not a string'); - done(); - }); - }); - }); - - describe('.receive(data)', function () { - it('should emit messages as strings when mode is "text"', function (done) { - var pyshell = new PythonShell('echo_text.py', { - mode: 'text' - }); - var count = 0; - pyshell.on('message', function (message) { - count === 0 && message.should.be.exactly('hello'); - count === 1 && message.should.be.exactly('world'); - count++; - }).on('close', function () { - count.should.be.exactly(2); - }).send('hello').send('world').end(done); - }); - it('should emit messages as JSON when mode is "json"', function (done) { - var pyshell = new PythonShell('echo_json.py', { - mode: 'json' - }); - var count = 0; - pyshell.send({ a: 'b' }).send(null).send([1, 2, 3, 4, 5]); - pyshell.on('message', function (message) { - count === 0 && message.should.eql({ a: 'b' }); - count === 1 && should(message).eql(null); - count === 2 && message.should.eql([1, 2, 3, 4, 5]); - count++; - }).on('close', function () { - count.should.be.exactly(3); - }).end(done); - }); - it('should properly buffer partial messages', function (done) { - var pyshell = new PythonShell('echo_json.py', { - mode: 'json' - }); - pyshell.on('message', function (message) { - message.should.be.an.Object; - message.should.eql({ a: true }); - }).receive('{"a"').receive(':').receive('true}\n').end(done); - }); - it('should not be invoked when mode is "binary"', function (done) { - var pyshell = new PythonShell('echo_args.py', { - args: ['hello', 'world'], - mode: 'binary' - }); - pyshell.receive = function () { - throw new Error('should not emit messages in binary mode'); - }; - pyshell.end(done); - }); - it('should use a custom parser function', function (done) { - var pyshell = new PythonShell('echo_text.py', { - mode: 'text', - parser: function (message) { - return message.toUpperCase(); - } - }); - var count = 0; - pyshell.on('message', function (message) { - count === 0 && message.should.be.exactly('HELLO'); - count === 1 && message.should.be.exactly('WORLD!'); - count++; - }).on('close', function () { - count.should.be.exactly(2); - }).send('hello').send('world!').end(done); - }); - }); - - describe('.end(callback)', function () { - it('should end normally when exit code is zero', function (done) { - var pyshell = new PythonShell('exit-code.py'); - pyshell.end(function (err) { - if (err) return done(err); - pyshell.exitCode.should.be.exactly(0); - done(); - }); - }); - it('should emit error if exit code is not zero', function (done) { - var pyshell = new PythonShell('exit-code.py', { - args: 3 - }); - pyshell.on('error', function (err) { - err.should.have.properties({ - message: 'process exited with code 3', - exitCode: 3 - }); - done(); - }); - }); - it('should emit error when data is written to stderr', function (done) { - var pyshell = new PythonShell('error.py'); - pyshell.on('error', function (err) { - err.message.should.be.exactly('ZeroDivisionError: integer division or modulo by zero'); - err.should.have.property('traceback'); - err.traceback.should.containEql('Traceback (most recent call last)'); - done(); - }); - }); - }); - - describe('.parseError(data)', function () { - it('should extend error with context properties', function (done) { - var pyshell = new PythonShell('exit-code.py', { - args: 1 - }); - pyshell.on('error', function (err) { - err.should.have.properties(['exitCode', 'script', 'options', 'args']); - done(); - }); - }); - it('should extend err.stack with traceback', function (done) { - var pyshell = new PythonShell('error.py'); - pyshell.on('error', function (err) { - err.stack.should.containEql('----- Python Traceback -----'); - err.stack.should.containEql('File "test/python/error.py", line 6'); - err.stack.should.containEql('File "test/python/error.py", line 4'); - done(); - }); - }); - }); -}); diff --git a/test/test-python-shell.ts b/test/test-python-shell.ts new file mode 100644 index 0000000..3d5de81 --- /dev/null +++ b/test/test-python-shell.ts @@ -0,0 +1,644 @@ +import * as should from 'should'; +import { PythonShell } from '..'; +import { sep, join } from 'path'; +import { EOL as newline } from 'os'; +import { chdir, cwd } from 'process'; + +describe('PythonShell', function () { + const pythonFolder = 'test/python'; + + PythonShell.defaultOptions = { + scriptPath: pythonFolder, + }; + + describe('#ctor(script, options)', function () { + it('should spawn a Python process', function (done) { + // spawning python might take a while for the first time + // after this python should be in memory and not need extra time for startup + this.timeout(3000); + + let pyshell = new PythonShell('exit-code.py'); + pyshell.command.should.eql([ + 'test' + sep + 'python' + sep + 'exit-code.py', + ]); + pyshell.terminated.should.be.false; + pyshell.end(function (err) { + if (err) return done(err); + pyshell.terminated.should.be.true; + done(); + }); + }); + it('should spawn a Python process even if scriptPath option is not specified', function (done) { + let originalDirectory = cwd(); + PythonShell.defaultOptions = {}; + chdir(join(__dirname, 'python')); + + let pyshell = new PythonShell('exit-code.py'); + pyshell.command.should.eql(['exit-code.py']); + pyshell.terminated.should.be.false; + pyshell.end(function (err) { + if (err) return done(err); + pyshell.terminated.should.be.true; + done(); + }); + + //reset values to intial status + PythonShell.defaultOptions = { + scriptPath: pythonFolder, + }; + chdir(originalDirectory); + }); + // executing python-shell with a absolute path is tested in runString suite + it('should spawn a Python process with options', function (done) { + let pyshell = new PythonShell('exit-code.py', { + pythonOptions: ['-u'], + }); + pyshell.command.should.eql([ + '-u', + 'test' + sep + 'python' + sep + 'exit-code.py', + ]); + pyshell.end(done); + }); + it('should fail to spawn python with bad path', function (done) { + let pyshell = new PythonShell('exit-code.py', { + pythonPath: 'foeisjofseij', + }); + pyshell.on('error', (err) => { + err.code.should.eql('ENOENT'); + done(); + }); + }); + it('should spawn a Python process with script arguments', function (done) { + let pyshell = new PythonShell('echo_args.py', { + args: ['hello', 'world'], + }); + pyshell.command.should.eql([ + 'test' + sep + 'python' + sep + 'echo_args.py', + 'hello', + 'world', + ]); + pyshell.end(done); + }); + }); + + describe('#checkSyntax(code:string)', function () { + // note checkSyntax is a wrapper around checkSyntaxFile + // so this tests checkSyntaxFile as well + + it('should check syntax', function (done) { + PythonShell.checkSyntax('x=1').then(() => { + done(); + }); + }); + + it('should invalidate bad syntax', function (done) { + PythonShell.checkSyntax('x=').catch(() => { + done(); + }); + }); + }); + + // #158 these tests are failing on appveyor windows node 8/10 python 2/3 + // but they work locally on my windows machine ..... + // these methods are not that important so just commenting out tests untill someone fixes them + // describe("#getVersion", function(){ + // it('should return a string', function(done){ + // PythonShell.getVersion().then((out)=>{ + // const version = out.stdout + // version.should.be.a.String(); + // version.length.should.be.greaterThan(0) + // done() + // }) + // }) + // }) + + // describe("#getVersionSync", function(){ + // it('should return a string', function(){ + // const version = PythonShell.getVersionSync() + // version.should.be.a.String(); + // version.length.should.be.greaterThan(0) + // }) + // }) + + describe('#runString(script, options)', function () { + before(() => { + PythonShell.defaultOptions = {}; + }); + it('should be able to execute a string of python code', function (done) { + PythonShell.runString('print("hello");print("world")', null).then( + (results) => { + results.should.be.an.Array().and.have.lengthOf(2); + results.should.eql(['hello', 'world']); + done(); + }, + ); + }); + it('should be able to execute a string of python code using promises', async function () { + let results = await PythonShell.runString( + 'print("hello");print("world")', + ); + results.should.be.an.Array().and.have.lengthOf(2); + results.should.eql(['hello', 'world']); + }); + it('should be able to execute a string of python code async', async function () { + let results = await PythonShell.runString( + 'print("hello");print("world")', + ); + results.should.be.an.Array().and.have.lengthOf(2); + results.should.eql(['hello', 'world']); + }); + after(() => { + PythonShell.defaultOptions = { + // reset to match initial value + scriptPath: pythonFolder, + }; + }); + }); + + describe('#run(script, options)', function () { + it('should run the script and return output data using callbacks', function (done) { + PythonShell.run('echo_args.py', { + args: ['hello', 'world'], + }).then((results) => { + results.should.be.an.Array().and.have.lengthOf(2); + results.should.eql(['hello', 'world']); + done(); + }); + }); + it('should run the script and return output data async', async function () { + let results = await PythonShell.run('echo_args.py', { + args: ['hello', 'world'], + }); + results.should.be.an.Array().and.have.lengthOf(2); + results.should.eql(['hello', 'world']); + }); + it('should try to run the script and fail appropriately', function (done) { + PythonShell.run('unknown_script.py', null).catch((err) => { + err.should.be.an.Error; + err.exitCode.should.be.exactly(2); + done(); + }); + }); + it('should try to run the script and fail appropriately - async', async function () { + try { + let results = await PythonShell.run('unknown_script.py'); + throw new Error( + `should not get here because the script should fail` + results, + ); + } catch (err) { + err.should.be.an.Error; + err.exitCode.should.be.exactly(2); + } + }); + it('should include both output and error', function (done) { + PythonShell.run('echo_hi_then_error.py', null) + .then((results) => { + done('Error: This promise should never successfully resolve'); + }) + .catch((err) => { + err.logs.should.eql(['hi']); + err.should.be.an.Error; + done(); + }); + }); + it('should run the script and fail with an extended stack trace', function (done) { + PythonShell.run('error.py', null).catch((err) => { + err.should.be.an.Error; + err.exitCode.should.be.exactly(1); + err.stack.should.containEql('----- Python Traceback -----'); + done(); + }); + }); + it('should run the script and fail with an extended stack trace even when mode is binary', function (done) { + PythonShell.run('error.py', { mode: 'binary' }).catch((err) => { + err.should.be.an.Error; + err.exitCode.should.be.exactly(1); + err.stack.should.containEql('----- Python Traceback -----'); + done(); + }); + }); + it('should run multiple scripts and fail with an extended stack trace for each of them', function (done) { + let numberOfTimesToRun = 5; + for (let i = 0; i < numberOfTimesToRun; i++) { + runSingleErrorScript(end); + } + let count = 0; + function end() { + count++; + if (count === numberOfTimesToRun) { + done(); + } + } + function runSingleErrorScript(callback) { + PythonShell.run('error.py', null).catch((err) => { + err.should.be.an.Error; + err.exitCode.should.be.exactly(1); + err.stack.should.containEql('----- Python Traceback -----'); + callback(); + }); + } + }); + + it('should run multiple scripts and return output data for each of them', function (done) { + let numberOfTimesToRun = 5; + for (let i = 0; i < numberOfTimesToRun; i++) { + runSingleScript(end); + } + let count = 0; + function end() { + count++; + if (count === numberOfTimesToRun) { + done(); + } + } + function runSingleScript(callback) { + PythonShell.run('echo_args.py', { + args: ['hello', 'world'], + }).then((results) => { + results.should.be.an.Array().and.have.lengthOf(2); + results.should.eql(['hello', 'world']); + callback(); + }); + } + }); + + it('should be able to run modules', function (done) { + PythonShell.defaultOptions = {}; + + PythonShell.run('-m', { + args: ['timeit', '-n 1', `'x=5'`], + }).then((results) => { + PythonShell.defaultOptions = { + // reset to match initial value + scriptPath: pythonFolder, + }; + results.should.be.an.Array(); + results[0].should.be.an.String(); + results[0].slice(0, 6).should.eql('1 loop'); + done(); + }); + }); + + after(() => { + // should be able to run modules test should theoretically reset this + // but we have this to in case something goes horribly wrong with the test + PythonShell.defaultOptions = { + // reset to match initial value + scriptPath: pythonFolder, + }; + }); + + it('should run PythonShell normally without access to std streams', async function () { + var pyshell = await PythonShell.run('exit-code.py', { + // 3 different ways of assigning values to the std streams in child_process.spawn() + // * ignore - pipe to /dev/null + // * inherit - inherit fd from parent process; + // * process.stderr - pass output directly to that stream. + stdio: ['ignore', 'inherit', process.stderr], + // @ts-expect-error python-shell technically allows a non-array arg, + // although the user shouldn't be doing this. We are just testing for + // increased code coverage + args: '0', + }); + + should(pyshell).be.eql([]); + }); + }); + + describe('.send(message)', function () { + it('should send string messages when mode is "text"', function (done) { + let pyshell = new PythonShell('echo_text.py', { + mode: 'text', + }); + let output = ''; + pyshell.stdout.on('data', function (data) { + output += '' + data; + }); + pyshell + .send('hello') + .send('world') + .end(function (err) { + if (err) return done(err); + output.should.be.exactly('hello' + newline + 'world' + newline); + done(); + }); + }); + it('should send JSON messages when mode is "json"', function (done) { + let pyshell = new PythonShell('echo_json.py', { + mode: 'json', + }); + let output = ''; + pyshell.stdout.on('data', function (data) { + output += '' + data; + }); + pyshell + .send({ a: 'b' }) + .send(null) + .send([1, 2, 3]) + .end(function (err) { + if (err) return done(err); + output.should.be.exactly( + '{"a": "b"}' + newline + 'null' + newline + '[1, 2, 3]' + newline, + ); + done(); + }); + }); + it('should use a custom formatter', function (done) { + let pyshell = new PythonShell('echo_text.py', { + formatter: function (message) { + return message.toUpperCase(); + }, + }); + let output = ''; + pyshell.stdout.on('data', function (data) { + output += '' + data; + }); + pyshell + .send('hello') + .send('world') + .end(function (err) { + if (err) return done(err); + output.should.be.exactly('HELLO' + newline + 'WORLD' + newline + ''); + done(); + }); + }); + it('should write as-is when mode is "binary"', function (done) { + let pyshell = new PythonShell('echo_binary.py', { + mode: 'binary', + }); + let output = ''; + pyshell.stdout.on('data', function (data) { + output += '' + data; + }); + pyshell.send(Buffer.from('i am not a string')).end(function (err) { + if (err) return done(err); + output.should.be.exactly('i am not a string'); + done(); + }); + }); + }); + + describe('stdout', function () { + it('should emit messages as strings when mode is "text"', function (done) { + let pyshell = new PythonShell('echo_text.py', { + mode: 'text', + }); + let count = 0; + pyshell + .on('message', function (message) { + count === 0 && message.should.be.exactly('hello'); + count === 1 && message.should.be.exactly('world'); + count++; + }) + .on('close', function () { + count.should.be.exactly(2); + }) + .send('hello') + .send('world') + .end(done); + }); + it('should emit messages as JSON when mode is "json"', function (done) { + let pyshell = new PythonShell('echo_json.py', { + mode: 'json', + }); + let count = 0; + pyshell.send({ a: 'b' }).send(null).send([1, 2, 3, 4, 5]); + pyshell + .on('message', function (message) { + count === 0 && message.should.eql({ a: 'b' }); + count === 1 && should(message).eql(null); + count === 2 && message.should.eql([1, 2, 3, 4, 5]); + count++; + }) + .on('close', function () { + count.should.be.exactly(3); + }) + .end(done); + }); + it('should properly buffer partial messages', function (done) { + // echo_text_with_newline_control echoes text with $'s replaced with newlines + let pyshell = new PythonShell('echo_text_with_newline_control.py', { + mode: 'text', + }); + pyshell + .on('message', (message) => { + console.log(message); + let messageObject = JSON.parse(message); + messageObject.should.be.an.Object; + messageObject.should.eql({ a: true }); + }) + .send('{"a"') + .send(':') + .send('true}${') + .send('"a":true}$') + .end(() => { + done(); + }); + }); + it('should not be invoked when mode is "binary"', function (done) { + let pyshell = new PythonShell('echo_args.py', { + args: ['hello', 'world'], + mode: 'binary', + }); + pyshell.on('message', () => { + done('should not emit messages in binary mode'); + return undefined; + }); + pyshell.end(done); + }); + it('should use a custom parser function', function (done) { + let pyshell = new PythonShell('echo_text.py', { + mode: 'text', + parser: function (message) { + return message.toUpperCase(); + }, + }); + let count = 0; + pyshell + .on('message', function (message) { + count === 0 && message.should.be.exactly('HELLO'); + count === 1 && message.should.be.exactly('WORLD!'); + count++; + }) + .on('close', function () { + count.should.be.exactly(2); + }) + .send('hello') + .send('world!') + .end(done); + }); + }); + + describe('stderr', function () { + it('should emit stderr logs as strings when mode is "text"', function (done) { + let pyshell = new PythonShell('stderrLogging.py', { + mode: 'text', + }); + let count = 0; + pyshell + .on('stderr', function (stderr) { + count === 0 && + stderr.should.be.exactly( + 'INFO:root:Jackdaws love my big sphinx of quartz.', + ); + count === 1 && + stderr.should.be.exactly( + 'DEBUG:log1:Quick zephyrs blow, vexing daft Jim.', + ); + count++; + }) + .on('close', function () { + count.should.be.exactly(5); + }) + .send('hello') + .send('world') + .end(done); + }); + it('should not be invoked when mode is "binary"', function (done) { + let pyshell = new PythonShell('stderrLogging.py', { + stderrParser: 'binary', + }); + pyshell.on('stderr', () => { + done('should not emit stderr in binary mode'); + }); + pyshell.end(() => { + done(); + }); + }); + it('should use a custom parser function', function (done) { + let pyshell = new PythonShell('stderrLogging.py', { + mode: 'text', + stderrParser: function (stderr) { + return stderr.toUpperCase(); + }, + }); + let count = 0; + pyshell + .on('stderr', function (stderr) { + count === 0 && + stderr.should.be.exactly( + 'INFO:ROOT:JACKDAWS LOVE MY BIG SPHINX OF QUARTZ.', + ); + count === 1 && + stderr.should.be.exactly( + 'DEBUG:LOG1:QUICK ZEPHYRS BLOW, VEXING DAFT JIM.', + ); + count++; + }) + .on('close', function () { + count.should.be.exactly(5); + }) + .send('hello') + .send('world!') + .end(done); + }); + }); + + describe('.end(callback)', function () { + it('should end normally when exit code is zero', function (done) { + let pyshell = new PythonShell('exit-code.py'); + pyshell.end(function (err, code, signal) { + if (err) return done(err); + code.should.be.exactly(0); + done(); + }); + }); + it('should emit error if exit code is not zero', function (done) { + let pyshell = new PythonShell('exit-code.py', { + args: ['3'], + }); + pyshell.on('pythonError', function (err) { + err.should.have.properties({ + message: 'process exited with code 3', + exitCode: 3, + }); + done(); + }); + }); + it('should emit error when the program exits because of an unhandled exception', function (done) { + let pyshell = new PythonShell('error.py'); + pyshell.on('pythonError', function (err) { + err.message.should.be.equalOneOf( + 'ZeroDivisionError: integer division or modulo by zero', + 'ZeroDivisionError: division by zero', + ); + err.should.have.property('traceback'); + err.traceback.should.containEql('Traceback (most recent call last)'); + done(); + }); + }); + it('should NOT emit error when logging is written to stderr', function (done) { + let pyshell = new PythonShell('stderrLogging.py'); + pyshell.on('pythonError', function (err) { + done(new Error('an error should not have been raised')); + }); + pyshell.on('close', function () { + done(); + }); + }); + }); + + describe('.parseError(data)', function () { + it('should extend error with context properties', function (done) { + let pyshell = new PythonShell('exit-code.py', { + args: ['1'], + }); + pyshell.on('pythonError', function (err) { + err.should.have.properties(['exitCode', 'script', 'options', 'args']); + done(); + }); + }); + it('should extend err.stack with traceback', function (done) { + let pyshell = new PythonShell('error.py'); + pyshell.on('pythonError', function (err) { + err.stack.should.containEql('----- Python Traceback -----'); + err.stack.should.containEql( + 'test' + sep + 'python' + sep + 'error.py", line 4', + ); + err.stack.should.containEql( + 'test' + sep + 'python' + sep + 'error.py", line 6', + ); + done(); + }); + }); + it('should work in json mode', function (done) { + let pyshell = new PythonShell('error.py', { mode: 'json' }); + pyshell.on('pythonError', function (err) { + err.stack.should.containEql('----- Python Traceback -----'); + err.stack.should.containEql( + 'test' + sep + 'python' + sep + 'error.py", line 4', + ); + err.stack.should.containEql( + 'test' + sep + 'python' + sep + 'error.py", line 6', + ); + done(); + }); + }); + }); + + describe('.kill()', function () { + it('set terminated to correct value', function (done) { + let pyshell = new PythonShell('infinite_loop.py'); + pyshell.kill(); + pyshell.terminated.should.be.true; + done(); + }); + it('run the end callback if specified', function (done) { + let pyshell = new PythonShell('infinite_loop.py'); + pyshell.end(() => { + done(); + }); + pyshell.kill(); + }); + it('kill with correct signal', function (done) { + let pyshell = new PythonShell('infinite_loop.py'); + pyshell.terminated.should.be.false; + pyshell.kill('SIGKILL'); + pyshell.terminated.should.be.true; + setTimeout(() => { + pyshell.exitSignal.should.be.exactly('SIGKILL'); + done(); + }, 500); + }); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a8f1cba --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["es6"], + "sourceMap": true, + "rootDir": ".", + "declaration": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": ["node_modules", "personal"] +}