删除 node_modules

This commit is contained in:
2025-06-22 17:27:35 +08:00
parent ebcd00ed99
commit 912d2d4a12
3852 changed files with 0 additions and 1061355 deletions

View File

@@ -1,13 +0,0 @@
/**
Delays the promise for the given duration.
@example
```
import {delay} from 'unicorn-magic';
await delay({seconds: 1});
console.log('1 second later');
```
*/
export function delay(duration: {seconds: number} | {milliseconds: number}): Promise<void>;

View File

@@ -1,14 +0,0 @@
export async function delay({seconds, milliseconds} = {}) {
let duration;
if (typeof seconds === 'number') {
duration = seconds * 1000;
} else if (typeof milliseconds === 'number') {
duration = milliseconds;
} else {
throw new TypeError('Expected an object with either `seconds` or `milliseconds`.');
}
return new Promise(resolve => {
setTimeout(resolve, duration);
});
}

9
node_modules/unicorn-magic/license generated vendored
View File

@@ -1,9 +0,0 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

125
node_modules/unicorn-magic/node.d.ts generated vendored
View File

@@ -1,125 +0,0 @@
import {
type ExecFileOptionsWithStringEncoding,
type ExecFileSyncOptionsWithStringEncoding,
type PromiseWithChild,
} from 'node:child_process';
/**
Converts a `URL` or path to a path.
__Not available in browsers.__
@example
```
import path from 'node:path';
import {toPath} from 'unicorn-magic';
// `cwd` can be `URL` or a path string.
const getUnicornPath = cwd => path.join(toPath(cwd), 'unicorn');
```
*/
export function toPath(urlOrPath: URL | string): string;
/**
Finds the root directory of the given path.
__Not available in browsers.__
On Unix-based systems, the root is always `'/'`.
On Windows, the root varies and includes the drive letter (e.g., `'C:\\'`).
This function operates purely on paths and does not interact with the file system.
@param path - The path or URL to check.
@returns The root directory of the path.
@example
```
import {rootDirectory} from 'unicorn-magic';
console.log(rootDirectory('/Users/x/y/z'));
//=> '/'
console.log(rootDirectory('C:\\Users\\x\\y\\z'));
//=> 'C:\\'
```
*/
export function rootDirectory(path: string | URL): string;
/**
Creates an iterable for traversing from a given start path up to the root directory.
__Not available in browsers.__
This function operates purely on paths and does not interact with the file system.
@param startPath - The starting path. Can be relative.
@returns An iterable that iterates over each parent directory up to the root.
Tip: To stop iteration before reaching the root, use a `break` statement within a conditional check.
@example
```
import {traversePathUp} from 'unicorn-magic';
for (const directory of traversePathUp('/Users/x/y/z')) {
console.log(directory);
//=> '/Users/x/y/z'
//=> '/Users/x/y'
//=> '/Users/x'
//=> '/Users'
//=> '/'
}
```
*/
export function traversePathUp(startPath: string | URL): Iterable<string>;
/**
Executes a file.
Same as the built-in `execFile` but with:
- Promise API
- 10 MB `maxBuffer` instead of 1 MB
@example
```
import {execFile} from 'unicorn-magic';
console.log(await execFile('ls', ['-l']));
```
__Not available in browsers.__
*/
export function execFile(
file: string,
arguments_: readonly string[],
options?: ExecFileOptionsWithStringEncoding
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
/**
Executes a file synchronously.
Same as the built-in `execFileSync` but with:
- String output instead of buffer (same as `execFile`)
- Does not output `stderr` to the terminal by default (same as `execFile`)
- 10 MB `maxBuffer` instead of 1 MB
@example
```
import {execFileSync} from 'unicorn-magic';
console.log(execFileSync('ls', ['-l']));
```
__Not available in browsers.__
*/
export function execFileSync(
file: string,
arguments_?: readonly string[],
options?: ExecFileSyncOptionsWithStringEncoding
): string;
export * from './default.js';

49
node_modules/unicorn-magic/node.js generated vendored
View File

@@ -1,49 +0,0 @@
import {promisify} from 'node:util';
import {execFile as execFileCallback, execFileSync as execFileSyncOriginal} from 'node:child_process';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
const execFileOriginal = promisify(execFileCallback);
export function toPath(urlOrPath) {
return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
}
export function rootDirectory(pathInput) {
return path.parse(toPath(pathInput)).root;
}
export function traversePathUp(startPath) {
return {
* [Symbol.iterator]() {
let currentPath = path.resolve(toPath(startPath));
let previousPath;
while (previousPath !== currentPath) {
yield currentPath;
previousPath = currentPath;
currentPath = path.resolve(currentPath, '..');
}
},
};
}
const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
export async function execFile(file, arguments_, options = {}) {
return execFileOriginal(file, arguments_, {
maxBuffer: TEN_MEGABYTES_IN_BYTES,
...options,
});
}
export function execFileSync(file, arguments_ = [], options = {}) {
return execFileSyncOriginal(file, arguments_, {
maxBuffer: TEN_MEGABYTES_IN_BYTES,
encoding: 'utf8',
stdio: 'pipe',
...options,
});
}
export * from './default.js';

View File

@@ -1,62 +0,0 @@
{
"name": "unicorn-magic",
"version": "0.3.0",
"description": "Some useful utilities I often need",
"license": "MIT",
"repository": "sindresorhus/unicorn-magic",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"node": {
"types": "./node.d.ts",
"import": "./node.js"
},
"default": {
"types": "./default.d.ts",
"import": "./default.js"
}
},
"sideEffects": false,
"engines": {
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsc node.d.ts"
},
"files": [
"node.js",
"node.d.ts",
"default.js",
"default.d.ts"
],
"keywords": [
"utilities",
"util",
"extras",
"url",
"path",
"delay",
"wait",
"settimeout",
"sleep",
"child_process",
"child",
"process",
"subprocess",
"exec",
"execfile",
"execfilesync"
],
"devDependencies": {
"ava": "^6.1.3",
"in-range": "^3.0.0",
"time-span": "^5.1.0",
"typescript": "^5.5.4",
"xo": "^0.59.2"
}
}

25
node_modules/unicorn-magic/readme.md generated vendored
View File

@@ -1,25 +0,0 @@
# unicorn-magic
> Some useful utilities I often need
*I'm not accepting requests.*
## Install
```sh
npm install unicorn-magic
```
## Usage
```js
import {delay} from 'unicorn-magic';
await delay({seconds: 1});
console.log('1 second later');
```
## API
See [the types](index.d.ts).