Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

21
Frontend-Learner/node_modules/unenv/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io>
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.

211
Frontend-Learner/node_modules/unenv/README.md generated vendored Normal file
View file

@ -0,0 +1,211 @@
# 🕊️ unenv
<!-- automd:badges color=yellow packagephobia -->
[![npm version](https://img.shields.io/npm/v/unenv?color=yellow)](https://npmjs.com/package/unenv)
[![npm downloads](https://img.shields.io/npm/dm/unenv?color=yellow)](https://npm.chart.dev/unenv)
[![install size](https://badgen.net/packagephobia/install/unenv?color=yellow)](https://packagephobia.com/result?p=unenv)
<!-- /automd -->
> [!NOTE]
> You are on the development (v2) branch. Check out [v1](https://github.com/unjs/unenv/tree/v1) for the current release.
unenv provides polyfills to add [Node.js](https://nodejs.org/) compatibility for any JavaScript runtime, including browsers and edge workers.
## 🌟 Used by
- [Nitro](https://nitro.build/)
- [Nuxt](https://nuxt.com/)
- [Cloudflare](https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
- [ESM.sh](https://esm.sh/)
## Usage
The `defineEnv` utility can generate a target environment configuration.
```js
import { defineEnv } from "unenv";
const { env } = defineEnv({
nodeCompat: true,
npmShims: true,
resolve: true,
overrides: {},
presets: [],
});
const { alias, inject, external, polyfill } = env;
```
You can then integrate the env object with your build tool:
<details>
| Bundler | `alias` | `inject` | `external` |
| -------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| rollup | [`@rollup/plugin-alias`](https://www.npmjs.com/package/@rollup/plugin-alias) | [`@rollup/plugin-inject`](https://www.npmjs.com/package/@rollup/plugin-inject) | [`external`](https://rollupjs.org/configuration-options/#external) |
| rolldown | [`resolve.alias`](https://rolldown.rs/reference/config-options#resolve-alias) | [`inject`](https://rolldown.rs/reference/config-options#inject) | [`external`](https://rolldown.rs/reference/config-options#external) |
| vite | [`resolve.alias`](https://vite.dev/config/shared-options#resolve-alias) | [`@rollup/plugin-inject`](https://www.npmjs.com/package/@rollup/plugin-inject) | [`ssr.external`](https://vite.dev/config/ssr-options#ssr-external) |
| esbuild | [`alias`](https://esbuild.github.io/api/#alias) | [`inject`](https://esbuild.github.io/api/#inject) | [`external`](https://esbuild.github.io/api/#external) |
| rspack | [`resolve.alias`](https://rspack.dev/config/resolve#resolvealias) | - | [`externals`](https://rspack.dev/config/externals#externals-1) |
| webpack | [`resolve.alias`](https://webpack.js.org/configuration/resolve/#resolvealias) | [`webpack-plugin-inject`](https://www.npmjs.com/package/webpack-inject-plugin) | [`externals`](https://webpack.js.org/configuration/externals/#externals) |
</details>
### Options
- `nodeCompat`: (default: `true`)
- Add `alias` entries for Node.js builtins as `<id>` and `node:<id>`.
- Add `inject` entries for Node.js globals `global`, `Buffer`, and `process`.
- `npmShims`: (default: `false`)
- Add `alias` entries to replace npm packages like `node-fetch` with lighter shims.
- `resolve`: (default: `false`) Resolve config values to absolute paths.
- `overrides`: Additional overrides for env config.
- `presets`: Additional presets (for example [`@cloudflare/unenv-preset`](https://npmjs.com/@cloudflare/unenv-preset/)).
### `unenv/` polyfills
You can also directly import `unenv/` polyfills:
| Polyfills | Description | Source |
| ------------------ | ---------------------------------- | -------------------------------------------------------------------------------------- |
| `unenv/mock/*` | Mocking utils | [`src/runtime/mock`](https://github.com/unjs/unenv/tree/main/src/runtime/mock) |
| `unenv/node/*` | APIs compatible with `Node.js` API | [`src/runtime/node`](https://github.com/unjs/unenv/tree/main/src/runtime/node) |
| `unenv/npm/*` | NPM package shims | [`src/runtime/npm`](https://github.com/unjs/unenv/tree/main/src/runtime/npm) |
| `unenv/polyfill/*` | Global polyfills | [`src/runtime/polyfill`](https://github.com/unjs/unenv/tree/main/src/runtime/polyfill) |
| `unenv/web/*` | Subset of Web APIs | [`src/runtime/web`](https://github.com/unjs/unenv/tree/main/src/runtime/web) |
## Node.js compatibility
`unenv` replaces Node.js built-in modules compatible with any runtime [(view source)](./src/runtime/node).
<details>
<!-- automd:file src="./coverage/unenv.md" -->
- ✅ [node:assert](https://nodejs.org/api/assert.html)
- ✅ [node:assert/strict](https://nodejs.org/api/assert.html)
- ✅ [node:async_hooks](https://nodejs.org/api/async_hooks.html)
- ✅ [node:buffer](https://nodejs.org/api/buffer.html)
- ✅ [node:child_process](https://nodejs.org/api/child_process.html)
- ✅ [node:cluster](https://nodejs.org/api/cluster.html)
- ✅ [node:console](https://nodejs.org/api/console.html)
- ✅ [node:constants](https://nodejs.org/api/constants.html)
- ✅ [node:crypto](https://nodejs.org/api/crypto.html)
- ✅ [node:dgram](https://nodejs.org/api/dgram.html)
- ✅ [node:diagnostics_channel](https://nodejs.org/api/diagnostics_channel.html)
- ✅ [node:dns](https://nodejs.org/api/dns.html)
- ✅ [node:dns/promises](https://nodejs.org/api/dns.html)
- ✅ [node:domain](https://nodejs.org/api/domain.html)
- ✅ [node:events](https://nodejs.org/api/events.html)
- ✅ [node:fs](https://nodejs.org/api/fs.html)
- ✅ [node:fs/promises](https://nodejs.org/api/fs.html)
- ✅ [node:http](https://nodejs.org/api/http.html)
- ✅ [node:http2](https://nodejs.org/api/http2.html)
- ✅ [node:https](https://nodejs.org/api/https.html)
- ✅ [node:inspector](https://nodejs.org/api/inspector.html)
- ✅ [node:inspector/promises](https://nodejs.org/api/inspector.html)
- ✅ [node:module](https://nodejs.org/api/module.html)
- ✅ [node:net](https://nodejs.org/api/net.html)
- ✅ [node:os](https://nodejs.org/api/os.html)
- ✅ [node:path](https://nodejs.org/api/path.html)
- ✅ [node:path/posix](https://nodejs.org/api/path.html)
- ✅ [node:path/win32](https://nodejs.org/api/path.html)
- ✅ [node:perf_hooks](https://nodejs.org/api/perf_hooks.html)
- ✅ [node:process](https://nodejs.org/api/process.html)
- ✅ [node:punycode](https://nodejs.org/api/punycode.html)
- ✅ [node:querystring](https://nodejs.org/api/querystring.html)
- ✅ [node:readline](https://nodejs.org/api/readline.html)
- ✅ [node:readline/promises](https://nodejs.org/api/readline.html)
- ✅ [node:repl](https://nodejs.org/api/repl.html)
- ✅ [node:stream](https://nodejs.org/api/stream.html)
- ✅ [node:stream/consumers](https://nodejs.org/api/stream.html)
- ✅ [node:stream/promises](https://nodejs.org/api/stream.html)
- ✅ [node:stream/web](https://nodejs.org/api/stream.html)
- ✅ [node:string_decoder](https://nodejs.org/api/string_decoder.html)
- ✅ [node:sys](https://nodejs.org/api/sys.html)
- ✅ [node:timers](https://nodejs.org/api/timers.html)
- ✅ [node:timers/promises](https://nodejs.org/api/timers.html)
- ✅ [node:tls](https://nodejs.org/api/tls.html)
- ✅ [node:trace_events](https://nodejs.org/api/trace_events.html)
- ✅ [node:tty](https://nodejs.org/api/tty.html)
- ✅ [node:url](https://nodejs.org/api/url.html)
- ✅ [node:util](https://nodejs.org/api/util.html)
- ✅ [node:util/types](https://nodejs.org/api/util.html)
- ✅ [node:v8](https://nodejs.org/api/v8.html)
- ✅ [node:vm](https://nodejs.org/api/vm.html)
- ✅ [node:wasi](https://nodejs.org/api/wasi.html)
- ✅ [node:worker_threads](https://nodejs.org/api/worker_threads.html)
- ✅ [node:zlib](https://nodejs.org/api/zlib.html)
<!-- /automd -->
</details>
## Manual mocking
<details>
```js
// Magic proxy to replace any unknown API
import MockProxy from "unenv/mock/proxy";
// You can also create named mocks
const lib = MockProxy.__createMock__("lib", {
/* overrides */
});
```
</details>
[(view source)](./src/runtime/mock)
## Nightly release channel
You can use the nightly release channel to try the latest changes in the `main` branch via [`unenv-nightly`](https://www.npmjs.com/package/unenv-nightly).
<details>
If directly using `unenv` in your project:
```json
{
"devDependencies": {
"unenv": "npm:unenv-nightly"
}
}
```
If using `unenv` via another tool (Nuxt or Nitro) in your project:
```json
{
"resolutions": {
"unenv": "npm:unenv-nightly"
}
}
```
</details>
## License
<!-- automd:contributors license=MIT author=pi0 -->
Published under the [MIT](https://github.com/unjs/unenv/blob/main/LICENSE) license.
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/unenv/graphs/contributors) 💛
<br><br>
<a href="https://github.com/unjs/unenv/graphs/contributors">
<img src="https://contrib.rocks/image?repo=unjs/unenv" />
</a>
<!-- /automd -->
<!-- automd:with-automd -->
---
_🤖 auto updated with [automd](https://automd.unjs.io)_
<!-- /automd -->

84
Frontend-Learner/node_modules/unenv/dist/index.d.mts generated vendored Normal file
View file

@ -0,0 +1,84 @@
//#region src/types.d.ts
interface CreateEnvOptions {
/**
* Node.js compatibility.
*
* - Add `alias` entries for Node.js builtins as `<id>` and `node:<id>`.
* - Add `inject` entries for Node.js globals `global`, `Buffer`, and `process`.
*
* Default: `true`
*/
nodeCompat?: boolean;
/**
* Add `alias` entries to replace npm packages like `node-fetch` with lighter shims.
*
* Default: `false`
*/
npmShims?: boolean;
/**
* Additional presets.
*/
presets?: Preset[];
/**
* Additional overrides.
*/
overrides?: Partial<Environment>;
/**
* Resolve paths in the environment to absolute paths.
*
* Default: `false`
*/
resolve?: boolean | EnvResolveOptions;
}
interface EnvResolveOptions {
/**
* Paths to resolve imports from.
*
* Always unenv path is appended.
*/
paths?: (string | URL)[];
}
/**
* Environment defined by presets.
*/
interface Environment {
alias: Readonly<Record<string, string>>;
inject: Readonly<Record<string, string | readonly string[] | false>>;
polyfill: readonly string[];
external: readonly string[];
}
/**
* Environment returned by `defineEnv`.
*
* It differs from the preset's Environment as the `inject` map never contains a `false` value.
*/
interface ResolvedEnvironment extends Environment {
inject: Readonly<Record<string, string | readonly string[]>>;
}
interface Preset extends Partial<Environment> {
meta?: {
/**
* Preset name.
*/
readonly name?: string;
/**
* Preset version.
*/
readonly version?: string;
/**
* Path or URL to preset entry (used for resolving absolute paths).
*/
readonly url?: string | URL;
};
}
//#endregion
//#region src/env.d.ts
/**
* Configure a target environment.
*/
declare function defineEnv(opts?: CreateEnvOptions): {
env: ResolvedEnvironment;
presets: Preset[];
};
//#endregion
export { type CreateEnvOptions, type EnvResolveOptions, type Environment, type Preset, type ResolvedEnvironment, defineEnv };

1171
Frontend-Learner/node_modules/unenv/dist/index.mjs generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
export type Callback<E = Error | null | undefined> = (error?: E) => void;
export type HeadersObject = {
[key: string]: string | string[] | undefined;
};
export type BufferEncoding = any;

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,14 @@
import type { HeadersObject } from "./types.mjs";
export declare function rawHeaders(headers: HeadersObject);
type Fn = (...args: any[]) => any;
export declare function mergeFns(...functions: Fn[]): unknown;
export declare function createNotImplementedError(name: string);
export declare function notImplemented<Fn extends (...args: any) => any>(name: string): Fn;
export interface Promisifiable {
(): any;
native: Promisifiable;
__promisify__: () => Promise<any>;
}
export declare function notImplementedAsync(name: string): Promisifiable;
export declare function notImplementedClass<T = unknown>(name: string): T;
export {};

View file

@ -0,0 +1,49 @@
/* @__NO_SIDE_EFFECTS__ */
export function rawHeaders(headers) {
const rawHeaders = [];
for (const key in headers) {
if (Array.isArray(headers[key])) {
for (const h of headers[key]) {
rawHeaders.push(key, h);
}
} else {
rawHeaders.push(key, headers[key]);
}
}
return rawHeaders;
}
/* @__NO_SIDE_EFFECTS__ */
export function mergeFns(...functions) {
return function(...args) {
for (const fn of functions) {
fn(...args);
}
};
}
/* @__NO_SIDE_EFFECTS__ */
export function createNotImplementedError(name) {
return new Error(`[unenv] ${name} is not implemented yet!`);
}
/* @__NO_SIDE_EFFECTS__ */
export function notImplemented(name) {
const fn = () => {
throw createNotImplementedError(name);
};
return Object.assign(fn, { __unenv__: true });
}
/* @__NO_SIDE_EFFECTS__ */
export function notImplementedAsync(name) {
const fn = notImplemented(name);
fn.__promisify__ = () => notImplemented(name + ".__promisify__");
fn.native = fn;
return fn;
}
/* @__NO_SIDE_EFFECTS__ */
export function notImplementedClass(name) {
return class {
__unenv__ = true;
constructor() {
throw new Error(`[unenv] ${name} is not implemented yet!`);
}
};
}

View file

@ -0,0 +1,2 @@
declare const _default;
export default _default;

View file

@ -0,0 +1 @@
export default Object.freeze(Object.create(null, { __unenv__: { get: () => true } }));

View file

@ -0,0 +1,2 @@
declare const _default;
export default _default;

View file

@ -0,0 +1 @@
export default Object.assign(() => {}, { __unenv__: true });

View file

@ -0,0 +1,2 @@
declare const _default;
export default _default;

View file

@ -0,0 +1,43 @@
function createMock(name, overrides = {}) {
const proxyFn = function() {};
proxyFn.prototype.name = name;
const props = {};
const proxy = new Proxy(proxyFn, {
get(_target, prop) {
if (prop === "caller") {
return null;
}
if (prop === "__createMock__") {
return createMock;
}
if (prop === "__unenv__") {
return true;
}
if (prop in overrides) {
return overrides[prop];
}
if (prop === "then") {
return (fn) => Promise.resolve(fn());
}
if (prop === "catch") {
return (fn) => Promise.resolve();
}
if (prop === "finally") {
return (fn) => Promise.resolve(fn());
}
// @ts-ignore
return props[prop] = props[prop] || createMock(`${name}.${prop.toString()}`);
},
apply(_target, _this, _args) {
return createMock(`${name}()`);
},
construct(_target, _args, _newT) {
return createMock(`[${name}]`);
},
enumerate() {
return [];
}
});
return proxy;
}
export default createMock("mock");

View file

@ -0,0 +1,165 @@
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
// Copyright Node.js contributors. All rights reserved.
//
// 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 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.
// Based on Node.js' assert module
// https://github.com/nodejs/node/blob/0db95d371274104a5acf09214bf8325c45bfb64a/lib/assert.js
import type nodeAssert from "node:assert";
export declare class AssertionError extends Error implements nodeAssert.AssertionError {
actual: unknown;
expected: unknown;
operator: string;
generatedMessage: boolean;
code: "ERR_ASSERTION";
constructor(options: {
message?: string;
actual?: unknown;
expected?: unknown;
operator?: string;
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
stackStartFn?: Function;
});
}
// All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided. All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.
// ----------------------------------------------------------------------------
// Assertions
// ----------------------------------------------------------------------------
/**
* Pure assertion tests whether a value is truthy, as determined
* by !!value.
* @param {...any} args
* @returns {void}
*/
export declare function ok(...args: unknown[]);
/**
* The equality assertion tests shallow, coercive equality with ==.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function equal(actual: unknown, expected: unknown, message?: string | Error): void;
/**
* The non-equality assertion tests for whether two objects are not
* equal with !=.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function notEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* The deep equivalence assertion tests a deep equality relation.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function deepEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* The deep non-equivalence assertion tests for any deep inequality.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* The deep strict equivalence assertion tests a deep strict equality
* relation.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function deepStrictEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* The deep strict non-equivalence assertion tests for any deep strict
* inequality.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* The strict equivalence assertion tests a strict equality relation.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function strictEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* The strict non-equivalence assertion tests for any strict inequality.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export declare function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error);
/**
* Expects the function `promiseFn` to throw an error.
*/
export declare function throws(promiseFn: () => any, ...args: unknown[]): void;
/**
* Expects `promiseFn` function or its value to reject.
*/
export declare function rejects(promiseFn: (() => Promise<unknown>) | Promise<unknown>, ...args: unknown[]): Promise<void>;
/**
* Asserts that the function `fn` does not throw an error.
*/
export declare function doesNotThrow(fn: () => any, ...args: unknown[]): void;
/**
* Expects `fn` or its value to not reject.
*/
export declare function doesNotReject(fn: (() => Promise<unknown>) | Promise<unknown>, ...args: unknown[]): Promise<void>;
/**
* Throws `value` if the value is not `null` or `undefined`.
* @param {any} err
* @returns {void}
*/
export declare function ifError(err: unknown);
/**
* Expects the `string` input to match the regular expression.
* @param {string} string
* @param {RegExp} regexp
* @param {string | Error} [message]
* @returns {void}
*/
export declare function match(string: string, regexp: RegExp, message?: string | Error);
/**
* Expects the `string` input not to match the regular expression.
* @param {string} string
* @param {RegExp} regexp
* @param {string | Error} [message]
* @returns {void}
*/
export declare function doesNotMatch(string: string, regexp: RegExp, message?: string | Error);
export declare function fail(actual: unknown, expected?: unknown, message?: string | Error, operator?: string, stackStartFn?: Function): never;
// deprecated
export declare const CallTracker: typeof nodeAssert.CallTracker;
export declare const partialDeepStrictEqual: unknown;
export declare const strict: unknown;
declare const _default;
export default _default;

View file

@ -0,0 +1,737 @@
import { notImplemented, notImplementedClass } from "../_internal/utils.mjs";
// TODO: Implement Error classes
const ERR_AMBIGUOUS_ARGUMENT = Error;
const ERR_INVALID_ARG_TYPE = Error;
const ERR_INVALID_ARG_VALUE = Error;
const ERR_INVALID_RETURN_VALUE = Error;
const ERR_MISSING_ARGS = Error;
export class AssertionError extends Error {
actual;
expected;
operator;
generatedMessage;
code = "ERR_ASSERTION";
constructor(options) {
super();
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator || "";
this.generatedMessage = options.message === undefined;
const stackStartFn = options.stackStartFn || fail;
Error.captureStackTrace?.(this, stackStartFn);
}
}
const inspect = (val, opts) => val;
const isEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
const isDeepEqual = isEqual;
const isDeepStrictEqual = isEqual;
let warned = false;
// The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
// assert module must conform to the following interface.
const NO_EXCEPTION_SENTINEL = {};
// All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided. All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.
// ----------------------------------------------------------------------------
// Assertions
// ----------------------------------------------------------------------------
/**
* Pure assertion tests whether a value is truthy, as determined
* by !!value.
* @param {...any} args
* @returns {void}
*/
export function ok(...args) {
// @ts-expect-error
innerOk(ok, args.length, ...args);
}
/**
* The equality assertion tests shallow, coercive equality with ==.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function equal(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (actual != expected && (!Number.isNaN(actual) || !Number.isNaN(expected))) {
innerFail({
actual,
expected,
message,
operator: "==",
stackStartFn: equal
});
}
}
/**
* The non-equality assertion tests for whether two objects are not
* equal with !=.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function notEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (actual == expected || Number.isNaN(actual) && Number.isNaN(expected)) {
innerFail({
actual,
expected,
message,
operator: "!=",
stackStartFn: notEqual
});
}
}
/**
* The deep equivalence assertion tests a deep equality relation.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function deepEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (!isDeepEqual(actual, expected)) {
innerFail({
actual,
expected,
message,
operator: "deepEqual",
stackStartFn: deepEqual
});
}
}
/**
* The deep non-equivalence assertion tests for any deep inequality.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function notDeepEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (isDeepEqual(actual, expected)) {
innerFail({
actual,
expected,
message,
operator: "notDeepEqual",
stackStartFn: notDeepEqual
});
}
}
/**
* The deep strict equivalence assertion tests a deep strict equality
* relation.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function deepStrictEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (!isDeepStrictEqual(actual, expected)) {
innerFail({
actual,
expected,
message,
operator: "deepStrictEqual",
stackStartFn: deepStrictEqual
});
}
}
/**
* The deep strict non-equivalence assertion tests for any deep strict
* inequality.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function notDeepStrictEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (isDeepStrictEqual(actual, expected)) {
innerFail({
actual,
expected,
message,
operator: "notDeepStrictEqual",
stackStartFn: notDeepStrictEqual
});
}
}
/**
* The strict equivalence assertion tests a strict equality relation.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function strictEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (!Object.is(actual, expected)) {
innerFail({
actual,
expected,
message,
operator: "strictEqual",
stackStartFn: strictEqual
});
}
}
/**
* The strict non-equivalence assertion tests for any strict inequality.
* @param {any} actual
* @param {any} expected
* @param {string | Error} [message]
* @returns {void}
*/
export function notStrictEqual(actual, expected, message) {
if (arguments.length < 2) {
// @ts-expect-error
throw new ERR_MISSING_ARGS("actual", "expected");
}
if (Object.is(actual, expected)) {
innerFail({
actual,
expected,
message,
operator: "notStrictEqual",
stackStartFn: notStrictEqual
});
}
}
/**
* Expects the function `promiseFn` to throw an error.
*/
export function throws(promiseFn, ...args) {
// @ts-expect-error
expectsError(throws, getActual(promiseFn), ...args);
}
/**
* Expects `promiseFn` function or its value to reject.
*/
export async function rejects(promiseFn, ...args) {
// @ts-expect-error
expectsError(rejects, await waitForActual(promiseFn), ...args);
}
/**
* Asserts that the function `fn` does not throw an error.
*/
export function doesNotThrow(fn, ...args) {
// @ts-expect-error
expectsNoError(doesNotThrow, getActual(fn), ...args);
}
/**
* Expects `fn` or its value to not reject.
*/
export async function doesNotReject(fn, ...args) {
// @ts-expect-error
expectsNoError(doesNotReject, await waitForActual(fn), ...args);
}
/**
* Throws `value` if the value is not `null` or `undefined`.
* @param {any} err
* @returns {void}
*/
export function ifError(err) {
if (err !== null && err !== undefined) {
let message = "ifError got unwanted exception: ";
if (typeof err === "object" && typeof err.message === "string") {
if (err.message.length === 0 && err.constructor) {
message += err.constructor.name;
} else {
message += err.message;
}
} else {
message += inspect(err);
}
const newErr = new AssertionError({
actual: err,
expected: null,
operator: "ifError",
message,
stackStartFn: ifError
});
// Make sure we actually have a stack trace!
const origStack = err?.stack;
if (typeof origStack === "string") {
// This will remove any duplicated frames from the error frames taken
// from within `ifError` and add the original error frames to the newly
// created ones.
const origStackStart = origStack.indexOf("\n at");
if (origStackStart !== -1) {
const originalFrames = origStack.slice(origStackStart + 1).split("\n");
// Filter all frames existing in err.stack.
let newFrames = (newErr.stack || "").split("\n");
for (const errFrame of originalFrames) {
// Find the first occurrence of the frame.
const pos = newFrames.indexOf(errFrame);
if (pos !== -1) {
// Only keep new frames.
newFrames = newFrames.slice(0, pos);
break;
}
}
const stackStart = newFrames.join("\n");
const stackEnd = originalFrames.join("\n");
newErr.stack = `${stackStart}\n${stackEnd}`;
}
}
throw newErr;
}
}
/**
* Expects the `string` input to match the regular expression.
* @param {string} string
* @param {RegExp} regexp
* @param {string | Error} [message]
* @returns {void}
*/
export function match(string, regexp, message) {
internalMatch(string, regexp, message, match);
}
/**
* Expects the `string` input not to match the regular expression.
* @param {string} string
* @param {RegExp} regexp
* @param {string | Error} [message]
* @returns {void}
*/
export function doesNotMatch(string, regexp, message) {
internalMatch(string, regexp, message, doesNotMatch);
}
export function fail(actual, expected, message, operator, stackStartFn) {
const argsLen = arguments.length;
let internalMessage = false;
if (actual == null && argsLen <= 1) {
internalMessage = true;
message = "Failed";
} else if (argsLen === 1) {
message = actual;
actual = undefined;
} else {
if (warned === false) {
warned = true;
process.emitWarning("assert.fail() with more than one argument is deprecated. " + "Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094");
}
if (argsLen === 2) operator = "!=";
}
if (message instanceof Error) throw message;
const errArgs = {
actual,
expected,
operator: operator === undefined ? "fail" : operator,
stackStartFn: stackStartFn || fail,
message
};
const err = new AssertionError(errArgs);
if (internalMessage) {
err.generatedMessage = true;
}
throw err;
}
// ----------------------------------------------------------------------------
// Internal utils
// ----------------------------------------------------------------------------
function innerFail(obj) {
if (obj.message instanceof Error) throw obj.message;
throw new AssertionError(obj);
}
function innerOk(fn, argLen, value, message) {
if (!value) {
let generatedMessage = false;
if (argLen === 0) {
generatedMessage = true;
message = "No value argument passed to `assert.ok()`";
} else if (message == null) {
generatedMessage = true;
message = "<null>";
} else if (message instanceof Error) {
throw message;
}
const err = new AssertionError({
actual: value,
expected: true,
message,
operator: "==",
stackStartFn: fn
});
err.generatedMessage = generatedMessage;
throw err;
}
}
class Comparison {
constructor(obj, keys, actual) {
for (const key of keys) {
if (key in obj) {
if (actual !== undefined && typeof actual[key] === "string" && obj[key] instanceof RegExp && obj[key].exec(actual[key]) !== null) {
// @ts-expect-error
this[key] = actual[key];
} else {
// @ts-expect-error
this[key] = obj[key];
}
}
}
}
}
function compareExceptionKey(actual, expected, key, message, keys, fn) {
if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
if (!message) {
// Create placeholder objects to create a nice output.
const a = new Comparison(actual, keys);
const b = new Comparison(expected, keys, actual);
const err = new AssertionError({
actual: a,
expected: b,
operator: "deepStrictEqual",
stackStartFn: fn
});
err.actual = actual;
err.expected = expected;
err.operator = fn.name;
throw err;
}
innerFail({
actual,
expected,
message,
operator: fn.name,
stackStartFn: fn
});
}
}
function expectedException(actual, expected, message, fn) {
let generatedMessage = false;
let throwError = false;
if (typeof expected !== "function") {
// Handle regular expressions.
if (expected instanceof RegExp) {
const str = String(actual);
if (RegExp.prototype.exec.call(expected, str) !== null) return;
if (!message) {
generatedMessage = true;
message = "The input did not match the regular expression " + `${inspect(expected)}. Input:\n\n${inspect(str)}\n`;
}
throwError = true;
} else if (typeof actual !== "object" || actual === null) {
const err = new AssertionError({
actual,
expected,
message,
operator: "deepStrictEqual",
stackStartFn: fn
});
err.operator = fn.name;
throw err;
} else {
// Handle validation objects.
const keys = Object.keys(expected);
// Special handle errors to make sure the name and the message are
// compared as well.
if (expected instanceof Error) {
keys.push("name", "message");
} else if (keys.length === 0) {
throw new ERR_INVALID_ARG_VALUE(
"error",
expected,
// @ts-expect-error
"may not be an empty object"
);
}
for (const key of keys) {
if (typeof actual[key] === "string" && expected[key] instanceof RegExp && expected[key].exec(actual[key]) !== null) {
continue;
}
compareExceptionKey(actual, expected, key, message, keys, fn);
}
return;
}
} else if (expected.prototype !== undefined && actual instanceof expected) {
return;
} else if (expected instanceof Error) {
if (!message) {
generatedMessage = true;
message = "The error is expected to be an instance of " + `"${expected.name}". Received `;
if (actual instanceof Error) {
const name = actual.constructor && actual.constructor.name || actual.name;
if (expected.name === name) {
message += "an error with identical name but a different prototype.";
} else {
message += `"${name}"`;
}
if (actual.message) {
message += `\n\nError message:\n\n${actual.message}`;
}
} else {
message += `"${inspect(actual, { depth: -1 })}"`;
}
}
throwError = true;
} else {
// Check validation functions return value.
const res = Reflect.apply(expected, {}, [actual]);
if (res !== true) {
if (!message) {
generatedMessage = true;
const name = expected.name ? `"${expected.name}" ` : "";
message = `The ${name}validation function is expected to return` + ` "true". Received ${inspect(res)}`;
if (actual instanceof Error) {
message += `\n\nCaught error:\n\n${actual}`;
}
}
throwError = true;
}
}
if (throwError) {
const err = new AssertionError({
actual,
expected,
message,
operator: fn.name,
stackStartFn: fn
});
err.generatedMessage = generatedMessage;
throw err;
}
}
function getActual(fn) {
// validateFunction(fn, "fn");
try {
fn();
} catch (error_) {
return error_;
}
return NO_EXCEPTION_SENTINEL;
}
function checkIsPromise(obj) {
// Accept native ES6 promises and promises that are implemented in a similar
// way. Do not accept thenables that use a function as `obj` and that have no
// `catch` handler.
return obj instanceof Promise || obj !== null && typeof obj === "object" && typeof obj.then === "function" && typeof obj.catch === "function";
}
function internalMatch(string, regexp, message, fn) {
if (!(regexp instanceof RegExp)) {
// @ts-expect-error
throw new ERR_INVALID_ARG_TYPE("regexp", "RegExp", regexp);
}
const match = fn === assert.match;
if (typeof string !== "string" || regexp.exec(string) !== null !== match) {
if (message instanceof Error) {
throw message;
}
const generatedMessage = !message;
// 'The input was expected to not match the regular expression ' +
message = message || (typeof string === "string" ? (match ? "The input did not match the regular expression " : "The input was expected to not match the regular expression ") + `${inspect(regexp)}. Input:\n\n${inspect(string)}\n` : "The \"string\" argument must be of type string. Received type " + `${typeof string} (${inspect(string)})`);
const err = new AssertionError({
actual: string,
expected: regexp,
message,
operator: fn?.name,
stackStartFn: fn
});
err.generatedMessage = generatedMessage;
throw err;
}
}
async function waitForActual(promiseFn) {
let resultPromise;
if (typeof promiseFn === "function") {
// Return a rejected promise if `promiseFn` throws synchronously.
resultPromise = promiseFn();
// Fail in case no promise is returned.
if (!checkIsPromise(resultPromise)) {
throw new ERR_INVALID_RETURN_VALUE(
"instance of Promise",
"promiseFn",
// @ts-expect-error
resultPromise
);
}
} else if (checkIsPromise(promiseFn)) {
resultPromise = promiseFn;
} else {
throw new ERR_INVALID_ARG_TYPE(
"promiseFn",
["Function", "Promise"],
// @ts-expect-error
promiseFn
);
}
try {
await resultPromise;
} catch (error_) {
return error_;
}
return NO_EXCEPTION_SENTINEL;
}
function expectsError(stackStartFn, actual, error, message) {
if (typeof error === "string") {
if (arguments.length === 4) {
throw new ERR_INVALID_ARG_TYPE(
"error",
[
"Object",
"Error",
"Function",
"RegExp"
],
// @ts-expect-error
error
);
}
if (typeof actual === "object" && actual !== null) {
if (actual?.message === error) {
throw new ERR_AMBIGUOUS_ARGUMENT(
"error/message",
// @ts-expect-error
`The error message "${actual.message}" is identical to the message.`
);
}
} else if (actual === error) {
throw new ERR_AMBIGUOUS_ARGUMENT(
"error/message",
// @ts-expect-error
`The error "${actual}" is identical to the message.`
);
}
message = error;
error = undefined;
} else if (error != null && typeof error !== "object" && typeof error !== "function") {
throw new ERR_INVALID_ARG_TYPE(
"error",
[
"Object",
"Error",
"Function",
"RegExp"
],
// @ts-expect-error
error
);
}
if (actual === NO_EXCEPTION_SENTINEL) {
let details = "";
if (error && error.name) {
details += ` (${error.name})`;
}
details += message ? `: ${message}` : ".";
const fnType = stackStartFn === assert.rejects ? "rejection" : "exception";
innerFail({
actual: undefined,
expected: error,
operator: stackStartFn.name,
message: `Missing expected ${fnType}${details}`,
stackStartFn
});
}
if (!error) return;
expectedException(actual, error, message, stackStartFn);
}
function hasMatchingError(actual, expected) {
if (typeof expected !== "function") {
if (expected instanceof RegExp) {
const str = String(actual);
return RegExp.prototype.exec.call(expected, str) !== null;
}
throw new ERR_INVALID_ARG_TYPE(
"expected",
["Function", "RegExp"],
// @ts-expect-error
expected
);
}
// Guard instanceof against arrow functions as they don't have a prototype.
if (expected.prototype !== undefined && actual instanceof expected) {
return true;
}
if (expected instanceof Error) {
return false;
}
return Reflect.apply(expected, {}, [actual]) === true;
}
function expectsNoError(stackStartFn, actual, error, message) {
if (actual === NO_EXCEPTION_SENTINEL) return;
if (typeof error === "string") {
message = error;
error = undefined;
}
if (!error || hasMatchingError(actual, error)) {
const details = message ? `: ${message}` : ".";
const fnType = stackStartFn === assert.doesNotReject ? "rejection" : "exception";
innerFail({
actual,
expected: error,
operator: stackStartFn?.name,
message: `Got unwanted ${fnType}${details}\n` + `Actual message: "${actual && actual.message}"`,
stackStartFn
});
}
throw actual;
}
// ----------------------------------------------------------------------------
// Exports
// ----------------------------------------------------------------------------
const assert = Object.assign(ok, {});
// deprecated
export const CallTracker = /* @__PURE__ */ notImplementedClass("asset.CallTracker");
export const partialDeepStrictEqual = /* @__PURE__ */ notImplemented("assert.partialDeepStrictEqual");
assert.fail = fail;
assert.ok = ok;
assert.equal = equal;
assert.notEqual = notEqual;
assert.deepEqual = deepEqual;
assert.notDeepEqual = notDeepEqual;
assert.deepStrictEqual = deepStrictEqual;
assert.notDeepStrictEqual = notDeepStrictEqual;
assert.strictEqual = strictEqual;
assert.notStrictEqual = notStrictEqual;
assert.throws = throws;
assert.rejects = rejects;
assert.doesNotThrow = doesNotThrow;
assert.doesNotReject = doesNotReject;
assert.ifError = ifError;
assert.match = match;
assert.doesNotMatch = doesNotMatch;
assert.partialDeepStrictEqual = partialDeepStrictEqual;
assert.AssertionError = AssertionError;
assert.CallTracker = CallTracker;
export const strict = Object.assign(function _strict(...args) {
// @ts-expect-error
innerOk(strict, args.length, ...args);
}, assert, {
equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual,
notEqual: assert.notStrictEqual,
notDeepEqual: assert.notDeepStrictEqual
});
assert.strict = strict;
assert.strict.strict = assert.strict;
export default assert;

View file

@ -0,0 +1,4 @@
import type nodeAssert from "node:assert";
export { AssertionError, CallTracker, strict, fail, ok, throws, rejects, doesNotThrow, doesNotReject, ifError, match, doesNotMatch, notDeepStrictEqual, notDeepStrictEqual as notDeepEqual, strictEqual, strictEqual as equal, notStrictEqual, notStrictEqual as notEqual, deepStrictEqual, deepStrictEqual as deepEqual, partialDeepStrictEqual } from "../assert.mjs";
declare const _default: typeof nodeAssert.strict;
export default _default;

View file

@ -0,0 +1,25 @@
import { AssertionError, CallTracker, strict, fail, ok, throws, rejects, doesNotThrow, doesNotReject, ifError, match, doesNotMatch, notDeepStrictEqual, notDeepStrictEqual as notDeepEqual, strictEqual, strictEqual as equal, notStrictEqual, notStrictEqual as notEqual, deepStrictEqual, deepStrictEqual as deepEqual, partialDeepStrictEqual } from "../assert.mjs";
export { AssertionError, CallTracker, strict, fail, ok, throws, rejects, doesNotThrow, doesNotReject, ifError, match, doesNotMatch, notDeepStrictEqual, notDeepStrictEqual as notDeepEqual, strictEqual, strictEqual as equal, notStrictEqual, notStrictEqual as notEqual, deepStrictEqual, deepStrictEqual as deepEqual, partialDeepStrictEqual } from "../assert.mjs";
export default Object.assign(ok, {
AssertionError,
CallTracker,
strict,
fail,
ok,
throws,
rejects,
doesNotThrow,
doesNotReject,
ifError,
match,
doesNotMatch,
notDeepStrictEqual,
notDeepEqual,
strictEqual,
equal,
notStrictEqual,
notEqual,
deepStrictEqual,
deepEqual,
partialDeepStrictEqual
});

View file

@ -0,0 +1,5 @@
export { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage.mjs";
export { AsyncResource } from "./internal/async_hooks/async-resource.mjs";
export * from "./internal/async_hooks/async-hook.mjs";
declare const _default: {};
export default _default;

View file

@ -0,0 +1,15 @@
import { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage.mjs";
import { AsyncResource } from "./internal/async_hooks/async-resource.mjs";
import { asyncWrapProviders, createHook, executionAsyncId, executionAsyncResource, triggerAsyncId } from "./internal/async_hooks/async-hook.mjs";
export { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage.mjs";
export { AsyncResource } from "./internal/async_hooks/async-resource.mjs";
export * from "./internal/async_hooks/async-hook.mjs";
export default {
asyncWrapProviders,
AsyncLocalStorage,
AsyncResource,
createHook,
executionAsyncId,
executionAsyncResource,
triggerAsyncId
};

View file

@ -0,0 +1,19 @@
// https://nodejs.org/api/buffer.html
import type nodeBuffer from "node:buffer";
export { kMaxLength, INSPECT_MAX_BYTES, SlowBuffer } from "./internal/buffer/buffer.mjs";
export declare const Buffer: unknown;
export { File } from "./internal/buffer/file.mjs";
// @ts-expect-eerror https://github.com/unjs/unenv/issues/64
export declare const Blob: typeof nodeBuffer.Blob;
export declare const resolveObjectURL: unknown;
export declare const transcode: unknown;
export declare const isUtf8: unknown;
export declare const isAscii: unknown;
export declare const btoa: unknown;
export declare const atob: unknown;
export declare const kStringMaxLength = 0;
export declare const constants: {};
declare const _default: {
SlowBuffer: typeof nodeBuffer.SlowBuffer;
};
export default _default;

View file

@ -0,0 +1,35 @@
import { notImplemented } from "../_internal/utils.mjs";
import { Buffer as _Buffer, kMaxLength, INSPECT_MAX_BYTES, SlowBuffer } from "./internal/buffer/buffer.mjs";
import { File } from "./internal/buffer/file.mjs";
export { kMaxLength, INSPECT_MAX_BYTES, SlowBuffer } from "./internal/buffer/buffer.mjs";
export const Buffer = globalThis.Buffer || _Buffer;
export { File } from "./internal/buffer/file.mjs";
// @ts-expect-eerror https://github.com/unjs/unenv/issues/64
export const Blob = globalThis.Blob;
export const resolveObjectURL = /* @__PURE__ */ notImplemented("buffer.resolveObjectURL");
export const transcode = /* @__PURE__ */ notImplemented("buffer.transcode");
export const isUtf8 = /* @__PURE__ */ notImplemented("buffer.isUtf8");
export const isAscii = /* @__PURE__ */ notImplemented("buffer.isAscii");
export const btoa = globalThis.btoa.bind(globalThis);
export const atob = globalThis.atob.bind(globalThis);
export const kStringMaxLength = 0;
export const constants = {
MAX_LENGTH: kMaxLength,
MAX_STRING_LENGTH: kStringMaxLength
};
export default {
Buffer,
SlowBuffer,
kMaxLength,
INSPECT_MAX_BYTES,
Blob,
resolveObjectURL,
transcode,
btoa,
atob,
kStringMaxLength,
constants,
isUtf8,
isAscii,
File
};

View file

@ -0,0 +1,12 @@
import type nodeChildProcess from "node:child_process";
export declare const ChildProcess: typeof nodeChildProcess.ChildProcess;
export declare const _forkChild: unknown;
export declare const exec: typeof nodeChildProcess.exec;
export declare const execFile: typeof nodeChildProcess.execFile;
export declare const execFileSync: typeof nodeChildProcess.execFileSync;
export declare const execSync: typeof nodeChildProcess.execSync;
export declare const fork: typeof nodeChildProcess.fork;
export declare const spawn: typeof nodeChildProcess.spawn;
export declare const spawnSync: typeof nodeChildProcess.spawnSync;
declare const _default: typeof nodeChildProcess;
export default _default;

View file

@ -0,0 +1,21 @@
import { notImplemented, notImplementedClass } from "../_internal/utils.mjs";
export const ChildProcess = /* @__PURE__ */ notImplementedClass("child_process.ChildProcess");
export const _forkChild = /* @__PURE__ */ notImplemented("child_process.ChildProcess");
export const exec = /* @__PURE__ */ notImplemented("child_process.exec");
export const execFile = /* @__PURE__ */ notImplemented("child_process.execFile");
export const execFileSync = /* @__PURE__ */ notImplemented("child_process.execFileSync");
export const execSync = /* @__PURE__ */ notImplemented("child_process.execSyn");
export const fork = /* @__PURE__ */ notImplemented("child_process.fork");
export const spawn = /* @__PURE__ */ notImplemented("child_process.spawn");
export const spawnSync = /* @__PURE__ */ notImplemented("child_process.spawnSync");
export default {
ChildProcess,
_forkChild,
exec,
execFile,
execFileSync,
execSync,
fork,
spawn,
spawnSync
};

View file

@ -0,0 +1,33 @@
import type nodeCluster from "node:cluster";
import type { Worker as NodeClusterWorker } from "node:cluster";
import { EventEmitter } from "node:events";
export declare const SCHED_NONE: typeof nodeCluster.SCHED_NONE;
export declare const SCHED_RR: typeof nodeCluster.SCHED_RR;
export declare const isMaster: typeof nodeCluster.isMaster;
export declare const isPrimary: typeof nodeCluster.isPrimary;
export declare const isWorker: typeof nodeCluster.isWorker;
export declare const schedulingPolicy: typeof nodeCluster.schedulingPolicy;
export declare const settings: typeof nodeCluster.settings;
export declare const workers: typeof nodeCluster.workers;
export declare const fork: typeof nodeCluster.fork;
export declare const disconnect: typeof nodeCluster.disconnect;
export declare const setupPrimary: typeof nodeCluster.setupPrimary;
export declare const setupMaster: typeof nodeCluster.setupMaster;
// Make ESM coverage happy
export declare const _events: unknown;
export declare const _eventsCount = 0;
export declare const _maxListeners = 0;
export declare class Worker extends EventEmitter implements NodeClusterWorker {
_connected: boolean;
id: number;
get process(): any;
get exitedAfterDisconnect();
isConnected(): boolean;
isDead(): boolean;
send(message: any, sendHandle?: any, options?: any, callback?: any): boolean;
kill(signal?: string): void;
destroy(signal?: string): void;
disconnect(): this;
}
declare const _default;
export default _default;

View file

@ -0,0 +1,71 @@
import { EventEmitter } from "node:events";
import { notImplemented } from "../_internal/utils.mjs";
export const SCHED_NONE = 1;
export const SCHED_RR = 2;
export const isMaster = true;
export const isPrimary = true;
export const isWorker = false;
export const schedulingPolicy = SCHED_RR;
export const settings = {};
export const workers = {};
export const fork = /* @__PURE__ */ notImplemented("cluster.fork");
export const disconnect = /* @__PURE__ */ notImplemented("cluster.disconnect");
export const setupPrimary = /* @__PURE__ */ notImplemented("cluster.setupPrimary");
export const setupMaster = /* @__PURE__ */ notImplemented("cluster.setupMaster");
// Make ESM coverage happy
export const _events = [];
export const _eventsCount = 0;
export const _maxListeners = 0;
export class Worker extends EventEmitter {
_connected = false;
id = 0;
get process() {
return globalThis.process;
}
get exitedAfterDisconnect() {
return this._connected;
}
isConnected() {
return this._connected;
}
isDead() {
return true;
}
send(message, sendHandle, options, callback) {
return false;
}
kill(signal) {
this._connected = false;
}
destroy(signal) {
this._connected = false;
}
disconnect() {
this._connected = false;
return this;
}
}
class _Cluster extends EventEmitter {
Worker = Worker;
isMaster = isMaster;
isPrimary = isPrimary;
isWorker = isWorker;
SCHED_NONE = SCHED_NONE;
SCHED_RR = SCHED_RR;
schedulingPolicy = SCHED_RR;
settings = settings;
workers = workers;
setupPrimary(_settings) {
setupPrimary();
}
setupMaster(_settings) {
setupMaster();
}
disconnect() {
disconnect();
}
fork(env) {
return fork(env);
}
}
export default new _Cluster();

View file

@ -0,0 +1,38 @@
import type nodeConsole from "node:console";
import { Writable } from "node:stream";
// undocumented public APIs
export declare const _ignoreErrors: boolean;
export declare const _stderr: Writable;
export declare const _stdout: Writable;
export declare const log: typeof nodeConsole.log;
export declare const info: typeof nodeConsole.info;
export declare const trace: typeof nodeConsole.trace;
export declare const debug: typeof nodeConsole.debug;
export declare const table: typeof nodeConsole.table;
export declare const error: typeof nodeConsole.error;
export declare const warn: typeof nodeConsole.warn;
// https://developer.chrome.com/docs/devtools/console/api#createtask
export declare const createTask: unknown;
export declare const assert: typeof nodeConsole.assert;
// noop
export declare const clear: typeof nodeConsole.clear;
export declare const count: typeof nodeConsole.count;
export declare const countReset: typeof nodeConsole.countReset;
export declare const dir: typeof nodeConsole.dir;
export declare const dirxml: typeof nodeConsole.dirxml;
export declare const group: typeof nodeConsole.group;
export declare const groupEnd: typeof nodeConsole.groupEnd;
export declare const groupCollapsed: typeof nodeConsole.groupCollapsed;
export declare const profile: typeof nodeConsole.profile;
export declare const profileEnd: typeof nodeConsole.profileEnd;
export declare const time: typeof nodeConsole.time;
export declare const timeEnd: typeof nodeConsole.timeEnd;
export declare const timeLog: typeof nodeConsole.timeLog;
export declare const timeStamp: typeof nodeConsole.timeStamp;
export declare const Console: typeof nodeConsole.Console;
export declare const _times: unknown;
export declare function context();
export declare const _stdoutErrorHandler: unknown;
export declare const _stderrErrorHandler: unknown;
declare const _default: {};
export default _default;

View file

@ -0,0 +1,74 @@
import { Writable } from "node:stream";
import noop from "../mock/noop.mjs";
import { notImplemented, notImplementedClass } from "../_internal/utils.mjs";
const _console = globalThis.console;
// undocumented public APIs
export const _ignoreErrors = true;
export const _stderr = new Writable();
export const _stdout = new Writable();
export const log = _console?.log ?? noop;
export const info = _console?.info ?? log;
export const trace = _console?.trace ?? info;
export const debug = _console?.debug ?? log;
export const table = _console?.table ?? log;
export const error = _console?.error ?? log;
export const warn = _console?.warn ?? error;
// https://developer.chrome.com/docs/devtools/console/api#createtask
export const createTask = _console?.createTask ?? /* @__PURE__ */ notImplemented("console.createTask");
export const assert = /* @__PURE__ */ notImplemented("console.assert");
// noop
export const clear = _console?.clear ?? noop;
export const count = _console?.count ?? noop;
export const countReset = _console?.countReset ?? noop;
export const dir = _console?.dir ?? noop;
export const dirxml = _console?.dirxml ?? noop;
export const group = _console?.group ?? noop;
export const groupEnd = _console?.groupEnd ?? noop;
export const groupCollapsed = _console?.groupCollapsed ?? noop;
export const profile = _console?.profile ?? noop;
export const profileEnd = _console?.profileEnd ?? noop;
export const time = _console?.time ?? noop;
export const timeEnd = _console?.timeEnd ?? noop;
export const timeLog = _console?.timeLog ?? noop;
export const timeStamp = _console?.timeStamp ?? noop;
export const Console = _console?.Console ?? /* @__PURE__ */ notImplementedClass("console.Console");
export const _times = /* @__PURE__ */ new Map();
export function context() {
// TODO: Should be Console with all the methods
return _console;
}
export const _stdoutErrorHandler = noop;
export const _stderrErrorHandler = noop;
export default {
_times,
_ignoreErrors,
_stdoutErrorHandler,
_stderrErrorHandler,
_stdout,
_stderr,
assert,
clear,
Console,
count,
countReset,
debug,
dir,
dirxml,
error,
context,
createTask,
group,
groupEnd,
groupCollapsed,
info,
log,
profile,
profileEnd,
table,
time,
timeEnd,
timeLog,
timeStamp,
trace,
warn
};

View file

@ -0,0 +1,13 @@
export * from "./internal/fs/constants.mjs";
// prettier-ignore
export { OPENSSL_VERSION_NUMBER, SSL_OP_ALL, SSL_OP_ALLOW_NO_DHE_KEX, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, SSL_OP_CIPHER_SERVER_PREFERENCE, SSL_OP_CISCO_ANYCONNECT, SSL_OP_COOKIE_EXCHANGE, SSL_OP_CRYPTOPRO_TLSEXT_BUG, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS, SSL_OP_LEGACY_SERVER_CONNECT, SSL_OP_NO_COMPRESSION, SSL_OP_NO_ENCRYPT_THEN_MAC, SSL_OP_NO_QUERY_MTU, SSL_OP_NO_RENEGOTIATION, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION, SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TICKET, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_PRIORITIZE_CHACHA, SSL_OP_TLS_ROLLBACK_BUG, ENGINE_METHOD_RSA, ENGINE_METHOD_DSA, ENGINE_METHOD_DH, ENGINE_METHOD_RAND, ENGINE_METHOD_EC, ENGINE_METHOD_CIPHERS, ENGINE_METHOD_DIGESTS, ENGINE_METHOD_PKEY_METHS, ENGINE_METHOD_PKEY_ASN1_METHS, ENGINE_METHOD_ALL, ENGINE_METHOD_NONE, DH_CHECK_P_NOT_SAFE_PRIME, DH_CHECK_P_NOT_PRIME, DH_UNABLE_TO_CHECK_GENERATOR, DH_NOT_SUITABLE_GENERATOR, RSA_PKCS1_PADDING, RSA_NO_PADDING, RSA_PKCS1_OAEP_PADDING, RSA_X931_PADDING, RSA_PKCS1_PSS_PADDING, RSA_PSS_SALTLEN_DIGEST, RSA_PSS_SALTLEN_MAX_SIGN, RSA_PSS_SALTLEN_AUTO, defaultCoreCipherList, TLS1_VERSION, TLS1_1_VERSION, TLS1_2_VERSION, TLS1_3_VERSION, POINT_CONVERSION_COMPRESSED, POINT_CONVERSION_UNCOMPRESSED, POINT_CONVERSION_HYBRID } from "./internal/crypto/constants.mjs";
export declare const;
// prettier-ignore
export declare const;
// prettier-ignore
export declare const;
// prettier-ignore
export declare const;
// prettier-ignore
declare const _default: {};
export default _default;

View file

@ -0,0 +1,254 @@
import { errno, priority, signals, dlopen } from "./internal/os/constants.mjs";
// prettier-ignore
import { UV_FS_SYMLINK_DIR, UV_FS_SYMLINK_JUNCTION, O_RDONLY, O_WRONLY, O_RDWR, UV_DIRENT_UNKNOWN, UV_DIRENT_FILE, UV_DIRENT_DIR, UV_DIRENT_LINK, UV_DIRENT_FIFO, UV_DIRENT_SOCKET, UV_DIRENT_CHAR, UV_DIRENT_BLOCK, EXTENSIONLESS_FORMAT_JAVASCRIPT, EXTENSIONLESS_FORMAT_WASM, S_IFMT, S_IFREG, S_IFDIR, S_IFCHR, S_IFBLK, S_IFIFO, S_IFLNK, S_IFSOCK, O_CREAT, O_EXCL, UV_FS_O_FILEMAP, O_NOCTTY, O_TRUNC, O_APPEND, O_DIRECTORY, O_NOATIME, O_NOFOLLOW, O_SYNC, O_DSYNC, O_DIRECT, O_NONBLOCK, S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, F_OK, R_OK, W_OK, X_OK, UV_FS_COPYFILE_EXCL, COPYFILE_EXCL, UV_FS_COPYFILE_FICLONE, COPYFILE_FICLONE, UV_FS_COPYFILE_FICLONE_FORCE, COPYFILE_FICLONE_FORCE } from "./internal/fs/constants.mjs";
// prettier-ignore
import { OPENSSL_VERSION_NUMBER, SSL_OP_ALL, SSL_OP_ALLOW_NO_DHE_KEX, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, SSL_OP_CIPHER_SERVER_PREFERENCE, SSL_OP_CISCO_ANYCONNECT, SSL_OP_COOKIE_EXCHANGE, SSL_OP_CRYPTOPRO_TLSEXT_BUG, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS, SSL_OP_LEGACY_SERVER_CONNECT, SSL_OP_NO_COMPRESSION, SSL_OP_NO_ENCRYPT_THEN_MAC, SSL_OP_NO_QUERY_MTU, SSL_OP_NO_RENEGOTIATION, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION, SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TICKET, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_PRIORITIZE_CHACHA, SSL_OP_TLS_ROLLBACK_BUG, ENGINE_METHOD_RSA, ENGINE_METHOD_DSA, ENGINE_METHOD_DH, ENGINE_METHOD_RAND, ENGINE_METHOD_EC, ENGINE_METHOD_CIPHERS, ENGINE_METHOD_DIGESTS, ENGINE_METHOD_PKEY_METHS, ENGINE_METHOD_PKEY_ASN1_METHS, ENGINE_METHOD_ALL, ENGINE_METHOD_NONE, DH_CHECK_P_NOT_SAFE_PRIME, DH_CHECK_P_NOT_PRIME, DH_UNABLE_TO_CHECK_GENERATOR, DH_NOT_SUITABLE_GENERATOR, RSA_PKCS1_PADDING, RSA_NO_PADDING, RSA_PKCS1_OAEP_PADDING, RSA_X931_PADDING, RSA_PKCS1_PSS_PADDING, RSA_PSS_SALTLEN_DIGEST, RSA_PSS_SALTLEN_MAX_SIGN, RSA_PSS_SALTLEN_AUTO, defaultCoreCipherList, TLS1_VERSION, TLS1_1_VERSION, TLS1_2_VERSION, TLS1_3_VERSION, POINT_CONVERSION_COMPRESSED, POINT_CONVERSION_UNCOMPRESSED, POINT_CONVERSION_HYBRID } from "./internal/crypto/constants.mjs";
export * from "./internal/fs/constants.mjs";
// prettier-ignore
export { OPENSSL_VERSION_NUMBER, SSL_OP_ALL, SSL_OP_ALLOW_NO_DHE_KEX, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, SSL_OP_CIPHER_SERVER_PREFERENCE, SSL_OP_CISCO_ANYCONNECT, SSL_OP_COOKIE_EXCHANGE, SSL_OP_CRYPTOPRO_TLSEXT_BUG, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS, SSL_OP_LEGACY_SERVER_CONNECT, SSL_OP_NO_COMPRESSION, SSL_OP_NO_ENCRYPT_THEN_MAC, SSL_OP_NO_QUERY_MTU, SSL_OP_NO_RENEGOTIATION, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION, SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TICKET, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_PRIORITIZE_CHACHA, SSL_OP_TLS_ROLLBACK_BUG, ENGINE_METHOD_RSA, ENGINE_METHOD_DSA, ENGINE_METHOD_DH, ENGINE_METHOD_RAND, ENGINE_METHOD_EC, ENGINE_METHOD_CIPHERS, ENGINE_METHOD_DIGESTS, ENGINE_METHOD_PKEY_METHS, ENGINE_METHOD_PKEY_ASN1_METHS, ENGINE_METHOD_ALL, ENGINE_METHOD_NONE, DH_CHECK_P_NOT_SAFE_PRIME, DH_CHECK_P_NOT_PRIME, DH_UNABLE_TO_CHECK_GENERATOR, DH_NOT_SUITABLE_GENERATOR, RSA_PKCS1_PADDING, RSA_NO_PADDING, RSA_PKCS1_OAEP_PADDING, RSA_X931_PADDING, RSA_PKCS1_PSS_PADDING, RSA_PSS_SALTLEN_DIGEST, RSA_PSS_SALTLEN_MAX_SIGN, RSA_PSS_SALTLEN_AUTO, defaultCoreCipherList, TLS1_VERSION, TLS1_1_VERSION, TLS1_2_VERSION, TLS1_3_VERSION, POINT_CONVERSION_COMPRESSED, POINT_CONVERSION_UNCOMPRESSED, POINT_CONVERSION_HYBRID } from "./internal/crypto/constants.mjs";
export const { RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, RTLD_LOCAL, RTLD_DEEPBIND } = dlopen;
// prettier-ignore
export const { E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, EAFNOSUPPORT, EAGAIN, EALREADY, EBADF, EBADMSG, EBUSY, ECANCELED, ECHILD, ECONNABORTED, ECONNREFUSED, ECONNRESET, EDEADLK, EDESTADDRREQ, EDOM, EDQUOT, EEXIST, EFAULT, EFBIG, EHOSTUNREACH, EIDRM, EILSEQ, EINPROGRESS, EINTR, EINVAL, EIO, EISCONN, EISDIR, ELOOP, EMFILE, EMLINK, EMSGSIZE, EMULTIHOP, ENAMETOOLONG, ENETDOWN, ENETRESET, ENETUNREACH, ENFILE, ENOBUFS, ENODATA, ENODEV, ENOENT, ENOEXEC, ENOLCK, ENOLINK, ENOMEM, ENOMSG, ENOPROTOOPT, ENOSPC, ENOSR, ENOSTR, ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTSOCK, ENOTSUP, ENOTTY, ENXIO, EOPNOTSUPP, EOVERFLOW, EPERM, EPIPE, EPROTO, EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, ESRCH, ESTALE, ETIME, ETIMEDOUT, ETXTBSY, EWOULDBLOCK, EXDEV } = errno;
// prettier-ignore
export const { PRIORITY_LOW, PRIORITY_BELOW_NORMAL, PRIORITY_NORMAL, PRIORITY_ABOVE_NORMAL, PRIORITY_HIGH, PRIORITY_HIGHEST } = priority;
// prettier-ignore
export const { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT, SIGBUS, SIGFPE, SIGKILL, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGSTKFLT, SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, SIGWINCH, SIGIO, SIGPOLL, SIGPWR, SIGSYS } = signals;
// prettier-ignore
export default {
OPENSSL_VERSION_NUMBER,
SSL_OP_ALL,
SSL_OP_ALLOW_NO_DHE_KEX,
SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION,
SSL_OP_CIPHER_SERVER_PREFERENCE,
SSL_OP_CISCO_ANYCONNECT,
SSL_OP_COOKIE_EXCHANGE,
SSL_OP_CRYPTOPRO_TLSEXT_BUG,
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS,
SSL_OP_LEGACY_SERVER_CONNECT,
SSL_OP_NO_COMPRESSION,
SSL_OP_NO_ENCRYPT_THEN_MAC,
SSL_OP_NO_QUERY_MTU,
SSL_OP_NO_RENEGOTIATION,
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION,
SSL_OP_NO_SSLv2,
SSL_OP_NO_SSLv3,
SSL_OP_NO_TICKET,
SSL_OP_NO_TLSv1,
SSL_OP_NO_TLSv1_1,
SSL_OP_NO_TLSv1_2,
SSL_OP_NO_TLSv1_3,
SSL_OP_PRIORITIZE_CHACHA,
SSL_OP_TLS_ROLLBACK_BUG,
ENGINE_METHOD_RSA,
ENGINE_METHOD_DSA,
ENGINE_METHOD_DH,
ENGINE_METHOD_RAND,
ENGINE_METHOD_EC,
ENGINE_METHOD_CIPHERS,
ENGINE_METHOD_DIGESTS,
ENGINE_METHOD_PKEY_METHS,
ENGINE_METHOD_PKEY_ASN1_METHS,
ENGINE_METHOD_ALL,
ENGINE_METHOD_NONE,
DH_CHECK_P_NOT_SAFE_PRIME,
DH_CHECK_P_NOT_PRIME,
DH_UNABLE_TO_CHECK_GENERATOR,
DH_NOT_SUITABLE_GENERATOR,
RSA_PKCS1_PADDING,
RSA_NO_PADDING,
RSA_PKCS1_OAEP_PADDING,
RSA_X931_PADDING,
RSA_PKCS1_PSS_PADDING,
RSA_PSS_SALTLEN_DIGEST,
RSA_PSS_SALTLEN_MAX_SIGN,
RSA_PSS_SALTLEN_AUTO,
defaultCoreCipherList,
TLS1_VERSION,
TLS1_1_VERSION,
TLS1_2_VERSION,
TLS1_3_VERSION,
POINT_CONVERSION_COMPRESSED,
POINT_CONVERSION_UNCOMPRESSED,
POINT_CONVERSION_HYBRID,
UV_FS_SYMLINK_DIR,
UV_FS_SYMLINK_JUNCTION,
O_RDONLY,
O_WRONLY,
O_RDWR,
UV_DIRENT_UNKNOWN,
UV_DIRENT_FILE,
UV_DIRENT_DIR,
UV_DIRENT_LINK,
UV_DIRENT_FIFO,
UV_DIRENT_SOCKET,
UV_DIRENT_CHAR,
UV_DIRENT_BLOCK,
EXTENSIONLESS_FORMAT_JAVASCRIPT,
EXTENSIONLESS_FORMAT_WASM,
S_IFMT,
S_IFREG,
S_IFDIR,
S_IFCHR,
S_IFBLK,
S_IFIFO,
S_IFLNK,
S_IFSOCK,
O_CREAT,
O_EXCL,
UV_FS_O_FILEMAP,
O_NOCTTY,
O_TRUNC,
O_APPEND,
O_DIRECTORY,
O_NOATIME,
O_NOFOLLOW,
O_SYNC,
O_DSYNC,
O_DIRECT,
O_NONBLOCK,
S_IRWXU,
S_IRUSR,
S_IWUSR,
S_IXUSR,
S_IRWXG,
S_IRGRP,
S_IWGRP,
S_IXGRP,
S_IRWXO,
S_IROTH,
S_IWOTH,
S_IXOTH,
F_OK,
R_OK,
W_OK,
X_OK,
UV_FS_COPYFILE_EXCL,
COPYFILE_EXCL,
UV_FS_COPYFILE_FICLONE,
COPYFILE_FICLONE,
UV_FS_COPYFILE_FICLONE_FORCE,
COPYFILE_FICLONE_FORCE,
E2BIG,
EACCES,
EADDRINUSE,
EADDRNOTAVAIL,
EAFNOSUPPORT,
EAGAIN,
EALREADY,
EBADF,
EBADMSG,
EBUSY,
ECANCELED,
ECHILD,
ECONNABORTED,
ECONNREFUSED,
ECONNRESET,
EDEADLK,
EDESTADDRREQ,
EDOM,
EDQUOT,
EEXIST,
EFAULT,
EFBIG,
EHOSTUNREACH,
EIDRM,
EILSEQ,
EINPROGRESS,
EINTR,
EINVAL,
EIO,
EISCONN,
EISDIR,
ELOOP,
EMFILE,
EMLINK,
EMSGSIZE,
EMULTIHOP,
ENAMETOOLONG,
ENETDOWN,
ENETRESET,
ENETUNREACH,
ENFILE,
ENOBUFS,
ENODATA,
ENODEV,
ENOENT,
ENOEXEC,
ENOLCK,
ENOLINK,
ENOMEM,
ENOMSG,
ENOPROTOOPT,
ENOSPC,
ENOSR,
ENOSTR,
ENOSYS,
ENOTCONN,
ENOTDIR,
ENOTEMPTY,
ENOTSOCK,
ENOTSUP,
ENOTTY,
ENXIO,
EOPNOTSUPP,
EOVERFLOW,
EPERM,
EPIPE,
EPROTO,
EPROTONOSUPPORT,
EPROTOTYPE,
ERANGE,
EROFS,
ESPIPE,
ESRCH,
ESTALE,
ETIME,
ETIMEDOUT,
ETXTBSY,
EWOULDBLOCK,
EXDEV,
RTLD_LAZY,
RTLD_NOW,
RTLD_GLOBAL,
RTLD_LOCAL,
RTLD_DEEPBIND,
PRIORITY_LOW,
PRIORITY_BELOW_NORMAL,
PRIORITY_NORMAL,
PRIORITY_ABOVE_NORMAL,
PRIORITY_HIGH,
PRIORITY_HIGHEST,
SIGHUP,
SIGINT,
SIGQUIT,
SIGILL,
SIGTRAP,
SIGABRT,
SIGIOT,
SIGBUS,
SIGFPE,
SIGKILL,
SIGUSR1,
SIGSEGV,
SIGUSR2,
SIGPIPE,
SIGALRM,
SIGTERM,
SIGCHLD,
SIGSTKFLT,
SIGCONT,
SIGSTOP,
SIGTSTP,
SIGTTIN,
SIGTTOU,
SIGURG,
SIGXCPU,
SIGXFSZ,
SIGVTALRM,
SIGPROF,
SIGWINCH,
SIGIO,
SIGPOLL,
SIGPWR,
SIGSYS
};

View file

@ -0,0 +1,6 @@
export * from "./internal/crypto/web.mjs";
export * from "./internal/crypto/node.mjs";
// prettier-ignore
export declare const constants: {};
declare const _default: {};
export default _default;

View file

@ -0,0 +1,138 @@
import { getRandomValues, randomUUID, subtle } from "./internal/crypto/web.mjs";
import { Certificate, Cipher, Cipheriv, Decipher, Decipheriv, DiffieHellman, DiffieHellmanGroup, ECDH, Hash, Hmac, KeyObject, Sign, Verify, X509Certificate, checkPrime, checkPrimeSync, createCipheriv, createDecipheriv, createDiffieHellman, createDiffieHellmanGroup, createECDH, createHash, createHmac, createPrivateKey, createPublicKey, createSecretKey, createSign, createVerify, diffieHellman, fips, generateKey, generateKeyPair, generateKeyPairSync, generateKeySync, generatePrime, generatePrimeSync, getCipherInfo, getCiphers, getCurves, getDiffieHellman, getFips, getHashes, hash, hkdf, hkdfSync, pbkdf2, pbkdf2Sync, privateDecrypt, privateEncrypt, pseudoRandomBytes, publicDecrypt, prng, publicEncrypt, randomBytes, randomFill, randomFillSync, randomInt, rng, scrypt, scryptSync, secureHeapUsed, setEngine, setFips, sign, timingSafeEqual, verify, webcrypto } from "./internal/crypto/node.mjs";
// prettier-ignore
import { OPENSSL_VERSION_NUMBER, SSL_OP_ALL, SSL_OP_ALLOW_NO_DHE_KEX, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, SSL_OP_CIPHER_SERVER_PREFERENCE, SSL_OP_CISCO_ANYCONNECT, SSL_OP_COOKIE_EXCHANGE, SSL_OP_CRYPTOPRO_TLSEXT_BUG, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS, SSL_OP_LEGACY_SERVER_CONNECT, SSL_OP_NO_COMPRESSION, SSL_OP_NO_ENCRYPT_THEN_MAC, SSL_OP_NO_QUERY_MTU, SSL_OP_NO_RENEGOTIATION, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION, SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TICKET, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_PRIORITIZE_CHACHA, SSL_OP_TLS_ROLLBACK_BUG, ENGINE_METHOD_RSA, ENGINE_METHOD_DSA, ENGINE_METHOD_DH, ENGINE_METHOD_RAND, ENGINE_METHOD_EC, ENGINE_METHOD_CIPHERS, ENGINE_METHOD_DIGESTS, ENGINE_METHOD_PKEY_METHS, ENGINE_METHOD_PKEY_ASN1_METHS, ENGINE_METHOD_ALL, ENGINE_METHOD_NONE, DH_CHECK_P_NOT_SAFE_PRIME, DH_CHECK_P_NOT_PRIME, DH_UNABLE_TO_CHECK_GENERATOR, DH_NOT_SUITABLE_GENERATOR, RSA_PKCS1_PADDING, RSA_NO_PADDING, RSA_PKCS1_OAEP_PADDING, RSA_X931_PADDING, RSA_PKCS1_PSS_PADDING, RSA_PSS_SALTLEN_DIGEST, RSA_PSS_SALTLEN_MAX_SIGN, RSA_PSS_SALTLEN_AUTO, defaultCoreCipherList, TLS1_VERSION, TLS1_1_VERSION, TLS1_2_VERSION, TLS1_3_VERSION, POINT_CONVERSION_COMPRESSED, POINT_CONVERSION_UNCOMPRESSED, POINT_CONVERSION_HYBRID, defaultCipherList } from "./internal/crypto/constants.mjs";
export * from "./internal/crypto/web.mjs";
export * from "./internal/crypto/node.mjs";
// prettier-ignore
export const constants = {
OPENSSL_VERSION_NUMBER,
SSL_OP_ALL,
SSL_OP_ALLOW_NO_DHE_KEX,
SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION,
SSL_OP_CIPHER_SERVER_PREFERENCE,
SSL_OP_CISCO_ANYCONNECT,
SSL_OP_COOKIE_EXCHANGE,
SSL_OP_CRYPTOPRO_TLSEXT_BUG,
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS,
SSL_OP_LEGACY_SERVER_CONNECT,
SSL_OP_NO_COMPRESSION,
SSL_OP_NO_ENCRYPT_THEN_MAC,
SSL_OP_NO_QUERY_MTU,
SSL_OP_NO_RENEGOTIATION,
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION,
SSL_OP_NO_SSLv2,
SSL_OP_NO_SSLv3,
SSL_OP_NO_TICKET,
SSL_OP_NO_TLSv1,
SSL_OP_NO_TLSv1_1,
SSL_OP_NO_TLSv1_2,
SSL_OP_NO_TLSv1_3,
SSL_OP_PRIORITIZE_CHACHA,
SSL_OP_TLS_ROLLBACK_BUG,
ENGINE_METHOD_RSA,
ENGINE_METHOD_DSA,
ENGINE_METHOD_DH,
ENGINE_METHOD_RAND,
ENGINE_METHOD_EC,
ENGINE_METHOD_CIPHERS,
ENGINE_METHOD_DIGESTS,
ENGINE_METHOD_PKEY_METHS,
ENGINE_METHOD_PKEY_ASN1_METHS,
ENGINE_METHOD_ALL,
ENGINE_METHOD_NONE,
DH_CHECK_P_NOT_SAFE_PRIME,
DH_CHECK_P_NOT_PRIME,
DH_UNABLE_TO_CHECK_GENERATOR,
DH_NOT_SUITABLE_GENERATOR,
RSA_PKCS1_PADDING,
RSA_NO_PADDING,
RSA_PKCS1_OAEP_PADDING,
RSA_X931_PADDING,
RSA_PKCS1_PSS_PADDING,
RSA_PSS_SALTLEN_DIGEST,
RSA_PSS_SALTLEN_MAX_SIGN,
RSA_PSS_SALTLEN_AUTO,
defaultCoreCipherList,
TLS1_VERSION,
TLS1_1_VERSION,
TLS1_2_VERSION,
TLS1_3_VERSION,
POINT_CONVERSION_COMPRESSED,
POINT_CONVERSION_UNCOMPRESSED,
POINT_CONVERSION_HYBRID,
defaultCipherList
};
export default {
constants,
getRandomValues,
randomUUID,
subtle,
Certificate,
Cipher,
Cipheriv,
Decipher,
Decipheriv,
DiffieHellman,
DiffieHellmanGroup,
ECDH,
Hash,
Hmac,
KeyObject,
Sign,
Verify,
X509Certificate,
checkPrime,
checkPrimeSync,
createCipheriv,
createDecipheriv,
createDiffieHellman,
createDiffieHellmanGroup,
createECDH,
createHash,
createHmac,
createPrivateKey,
createPublicKey,
createSecretKey,
createSign,
createVerify,
diffieHellman,
fips,
generateKey,
generateKeyPair,
generateKeyPairSync,
generateKeySync,
generatePrime,
generatePrimeSync,
getCipherInfo,
getCiphers,
getCurves,
getDiffieHellman,
getFips,
getHashes,
hash,
hkdf,
hkdfSync,
pbkdf2,
pbkdf2Sync,
privateDecrypt,
privateEncrypt,
pseudoRandomBytes,
publicDecrypt,
prng,
publicEncrypt,
randomBytes,
randomFill,
randomFillSync,
randomInt,
rng,
scrypt,
scryptSync,
secureHeapUsed,
setEngine,
setFips,
sign,
timingSafeEqual,
verify,
webcrypto
};

View file

@ -0,0 +1,6 @@
import type nodeDgram from "node:dgram";
export { Socket } from "./internal/dgram/socket.mjs";
export declare const _createSocketHandle: unknown;
export declare const createSocket: typeof nodeDgram.createSocket;
declare const _default: typeof nodeDgram;
export default _default;

View file

@ -0,0 +1,12 @@
import noop from "../mock/noop.mjs";
import { Socket } from "./internal/dgram/socket.mjs";
export { Socket } from "./internal/dgram/socket.mjs";
export const _createSocketHandle = noop;
export const createSocket = function() {
return new Socket();
};
export default {
Socket,
_createSocketHandle,
createSocket
};

View file

@ -0,0 +1,11 @@
import type nodeDiagnosticsChannel from "node:diagnostics_channel";
export { Channel } from "./internal/diagnostics_channel/channel.mjs";
export declare const channel: typeof nodeDiagnosticsChannel.channel;
export declare const hasSubscribers: typeof nodeDiagnosticsChannel.hasSubscribers;
export declare const subscribe: typeof nodeDiagnosticsChannel.subscribe;
export declare const unsubscribe: typeof nodeDiagnosticsChannel.unsubscribe;
export declare const tracingChannel: typeof nodeDiagnosticsChannel.tracingChannel;
// TracingChannel is incorrectly exposed on the `diagnostics_channel` type. In addition, its type
// takes a constructor with no arguments, whereas the node implementation takes a name (matching `tracingChannel`)
declare const _default: {};
export default _default;

View file

@ -0,0 +1,34 @@
import { Channel, getChannels } from "./internal/diagnostics_channel/channel.mjs";
import { TracingChannel } from "./internal/diagnostics_channel/tracing-channel.mjs";
export { Channel } from "./internal/diagnostics_channel/channel.mjs";
export const channel = function(name) {
const channels = getChannels();
if (name in channels) {
return channels[name];
}
return new Channel(name);
};
export const hasSubscribers = function(name) {
const channels = getChannels();
const channel = channels[name];
return channel && channel.hasSubscribers;
};
export const subscribe = function(name, onMessage) {
channel(name).subscribe(onMessage);
};
export const unsubscribe = function(name, onMessage) {
return channel(name).unsubscribe(onMessage);
};
export const tracingChannel = function(name) {
return new TracingChannel(name);
};
// TracingChannel is incorrectly exposed on the `diagnostics_channel` type. In addition, its type
// takes a constructor with no arguments, whereas the node implementation takes a name (matching `tracingChannel`)
export default {
Channel,
channel,
hasSubscribers,
subscribe,
tracingChannel,
unsubscribe
};

View file

@ -0,0 +1,29 @@
import type nodeDns from "node:dns";
import promises from "node:dns/promises";
export { promises };
export declare const Resolver: typeof nodeDns.Resolver;
export declare const getDefaultResultOrder: typeof nodeDns.getDefaultResultOrder;
export declare const getServers: typeof nodeDns.getServers;
export declare const lookup: typeof nodeDns.lookup;
export declare const lookupService: typeof nodeDns.lookupService;
export declare const resolve: typeof nodeDns.resolve;
export declare const resolve4: typeof nodeDns.resolve4;
export declare const resolve6: typeof nodeDns.resolve6;
export declare const resolveAny: typeof nodeDns.resolveAny;
export declare const resolveCaa: typeof nodeDns.resolveCaa;
export declare const resolveCname: typeof nodeDns.resolveCname;
export declare const resolveMx: typeof nodeDns.resolveMx;
export declare const resolveNaptr: typeof nodeDns.resolveNaptr;
export declare const resolveNs: typeof nodeDns.resolveNs;
export declare const resolvePtr: typeof nodeDns.resolvePtr;
export declare const resolveSoa: typeof nodeDns.resolveSoa;
export declare const resolveSrv: typeof nodeDns.resolveSrv;
export declare const resolveTxt: typeof nodeDns.resolveTxt;
export declare const reverse: typeof nodeDns.reverse;
export declare const setDefaultResultOrder: typeof nodeDns.setDefaultResultOrder;
export declare const setServers: typeof nodeDns.setServers;
// prettier-ignore
export { NODATA, FORMERR, SERVFAIL, NOTFOUND, NOTIMP, REFUSED, BADQUERY, BADNAME, BADFAMILY, BADRESP, CONNREFUSED, TIMEOUT, EOF, FILE, NOMEM, DESTRUCTION, BADSTR, BADFLAGS, NONAME, BADHINTS, NOTINITIALIZED, LOADIPHLPAPI, ADDRGETNETWORKPARAMS, CANCELLED, ADDRCONFIG, ALL, V4MAPPED } from "./internal/dns/constants.mjs";
// prettier-ignore
declare const _default: {};
export default _default;

View file

@ -0,0 +1,81 @@
import noop from "../mock/noop.mjs";
import { notImplemented, notImplementedAsync, notImplementedClass } from "../_internal/utils.mjs";
import promises from "node:dns/promises";
export { promises };
export const Resolver = /* @__PURE__ */ notImplementedClass("dns.Resolver");
export const getDefaultResultOrder = () => "verbatim";
export const getServers = () => [];
export const lookup = /* @__PURE__ */ notImplementedAsync("dns.lookup");
export const lookupService = /* @__PURE__ */ notImplementedAsync("dns.lookupService");
export const resolve = /* @__PURE__ */ notImplementedAsync("dns.resolve");
export const resolve4 = /* @__PURE__ */ notImplementedAsync("dns.resolve4");
export const resolve6 = /* @__PURE__ */ notImplementedAsync("dns.resolve6");
export const resolveAny = /* @__PURE__ */ notImplementedAsync("dns.resolveAny");
export const resolveCaa = /* @__PURE__ */ notImplementedAsync("dns.resolveCaa");
export const resolveCname = /* @__PURE__ */ notImplementedAsync("dns.resolveCname");
export const resolveMx = /* @__PURE__ */ notImplementedAsync("dns.resolveMx");
export const resolveNaptr = /* @__PURE__ */ notImplementedAsync("dns.resolveNaptr");
export const resolveNs = /* @__PURE__ */ notImplementedAsync("dns.resolveNs");
export const resolvePtr = /* @__PURE__ */ notImplementedAsync("dns.resolvePtr");
export const resolveSoa = /* @__PURE__ */ notImplementedAsync("dns.resolveSoa");
export const resolveSrv = /* @__PURE__ */ notImplementedAsync("dns.resolveSrv");
export const resolveTxt = /* @__PURE__ */ notImplementedAsync("dns.resolveTxt");
export const reverse = /* @__PURE__ */ notImplemented("dns.reverse");
export const setDefaultResultOrder = noop;
export const setServers = noop;
// prettier-ignore
import { NODATA, FORMERR, SERVFAIL, NOTFOUND, NOTIMP, REFUSED, BADQUERY, BADNAME, BADFAMILY, BADRESP, CONNREFUSED, TIMEOUT, EOF, FILE, NOMEM, DESTRUCTION, BADSTR, BADFLAGS, NONAME, BADHINTS, NOTINITIALIZED, LOADIPHLPAPI, ADDRGETNETWORKPARAMS, CANCELLED, ADDRCONFIG, ALL, V4MAPPED } from "./internal/dns/constants.mjs";
// prettier-ignore
export { NODATA, FORMERR, SERVFAIL, NOTFOUND, NOTIMP, REFUSED, BADQUERY, BADNAME, BADFAMILY, BADRESP, CONNREFUSED, TIMEOUT, EOF, FILE, NOMEM, DESTRUCTION, BADSTR, BADFLAGS, NONAME, BADHINTS, NOTINITIALIZED, LOADIPHLPAPI, ADDRGETNETWORKPARAMS, CANCELLED, ADDRCONFIG, ALL, V4MAPPED } from "./internal/dns/constants.mjs";
// prettier-ignore
export default {
NODATA,
FORMERR,
SERVFAIL,
NOTFOUND,
NOTIMP,
REFUSED,
BADQUERY,
BADNAME,
BADFAMILY,
BADRESP,
CONNREFUSED,
TIMEOUT,
EOF,
FILE,
NOMEM,
DESTRUCTION,
BADSTR,
BADFLAGS,
NONAME,
BADHINTS,
NOTINITIALIZED,
LOADIPHLPAPI,
ADDRGETNETWORKPARAMS,
CANCELLED,
ADDRCONFIG,
ALL,
V4MAPPED,
Resolver,
getDefaultResultOrder,
getServers,
lookup,
lookupService,
promises,
resolve,
resolve4,
resolve6,
resolveAny,
resolveCaa,
resolveCname,
resolveMx,
resolveNaptr,
resolveNs,
resolvePtr,
resolveSoa,
resolveSrv,
resolveTxt,
reverse,
setDefaultResultOrder,
setServers
};

View file

@ -0,0 +1,27 @@
import type nodeDnsPromises from "node:dns/promises";
// prettier-ignore
export { NODATA, FORMERR, SERVFAIL, NOTFOUND, NOTIMP, REFUSED, BADQUERY, BADNAME, BADFAMILY, BADRESP, CONNREFUSED, TIMEOUT, EOF, FILE, NOMEM, DESTRUCTION, BADSTR, BADFLAGS, NONAME, BADHINTS, NOTINITIALIZED, LOADIPHLPAPI, ADDRGETNETWORKPARAMS, CANCELLED } from "../internal/dns/constants.mjs";
export declare const Resolver: typeof nodeDnsPromises.Resolver;
export declare const getDefaultResultOrder: typeof nodeDnsPromises.getDefaultResultOrder;
export declare const getServers: typeof nodeDnsPromises.getServers;
export declare const lookup: typeof nodeDnsPromises.lookup;
export declare const lookupService: typeof nodeDnsPromises.lookupService;
export declare const resolve: typeof nodeDnsPromises.resolve;
export declare const resolve4: typeof nodeDnsPromises.resolve4;
export declare const resolve6: typeof nodeDnsPromises.resolve6;
export declare const resolveAny: typeof nodeDnsPromises.resolveAny;
export declare const resolveCaa: typeof nodeDnsPromises.resolveCaa;
export declare const resolveCname: typeof nodeDnsPromises.resolveCname;
export declare const resolveMx: typeof nodeDnsPromises.resolveMx;
export declare const resolveNaptr: typeof nodeDnsPromises.resolveNaptr;
export declare const resolveNs: typeof nodeDnsPromises.resolveNs;
export declare const resolvePtr: typeof nodeDnsPromises.resolvePtr;
export declare const resolveSoa: typeof nodeDnsPromises.resolveSoa;
export declare const resolveSrv: typeof nodeDnsPromises.resolveSrv;
export declare const resolveTxt: typeof nodeDnsPromises.resolveTxt;
export declare const reverse: typeof nodeDnsPromises.reverse;
export declare const setDefaultResultOrder: typeof nodeDnsPromises.setDefaultResultOrder;
export declare const setServers: typeof nodeDnsPromises.setServers;
// prettier-ignore
declare const _default: {};
export default _default;

View file

@ -0,0 +1,75 @@
import noop from "../../mock/noop.mjs";
import { notImplemented, notImplementedAsync, notImplementedClass } from "../../_internal/utils.mjs";
// prettier-ignore
import { NODATA, FORMERR, SERVFAIL, NOTFOUND, NOTIMP, REFUSED, BADQUERY, BADNAME, BADFAMILY, BADRESP, CONNREFUSED, TIMEOUT, EOF, FILE, NOMEM, DESTRUCTION, BADSTR, BADFLAGS, NONAME, BADHINTS, NOTINITIALIZED, LOADIPHLPAPI, ADDRGETNETWORKPARAMS, CANCELLED } from "../internal/dns/constants.mjs";
// prettier-ignore
export { NODATA, FORMERR, SERVFAIL, NOTFOUND, NOTIMP, REFUSED, BADQUERY, BADNAME, BADFAMILY, BADRESP, CONNREFUSED, TIMEOUT, EOF, FILE, NOMEM, DESTRUCTION, BADSTR, BADFLAGS, NONAME, BADHINTS, NOTINITIALIZED, LOADIPHLPAPI, ADDRGETNETWORKPARAMS, CANCELLED } from "../internal/dns/constants.mjs";
export const Resolver = /* @__PURE__ */ notImplementedClass("dns.Resolver");
export const getDefaultResultOrder = () => "verbatim";
export const getServers = () => [];
export const lookup = /* @__PURE__ */ notImplementedAsync("dns.lookup");
export const lookupService = /* @__PURE__ */ notImplementedAsync("dns.lookupService");
export const resolve = /* @__PURE__ */ notImplementedAsync("dns.resolve");
export const resolve4 = /* @__PURE__ */ notImplementedAsync("dns.resolve4");
export const resolve6 = /* @__PURE__ */ notImplementedAsync("dns.resolve6");
export const resolveAny = /* @__PURE__ */ notImplementedAsync("dns.resolveAny");
export const resolveCaa = /* @__PURE__ */ notImplementedAsync("dns.resolveCaa");
export const resolveCname = /* @__PURE__ */ notImplementedAsync("dns.resolveCname");
export const resolveMx = /* @__PURE__ */ notImplementedAsync("dns.resolveMx");
export const resolveNaptr = /* @__PURE__ */ notImplementedAsync("dns.resolveNaptr");
export const resolveNs = /* @__PURE__ */ notImplementedAsync("dns.resolveNs");
export const resolvePtr = /* @__PURE__ */ notImplementedAsync("dns.resolvePtr");
export const resolveSoa = /* @__PURE__ */ notImplementedAsync("dns.resolveSoa");
export const resolveSrv = /* @__PURE__ */ notImplementedAsync("dns.resolveSrv");
export const resolveTxt = /* @__PURE__ */ notImplementedAsync("dns.resolveTxt");
export const reverse = /* @__PURE__ */ notImplemented("dns.reverse");
export const setDefaultResultOrder = noop;
export const setServers = noop;
// prettier-ignore
export default {
NODATA,
FORMERR,
SERVFAIL,
NOTFOUND,
NOTIMP,
REFUSED,
BADQUERY,
BADNAME,
BADFAMILY,
BADRESP,
CONNREFUSED,
TIMEOUT,
EOF,
FILE,
NOMEM,
DESTRUCTION,
BADSTR,
BADFLAGS,
NONAME,
BADHINTS,
NOTINITIALIZED,
LOADIPHLPAPI,
ADDRGETNETWORKPARAMS,
CANCELLED,
Resolver,
getDefaultResultOrder,
getServers,
lookup,
lookupService,
resolve,
resolve4,
resolve6,
resolveAny,
resolveCaa,
resolveCname,
resolveMx,
resolveNaptr,
resolveNs,
resolvePtr,
resolveSoa,
resolveSrv,
resolveTxt,
reverse,
setDefaultResultOrder,
setServers
};

View file

@ -0,0 +1,8 @@
import type nodeDomain from "node:domain";
export { Domain } from "./internal/domain/domain.mjs";
export declare const create: typeof nodeDomain.create;
export declare const createDomain: typeof nodeDomain.create;
export declare const active: unknown;
export declare const _stack: unknown;
declare const _default: typeof nodeDomain;
export default _default;

View file

@ -0,0 +1,16 @@
import { Domain } from "./internal/domain/domain.mjs";
export { Domain } from "./internal/domain/domain.mjs";
export const create = function() {
return new Domain();
};
export const createDomain = create;
const _domain = create();
export const active = () => _domain;
export const _stack = [];
export default {
Domain,
_stack,
active,
create,
createDomain
};

View file

@ -0,0 +1,13 @@
// https://nodejs.org/api/events.html
import type nodeEvents from "node:events";
export { _EventEmitter as EventEmitter, EventEmitterAsyncResource, addAbortListener, getEventListeners, getMaxListeners, on, once } from "./internal/events/events.mjs";
export declare const usingDomains: boolean;
export declare const captureRejectionSymbol: unknown;
export declare const captureRejections: boolean;
export declare const errorMonitor: unknown;
export declare const defaultMaxListeners = 10;
export declare const setMaxListeners: unknown;
export declare const listenerCount: unknown;
export declare const init: unknown;
declare const _default: typeof nodeEvents;
export default _default;

View file

@ -0,0 +1,12 @@
import { _EventEmitter } from "./internal/events/events.mjs";
import { notImplemented } from "../_internal/utils.mjs";
export { _EventEmitter as EventEmitter, EventEmitterAsyncResource, addAbortListener, getEventListeners, getMaxListeners, on, once } from "./internal/events/events.mjs";
export const usingDomains = false;
export const captureRejectionSymbol = /* @__PURE__ */ Symbol.for("nodejs.rejection");
export const captureRejections = false;
export const errorMonitor = /* @__PURE__ */ Symbol.for("events.errorMonitor");
export const defaultMaxListeners = 10;
export const setMaxListeners = /* @__PURE__ */ notImplemented("node:events.setMaxListeners");
export const listenerCount = /* @__PURE__ */ notImplemented("node:events.listenerCount");
export const init = /* @__PURE__ */ notImplemented("node:events.init");
export default _EventEmitter;

View file

@ -0,0 +1,10 @@
import promises from "node:fs/promises";
import * as constants from "./internal/fs/constants.mjs";
export { F_OK, R_OK, W_OK, X_OK } from "./internal/fs/constants.mjs";
export { promises, constants };
export * from "./internal/fs/fs.mjs";
export * from "./internal/fs/classes.mjs";
declare const _default: {
constants: any;
};
export default _default;

View file

@ -0,0 +1,117 @@
import promises from "node:fs/promises";
import { Dir, Dirent, FileReadStream, FileWriteStream, ReadStream, Stats, WriteStream } from "./internal/fs/classes.mjs";
import { _toUnixTimestamp, access, accessSync, appendFile, appendFileSync, chmod, chmodSync, chown, chownSync, close, closeSync, copyFile, copyFileSync, cp, cpSync, createReadStream, createWriteStream, exists, existsSync, fchmod, fchmodSync, fchown, fchownSync, fdatasync, fdatasyncSync, fstat, fstatSync, fsync, fsyncSync, ftruncate, ftruncateSync, futimes, futimesSync, glob, lchmod, globSync, lchmodSync, lchown, lchownSync, link, linkSync, lstat, lstatSync, lutimes, lutimesSync, mkdir, mkdirSync, mkdtemp, mkdtempSync, open, openAsBlob, openSync, opendir, opendirSync, read, readFile, readFileSync, readSync, readdir, readdirSync, readlink, readlinkSync, readv, readvSync, realpath, realpathSync, rename, renameSync, rm, rmSync, rmdir, rmdirSync, stat, statSync, statfs, statfsSync, symlink, symlinkSync, truncate, truncateSync, unlink, unlinkSync, unwatchFile, utimes, utimesSync, watch, watchFile, write, writeFile, writeFileSync, writeSync, writev, writevSync } from "./internal/fs/fs.mjs";
import * as constants from "./internal/fs/constants.mjs";
import { F_OK, R_OK, W_OK, X_OK } from "./internal/fs/constants.mjs";
export { F_OK, R_OK, W_OK, X_OK } from "./internal/fs/constants.mjs";
export { promises, constants };
export * from "./internal/fs/fs.mjs";
export * from "./internal/fs/classes.mjs";
export default {
F_OK,
R_OK,
W_OK,
X_OK,
constants,
promises,
Dir,
Dirent,
FileReadStream,
FileWriteStream,
ReadStream,
Stats,
WriteStream,
_toUnixTimestamp,
access,
accessSync,
appendFile,
appendFileSync,
chmod,
chmodSync,
chown,
chownSync,
close,
closeSync,
copyFile,
copyFileSync,
cp,
cpSync,
createReadStream,
createWriteStream,
exists,
existsSync,
fchmod,
fchmodSync,
fchown,
fchownSync,
fdatasync,
fdatasyncSync,
fstat,
fstatSync,
fsync,
fsyncSync,
ftruncate,
ftruncateSync,
futimes,
futimesSync,
glob,
lchmod,
globSync,
lchmodSync,
lchown,
lchownSync,
link,
linkSync,
lstat,
lstatSync,
lutimes,
lutimesSync,
mkdir,
mkdirSync,
mkdtemp,
mkdtempSync,
open,
openAsBlob,
openSync,
opendir,
opendirSync,
read,
readFile,
readFileSync,
readSync,
readdir,
readdirSync,
readlink,
readlinkSync,
readv,
readvSync,
realpath,
realpathSync,
rename,
renameSync,
rm,
rmSync,
rmdir,
rmdirSync,
stat,
statSync,
statfs,
statfsSync,
symlink,
symlinkSync,
truncate,
truncateSync,
unlink,
unlinkSync,
unwatchFile,
utimes,
utimesSync,
watch,
watchFile,
write,
writeFile,
writeFileSync,
writeSync,
writev,
writevSync
};

View file

@ -0,0 +1,7 @@
import * as constants from "../internal/fs/constants.mjs";
export { constants };
export * from "../internal/fs/promises.mjs";
declare const _default: {
constants: any;
};
export default _default;

View file

@ -0,0 +1,38 @@
import { access, appendFile, chmod, chown, copyFile, cp, glob, lchmod, lchown, link, lstat, lutimes, mkdir, mkdtemp, open, opendir, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat, statfs, symlink, truncate, unlink, utimes, watch, writeFile } from "../internal/fs/promises.mjs";
import * as constants from "../internal/fs/constants.mjs";
export { constants };
export * from "../internal/fs/promises.mjs";
export default {
constants,
access,
appendFile,
chmod,
chown,
copyFile,
cp,
glob,
lchmod,
lchown,
link,
lstat,
lutimes,
mkdir,
mkdtemp,
open,
opendir,
readFile,
readdir,
readlink,
realpath,
rename,
rm,
rmdir,
stat,
statfs,
symlink,
truncate,
unlink,
utimes,
watch,
writeFile
};

View file

@ -0,0 +1,23 @@
// https://nodejs.org/api/http.html
import type nodeHttp from "node:http";
import { METHODS, STATUS_CODES, maxHeaderSize } from "./internal/http/constants.mjs";
export { METHODS, STATUS_CODES, maxHeaderSize };
export * from "./internal/http/request.mjs";
export * from "./internal/http/response.mjs";
export { Agent } from "./internal/http/agent.mjs";
export declare const createServer: unknown;
export declare const request: unknown;
export declare const get: unknown;
export declare const Server: typeof nodeHttp.Server;
export declare const OutgoingMessage: typeof nodeHttp.OutgoingMessage;
export declare const ClientRequest: typeof nodeHttp.ClientRequest;
export declare const globalAgent: typeof nodeHttp.globalAgent;
export declare const validateHeaderName: unknown;
export declare const validateHeaderValue: unknown;
export declare const setMaxIdleHTTPParsers: unknown;
export declare const _connectionListener: unknown;
export declare const WebSocket: unknown;
export declare const CloseEvent: unknown;
export declare const MessageEvent: unknown;
declare const _default: typeof nodeHttp;
export default _default;

View file

@ -0,0 +1,45 @@
import { notImplemented, notImplementedClass } from "../_internal/utils.mjs";
import { IncomingMessage } from "./internal/http/request.mjs";
import { ServerResponse } from "./internal/http/response.mjs";
import { Agent } from "./internal/http/agent.mjs";
import { METHODS, STATUS_CODES, maxHeaderSize } from "./internal/http/constants.mjs";
export { METHODS, STATUS_CODES, maxHeaderSize };
export * from "./internal/http/request.mjs";
export * from "./internal/http/response.mjs";
export { Agent } from "./internal/http/agent.mjs";
export const createServer = /* @__PURE__ */ notImplemented("http.createServer");
export const request = /* @__PURE__ */ notImplemented("http.request");
export const get = /* @__PURE__ */ notImplemented("http.get");
export const Server = /* @__PURE__ */ notImplementedClass("http.Server");
export const OutgoingMessage = /* @__PURE__ */ notImplementedClass("http.OutgoingMessage");
export const ClientRequest = /* @__PURE__ */ notImplementedClass("http.ClientRequest");
export const globalAgent = new Agent();
export const validateHeaderName = /* @__PURE__ */ notImplemented("http.validateHeaderName");
export const validateHeaderValue = /* @__PURE__ */ notImplemented("http.validateHeaderValue");
export const setMaxIdleHTTPParsers = /* @__PURE__ */ notImplemented("http.setMaxIdleHTTPParsers");
export const _connectionListener = /* @__PURE__ */ notImplemented("http._connectionListener");
export const WebSocket = globalThis.WebSocket || /* @__PURE__ */ notImplementedClass("WebSocket");
export const CloseEvent = globalThis.CloseEvent || /* @__PURE__ */ notImplementedClass("CloseEvent");
export const MessageEvent = globalThis.MessageEvent || /* @__PURE__ */ notImplementedClass("MessageEvent");
export default {
METHODS,
STATUS_CODES,
maxHeaderSize,
IncomingMessage,
ServerResponse,
WebSocket,
CloseEvent,
MessageEvent,
createServer,
request,
get,
Server,
OutgoingMessage,
ClientRequest,
Agent,
globalAgent,
validateHeaderName,
validateHeaderValue,
setMaxIdleHTTPParsers,
_connectionListener
};

View file

@ -0,0 +1,15 @@
import type nodeHttp2 from "node:http2";
// prettier-ignore
export declare const constants: typeof nodeHttp2.constants;
export declare const createSecureServer: unknown;
export declare const createServer: unknown;
export declare const connect: typeof nodeHttp2.connect;
export declare const performServerHandshake: typeof nodeHttp2.performServerHandshake;
export declare const Http2ServerRequest: typeof nodeHttp2.Http2ServerRequest;
export declare const Http2ServerResponse: typeof nodeHttp2.Http2ServerResponse;
export declare const getDefaultSettings: typeof nodeHttp2.getDefaultSettings;
export declare const getPackedSettings: typeof nodeHttp2.getPackedSettings;
export declare const getUnpackedSettings: typeof nodeHttp2.getUnpackedSettings;
export declare const sensitiveHeaders: typeof nodeHttp2.sensitiveHeaders;
declare const _default: {};
export default _default;

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
// https://nodejs.org/api/https.html
import type nodeHttps from "node:https";
export declare const Server: typeof nodeHttps.Server;
export declare const Agent: typeof nodeHttps.Agent;
export declare const globalAgent: typeof nodeHttps.globalAgent;
export declare const get: unknown;
export declare const createServer: unknown;
export declare const request: unknown;
declare const _default: {};
export default _default;

View file

@ -0,0 +1,16 @@
import { notImplemented, notImplementedClass } from "../_internal/utils.mjs";
import { Agent as HttpAgent } from "./internal/http/agent.mjs";
export const Server = /* @__PURE__ */ notImplementedClass("https.Server");
export const Agent = HttpAgent;
export const globalAgent = /* @__PURE__ */ new Agent();
export const get = /* @__PURE__ */ notImplemented("https.get");
export const createServer = /* @__PURE__ */ notImplemented("https.createServer");
export const request = /* @__PURE__ */ notImplemented("https.request");
export default {
Server,
Agent,
globalAgent,
get,
createServer,
request
};

View file

@ -0,0 +1,12 @@
import type nodeInspector from "node:inspector";
export declare const close: typeof nodeInspector.close;
export declare const console: nodeInspector.InspectorConsole;
export declare const open: typeof nodeInspector.open;
export declare const url: typeof nodeInspector.url;
export declare const waitForDebugger: typeof nodeInspector.waitForDebugger;
// `node:inspector` and `node:inspector/promises` share the same implementation with only Session being in the promises module:
// https://github.com/nodejs/node/blob/main/lib/inspector/promises.js
export declare const Session: typeof nodeInspector.Session;
export declare const Network: typeof nodeInspector.Network;
declare const _default: {};
export default _default;

View file

@ -0,0 +1,53 @@
// https://nodejs.org/api/inspector.html
import { notImplementedClass, notImplemented } from "../_internal/utils.mjs";
import noop from "../mock/noop.mjs";
export const close = noop;
export const console = {
debug: noop,
error: noop,
info: noop,
log: noop,
warn: noop,
dir: noop,
dirxml: noop,
table: noop,
trace: noop,
group: noop,
groupCollapsed: noop,
groupEnd: noop,
clear: noop,
count: noop,
countReset: noop,
assert: noop,
profile: noop,
profileEnd: noop,
time: noop,
timeLog: noop,
timeStamp: noop
};
export const open = () => ({
__unenv__: true,
[Symbol.dispose]() {
return Promise.resolve();
}
});
export const url = () => undefined;
export const waitForDebugger = noop;
// `node:inspector` and `node:inspector/promises` share the same implementation with only Session being in the promises module:
// https://github.com/nodejs/node/blob/main/lib/inspector/promises.js
export const Session = /* @__PURE__ */ notImplementedClass("inspector.Session");
export const Network = {
loadingFailed: /* @__PURE__ */ notImplemented("inspector.Network.loadingFailed"),
loadingFinished: /* @__PURE__ */ notImplemented("inspector.Network.loadingFinished"),
requestWillBeSent: /* @__PURE__ */ notImplemented("inspector.Network.requestWillBeSent"),
responseReceived: /* @__PURE__ */ notImplemented("inspector.Network.responseReceived")
};
export default {
Session,
close,
console,
open,
url,
waitForDebugger,
Network
};

View file

@ -0,0 +1,10 @@
import type nodeInspectorPromises from "node:inspector/promises";
export declare const console: typeof nodeInspectorPromises.console;
export declare const Network: unknown;
export declare const Session: unknown;
export declare const url: unknown;
export declare const waitForDebugger: unknown;
export declare const open: unknown;
export declare const close: unknown;
declare const _default: {};
export default _default;

View file

@ -0,0 +1,40 @@
import { notImplemented, notImplementedClass } from "../../_internal/utils.mjs";
import noop from "../../mock/noop.mjs";
export const console = {
debug: noop,
error: noop,
info: noop,
log: noop,
warn: noop,
dir: noop,
dirxml: noop,
table: noop,
trace: noop,
group: noop,
groupCollapsed: noop,
groupEnd: noop,
clear: noop,
count: noop,
countReset: noop,
assert: noop,
profile: noop,
profileEnd: noop,
time: noop,
timeLog: noop,
timeStamp: noop
};
export const Network = /* @__PURE__ */ notImplementedClass("inspectorPromises.Network");
export const Session = /* @__PURE__ */ notImplementedClass("inspectorPromises.Session");
export const url = /* @__PURE__ */ notImplemented("inspectorPromises.url");
export const waitForDebugger = /* @__PURE__ */ notImplemented("inspectorPromises.waitForDebugger");
export const open = /* @__PURE__ */ notImplemented("inspectorPromises.open");
export const close = /* @__PURE__ */ notImplemented("inspectorPromises.close");
export default {
close,
console,
Network,
open,
Session,
url,
waitForDebugger
};

View file

@ -0,0 +1,7 @@
import type nodeAsyncHooks from "node:async_hooks";
export declare const createHook: typeof nodeAsyncHooks.createHook;
export declare const executionAsyncId: typeof nodeAsyncHooks.executionAsyncId;
export declare const executionAsyncResource: typeof nodeAsyncHooks.executionAsyncResource;
export declare const triggerAsyncId: typeof nodeAsyncHooks.triggerAsyncId;
// @ts-expect-error @types/node is missing this one - this is a bug in typings
export declare const asyncWrapProviders: typeof nodeAsyncHooks.asyncWrapProviders;

View file

@ -0,0 +1,115 @@
const kInit = /* @__PURE__ */ Symbol("init");
const kBefore = /* @__PURE__ */ Symbol("before");
const kAfter = /* @__PURE__ */ Symbol("after");
const kDestroy = /* @__PURE__ */ Symbol("destroy");
const kPromiseResolve = /* @__PURE__ */ Symbol("promiseResolve");
class _AsyncHook {
__unenv__ = true;
_enabled = false;
_callbacks = {};
constructor(callbacks = {}) {
this._callbacks = callbacks;
}
enable() {
this._enabled = true;
return this;
}
disable() {
this._enabled = false;
return this;
}
get [kInit]() {
return this._callbacks.init;
}
get [kBefore]() {
return this._callbacks.before;
}
get [kAfter]() {
return this._callbacks.after;
}
get [kDestroy]() {
return this._callbacks.destroy;
}
get [kPromiseResolve]() {
return this._callbacks.promiseResolve;
}
}
export const createHook = function createHook(callbacks) {
const asyncHook = new _AsyncHook(callbacks);
return asyncHook;
};
export const executionAsyncId = function executionAsyncId() {
return 0;
};
export const executionAsyncResource = function() {
return Object.create(null);
};
export const triggerAsyncId = function() {
return 0;
};
// @ts-expect-error @types/node is missing this one - this is a bug in typings
export const asyncWrapProviders = Object.assign(Object.create(null), {
NONE: 0,
DIRHANDLE: 1,
DNSCHANNEL: 2,
ELDHISTOGRAM: 3,
FILEHANDLE: 4,
FILEHANDLECLOSEREQ: 5,
BLOBREADER: 6,
FSEVENTWRAP: 7,
FSREQCALLBACK: 8,
FSREQPROMISE: 9,
GETADDRINFOREQWRAP: 10,
GETNAMEINFOREQWRAP: 11,
HEAPSNAPSHOT: 12,
HTTP2SESSION: 13,
HTTP2STREAM: 14,
HTTP2PING: 15,
HTTP2SETTINGS: 16,
HTTPINCOMINGMESSAGE: 17,
HTTPCLIENTREQUEST: 18,
JSSTREAM: 19,
JSUDPWRAP: 20,
MESSAGEPORT: 21,
PIPECONNECTWRAP: 22,
PIPESERVERWRAP: 23,
PIPEWRAP: 24,
PROCESSWRAP: 25,
PROMISE: 26,
QUERYWRAP: 27,
QUIC_ENDPOINT: 28,
QUIC_LOGSTREAM: 29,
QUIC_PACKET: 30,
QUIC_SESSION: 31,
QUIC_STREAM: 32,
QUIC_UDP: 33,
SHUTDOWNWRAP: 34,
SIGNALWRAP: 35,
STATWATCHER: 36,
STREAMPIPE: 37,
TCPCONNECTWRAP: 38,
TCPSERVERWRAP: 39,
TCPWRAP: 40,
TTYWRAP: 41,
UDPSENDWRAP: 42,
UDPWRAP: 43,
SIGINTWATCHDOG: 44,
WORKER: 45,
WORKERHEAPSNAPSHOT: 46,
WRITEWRAP: 47,
ZLIB: 48,
CHECKPRIMEREQUEST: 49,
PBKDF2REQUEST: 50,
KEYPAIRGENREQUEST: 51,
KEYGENREQUEST: 52,
KEYEXPORTREQUEST: 53,
CIPHERREQUEST: 54,
DERIVEBITSREQUEST: 55,
HASHREQUEST: 56,
RANDOMBYTESREQUEST: 57,
RANDOMPRIMEREQUEST: 58,
SCRYPTREQUEST: 59,
SIGNREQUEST: 60,
TLSWRAP: 61,
VERIFYREQUEST: 62
});

View file

@ -0,0 +1,2 @@
import type nodeAsyncHooks from "node:async_hooks";
export declare const AsyncLocalStorage: typeof nodeAsyncHooks.AsyncLocalStorage;

View file

@ -0,0 +1,36 @@
// https://nodejs.org/api/async_context.html#class-asynclocalstorage
class _AsyncLocalStorage {
__unenv__ = true;
_currentStore;
_enterStore;
_enabled = true;
getStore() {
return this._currentStore ?? this._enterStore;
}
disable() {
this._enabled = false;
}
enable() {
this._enabled = true;
}
enterWith(store) {
this._enterStore = store;
}
run(store, callback, ...args) {
this._currentStore = store;
const res = callback(...args);
this._currentStore = undefined;
return res;
}
exit(callback, ...args) {
const _previousStore = this._currentStore;
this._currentStore = undefined;
const res = callback(...args);
this._currentStore = _previousStore;
return res;
}
static snapshot() {
throw new Error("[unenv] `AsyncLocalStorage.snapshot` is not implemented!");
}
}
export const AsyncLocalStorage = globalThis.AsyncLocalStorage || _AsyncLocalStorage;

View file

@ -0,0 +1,2 @@
import type nodeAsyncHooks from "node:async_hooks";
export declare const AsyncResource: typeof nodeAsyncHooks.AsyncResource;

View file

@ -0,0 +1,37 @@
import { executionAsyncId } from "./async-hook.mjs";
// https://nodejs.org/api/async_context.html#class-asyncresource
let _asyncIdCounter = 100;
class _AsyncResource {
__unenv__ = true;
type;
_asyncId;
_triggerAsyncId;
constructor(type, triggerAsyncId = executionAsyncId()) {
this.type = type;
this._asyncId = -1 * _asyncIdCounter++;
this._triggerAsyncId = typeof triggerAsyncId === "number" ? triggerAsyncId : triggerAsyncId?.triggerAsyncId;
}
static bind(fn, type, thisArg) {
const resource = new AsyncResource(type ?? "anonymous");
return resource.bind(fn);
}
bind(fn, thisArg) {
const binded = (...args) => this.runInAsyncScope(fn, thisArg, ...args);
binded.asyncResource = this;
return binded;
}
runInAsyncScope(fn, thisArg, ...args) {
const result = fn.apply(thisArg, args);
return result;
}
emitDestroy() {
return this;
}
asyncId() {
return this._asyncId;
}
triggerAsyncId() {
return this._triggerAsyncId;
}
}
export const AsyncResource = globalThis.AsyncResource || _AsyncResource;

View file

@ -0,0 +1,4 @@
// base64 is 4/3 + up to two characters of the original data
export declare function byteLength(b64);
export declare function toByteArray(b64);
export declare function fromByteArray(uint8);

View file

@ -0,0 +1,97 @@
// @ts-nocheck
// Source: https://github.com/beatgammit/base64-js/blob/88957c9943c7e2a0f03cdf73e71d579e433627d3/index.js
const lookup = [];
const revLookup = [];
const Arr = typeof Uint8Array === "undefined" ? Array : Uint8Array;
const code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (let i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i];
revLookup[code.charCodeAt(i)] = i;
}
// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup["-".charCodeAt(0)] = 62;
revLookup["_".charCodeAt(0)] = 63;
function getLens(b64) {
const len = b64.length;
if (len % 4 > 0) {
throw new Error("Invalid string. Length must be a multiple of 4");
}
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
let validLen = b64.indexOf("=");
if (validLen === -1) {
validLen = len;
}
const placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
return [validLen, placeHoldersLen];
}
// base64 is 4/3 + up to two characters of the original data
export function byteLength(b64) {
const lens = getLens(b64);
const validLen = lens[0];
const placeHoldersLen = lens[1];
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function _byteLength(b64, validLen, placeHoldersLen) {
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
export function toByteArray(b64) {
let tmp;
const lens = getLens(b64);
const validLen = lens[0];
const placeHoldersLen = lens[1];
const arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
let curByte = 0;
// if there are placeholders, only get up to the last complete 4 chars
const len = placeHoldersLen > 0 ? validLen - 4 : validLen;
let i;
for (i = 0; i < len; i += 4) {
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
arr[curByte++] = tmp >> 16 & 255;
arr[curByte++] = tmp >> 8 & 255;
arr[curByte++] = tmp & 255;
}
if (placeHoldersLen === 2) {
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
arr[curByte++] = tmp & 255;
}
if (placeHoldersLen === 1) {
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
arr[curByte++] = tmp >> 8 & 255;
arr[curByte++] = tmp & 255;
}
return arr;
}
function tripletToBase64(num) {
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
}
function encodeChunk(uint8, start, end) {
let tmp;
const output = [];
for (let i = start; i < end; i += 3) {
tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
output.push(tripletToBase64(tmp));
}
return output.join("");
}
export function fromByteArray(uint8) {
let tmp;
const len = uint8.length;
const extraBytes = len % 3;
const parts = [];
const maxChunkLength = 16383;
// go through the array every three bytes, we'll deal with trailing stuff later
for (let i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1];
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
}
return parts.join("");
}

View file

@ -0,0 +1,13 @@
export declare const INSPECT_MAX_BYTES = 50;
export declare const kMaxLength: unknown;
/**
* The Buffer constructor returns instances of `Uint8Array` that have their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
export declare function Buffer(arg, encodingOrOffset, length);
export declare function SlowBuffer(length);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
import type nodeBuffer from "node:buffer";
export declare class File extends Blob implements nodeBuffer.File {
readonly __unenv__: true;
size: number;
type: any;
name: string;
lastModified: number;
constructor(...args: any[]);
arrayBuffer(): Promise<ArrayBuffer>;
slice(): any;
text(): any;
stream(): any;
bytes(): Promise<Uint8Array<ArrayBuffer>>;
}

View file

@ -0,0 +1,26 @@
export class File extends Blob {
__unenv__ = true;
size = 0;
type = "";
name = "";
lastModified = 0;
constructor(...args) {
super(...args);
throw new Error("[unenv] buffer.File is not implemented");
}
arrayBuffer() {
throw new Error("Not implemented");
}
slice() {
throw new Error("Not implemented");
}
text() {
throw new Error("Not implemented");
}
stream() {
throw new Error("Not implemented");
}
bytes() {
throw new Error("Not implemented");
}
}

View file

@ -0,0 +1,4 @@
// Source: https://github.com/feross/ieee754/blob/8a0041f3d5e41b7cfcf0e0158fcf84b071709bda/index.js
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
export declare function read(buffer: Uint8Array, offset: number, isLE: boolean, mLen: number, nBytes: number);
export declare function write(buffer: Uint8Array, value: number, offset: number, isLE: boolean, mLen: number, nBytes: number);

View file

@ -0,0 +1,89 @@
// Source: https://github.com/feross/ieee754/blob/8a0041f3d5e41b7cfcf0e0158fcf84b071709bda/index.js
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
export function read(buffer, offset, isLE, mLen, nBytes) {
let e, m;
const eLen = nBytes * 8 - mLen - 1;
const eMax = (1 << eLen) - 1;
const eBias = eMax >> 1;
let nBits = -7;
let i = isLE ? nBytes - 1 : 0;
const d = isLE ? -1 : 1;
let s = buffer[offset + i];
i += d;
e = s & (1 << -nBits) - 1;
s >>= -nBits;
nBits += eLen;
while (nBits > 0) {
e = e * 256 + buffer[offset + i];
i += d;
nBits -= 8;
}
m = e & (1 << -nBits) - 1;
e >>= -nBits;
nBits += mLen;
while (nBits > 0) {
m = m * 256 + buffer[offset + i];
i += d;
nBits -= 8;
}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? Number.NaN : (s ? -1 : 1) * Number.POSITIVE_INFINITY;
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
}
export function write(buffer, value, offset, isLE, mLen, nBytes) {
let e, m, c;
let eLen = nBytes * 8 - mLen - 1;
const eMax = (1 << eLen) - 1;
const eBias = eMax >> 1;
const rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
let i = isLE ? 0 : nBytes - 1;
const d = isLE ? 1 : -1;
const s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
value = Math.abs(value);
if (Number.isNaN(value) || value === Number.POSITIVE_INFINITY) {
m = Number.isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log2(value));
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
value += e + eBias >= 1 ? rt / c : rt * Math.pow(2, 1 - eBias);
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
while (mLen >= 8) {
buffer[offset + i] = m & 255;
i += d;
m /= 256;
mLen -= 8;
}
e = e << mLen | m;
eLen += mLen;
while (eLen > 0) {
buffer[offset + i] = e & 255;
i += d;
e /= 256;
eLen -= 8;
}
buffer[offset + i - d] |= s * 128;
}

View file

@ -0,0 +1,58 @@
// npx -y node@22.14 -e 'const{constants}=require("crypto");console.log(Object.entries(constants).map(([k,v]) => `export const ${k} = ${JSON.stringify(v)}`).join("\n"))'
export declare const SSL_OP_ALL = 2147485776;
export declare const SSL_OP_ALLOW_NO_DHE_KEX = 1024;
export declare const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 262144;
export declare const SSL_OP_CIPHER_SERVER_PREFERENCE = 4194304;
export declare const SSL_OP_CISCO_ANYCONNECT = 32768;
export declare const SSL_OP_COOKIE_EXCHANGE = 8192;
export declare const SSL_OP_CRYPTOPRO_TLSEXT_BUG = 2147483648;
export declare const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 2048;
export declare const SSL_OP_LEGACY_SERVER_CONNECT = 4;
export declare const SSL_OP_NO_COMPRESSION = 131072;
export declare const SSL_OP_NO_ENCRYPT_THEN_MAC = 524288;
export declare const SSL_OP_NO_QUERY_MTU = 4096;
export declare const SSL_OP_NO_RENEGOTIATION = 1073741824;
export declare const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 65536;
export declare const SSL_OP_NO_SSLv2 = 0;
export declare const SSL_OP_NO_SSLv3 = 33554432;
export declare const SSL_OP_NO_TICKET = 16384;
export declare const SSL_OP_NO_TLSv1 = 67108864;
export declare const SSL_OP_NO_TLSv1_1 = 268435456;
export declare const SSL_OP_NO_TLSv1_2 = 134217728;
export declare const SSL_OP_NO_TLSv1_3 = 536870912;
export declare const SSL_OP_PRIORITIZE_CHACHA = 2097152;
export declare const SSL_OP_TLS_ROLLBACK_BUG = 8388608;
export declare const ENGINE_METHOD_RSA = 1;
export declare const ENGINE_METHOD_DSA = 2;
export declare const ENGINE_METHOD_DH = 4;
export declare const ENGINE_METHOD_RAND = 8;
export declare const ENGINE_METHOD_EC = 2048;
export declare const ENGINE_METHOD_CIPHERS = 64;
export declare const ENGINE_METHOD_DIGESTS = 128;
export declare const ENGINE_METHOD_PKEY_METHS = 512;
export declare const ENGINE_METHOD_PKEY_ASN1_METHS = 1024;
export declare const ENGINE_METHOD_ALL = 65535;
export declare const ENGINE_METHOD_NONE = 0;
export declare const DH_CHECK_P_NOT_SAFE_PRIME = 2;
export declare const DH_CHECK_P_NOT_PRIME = 1;
export declare const DH_UNABLE_TO_CHECK_GENERATOR = 4;
export declare const DH_NOT_SUITABLE_GENERATOR = 8;
export declare const RSA_PKCS1_PADDING = 1;
export declare const RSA_NO_PADDING = 3;
export declare const RSA_PKCS1_OAEP_PADDING = 4;
export declare const RSA_X931_PADDING = 5;
export declare const RSA_PKCS1_PSS_PADDING = 6;
export declare const RSA_PSS_SALTLEN_DIGEST = -1;
export declare const RSA_PSS_SALTLEN_MAX_SIGN = -2;
export declare const RSA_PSS_SALTLEN_AUTO = -2;
export declare const POINT_CONVERSION_COMPRESSED = 2;
export declare const POINT_CONVERSION_UNCOMPRESSED = 4;
export declare const POINT_CONVERSION_HYBRID = 6;
// Versions explicitly set to 0 to avoid version misdetections
export declare const defaultCoreCipherList = "";
export declare const defaultCipherList = "";
export declare const OPENSSL_VERSION_NUMBER = 0;
export declare const TLS1_VERSION = 0;
export declare const TLS1_1_VERSION = 0;
export declare const TLS1_2_VERSION = 0;
export declare const TLS1_3_VERSION = 0;

View file

@ -0,0 +1,58 @@
// npx -y node@22.14 -e 'const{constants}=require("crypto");console.log(Object.entries(constants).map(([k,v]) => `export const ${k} = ${JSON.stringify(v)}`).join("\n"))'
export const SSL_OP_ALL = 2147485776;
export const SSL_OP_ALLOW_NO_DHE_KEX = 1024;
export const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 262144;
export const SSL_OP_CIPHER_SERVER_PREFERENCE = 4194304;
export const SSL_OP_CISCO_ANYCONNECT = 32768;
export const SSL_OP_COOKIE_EXCHANGE = 8192;
export const SSL_OP_CRYPTOPRO_TLSEXT_BUG = 2147483648;
export const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 2048;
export const SSL_OP_LEGACY_SERVER_CONNECT = 4;
export const SSL_OP_NO_COMPRESSION = 131072;
export const SSL_OP_NO_ENCRYPT_THEN_MAC = 524288;
export const SSL_OP_NO_QUERY_MTU = 4096;
export const SSL_OP_NO_RENEGOTIATION = 1073741824;
export const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 65536;
export const SSL_OP_NO_SSLv2 = 0;
export const SSL_OP_NO_SSLv3 = 33554432;
export const SSL_OP_NO_TICKET = 16384;
export const SSL_OP_NO_TLSv1 = 67108864;
export const SSL_OP_NO_TLSv1_1 = 268435456;
export const SSL_OP_NO_TLSv1_2 = 134217728;
export const SSL_OP_NO_TLSv1_3 = 536870912;
export const SSL_OP_PRIORITIZE_CHACHA = 2097152;
export const SSL_OP_TLS_ROLLBACK_BUG = 8388608;
export const ENGINE_METHOD_RSA = 1;
export const ENGINE_METHOD_DSA = 2;
export const ENGINE_METHOD_DH = 4;
export const ENGINE_METHOD_RAND = 8;
export const ENGINE_METHOD_EC = 2048;
export const ENGINE_METHOD_CIPHERS = 64;
export const ENGINE_METHOD_DIGESTS = 128;
export const ENGINE_METHOD_PKEY_METHS = 512;
export const ENGINE_METHOD_PKEY_ASN1_METHS = 1024;
export const ENGINE_METHOD_ALL = 65535;
export const ENGINE_METHOD_NONE = 0;
export const DH_CHECK_P_NOT_SAFE_PRIME = 2;
export const DH_CHECK_P_NOT_PRIME = 1;
export const DH_UNABLE_TO_CHECK_GENERATOR = 4;
export const DH_NOT_SUITABLE_GENERATOR = 8;
export const RSA_PKCS1_PADDING = 1;
export const RSA_NO_PADDING = 3;
export const RSA_PKCS1_OAEP_PADDING = 4;
export const RSA_X931_PADDING = 5;
export const RSA_PKCS1_PSS_PADDING = 6;
export const RSA_PSS_SALTLEN_DIGEST = -1;
export const RSA_PSS_SALTLEN_MAX_SIGN = -2;
export const RSA_PSS_SALTLEN_AUTO = -2;
export const POINT_CONVERSION_COMPRESSED = 2;
export const POINT_CONVERSION_UNCOMPRESSED = 4;
export const POINT_CONVERSION_HYBRID = 6;
// Versions explicitly set to 0 to avoid version misdetections
export const defaultCoreCipherList = "";
export const defaultCipherList = "";
export const OPENSSL_VERSION_NUMBER = 0;
export const TLS1_VERSION = 0;
export const TLS1_1_VERSION = 0;
export const TLS1_2_VERSION = 0;
export const TLS1_3_VERSION = 0;

View file

@ -0,0 +1,78 @@
import type nodeCrypto from "node:crypto";
// ---- implemented Utils ----
export declare const webcrypto: unknown;
export declare const randomBytes: typeof nodeCrypto.randomBytes;
export declare const rng: unknown;
export declare const prng: unknown;
// ---- Constants ----
export declare const fips: typeof nodeCrypto.fips;
// ---- Unimplemented utils ----
export declare const checkPrime: unknown;
export declare const checkPrimeSync: unknown;
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export declare const createCipher: undefined;
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export declare const createDecipher: undefined;
export declare const pseudoRandomBytes: unknown;
export declare const createCipheriv: unknown;
export declare const createDecipheriv: unknown;
export declare const createDiffieHellman: unknown;
export declare const createDiffieHellmanGroup: unknown;
export declare const createECDH: unknown;
export declare const createHash: unknown;
export declare const createHmac: unknown;
export declare const createPrivateKey: unknown;
export declare const createPublicKey: unknown;
export declare const createSecretKey: unknown;
export declare const createSign: unknown;
export declare const createVerify: unknown;
export declare const diffieHellman: unknown;
export declare const generatePrime: unknown;
export declare const generatePrimeSync: unknown;
export declare const getCiphers: unknown;
export declare const getCipherInfo: unknown;
export declare const getCurves: unknown;
export declare const getDiffieHellman: unknown;
export declare const getHashes: unknown;
export declare const hkdf: unknown;
export declare const hkdfSync: unknown;
export declare const pbkdf2: unknown;
export declare const pbkdf2Sync: unknown;
export declare const generateKeyPair: unknown;
export declare const generateKeyPairSync: unknown;
export declare const generateKey: unknown;
export declare const generateKeySync: unknown;
export declare const privateDecrypt: unknown;
export declare const privateEncrypt: unknown;
export declare const publicDecrypt: unknown;
export declare const publicEncrypt: unknown;
export declare const randomFill: unknown;
export declare const randomFillSync: unknown;
export declare const randomInt: unknown;
export declare const scrypt: unknown;
export declare const scryptSync: unknown;
export declare const sign: unknown;
export declare const setEngine: unknown;
export declare const timingSafeEqual: unknown;
export declare const getFips: unknown;
export declare const setFips: unknown;
export declare const verify: unknown;
export declare const secureHeapUsed: unknown;
export declare const hash: unknown;
// ---- Unimplemented Classes ----
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export declare const Cipher: typeof nodeCrypto.Cipher;
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export declare const Decipher: typeof nodeCrypto.Decipher;
export declare const Certificate: typeof nodeCrypto.Certificate;
export declare const Cipheriv: typeof nodeCrypto.Cipheriv;
export declare const Decipheriv: typeof nodeCrypto.Decipheriv;
export declare const DiffieHellman: typeof nodeCrypto.DiffieHellman;
export declare const DiffieHellmanGroup: typeof nodeCrypto.DiffieHellmanGroup;
export declare const ECDH: typeof nodeCrypto.ECDH;
export declare const Hash: typeof nodeCrypto.Hash;
export declare const Hmac: typeof nodeCrypto.Hmac;
export declare const KeyObject: typeof nodeCrypto.KeyObject;
export declare const Sign: typeof nodeCrypto.Sign;
export declare const Verify: typeof nodeCrypto.Verify;
export declare const X509Certificate: typeof nodeCrypto.X509Certificate;

View file

@ -0,0 +1,110 @@
import { notImplemented, notImplementedClass } from "../../../_internal/utils.mjs";
import { getRandomValues } from "./web.mjs";
// limit of Crypto.getRandomValues()
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
const MAX_RANDOM_VALUE_BYTES = 65536;
// ---- implemented Utils ----
export const webcrypto = new Proxy(globalThis.crypto, { get(_, key) {
if (key === "CryptoKey") {
return globalThis.CryptoKey;
}
if (typeof globalThis.crypto[key] === "function") {
// @ts-ignore
return globalThis.crypto[key].bind(globalThis.crypto);
}
return globalThis.crypto[key];
} });
export const randomBytes = (size, cb) => {
const bytes = Buffer.alloc(size, 0, undefined);
for (let generated = 0; generated < size; generated += MAX_RANDOM_VALUE_BYTES) {
getRandomValues(
// Use subarray to get a view of the buffer
Uint8Array.prototype.subarray.call(bytes, generated, generated + MAX_RANDOM_VALUE_BYTES)
);
}
if (typeof cb === "function") {
cb(null, bytes);
return undefined;
}
return bytes;
};
export const rng = randomBytes;
export const prng = randomBytes;
// ---- Constants ----
export const fips = false;
// ---- Unimplemented utils ----
export const checkPrime = /* @__PURE__ */ notImplemented("crypto.checkPrime");
export const checkPrimeSync = /* @__PURE__ */ notImplemented("crypto.checkPrimeSync");
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export const createCipher = undefined;
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export const createDecipher = undefined;
export const pseudoRandomBytes = /* @__PURE__ */ notImplemented("crypto.pseudoRandomBytes");
export const createCipheriv = /* @__PURE__ */ notImplemented("crypto.createCipheriv");
export const createDecipheriv = /* @__PURE__ */ notImplemented("crypto.createDecipheriv");
export const createDiffieHellman = /* @__PURE__ */ notImplemented("crypto.createDiffieHellman");
export const createDiffieHellmanGroup = /* @__PURE__ */ notImplemented("crypto.createDiffieHellmanGroup");
export const createECDH = /* @__PURE__ */ notImplemented("crypto.createECDH");
export const createHash = /* @__PURE__ */ notImplemented("crypto.createHash");
export const createHmac = /* @__PURE__ */ notImplemented("crypto.createHmac");
export const createPrivateKey = /* @__PURE__ */ notImplemented("crypto.createPrivateKey");
export const createPublicKey = /* @__PURE__ */ notImplemented("crypto.createPublicKey");
export const createSecretKey = /* @__PURE__ */ notImplemented("crypto.createSecretKey");
export const createSign = /* @__PURE__ */ notImplemented("crypto.createSign");
export const createVerify = /* @__PURE__ */ notImplemented("crypto.createVerify");
export const diffieHellman = /* @__PURE__ */ notImplemented("crypto.diffieHellman");
export const generatePrime = /* @__PURE__ */ notImplemented("crypto.generatePrime");
export const generatePrimeSync = /* @__PURE__ */ notImplemented("crypto.generatePrimeSync");
export const getCiphers = /* @__PURE__ */ notImplemented("crypto.getCiphers");
export const getCipherInfo = /* @__PURE__ */ notImplemented("crypto.getCipherInfo");
export const getCurves = /* @__PURE__ */ notImplemented("crypto.getCurves");
export const getDiffieHellman = /* @__PURE__ */ notImplemented("crypto.getDiffieHellman");
export const getHashes = /* @__PURE__ */ notImplemented("crypto.getHashes");
export const hkdf = /* @__PURE__ */ notImplemented("crypto.hkdf");
export const hkdfSync = /* @__PURE__ */ notImplemented("crypto.hkdfSync");
export const pbkdf2 = /* @__PURE__ */ notImplemented("crypto.pbkdf2");
export const pbkdf2Sync = /* @__PURE__ */ notImplemented("crypto.pbkdf2Sync");
export const generateKeyPair = /* @__PURE__ */ notImplemented("crypto.generateKeyPair");
export const generateKeyPairSync = /* @__PURE__ */ notImplemented("crypto.generateKeyPairSync");
export const generateKey = /* @__PURE__ */ notImplemented("crypto.generateKey");
export const generateKeySync = /* @__PURE__ */ notImplemented("crypto.generateKeySync");
export const privateDecrypt = /* @__PURE__ */ notImplemented("crypto.privateDecrypt");
export const privateEncrypt = /* @__PURE__ */ notImplemented("crypto.privateEncrypt");
export const publicDecrypt = /* @__PURE__ */ notImplemented("crypto.publicDecrypt");
export const publicEncrypt = /* @__PURE__ */ notImplemented("crypto.publicEncrypt");
export const randomFill = /* @__PURE__ */ notImplemented("crypto.randomFill");
export const randomFillSync = /* @__PURE__ */ notImplemented("crypto.randomFillSync");
export const randomInt = /* @__PURE__ */ notImplemented("crypto.randomInt");
export const scrypt = /* @__PURE__ */ notImplemented("crypto.scrypt");
export const scryptSync = /* @__PURE__ */ notImplemented("crypto.scryptSync");
export const sign = /* @__PURE__ */ notImplemented("crypto.sign");
export const setEngine = /* @__PURE__ */ notImplemented("crypto.setEngine");
export const timingSafeEqual = /* @__PURE__ */ notImplemented("crypto.timingSafeEqual");
export const getFips = /* @__PURE__ */ notImplemented("crypto.getFips");
export const setFips = /* @__PURE__ */ notImplemented("crypto.setFips");
export const verify = /* @__PURE__ */ notImplemented("crypto.verify");
export const secureHeapUsed = /* @__PURE__ */ notImplemented("crypto.secureHeapUsed");
export const hash = /* @__PURE__ */ notImplemented("crypto.hash");
// ---- Unimplemented Classes ----
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export const Cipher = undefined;
/** @deprecated https://nodejs.org/docs/latest/api/deprecations.html#dep0106-cryptocreatecipher-and-cryptocreatedecipher */
export const Decipher = undefined;
export const Certificate = /* @__PURE__ */ notImplementedClass("crypto.Certificate");
export const Cipheriv = /* @__PURE__ */ notImplementedClass(
"crypto.Cipheriv"
// @ts-expect-error not typed yet
);
export const Decipheriv = /* @__PURE__ */ notImplementedClass(
"crypto.Decipheriv"
// @ts-expect-error not typed yet
);
export const DiffieHellman = /* @__PURE__ */ notImplementedClass("crypto.DiffieHellman");
export const DiffieHellmanGroup = /* @__PURE__ */ notImplementedClass("crypto.DiffieHellmanGroup");
export const ECDH = /* @__PURE__ */ notImplementedClass("crypto.ECDH");
export const Hash = /* @__PURE__ */ notImplementedClass("crypto.Hash");
export const Hmac = /* @__PURE__ */ notImplementedClass("crypto.Hmac");
export const KeyObject = /* @__PURE__ */ notImplementedClass("crypto.KeyObject");
export const Sign = /* @__PURE__ */ notImplementedClass("crypto.Sign");
export const Verify = /* @__PURE__ */ notImplementedClass("crypto.Verify");
export const X509Certificate = /* @__PURE__ */ notImplementedClass("crypto.X509Certificate");

View file

@ -0,0 +1,5 @@
// https://nodejs.org/api/crypto.html
// https://github.com/unjs/uncrypto
export declare const subtle: SubtleCrypto;
export declare const randomUUID: Crypto["randomUUID"];
export declare const getRandomValues: Crypto["getRandomValues"];

View file

@ -0,0 +1,9 @@
// https://nodejs.org/api/crypto.html
// https://github.com/unjs/uncrypto
export const subtle = globalThis.crypto?.subtle;
export const randomUUID = () => {
return globalThis.crypto?.randomUUID();
};
export const getRandomValues = (array) => {
return globalThis.crypto?.getRandomValues(array);
};

View file

@ -0,0 +1,31 @@
import { EventEmitter } from "node:events";
import type nodeNet from "node:net";
import type nodeDgram from "node:dgram";
export declare class Socket extends EventEmitter implements nodeDgram.Socket {
readonly __unenv__: true;
bind(): this;
close(): this;
ref(): this;
unref(): this;
getRecvBufferSize(): number;
getSendBufferSize(): number;
getSendQueueSize(): number;
getSendQueueCount(): number;
setMulticastLoopback(): boolean;
setMulticastTTL(): number;
setTTL(): number;
address(): nodeNet.AddressInfo;
remoteAddress(): nodeNet.AddressInfo;
[Symbol.asyncDispose]();
addMembership();
addSourceSpecificMembership();
connect();
disconnect();
dropMembership();
dropSourceSpecificMembership();
send();
setSendBufferSize();
setBroadcast();
setRecvBufferSize();
setMulticastInterface();
}

View file

@ -0,0 +1,61 @@
import { EventEmitter } from "node:events";
export class Socket extends EventEmitter {
__unenv__ = true;
bind() {
return this;
}
close() {
return this;
}
ref() {
return this;
}
unref() {
return this;
}
getRecvBufferSize() {
return 1e5;
}
getSendBufferSize() {
return 1e4;
}
getSendQueueSize() {
return 0;
}
getSendQueueCount() {
return 0;
}
setMulticastLoopback() {
return false;
}
setMulticastTTL() {
return 1;
}
setTTL() {
return 1;
}
address() {
return {
address: "127.0.0.1",
family: "IPv4",
port: 1234
};
}
remoteAddress() {
throw new Error("ERR_SOCKET_DGRAM_NOT_CONNECTED");
}
[Symbol.asyncDispose]() {
return Promise.resolve();
}
addMembership() {}
addSourceSpecificMembership() {}
connect() {}
disconnect() {}
dropMembership() {}
dropSourceSpecificMembership() {}
send() {}
setSendBufferSize() {}
setBroadcast() {}
setRecvBufferSize() {}
setMulticastInterface() {}
}

View file

@ -0,0 +1,18 @@
import type nodeDiagnosticsChannel from "node:diagnostics_channel";
export declare const getChannels: unknown;
export declare class Channel<
StoreType,
ContextType
> implements nodeDiagnosticsChannel.Channel<StoreType, ContextType> {
readonly __unenv__: true;
name: nodeDiagnosticsChannel.Channel["name"];
get hasSubscribers();
_subscribers: nodeDiagnosticsChannel.ChannelListener[];
constructor(name: nodeDiagnosticsChannel.Channel["name"]);
subscribe(onMessage: nodeDiagnosticsChannel.ChannelListener);
unsubscribe(onMessage: nodeDiagnosticsChannel.ChannelListener);
publish(message: unknown): void;
bindStore();
unbindStore();
runStores();
}

View file

@ -0,0 +1,40 @@
import { createNotImplementedError } from "../../../_internal/utils.mjs";
const channels = {};
export const getChannels = () => channels;
export class Channel {
__unenv__ = true;
name;
get hasSubscribers() {
return this._subscribers.length > 0;
}
_subscribers;
constructor(name) {
this.name = name;
this._subscribers = [];
const channels = getChannels();
channels[name] = this;
}
subscribe(onMessage) {
this._subscribers.push(onMessage);
}
unsubscribe(onMessage) {
const index = this._subscribers.indexOf(onMessage);
if (index === -1) return false;
this._subscribers.splice(index, 1);
return true;
}
publish(message) {
for (const subscriber of this._subscribers) {
subscriber(message, this.name);
}
}
bindStore() {
throw createNotImplementedError("Channel.bindStore");
}
unbindStore() {
throw createNotImplementedError("Channel.unbindStore");
}
runStores() {
throw createNotImplementedError("Channel.runStores");
}
}

View file

@ -0,0 +1,19 @@
import type nodeDagnosticsChannel from "node:diagnostics_channel";
import { Channel } from "./channel.mjs";
export declare class TracingChannel<
StoreType = unknown,
ContextType extends object = object
> implements nodeDagnosticsChannel.TracingChannel<StoreType, ContextType> {
readonly __unenv__: true;
asyncEnd: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
start: Channel<StoreType, ContextType>;
constructor(nameOrChannels: string | nodeDagnosticsChannel.TracingChannelCollection<StoreType, ContextType>);
subscribe(handlers: nodeDagnosticsChannel.TracingChannelSubscribers<ContextType>): void;
unsubscribe(handlers: nodeDagnosticsChannel.TracingChannelSubscribers<ContextType>): void;
traceSync();
tracePromise();
traceCallback();
}

View file

@ -0,0 +1,48 @@
import { createNotImplementedError } from "../../../_internal/utils.mjs";
import { Channel } from "./channel.mjs";
export class TracingChannel {
__unenv__ = true;
asyncEnd = new Channel("asyncEnd");
asyncStart = new Channel("asyncStart");
end = new Channel("end");
error = new Channel("error");
start = new Channel("start");
constructor(nameOrChannels) {
if (typeof nameOrChannels === "string") {
this.asyncEnd = new Channel(`trace:${nameOrChannels}:asyncEnd`);
this.asyncStart = new Channel(`trace:${nameOrChannels}:asyncStart`);
this.end = new Channel(`trace:${nameOrChannels}:end`);
this.error = new Channel(`trace:${nameOrChannels}:error`);
this.start = new Channel(`trace:${nameOrChannels}:start`);
} else {
this.asyncStart = nameOrChannels.asyncStart;
this.asyncEnd = nameOrChannels.asyncEnd;
this.end = nameOrChannels.end;
this.error = nameOrChannels.error;
this.start = nameOrChannels.start;
}
}
subscribe(handlers) {
this.asyncEnd?.subscribe(handlers.asyncEnd);
this.asyncStart?.subscribe(handlers.asyncStart);
this.end?.subscribe(handlers.end);
this.error?.subscribe(handlers.error);
this.start?.subscribe(handlers.start);
}
unsubscribe(handlers) {
this.asyncEnd?.unsubscribe(handlers.asyncEnd);
this.asyncStart?.unsubscribe(handlers.asyncStart);
this.end?.unsubscribe(handlers.end);
this.error?.unsubscribe(handlers.error);
this.start?.unsubscribe(handlers.start);
}
traceSync() {
throw createNotImplementedError("TracingChannel.traceSync");
}
tracePromise() {
throw createNotImplementedError("TracingChannel.tracePromise");
}
traceCallback() {
throw createNotImplementedError("TracingChannel.traceCallback");
}
}

View file

@ -0,0 +1,28 @@
// npx -y node@22.14 -e 'const dns=require("dns");console.log(Object.entries(dns).filter(e => ["string", "number"].includes(typeof e[1])).map(([k,v]) => `export const ${k} = ${JSON.stringify(v)}`).join("\n"))'
export declare const ADDRCONFIG = 1024;
export declare const ALL = 256;
export declare const V4MAPPED = 2048;
export declare const NODATA = "ENODATA";
export declare const FORMERR = "EFORMERR";
export declare const SERVFAIL = "ESERVFAIL";
export declare const NOTFOUND = "ENOTFOUND";
export declare const NOTIMP = "ENOTIMP";
export declare const REFUSED = "EREFUSED";
export declare const BADQUERY = "EBADQUERY";
export declare const BADNAME = "EBADNAME";
export declare const BADFAMILY = "EBADFAMILY";
export declare const BADRESP = "EBADRESP";
export declare const CONNREFUSED = "ECONNREFUSED";
export declare const TIMEOUT = "ETIMEOUT";
export declare const EOF = "EOF";
export declare const FILE = "EFILE";
export declare const NOMEM = "ENOMEM";
export declare const DESTRUCTION = "EDESTRUCTION";
export declare const BADSTR = "EBADSTR";
export declare const BADFLAGS = "EBADFLAGS";
export declare const NONAME = "ENONAME";
export declare const BADHINTS = "EBADHINTS";
export declare const NOTINITIALIZED = "ENOTINITIALIZED";
export declare const LOADIPHLPAPI = "ELOADIPHLPAPI";
export declare const ADDRGETNETWORKPARAMS = "EADDRGETNETWORKPARAMS";
export declare const CANCELLED = "ECANCELLED";

View file

@ -0,0 +1,28 @@
// npx -y node@22.14 -e 'const dns=require("dns");console.log(Object.entries(dns).filter(e => ["string", "number"].includes(typeof e[1])).map(([k,v]) => `export const ${k} = ${JSON.stringify(v)}`).join("\n"))'
export const ADDRCONFIG = 1024;
export const ALL = 256;
export const V4MAPPED = 2048;
export const NODATA = "ENODATA";
export const FORMERR = "EFORMERR";
export const SERVFAIL = "ESERVFAIL";
export const NOTFOUND = "ENOTFOUND";
export const NOTIMP = "ENOTIMP";
export const REFUSED = "EREFUSED";
export const BADQUERY = "EBADQUERY";
export const BADNAME = "EBADNAME";
export const BADFAMILY = "EBADFAMILY";
export const BADRESP = "EBADRESP";
export const CONNREFUSED = "ECONNREFUSED";
export const TIMEOUT = "ETIMEOUT";
export const EOF = "EOF";
export const FILE = "EFILE";
export const NOMEM = "ENOMEM";
export const DESTRUCTION = "EDESTRUCTION";
export const BADSTR = "EBADSTR";
export const BADFLAGS = "EBADFLAGS";
export const NONAME = "ENONAME";
export const BADHINTS = "EBADHINTS";
export const NOTINITIALIZED = "ENOTINITIALIZED";
export const LOADIPHLPAPI = "ELOADIPHLPAPI";
export const ADDRGETNETWORKPARAMS = "EADDRGETNETWORKPARAMS";
export const CANCELLED = "ECANCELLED";

View file

@ -0,0 +1,13 @@
import { EventEmitter } from "node:events";
import type nodeDomain from "node:domain";
export declare class Domain extends EventEmitter implements nodeDomain.Domain {
readonly __unenv__: true;
members: unknown;
add();
enter();
exit();
remove();
bind<T>(callback: T): T;
intercept<T>(callback: T): T;
run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
}

View file

@ -0,0 +1,19 @@
import { createNotImplementedError } from "../../../_internal/utils.mjs";
import { EventEmitter } from "node:events";
export class Domain extends EventEmitter {
__unenv__ = true;
members = [];
add() {}
enter() {}
exit() {}
remove() {}
bind(callback) {
throw createNotImplementedError("Domain.bind");
}
intercept(callback) {
throw createNotImplementedError("Domain.intercept");
}
run(fn, ...args) {
throw createNotImplementedError("Domain.run");
}
}

View file

@ -0,0 +1,207 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.
// Based on Node.js EventEmitter implementation
// https://github.com/nodejs/node/blob/26f2cbdd59957e9a33a94ee2e0fdbeb9aadb0be6/lib/events.js
import type nodeEvents from "node:events";
import { EventEmitter as NodeEventEmitter } from "node:events";
// Types
type Listener = (...args: any[]) => void;
// ----------------------------------------------------------------------------
// EventEmitter
// ----------------------------------------------------------------------------
export declare class _EventEmitter implements NodeEventEmitter {
// Internal state
_events: any;
_eventsCount: number;
_maxListeners: number | undefined;
// Symbols
static captureRejectionSymbol;
static errorMonitor;
static kMaxEventTargetListeners;
static kMaxEventTargetListenersWarned;
// Static utils
static usingDomains: boolean;
static get on();
static get once();
static get getEventListeners();
static get getMaxListeners();
static get addAbortListener();
static get EventEmitterAsyncResource();
static get EventEmitter();
static setMaxListeners(n?, ...eventTargets: (_EventEmitter | EventTarget)[]);
static listenerCount(emitter: NodeEventEmitter, type: string);
static init();
static get captureRejections();
static set captureRejections(value);
static get defaultMaxListeners();
static set defaultMaxListeners(arg);
// Constructor
constructor(opts?: any);
/**
* Increases the max listeners of the event emitter.
* @param {number} n
* @returns {EventEmitter}
*/
setMaxListeners(n: number);
/**
* Returns the current max listener value for the event emitter.
* @returns {number}
*/
getMaxListeners();
/**
* Synchronously calls each of the listeners registered
* for the event.
* @param {...any} [args]
* @returns {boolean}
*/
emit(type: string | symbol, ...args: any[]);
/**
* Adds a listener to the event emitter.
* @returns {EventEmitter}
*/
addListener(type: string | symbol, listener: Listener);
on(type: string | symbol, listener: Listener);
/**
* Adds the `listener` function to the beginning of
* the listeners array.
*/
prependListener(type: string | symbol, listener: Listener);
/**
* Adds a one-time `listener` function to the event emitter.
*/
once(type: string | symbol, listener: Listener);
/**
* Adds a one-time `listener` function to the beginning of
* the listeners array.
*/
prependOnceListener(type: string | symbol, listener: Listener);
/**
* Removes the specified `listener` from the listeners array.
* @param {string | symbol} type
* @param {Function} listener
* @returns {EventEmitter}
*/
removeListener(type: string | symbol, listener: Listener);
off(type: string | symbol, listener: Listener);
/**
* Removes all listeners from the event emitter. (Only
* removes listeners for a specific event name if specified
* as `type`).
*/
removeAllListeners(type?: string | symbol);
/**
* Returns a copy of the array of listeners for the event name
* specified as `type`.
* @param {string | symbol} type
* @returns {Function[]}
*/
listeners(type: string | symbol);
/**
* Returns a copy of the array of listeners and wrappers for
* the event name specified as `type`.
* @returns {Function[]}
*/
rawListeners(type: string | symbol);
/**
* Returns an array listing the events for which
* the emitter has registered listeners.
* @returns {any[]}
*/
eventNames();
/**
* Returns the number of listeners listening to event name
*/
listenerCount(eventName: string | symbol, listener?: Listener): number;
}
// ----------------------------------------------------------------------------
// EventEmitterAsyncResource
// ----------------------------------------------------------------------------
export declare class EventEmitterAsyncResource extends _EventEmitter {
/**
* @param {{
* name?: string,
* triggerAsyncId?: number,
* requireManualDestroy?: boolean,
* }} [options]
*/
constructor(options: any);
/**
* @param {symbol,string} event
* @param {...any} args
* @returns {boolean}
*/
emit(event: string | symbol, ...args: any[]): boolean;
/**
* @returns {void}
*/
emitDestroy();
/**
* @type {number}
*/
get asyncId();
/**
* @type {number}
*/
get triggerAsyncId();
/**
* @type {EventEmitterReferencingAsyncResource}
*/
get asyncResource();
}
// ----------------------------------------------------------------------------
// Exported utils
// ----------------------------------------------------------------------------
/**
* Returns an `AsyncIterator` that iterates `event` events.
* @param {EventEmitter} emitter
* @param {string | symbol} event
* @param {{
* signal: AbortSignal;
* close?: string[];
* highWaterMark?: number,
* lowWaterMark?: number
* }} [options]
* @returns {AsyncIterator}
*/
export declare const on: typeof nodeEvents.on;
/**
* Creates a `Promise` that is fulfilled when the emitter
* emits the given event.
* @param {EventEmitter} emitter
* @param {string} name
* @param {{ signal: AbortSignal; }} [options]
* @returns {Promise}
*/
export declare const once: typeof nodeEvents.once;
export declare const addAbortListener: typeof nodeEvents.addAbortListener;
/**
* Returns a copy of the array of listeners for the event name
* specified as `type`.
* @returns {Function[]}
*/
export declare const getEventListeners: typeof nodeEvents.getEventListeners;
/**
* Returns the max listeners set.
* @param {EventEmitter | EventTarget} emitterOrTarget
* @returns {number}
*/
export declare const getMaxListeners: typeof nodeEvents.getMaxListeners;
export {};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
import type nodeFs from "node:fs";
export declare const Dir: typeof nodeFs.Dir;
export declare const Dirent: typeof nodeFs.Dirent;
export declare const Stats: typeof nodeFs.Stats;
export declare const ReadStream: typeof nodeFs.ReadStream;
export declare const WriteStream: typeof nodeFs.WriteStream;
export declare const FileReadStream: unknown;
export declare const FileWriteStream: unknown;

View file

@ -0,0 +1,8 @@
import { notImplementedClass } from "../../../_internal/utils.mjs";
export const Dir = /* @__PURE__ */ notImplementedClass("fs.Dir");
export const Dirent = /* @__PURE__ */ notImplementedClass("fs.Dirent");
export const Stats = /* @__PURE__ */ notImplementedClass("fs.Stats");
export const ReadStream = /* @__PURE__ */ notImplementedClass("fs.ReadStream");
export const WriteStream = /* @__PURE__ */ notImplementedClass("fs.WriteStream");
export const FileReadStream = ReadStream;
export const FileWriteStream = WriteStream;

View file

@ -0,0 +1,59 @@
// npx -y node@22.14 -e 'const{constants}=require("fs");console.log(Object.entries(constants).map(([k,v]) => `export const ${k} = ${JSON.stringify(v)}`).join("\n"))'
export declare const UV_FS_SYMLINK_DIR = 1;
export declare const UV_FS_SYMLINK_JUNCTION = 2;
export declare const O_RDONLY = 0;
export declare const O_WRONLY = 1;
export declare const O_RDWR = 2;
export declare const UV_DIRENT_UNKNOWN = 0;
export declare const UV_DIRENT_FILE = 1;
export declare const UV_DIRENT_DIR = 2;
export declare const UV_DIRENT_LINK = 3;
export declare const UV_DIRENT_FIFO = 4;
export declare const UV_DIRENT_SOCKET = 5;
export declare const UV_DIRENT_CHAR = 6;
export declare const UV_DIRENT_BLOCK = 7;
export declare const EXTENSIONLESS_FORMAT_JAVASCRIPT = 0;
export declare const EXTENSIONLESS_FORMAT_WASM = 1;
export declare const S_IFMT = 61440;
export declare const S_IFREG = 32768;
export declare const S_IFDIR = 16384;
export declare const S_IFCHR = 8192;
export declare const S_IFBLK = 24576;
export declare const S_IFIFO = 4096;
export declare const S_IFLNK = 40960;
export declare const S_IFSOCK = 49152;
export declare const O_CREAT = 64;
export declare const O_EXCL = 128;
export declare const UV_FS_O_FILEMAP = 0;
export declare const O_NOCTTY = 256;
export declare const O_TRUNC = 512;
export declare const O_APPEND = 1024;
export declare const O_DIRECTORY = 65536;
export declare const O_NOATIME = 262144;
export declare const O_NOFOLLOW = 131072;
export declare const O_SYNC = 1052672;
export declare const O_DSYNC = 4096;
export declare const O_DIRECT = 16384;
export declare const O_NONBLOCK = 2048;
export declare const S_IRWXU = 448;
export declare const S_IRUSR = 256;
export declare const S_IWUSR = 128;
export declare const S_IXUSR = 64;
export declare const S_IRWXG = 56;
export declare const S_IRGRP = 32;
export declare const S_IWGRP = 16;
export declare const S_IXGRP = 8;
export declare const S_IRWXO = 7;
export declare const S_IROTH = 4;
export declare const S_IWOTH = 2;
export declare const S_IXOTH = 1;
export declare const F_OK = 0;
export declare const R_OK = 4;
export declare const W_OK = 2;
export declare const X_OK = 1;
export declare const UV_FS_COPYFILE_EXCL = 1;
export declare const COPYFILE_EXCL = 1;
export declare const UV_FS_COPYFILE_FICLONE = 2;
export declare const COPYFILE_FICLONE = 2;
export declare const UV_FS_COPYFILE_FICLONE_FORCE = 4;
export declare const COPYFILE_FICLONE_FORCE = 4;

View file

@ -0,0 +1,59 @@
// npx -y node@22.14 -e 'const{constants}=require("fs");console.log(Object.entries(constants).map(([k,v]) => `export const ${k} = ${JSON.stringify(v)}`).join("\n"))'
export const UV_FS_SYMLINK_DIR = 1;
export const UV_FS_SYMLINK_JUNCTION = 2;
export const O_RDONLY = 0;
export const O_WRONLY = 1;
export const O_RDWR = 2;
export const UV_DIRENT_UNKNOWN = 0;
export const UV_DIRENT_FILE = 1;
export const UV_DIRENT_DIR = 2;
export const UV_DIRENT_LINK = 3;
export const UV_DIRENT_FIFO = 4;
export const UV_DIRENT_SOCKET = 5;
export const UV_DIRENT_CHAR = 6;
export const UV_DIRENT_BLOCK = 7;
export const EXTENSIONLESS_FORMAT_JAVASCRIPT = 0;
export const EXTENSIONLESS_FORMAT_WASM = 1;
export const S_IFMT = 61440;
export const S_IFREG = 32768;
export const S_IFDIR = 16384;
export const S_IFCHR = 8192;
export const S_IFBLK = 24576;
export const S_IFIFO = 4096;
export const S_IFLNK = 40960;
export const S_IFSOCK = 49152;
export const O_CREAT = 64;
export const O_EXCL = 128;
export const UV_FS_O_FILEMAP = 0;
export const O_NOCTTY = 256;
export const O_TRUNC = 512;
export const O_APPEND = 1024;
export const O_DIRECTORY = 65536;
export const O_NOATIME = 262144;
export const O_NOFOLLOW = 131072;
export const O_SYNC = 1052672;
export const O_DSYNC = 4096;
export const O_DIRECT = 16384;
export const O_NONBLOCK = 2048;
export const S_IRWXU = 448;
export const S_IRUSR = 256;
export const S_IWUSR = 128;
export const S_IXUSR = 64;
export const S_IRWXG = 56;
export const S_IRGRP = 32;
export const S_IWGRP = 16;
export const S_IXGRP = 8;
export const S_IRWXO = 7;
export const S_IROTH = 4;
export const S_IWOTH = 2;
export const S_IXOTH = 1;
export const F_OK = 0;
export const R_OK = 4;
export const W_OK = 2;
export const X_OK = 1;
export const UV_FS_COPYFILE_EXCL = 1;
export const COPYFILE_EXCL = 1;
export const UV_FS_COPYFILE_FICLONE = 2;
export const COPYFILE_FICLONE = 2;
export const UV_FS_COPYFILE_FICLONE_FORCE = 4;
export const COPYFILE_FICLONE_FORCE = 4;

View file

@ -0,0 +1,96 @@
import type nodeFs from "node:fs";
// Async
export declare const access: typeof nodeFs.access;
export declare const appendFile: typeof nodeFs.appendFile;
export declare const chown: typeof nodeFs.chown;
export declare const chmod: typeof nodeFs.chmod;
export declare const copyFile: typeof nodeFs.copyFile;
export declare const cp: typeof nodeFs.cp;
export declare const lchown: typeof nodeFs.lchown;
export declare const lchmod: typeof nodeFs.lchmod;
export declare const link: typeof nodeFs.link;
export declare const lstat: typeof nodeFs.lstat;
export declare const lutimes: typeof nodeFs.lutimes;
export declare const mkdir: typeof nodeFs.mkdir;
export declare const mkdtemp: typeof nodeFs.mkdtemp;
export declare const realpath: typeof nodeFs.realpath;
export declare const open: typeof nodeFs.open;
export declare const opendir: typeof nodeFs.opendir;
export declare const readdir: typeof nodeFs.readdir;
export declare const readFile: typeof nodeFs.readFile;
export declare const readlink: typeof nodeFs.readlink;
export declare const rename: typeof nodeFs.rename;
export declare const rm: typeof nodeFs.rm;
export declare const rmdir: typeof nodeFs.rmdir;
export declare const stat: typeof nodeFs.stat;
export declare const symlink: typeof nodeFs.symlink;
export declare const truncate: typeof nodeFs.truncate;
export declare const unlink: typeof nodeFs.unlink;
export declare const utimes: typeof nodeFs.utimes;
export declare const writeFile: typeof nodeFs.writeFile;
export declare const statfs: typeof nodeFs.statfs;
export declare const close: typeof nodeFs.close;
export declare const createReadStream: typeof nodeFs.createReadStream;
export declare const createWriteStream: typeof nodeFs.createWriteStream;
export declare const exists: typeof nodeFs.exists;
export declare const fchown: typeof nodeFs.fchown;
export declare const fchmod: typeof nodeFs.fchmod;
export declare const fdatasync: typeof nodeFs.fdatasync;
export declare const fstat: typeof nodeFs.fstat;
export declare const fsync: typeof nodeFs.fsync;
export declare const ftruncate: typeof nodeFs.ftruncate;
export declare const futimes: typeof nodeFs.futimes;
export declare const lstatSync: typeof nodeFs.lstatSync;
export declare const read: typeof nodeFs.read;
export declare const readv: typeof nodeFs.readv;
export declare const realpathSync: typeof nodeFs.realpathSync;
export declare const statSync: typeof nodeFs.statSync;
export declare const unwatchFile: typeof nodeFs.unwatchFile;
export declare const watch: typeof nodeFs.watch;
export declare const watchFile: typeof nodeFs.watchFile;
export declare const write: typeof nodeFs.write;
export declare const writev: typeof nodeFs.writev;
export declare const _toUnixTimestamp: unknown;
export declare const openAsBlob: typeof nodeFs.openAsBlob;
export declare const glob: typeof nodeFs.glob;
// Sync
export declare const appendFileSync: unknown;
export declare const accessSync: unknown;
export declare const chownSync: unknown;
export declare const chmodSync: unknown;
export declare const closeSync: unknown;
export declare const copyFileSync: unknown;
export declare const cpSync: unknown;
export declare const existsSync: typeof nodeFs.existsSync;
export declare const fchownSync: unknown;
export declare const fchmodSync: unknown;
export declare const fdatasyncSync: unknown;
export declare const fstatSync: typeof nodeFs.fstatSync;
export declare const fsyncSync: unknown;
export declare const ftruncateSync: unknown;
export declare const futimesSync: unknown;
export declare const lchownSync: unknown;
export declare const lchmodSync: unknown;
export declare const linkSync: unknown;
export declare const lutimesSync: unknown;
export declare const mkdirSync: unknown;
export declare const mkdtempSync: typeof nodeFs.mkdtempSync;
export declare const openSync: unknown;
export declare const opendirSync: unknown;
export declare const readdirSync: typeof nodeFs.readdirSync;
export declare const readSync: unknown;
export declare const readvSync: unknown;
export declare const readFileSync: typeof nodeFs.readFileSync;
export declare const readlinkSync: typeof nodeFs.readlinkSync;
export declare const renameSync: unknown;
export declare const rmSync: unknown;
export declare const rmdirSync: unknown;
export declare const symlinkSync: unknown;
export declare const truncateSync: unknown;
export declare const unlinkSync: unknown;
export declare const utimesSync: unknown;
export declare const writeFileSync: unknown;
export declare const writeSync: unknown;
export declare const writevSync: unknown;
export declare const statfsSync: typeof nodeFs.statfsSync;
export declare const globSync: unknown;

View file

@ -0,0 +1,106 @@
import { notImplemented, notImplementedAsync } from "../../../_internal/utils.mjs";
import * as fsp from "./promises.mjs";
function callbackify(fn) {
const fnc = function(...args) {
const cb = args.pop();
fn().catch((error) => cb(error)).then((val) => cb(undefined, val));
};
fnc.__promisify__ = fn;
fnc.native = fnc;
return fnc;
}
// Async
export const access = callbackify(fsp.access);
export const appendFile = callbackify(fsp.appendFile);
export const chown = callbackify(fsp.chown);
export const chmod = callbackify(fsp.chmod);
export const copyFile = callbackify(fsp.copyFile);
export const cp = callbackify(fsp.cp);
export const lchown = callbackify(fsp.lchown);
export const lchmod = callbackify(fsp.lchmod);
export const link = callbackify(fsp.link);
export const lstat = callbackify(fsp.lstat);
export const lutimes = callbackify(fsp.lutimes);
export const mkdir = callbackify(fsp.mkdir);
export const mkdtemp = callbackify(fsp.mkdtemp);
export const realpath = callbackify(fsp.realpath);
export const open = callbackify(fsp.open);
export const opendir = callbackify(fsp.opendir);
export const readdir = callbackify(fsp.readdir);
export const readFile = callbackify(fsp.readFile);
export const readlink = callbackify(fsp.readlink);
export const rename = callbackify(fsp.rename);
export const rm = callbackify(fsp.rm);
export const rmdir = callbackify(fsp.rmdir);
export const stat = callbackify(fsp.stat);
export const symlink = callbackify(fsp.symlink);
export const truncate = callbackify(fsp.truncate);
export const unlink = callbackify(fsp.unlink);
export const utimes = callbackify(fsp.utimes);
export const writeFile = callbackify(fsp.writeFile);
export const statfs = callbackify(fsp.statfs);
export const close = /* @__PURE__ */ notImplementedAsync("fs.close");
export const createReadStream = /* @__PURE__ */ notImplementedAsync("fs.createReadStream");
export const createWriteStream = /* @__PURE__ */ notImplementedAsync("fs.createWriteStream");
export const exists = /* @__PURE__ */ notImplementedAsync("fs.exists");
export const fchown = /* @__PURE__ */ notImplementedAsync("fs.fchown");
export const fchmod = /* @__PURE__ */ notImplementedAsync("fs.fchmod");
export const fdatasync = /* @__PURE__ */ notImplementedAsync("fs.fdatasync");
export const fstat = /* @__PURE__ */ notImplementedAsync("fs.fstat");
export const fsync = /* @__PURE__ */ notImplementedAsync("fs.fsync");
export const ftruncate = /* @__PURE__ */ notImplementedAsync("fs.ftruncate");
export const futimes = /* @__PURE__ */ notImplementedAsync("fs.futimes");
export const lstatSync = /* @__PURE__ */ notImplementedAsync("fs.lstatSync");
export const read = /* @__PURE__ */ notImplementedAsync("fs.read");
export const readv = /* @__PURE__ */ notImplementedAsync("fs.readv");
export const realpathSync = /* @__PURE__ */ notImplementedAsync("fs.realpathSync");
export const statSync = /* @__PURE__ */ notImplementedAsync("fs.statSync");
export const unwatchFile = /* @__PURE__ */ notImplementedAsync("fs.unwatchFile");
export const watch = /* @__PURE__ */ notImplementedAsync("fs.watch");
export const watchFile = /* @__PURE__ */ notImplementedAsync("fs.watchFile");
export const write = /* @__PURE__ */ notImplementedAsync("fs.write");
export const writev = /* @__PURE__ */ notImplementedAsync("fs.writev");
export const _toUnixTimestamp = /* @__PURE__ */ notImplementedAsync("fs._toUnixTimestamp");
export const openAsBlob = /* @__PURE__ */ notImplementedAsync("fs.openAsBlob");
export const glob = /* @__PURE__ */ notImplementedAsync("fs.glob");
// Sync
export const appendFileSync = /* @__PURE__ */ notImplemented("fs.appendFileSync");
export const accessSync = /* @__PURE__ */ notImplemented("fs.accessSync");
export const chownSync = /* @__PURE__ */ notImplemented("fs.chownSync");
export const chmodSync = /* @__PURE__ */ notImplemented("fs.chmodSync");
export const closeSync = /* @__PURE__ */ notImplemented("fs.closeSync");
export const copyFileSync = /* @__PURE__ */ notImplemented("fs.copyFileSync");
export const cpSync = /* @__PURE__ */ notImplemented("fs.cpSync");
export const existsSync = () => false;
export const fchownSync = /* @__PURE__ */ notImplemented("fs.fchownSync");
export const fchmodSync = /* @__PURE__ */ notImplemented("fs.fchmodSync");
export const fdatasyncSync = /* @__PURE__ */ notImplemented("fs.fdatasyncSync");
export const fstatSync = /* @__PURE__ */ notImplemented("fs.fstatSync");
export const fsyncSync = /* @__PURE__ */ notImplemented("fs.fsyncSync");
export const ftruncateSync = /* @__PURE__ */ notImplemented("fs.ftruncateSync");
export const futimesSync = /* @__PURE__ */ notImplemented("fs.futimesSync");
export const lchownSync = /* @__PURE__ */ notImplemented("fs.lchownSync");
export const lchmodSync = /* @__PURE__ */ notImplemented("fs.lchmodSync");
export const linkSync = /* @__PURE__ */ notImplemented("fs.linkSync");
export const lutimesSync = /* @__PURE__ */ notImplemented("fs.lutimesSync");
export const mkdirSync = /* @__PURE__ */ notImplemented("fs.mkdirSync");
export const mkdtempSync = /* @__PURE__ */ notImplemented("fs.mkdtempSync");
export const openSync = /* @__PURE__ */ notImplemented("fs.openSync");
export const opendirSync = /* @__PURE__ */ notImplemented("fs.opendirSync");
export const readdirSync = /* @__PURE__ */ notImplemented("fs.readdirSync");
export const readSync = /* @__PURE__ */ notImplemented("fs.readSync");
export const readvSync = /* @__PURE__ */ notImplemented("fs.readvSync");
export const readFileSync = /* @__PURE__ */ notImplemented("fs.readFileSync");
export const readlinkSync = /* @__PURE__ */ notImplemented("fs.readlinkSync");
export const renameSync = /* @__PURE__ */ notImplemented("fs.renameSync");
export const rmSync = /* @__PURE__ */ notImplemented("fs.rmSync");
export const rmdirSync = /* @__PURE__ */ notImplemented("fs.rmdirSync");
export const symlinkSync = /* @__PURE__ */ notImplemented("fs.symlinkSync");
export const truncateSync = /* @__PURE__ */ notImplemented("fs.truncateSync");
export const unlinkSync = /* @__PURE__ */ notImplemented("fs.unlinkSync");
export const utimesSync = /* @__PURE__ */ notImplemented("fs.utimesSync");
export const writeFileSync = /* @__PURE__ */ notImplemented("fs.writeFileSync");
export const writeSync = /* @__PURE__ */ notImplemented("fs.writeSync");
export const writevSync = /* @__PURE__ */ notImplemented("fs.writevSync");
export const statfsSync = /* @__PURE__ */ notImplemented("fs.statfsSync");
export const globSync = /* @__PURE__ */ notImplemented("fs.globSync");

View file

@ -0,0 +1,32 @@
import type nodeFsPromises from "node:fs/promises";
export declare const access: unknown;
export declare const copyFile: unknown;
export declare const cp: unknown;
export declare const open: unknown;
export declare const opendir: unknown;
export declare const rename: unknown;
export declare const truncate: unknown;
export declare const rm: unknown;
export declare const rmdir: unknown;
export declare const mkdir: typeof nodeFsPromises.mkdir;
export declare const readdir: typeof nodeFsPromises.readdir;
export declare const readlink: typeof nodeFsPromises.readlink;
export declare const symlink: unknown;
export declare const lstat: typeof nodeFsPromises.lstat;
export declare const stat: typeof nodeFsPromises.stat;
export declare const link: unknown;
export declare const unlink: unknown;
export declare const chmod: unknown;
export declare const lchmod: unknown;
export declare const lchown: unknown;
export declare const chown: unknown;
export declare const utimes: unknown;
export declare const lutimes: unknown;
export declare const realpath: typeof nodeFsPromises.realpath;
export declare const mkdtemp: typeof nodeFsPromises.mkdtemp;
export declare const writeFile: unknown;
export declare const appendFile: unknown;
export declare const readFile: typeof nodeFsPromises.readFile;
export declare const watch: typeof nodeFsPromises.watch;
export declare const statfs: typeof nodeFsPromises.statfs;
export declare const glob: unknown;

View file

@ -0,0 +1,32 @@
import { notImplemented } from "../../../_internal/utils.mjs";
export const access = /* @__PURE__ */ notImplemented("fs.access");
export const copyFile = /* @__PURE__ */ notImplemented("fs.copyFile");
export const cp = /* @__PURE__ */ notImplemented("fs.cp");
export const open = /* @__PURE__ */ notImplemented("fs.open");
export const opendir = /* @__PURE__ */ notImplemented("fs.opendir");
export const rename = /* @__PURE__ */ notImplemented("fs.rename");
export const truncate = /* @__PURE__ */ notImplemented("fs.truncate");
export const rm = /* @__PURE__ */ notImplemented("fs.rm");
export const rmdir = /* @__PURE__ */ notImplemented("fs.rmdir");
export const mkdir = /* @__PURE__ */ notImplemented("fs.mkdir");
export const readdir = /* @__PURE__ */ notImplemented("fs.readdir");
export const readlink = /* @__PURE__ */ notImplemented("fs.readlink");
export const symlink = /* @__PURE__ */ notImplemented("fs.symlink");
export const lstat = /* @__PURE__ */ notImplemented("fs.lstat");
export const stat = /* @__PURE__ */ notImplemented("fs.stat");
export const link = /* @__PURE__ */ notImplemented("fs.link");
export const unlink = /* @__PURE__ */ notImplemented("fs.unlink");
export const chmod = /* @__PURE__ */ notImplemented("fs.chmod");
export const lchmod = /* @__PURE__ */ notImplemented("fs.lchmod");
export const lchown = /* @__PURE__ */ notImplemented("fs.lchown");
export const chown = /* @__PURE__ */ notImplemented("fs.chown");
export const utimes = /* @__PURE__ */ notImplemented("fs.utimes");
export const lutimes = /* @__PURE__ */ notImplemented("fs.lutimes");
export const realpath = /* @__PURE__ */ notImplemented("fs.realpath");
export const mkdtemp = /* @__PURE__ */ notImplemented("fs.mkdtemp");
export const writeFile = /* @__PURE__ */ notImplemented("fs.writeFile");
export const appendFile = /* @__PURE__ */ notImplemented("fs.appendFile");
export const readFile = /* @__PURE__ */ notImplemented("fs.readFile");
export const watch = /* @__PURE__ */ notImplemented("fs.watch");
export const statfs = /* @__PURE__ */ notImplemented("fs.statfs");
export const glob = /* @__PURE__ */ notImplemented("fs.glob");

View file

@ -0,0 +1,14 @@
import type nodeHttp from "node:http";
import { EventEmitter } from "node:events";
export declare class Agent extends EventEmitter implements nodeHttp.Agent {
__unenv__: {};
maxFreeSockets: number;
maxSockets: number;
maxTotalSockets: number;
readonly freeSockets: {};
readonly sockets: {};
readonly requests: {};
readonly options: nodeHttp.AgentOptions;
constructor(opts?: nodeHttp.AgentOptions);
destroy(): void;
}

View file

@ -0,0 +1,16 @@
import { EventEmitter } from "node:events";
export class Agent extends EventEmitter {
__unenv__ = {};
maxFreeSockets = 256;
maxSockets = Infinity;
maxTotalSockets = Infinity;
freeSockets = {};
sockets = {};
requests = {};
options;
constructor(opts = {}) {
super();
this.options = opts;
}
destroy() {}
}

Some files were not shown because too many files have changed in this diff Show more