New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unenv

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unenv - npm Package Compare versions

Comparing version

to
0.5.0

runtime/node/buffer/_base64.cjs

6

dist/index.d.ts

@@ -17,8 +17,8 @@ declare const NodeBuiltinModules: string[];

declare const _default$1: Preset;
declare const _default: Preset;
declare const nodeless: Preset;
declare function env(...presets: Preset[]): Environment;
export { Environment, NodeBuiltinModules, Preset, env, mapArrToVal, _default$1 as node, _default as nodeless };
export { Environment, NodeBuiltinModules, Preset, env, mapArrToVal, _default as node, nodeless };
{
"name": "unenv",
"version": "0.4.6",
"version": "0.5.0",
"description": "",

@@ -25,11 +25,6 @@ "repository": "unjs/unenv",

"dependencies": {
"buffer": "^6.0.2",
"abort-controller": "^3.0.0",
"defu": "^6.0.0",
"events": "^3.2.0",
"inherits": "^2.0.4",
"mime": "^2.4.6",
"node-fetch": "^3.2.3",
"process": "^0.11.10",
"upath": "^2.0.1",
"util": "^0.12.4"
"mime": "^3.0.0",
"node-fetch": "^3.2.4"
},

@@ -46,3 +41,3 @@ "devDependencies": {

},
"packageManager": "pnpm@6.32.3",
"packageManager": "pnpm@7.0.0",
"scripts": {

@@ -52,4 +47,3 @@ "build": "unbuild",

"release": "standard-version && pnpm publish && git push --follow-tags"
},
"readme": "# unenv\n\nUnenv is a framework agnostic system that allows converting JavaScript code to be platform agnostic and working in any environment including Browsers, Workers, Node.js or pure JavaScript runtime.\n\n## Install\n\n\n```bash\n# Using npm\nnpm i -D unenv\n\n# Using yarn\nyarn add --dev unenv\n```\n\n## Usage\n\nUsing `env` utility and builtin presets ( and [nodeless](./src/presets/nodeless.ts)), unenv will provide an abstract config that can be used in building pipelines ([rollup.js](https://rollupjs.org), [webpack](https://webpack.js.org), etc)\n\n```js\nimport { env, node, nodeless } from 'unenv'\n\nconst { alias, inject, polyfill, external } = env(...presets)\n```\n\n## Presets\n\n### `node`\n\nSuitable to convert universal libraries working in Node.js. ([preset]([node](./src/presets/node.ts)))\n\n- Add support for global [`fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)\n- Set Node.js built-ins as externals\n\n### `nodeless`\n\nUsing this preset, we can convert a code that is depending on Node.js to work anywhere else.\n\n#### Built-in Node.js modules\n\nModule | Status | Source\n-------|--------|---------------\n[node:assert](https://nodejs.org/api/assert.html) | Mocked | -\n[node:async_hooks](https://nodejs.org/api/async_hooks.html) | Mocked | -\n[node:buffer](https://nodejs.org/api/buffer.html) | Polyfilled | [npm:buffer](https://www.npmjs.com/package/buffer)\n[node:child_process](https://nodejs.org/api/child_process.html) | Mocked | -\n[node:cluster](https://nodejs.org/api/cluster.html) | Mocked | -\n[node:console](https://nodejs.org/api/console.html) | Mocked | -\n[node:constants](https://nodejs.org/api/constants.html) | Mocked | -\n[node:crypto](https://nodejs.org/api/crypto.html) | Mocked | -\n[node:dgram](https://nodejs.org/api/dgram.html) | Mocked | -\n[node:diagnostics_channel](https://nodejs.org/api/diagnostics_channel.html) | Mocked | -\n[node:dns](https://nodejs.org/api/dns.html) | Mocked | -\n[node:domain](https://nodejs.org/api/domain.html) | Mocked | -\n[node:events](https://nodejs.org/api/events.html) | Polyfilled | [npm:events](https://www.npmjs.com/package/events)\n[node:fs/promises](https://nodejs.org/api/fs/promises.html) | Mocked | -\n[node:fs](https://nodejs.org/api/fs.html) | Mocked | -\n[node:http2](https://nodejs.org/api/http2.html) | Mocked | -\n[node:http](https://nodejs.org/api/http.html) | Polyfilled | [unenv/runtime/http/request](./src/runtime/node/http)\n[node:https](https://nodejs.org/api/https.html) | Mocked | -\n[node:inspector](https://nodejs.org/api/inspector.html) | Mocked | -\n[node:module](https://nodejs.org/api/module.html) | Mocked | -\n[node:net](https://nodejs.org/api/net.html) | Polyfilled | [unenv/runtime/node/request](./src/runtime/node/net)\n[node:os](https://nodejs.org/api/os.html) | Mocked | -\n[node:path](https://nodejs.org/api/path.html) | Mocked | -\n[node:perf_hooks](https://nodejs.org/api/perf_hooks.html) | Mocked | -\n[node:process](https://nodejs.org/api/process.html) | Polyfilled | -\n[node:punycode](https://nodejs.org/api/punycode.html) | Mocked | -\n[node:querystring](https://nodejs.org/api/querystring.html) | Mocked | -\n[node:readline](https://nodejs.org/api/readline.html) | Mocked | -\n[node:repl](https://nodejs.org/api/repl.html) | Mocked | -\n[node:stream](https://nodejs.org/api/stream.html) | Polyfilled | [unenv/runtime/strean/request](./src/runtime/node/stream)\n[node:string_decoder](https://nodejs.org/api/string_decoder.html) | Mocked | -\n[node:sys](https://nodejs.org/api/sys.html) | Mocked | -\n[node:timers](https://nodejs.org/api/timers.html) | Mocked | -\n[node:tls](https://nodejs.org/api/tls.html) | Mocked | -\n[node:trace_events](https://nodejs.org/api/trace_events.html) | Mocked | -\n[node:tty](https://nodejs.org/api/tty.html) | Mocked | -\n[node:url](https://nodejs.org/api/url.html) | Polyfilled | [unenv/runtime/url/request](./src/runtime/node/url)\n[node:util](https://nodejs.org/api/util.html) | Polyfilled | [npm:util](https://www.npmjs.com/package/util)\n[node:v8](https://nodejs.org/api/v8.html) | Mocked | -\n[node:vm](https://nodejs.org/api/vm.html) | Mocked | -\n[node:wasi](https://nodejs.org/api/wasi.html) | Mocked | -\n[node:worker_threads](https://nodejs.org/api/worker_threads.html) | Mocked | -\n[node:zlib](https://nodejs.org/api/zlib.html) | Mocked | -\n[npm:etag](https://www.npmjs.com/package/etag) | Polyfilled | [unenv/runtime/npm:etag](./src/runtime/npm:etag)\n[npm:fsevents](https://www.npmjs.com/package/fsevents) | Polyfilled | [unenv/runtime/npm:fsevents](./src/runtime/npm:fsevents)\n[npm:mime-db](https://www.npmjs.com/package/mime-db) | Polyfilled | [unenv/runtime/npm:mime-db](./src/runtime/npm:mime-db)\n[npm:mime](https://www.npmjs.com/package/mime) | Polyfilled | [unenv/runtime/npm:mime](./src/runtime/npm:mime)\n[npm:node-fetch](https://www.npmjs.com/package/node-fetch) | Polyfilled | [unenv/runtime/npm:node-fetch](./src/runtime/npm:node-fetch)\n\n\n\n## Auto-mocking proxy\n\n```js\nimport MockProxy from 'unenv/runtime/mock/proxy'\n\nconsole.log(MockProxy().foo.bar()[0])\n```\n\n\n\nAbove package doesn't works outside of Node.js and neither we need any platform specific logic! When aliasing `os` to `mock/proxy-cjs`, it will be auto mocked using a [Proxy Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) which can be recursively traversed like an `Object`, called like a `Function`, Iterated like an `Array`, or instantiated like a `Class`.\n\nWe use this proxy for auto mocking unimplemented internals. Imagine a packages does this:\n\n```js\nconst os = require('os')\nif (os.platform() === 'windows') { /* do some fix */ }\nmodule.exports = () => 'Hello world'\n```\n\nBy aliasing `os` to `unenv/runtime/mock/proxy-cjs`, code will be compatible in other platforms.\n\n## Other polyfilles\n\nPlease check [./src/rutime](./src/runtime) to discover other polyfilles.\n\n## License\n\nMIT\n"
}
}

@@ -39,4 +39,6 @@ # unenv

#### Built-in Node.js modules
### Built-in Node.js modules
Unenv provides a replacement for all Node.js built-ins for cross-platform compatiblity.
Module | Status | Source

@@ -46,3 +48,3 @@ -------|--------|---------------

[node:async_hooks](https://nodejs.org/api/async_hooks.html) | Mocked | -
[node:buffer](https://nodejs.org/api/buffer.html) | Polyfilled | [npm:buffer](https://www.npmjs.com/package/buffer)
[node:buffer](https://nodejs.org/api/buffer.html) | Polyfilled | [unenv/node/buffer](./src/runtime/node/buffer)
[node:child_process](https://nodejs.org/api/child_process.html) | Mocked | -

@@ -57,11 +59,11 @@ [node:cluster](https://nodejs.org/api/cluster.html) | Mocked | -

[node:domain](https://nodejs.org/api/domain.html) | Mocked | -
[node:events](https://nodejs.org/api/events.html) | Polyfilled | [npm:events](https://www.npmjs.com/package/events)
[node:events](https://nodejs.org/api/events.html) | Polyfilled | [unenv/node/events](./src/runtime/node/events)
[node:fs/promises](https://nodejs.org/api/fs/promises.html) | Mocked | -
[node:fs](https://nodejs.org/api/fs.html) | Mocked | -
[node:http2](https://nodejs.org/api/http2.html) | Mocked | -
[node:http](https://nodejs.org/api/http.html) | Polyfilled | [unenv/runtime/http/request](./src/runtime/node/http)
[node:http](https://nodejs.org/api/http.html) | Polyfilled | [unenv/node/http](./src/runtime/node/http)
[node:https](https://nodejs.org/api/https.html) | Mocked | -
[node:inspector](https://nodejs.org/api/inspector.html) | Mocked | -
[node:module](https://nodejs.org/api/module.html) | Mocked | -
[node:net](https://nodejs.org/api/net.html) | Polyfilled | [unenv/runtime/node/request](./src/runtime/node/net)
[node:net](https://nodejs.org/api/net.html) | Polyfilled | [unenv/node/net](./src/runtime/node/net)
[node:os](https://nodejs.org/api/os.html) | Mocked | -

@@ -75,3 +77,3 @@ [node:path](https://nodejs.org/api/path.html) | Mocked | -

[node:repl](https://nodejs.org/api/repl.html) | Mocked | -
[node:stream](https://nodejs.org/api/stream.html) | Polyfilled | [unenv/runtime/strean/request](./src/runtime/node/stream)
[node:stream](https://nodejs.org/api/stream.html) | Polyfilled | [unenv/node/stream](./src/runtime/node/stream)
[node:string_decoder](https://nodejs.org/api/string_decoder.html) | Mocked | -

@@ -83,4 +85,4 @@ [node:sys](https://nodejs.org/api/sys.html) | Mocked | -

[node:tty](https://nodejs.org/api/tty.html) | Mocked | -
[node:url](https://nodejs.org/api/url.html) | Polyfilled | [unenv/runtime/url/request](./src/runtime/node/url)
[node:util](https://nodejs.org/api/util.html) | Polyfilled | [npm:util](https://www.npmjs.com/package/util)
[node:url](https://nodejs.org/api/url.html) | Polyfilled | [unenv/node/url](./src/runtime/node/url)
[node:util](https://nodejs.org/api/util.html) | Polyfilled | [unenv/node/util](./src/runtime/node/util)
[node:v8](https://nodejs.org/api/v8.html) | Mocked | -

@@ -91,10 +93,19 @@ [node:vm](https://nodejs.org/api/vm.html) | Mocked | -

[node:zlib](https://nodejs.org/api/zlib.html) | Mocked | -
[npm:etag](https://www.npmjs.com/package/etag) | Polyfilled | [unenv/runtime/npm:etag](./src/runtime/npm:etag)
[npm:fsevents](https://www.npmjs.com/package/fsevents) | Polyfilled | [unenv/runtime/npm:fsevents](./src/runtime/npm:fsevents)
[npm:mime-db](https://www.npmjs.com/package/mime-db) | Polyfilled | [unenv/runtime/npm:mime-db](./src/runtime/npm:mime-db)
[npm:mime](https://www.npmjs.com/package/mime) | Polyfilled | [unenv/runtime/npm:mime](./src/runtime/npm:mime)
[npm:node-fetch](https://www.npmjs.com/package/node-fetch) | Polyfilled | [unenv/runtime/npm:node-fetch](./src/runtime/npm:node-fetch)
## npm packages
Unenv provides a replacement for common npm packages for cross platform compatibility.
Package | Status | Source
-------|--------|---------------
[npm/consola](https://www.npmjs.com/package/consola) | Use native `console` | [unenv/runtime/npm/consola](./src/runtime/npm/consola.ts)
[npm/cross-fetch](https://www.npmjs.com/package/node-fetch) | Use native `fetch` | [unenv/runtime/npm/cross-fetch](./src/runtime/npm/cross-fetch.ts)
[npm/debug](https://www.npmjs.com/package/debug) | Mocked with `console.debug` | [unenv/runtime/npm/debug](./src/runtime/npm/debug.ts)
[npm/fsevents](https://www.npmjs.com/package/fsevents) | Mocked | [unenv/runtime/npm/fsevents](./src/runtime/npm/fsevents.ts)
[npm/inherits](https://www.npmjs.com/package/inherits) | Inlined | [unenv/runtime/npm/inherits](./src/runtime/npm/inherits.ts)
[npm/mime-db](https://www.npmjs.com/package/mime-db) | Minimized | [unenv/runtime/npm/mime-db](./src/runtime/npm/mime-db.ts)
[npm/mime](https://www.npmjs.com/package/mime) | Minimized | [unenv/runtime/npm/mime](./src/runtime/npm/mime.ts)
[npm/node-fetch](https://www.npmjs.com/package/node-fetch) | Use native `fetch` | [unenv/runtime/npm/node-fetch](./src/runtime/npm/node-fetch.ts)
[npm/whatwg-url](https://www.npmjs.com/package/whatwg-url) | Use native `URL` | [unenv/runtime/npm/whatwg-url](./src/runtime/npm/whatwg-url.ts)
## Auto-mocking proxy

@@ -101,0 +112,0 @@

import type { HeadersObject } from './types';
export declare function rawHeaders(headers: HeadersObject): any[];
export declare function mergeFns(...functions: Function[]): (...args: any[]) => void;
export declare function notImplemented(name: string): () => never;

@@ -1,3 +0,3 @@

import { IncomingMessage } from '../node/http/request';
import { ServerResponse } from '../node/http/response';
import { IncomingMessage } from '../node/http/_request';
import { ServerResponse } from '../node/http/_response';
export declare type Handle = (req: IncomingMessage, res: ServerResponse) => Promise<any>;

@@ -4,0 +4,0 @@ export declare type CallHandle = ReturnType<typeof createCall>;

@@ -1,76 +0,5 @@

import * as request from './request';
import * as response from './response';
export * from './consts';
export * from './request';
export * from './response';
declare const _default: {
ServerResponse: typeof response.ServerResponse;
IncomingMessage: typeof request.IncomingMessage;
METHODS: string[];
STATUS_CODES: {
100: string;
101: string;
102: string;
103: string;
200: string;
201: string;
202: string;
203: string;
204: string;
205: string;
206: string;
207: string;
208: string;
226: string;
300: string;
301: string;
302: string;
303: string;
304: string;
305: string;
307: string;
308: string;
400: string;
401: string;
402: string;
403: string;
404: string;
405: string;
406: string;
407: string;
408: string;
409: string;
410: string;
411: string;
412: string;
413: string;
414: string;
415: string;
416: string;
417: string;
418: string;
421: string;
422: string;
423: string;
424: string;
425: string;
426: string;
428: string;
429: string;
431: string;
451: string;
500: string;
501: string;
502: string;
503: string;
504: string;
505: string;
506: string;
507: string;
508: string;
509: string;
510: string;
511: string;
};
};
export * from './_consts';
export * from './_request';
export * from './_response';
declare const _default: any;
export default _default;

@@ -1,6 +0,3 @@

import * as socket from './socket';
export * from './socket';
declare const _default: {
Socket: typeof socket.Socket;
};
declare const _default: any;
export default _default;

@@ -1,5 +0,1 @@

/// <reference types="node" />
import * as readable from './readable';
import * as writable from './writable';
import * as transform from './transform';
export * from './readable';

@@ -9,8 +5,4 @@ export * from './writable';

export * from './transform';
declare const _default: {
Transform: typeof transform.Transform;
Duplex: new () => import("stream").Duplex;
Writable: typeof writable.Writable;
Readable: typeof readable.Readable;
};
export * from './mock';
declare const _default: any;
export default _default;

@@ -20,23 +20,3 @@ export declare const URL: {

export declare const fileURLToPath: any;
declare const _default: {
URL: {
new (url: string | URL, base?: string | URL): URL;
prototype: URL;
createObjectURL(obj: Blob | MediaSource): string;
revokeObjectURL(url: string): void;
};
URLSearchParams: {
new (init?: string | URLSearchParams | string[][] | Record<string, string>): URLSearchParams;
prototype: URLSearchParams;
toString(): string;
};
domainToASCII: any;
domainToUnicode: any;
fileURLToPath: any;
format: any;
parse: any;
pathToFileURL: any;
resolve: any;
urlToHttpOptions: any;
};
declare const _default: any;
export default _default;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet