first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

22
node_modules/@expo/spawn-async/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 650 Industries
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

66
node_modules/@expo/spawn-async/README.md generated vendored Normal file
View File

@@ -0,0 +1,66 @@
# spawn-async [![Tests](https://github.com/expo/spawn-async/actions/workflows/main.yml/badge.svg)](https://github.com/expo/spawn-async/actions/workflows/main.yml)
A cross-platform version of Node's `child_process.spawn` as an async function that returns a promise. Supports Node 12 LTS and up.
## Usage:
```js
import spawnAsync from '@expo/spawn-async';
(async function () {
let resultPromise = spawnAsync('echo', ['hello', 'world']);
let spawnedChildProcess = resultPromise.child;
try {
let {
pid,
output: [stdout, stderr],
stdout,
stderr,
status,
signal,
} = await resultPromise;
} catch (e) {
console.error(e.stack);
// The error object also has the same properties as the result object
}
})();
```
## API
`spawnAsync` takes the same arguments as [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). Its options are the same as those of `child_process.spawn` plus:
- `ignoreStdio`: whether to ignore waiting for the child process's stdio streams to close before resolving the result promise. When ignoring stdio, the returned values for `stdout` and `stderr` will be empty strings. The default value of this option is `false`.
It returns a promise whose result is an object with these properties:
- `pid`: the process ID of the spawned child process
- `output`: an array with stdout and stderr's output
- `stdout`: a string of what the child process wrote to stdout
- `stderr`: a string of what the child process wrote to stderr
- `status`: the exit code of the child process
- `signal`: the signal (ex: `SIGTERM`) used to stop the child process if it did not exit on its own
If there's an error running the child process or it exits with a non-zero status code, `spawnAsync` rejects the returned promise. The Error object also has the properties listed above.
### Accessing the child process
Sometimes you may want to access the child process object--for example, if you wanted to attach event handlers to `stdio` or `stderr` and process data as it is available instead of waiting for the process to be resolved.
You can do this by accessing `.child` on the Promise that is returned by `spawnAsync`.
Here is an example:
```js
(async () => {
let ffmpeg$ = spawnAsync('ffmpeg', ['-i', 'path/to/source.flac', '-codec:a', 'libmp3lame', '-b:a', '320k', '-ar', '44100', 'path/to/output.mp3']);
let childProcess = ffmpeg$.child;
childProcess.stdout.on('data', (data) => {
console.log(`ffmpeg stdout: ${data}`);
});
childProcess.stderr.on('data', (data) => {
console.error(`ffmpeg stderr: ${data}`);
});
let result = await ffmpeg$;
console.log(`ffmpeg pid ${result.pid} exited with code ${result.code}`);
})();
```

20
node_modules/@expo/spawn-async/build/spawnAsync.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/// <reference types="node" />
import { ChildProcess, SpawnOptions as NodeSpawnOptions } from 'child_process';
declare namespace spawnAsync {
interface SpawnOptions extends NodeSpawnOptions {
ignoreStdio?: boolean;
}
interface SpawnPromise<T> extends Promise<T> {
child: ChildProcess;
}
interface SpawnResult {
pid?: number;
output: string[];
stdout: string;
stderr: string;
status: number | null;
signal: string | null;
}
}
declare function spawnAsync(command: string, args?: ReadonlyArray<string>, options?: spawnAsync.SpawnOptions): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
export = spawnAsync;

84
node_modules/@expo/spawn-async/build/spawnAsync.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const cross_spawn_1 = __importDefault(require("cross-spawn"));
function spawnAsync(command, args, options = {}) {
const stubError = new Error();
const callerStack = stubError.stack ? stubError.stack.replace(/^.*/, ' ...') : null;
let child;
let promise = new Promise((resolve, reject) => {
let { ignoreStdio, ...nodeOptions } = options;
// @ts-ignore: cross-spawn declares "args" to be a regular array instead of a read-only one
child = (0, cross_spawn_1.default)(command, args, nodeOptions);
let stdout = '';
let stderr = '';
if (!ignoreStdio) {
if (child.stdout) {
child.stdout.on('data', (data) => {
stdout += data;
});
}
if (child.stderr) {
child.stderr.on('data', (data) => {
stderr += data;
});
}
}
let completionListener = (code, signal) => {
child.removeListener('error', errorListener);
let result = {
pid: child.pid,
output: [stdout, stderr],
stdout,
stderr,
status: code,
signal,
};
if (code !== 0) {
let argumentString = args && args.length > 0 ? ` ${args.join(' ')}` : '';
let error = signal
? new Error(`${command}${argumentString} exited with signal: ${signal}`)
: new Error(`${command}${argumentString} exited with non-zero code: ${code}`);
if (error.stack && callerStack) {
error.stack += `\n${callerStack}`;
}
Object.assign(error, result);
reject(error);
}
else {
resolve(result);
}
};
let errorListener = (error) => {
if (ignoreStdio) {
child.removeListener('exit', completionListener);
}
else {
child.removeListener('close', completionListener);
}
Object.assign(error, {
pid: child.pid,
output: [stdout, stderr],
stdout,
stderr,
status: null,
signal: null,
});
reject(error);
};
if (ignoreStdio) {
child.once('exit', completionListener);
}
else {
child.once('close', completionListener);
}
child.once('error', errorListener);
});
// @ts-ignore: TypeScript isn't aware the Promise constructor argument runs synchronously and
// thinks `child` is not yet defined
promise.child = child;
return promise;
}
module.exports = spawnAsync;
//# sourceMappingURL=spawnAsync.js.map

File diff suppressed because one or more lines are too long

53
node_modules/@expo/spawn-async/package.json generated vendored Normal file
View File

@@ -0,0 +1,53 @@
{
"name": "@expo/spawn-async",
"version": "1.7.2",
"description": "A Promise-based interface into processes created by child_process.spawn",
"main": "./build/spawnAsync.js",
"types": "./build/spawnAsync.d.ts",
"files": [
"build",
"!build/**/__tests__"
],
"engines": {
"node": ">=12"
},
"scripts": {
"build": "tsc",
"clean": "rm -rf build",
"prepare": "yarn clean && yarn build",
"start": "tsc --watch",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/expo/spawn-async.git"
},
"keywords": [
"spawn",
"child_process",
"async",
"promise",
"process"
],
"author": "Expo",
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/spawn-async/issues"
},
"homepage": "https://github.com/expo/spawn-async#readme",
"jest": {
"preset": "ts-jest",
"rootDir": "src"
},
"dependencies": {
"cross-spawn": "^7.0.3"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.2",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"jest": "^29.5.0",
"ts-jest": "^29.0.5",
"typescript": "^5.0.2"
}
}