📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

vite

Package Overview
Dependencies
Maintainers
5
Versions
651
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite - npm Package Compare versions

Comparing version

to
3.2.7

dist/node/chunks/dep-19c40c50.js

49

client.d.ts

@@ -34,2 +34,6 @@ /// <reference path="./types/importMeta.d.ts" />

}
declare module '*.module.sss' {
const classes: CSSModuleClasses
export default classes
}

@@ -65,7 +69,15 @@ // CSS

}
declare module '*.sss' {
const css: string
export default css
}
// Built-in asset types
// see `src/constants.ts`
// see `src/node/constants.ts`
// images
declare module '*.png' {
const src: string
export default src
}
declare module '*.jpg' {

@@ -91,6 +103,2 @@ const src: string

}
declare module '*.png' {
const src: string
export default src
}
declare module '*.gif' {

@@ -170,8 +178,2 @@ const src: string

// other
declare module '*.wasm?init' {
const initWasm: (
options: WebAssembly.Imports
) => Promise<WebAssembly.Instance>
export default initWasm
}
declare module '*.webmanifest' {

@@ -190,2 +192,10 @@ const src: string

// wasm?init
declare module '*.wasm?init' {
const initWasm: (
options: WebAssembly.Imports
) => Promise<WebAssembly.Instance>
export default initWasm
}
// web worker

@@ -206,2 +216,7 @@ declare module '*?worker' {

declare module '*?worker&url' {
const src: string
export default src
}
declare module '*?sharedworker' {

@@ -214,2 +229,14 @@ const sharedWorkerConstructor: {

declare module '*?sharedworker&inline' {
const sharedWorkerConstructor: {
new (): SharedWorker
}
export default sharedWorkerConstructor
}
declare module '*?sharedworker&url' {
const src: string
export default src
}
declare module '*?raw' {

@@ -216,0 +243,0 @@ const src: string

import { performance } from 'node:perf_hooks';
import { EventEmitter } from 'events';
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-0fc8e132.js';
import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-2faf2534.js';
import { VERSION } from './constants.js';

@@ -27,4 +27,5 @@ import 'node:fs';

import 'crypto';
import 'buffer';
import 'node:buffer';
import 'module';
import 'worker_threads';
import 'zlib';

@@ -35,3 +36,2 @@ import 'https';

import 'node:https';
import 'worker_threads';
import 'querystring';

@@ -656,2 +656,9 @@ import 'node:readline';

const cli = cac('vite');
const filterDuplicateOptions = (options) => {
for (const [key, value] of Object.entries(options)) {
if (Array.isArray(value)) {
options[key] = value[value.length - 1];
}
}
};
/**

@@ -698,5 +705,6 @@ * removing global flags before passing as command specific sub-configs

.action(async (root, options) => {
filterDuplicateOptions(options);
// output structure is preserved even after bundling so require()
// is ok here
const { createServer } = await import('./chunks/dep-0fc8e132.js').then(function (n) { return n.E; });
const { createServer } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.D; });
try {

@@ -721,3 +729,3 @@ const server = await createServer({

const startupDurationString = viteStartTime
? picocolors.exports.dim(`ready in ${picocolors.exports.white(picocolors.exports.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
? picocolors.exports.dim(`ready in ${picocolors.exports.reset(picocolors.exports.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
: '';

@@ -749,3 +757,4 @@ info(`\n ${picocolors.exports.green(`${picocolors.exports.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });

.action(async (root, options) => {
const { build } = await import('./chunks/dep-0fc8e132.js').then(function (n) { return n.D; });
filterDuplicateOptions(options);
const { build } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.C; });
const buildOptions = cleanOptions(options);

@@ -774,3 +783,4 @@ try {

.action(async (root, options) => {
const { optimizeDeps } = await import('./chunks/dep-0fc8e132.js').then(function (n) { return n.C; });
filterDuplicateOptions(options);
const { optimizeDeps } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.B; });
try {

@@ -797,4 +807,6 @@ const config = await resolveConfig({

.option('--open [path]', `[boolean | string] open browser on startup`)
.option('--outDir <dir>', `[string] output directory (default: dist)`)
.action(async (root, options) => {
const { preview } = await import('./chunks/dep-0fc8e132.js').then(function (n) { return n.F; });
filterDuplicateOptions(options);
const { preview } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.E; });
try {

@@ -807,2 +819,5 @@ const server = await preview({

mode: options.mode,
build: {
outDir: options.outDir
},
preview: {

@@ -809,0 +824,0 @@ port: options.port,

import path, { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
var version = "3.0.9";
var version = "3.2.7";

@@ -6,0 +6,0 @@ const VERSION = version;

@@ -1,2 +0,2 @@

export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-0fc8e132.js';
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-2faf2534.js';
export { VERSION as version } from './constants.js';

@@ -28,4 +28,5 @@ export { version as esbuildVersion } from 'esbuild';

import 'crypto';
import 'buffer';
import 'node:buffer';
import 'module';
import 'worker_threads';
import 'zlib';

@@ -36,3 +37,2 @@ import 'https';

import 'node:https';
import 'worker_threads';
import 'querystring';

@@ -39,0 +39,0 @@ import 'node:readline';

{
"name": "vite",
"version": "3.0.9",
"version": "3.2.7",
"type": "module",

@@ -31,3 +31,2 @@ "license": "MIT",

"index.cjs",
"src/client",
"types"

@@ -51,7 +50,8 @@ ],

"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
"build-types": "run-s build-temp-types patch-types roll-types check-dist-types",
"build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
"patch-types": "tsx scripts/patchTypes.ts",
"roll-types": "api-extractor run && rimraf temp",
"check-dist-types": "tsc --project tsconfig.check.json",
"build-types": "run-s build-types-temp build-types-pre-patch build-types-roll build-types-post-patch build-types-check",
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
"build-types-pre-patch": "tsx scripts/prePatchTypes.ts",
"build-types-roll": "api-extractor run && rimraf temp",
"build-types-post-patch": "tsx scripts/postPatchTypes.ts",
"build-types-check": "tsc --project tsconfig.check.json",
"lint": "eslint --cache --ext .ts src/**",

@@ -63,6 +63,6 @@ "format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",

"dependencies": {
"esbuild": "^0.14.47",
"postcss": "^8.4.16",
"esbuild": "^0.15.9",
"postcss": "^8.4.18",
"resolve": "^1.22.1",
"rollup": ">=2.75.6 <2.77.0 || ~2.77.0"
"rollup": "^2.79.1"
},

@@ -74,44 +74,48 @@ "optionalDependencies": {

"@ampproject/remapping": "^2.2.0",
"@babel/parser": "^7.18.11",
"@babel/types": "^7.18.10",
"@jridgewell/trace-mapping": "^0.3.15",
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-dynamic-import-vars": "^1.4.4",
"@babel/parser": "^7.20.0",
"@babel/types": "^7.20.0",
"@jridgewell/trace-mapping": "^0.3.17",
"@rollup/plugin-alias": "^4.0.2",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-dynamic-import-vars": "^2.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-typescript": "^8.3.4",
"@rollup/plugin-node-resolve": "14.1.0",
"@rollup/plugin-typescript": "^8.5.0",
"@rollup/pluginutils": "^4.2.1",
"@vue/compiler-dom": "^3.2.37",
"acorn": "^8.8.0",
"cac": "^6.7.12",
"@types/escape-html": "^1.0.0",
"acorn": "^8.8.1",
"acorn-walk": "^8.2.0",
"cac": "^6.7.14",
"chokidar": "^3.5.3",
"connect": "^3.7.0",
"connect-history-api-fallback": "^2.0.0",
"convert-source-map": "^1.8.0",
"convert-source-map": "^1.9.0",
"cors": "^2.8.5",
"cross-spawn": "^7.0.3",
"debug": "^4.3.4",
"dep-types": "link:./src/types",
"dotenv": "^14.3.2",
"dotenv-expand": "^5.1.0",
"es-module-lexer": "^1.0.3",
"es-module-lexer": "^1.1.0",
"escape-html": "^1.0.3",
"estree-walker": "^3.0.1",
"etag": "^1.8.1",
"fast-glob": "^3.2.11",
"fast-glob": "^3.2.12",
"http-proxy": "^1.18.1",
"json5": "^2.2.1",
"launch-editor-middleware": "^2.5.0",
"magic-string": "^0.26.2",
"launch-editor-middleware": "^2.6.0",
"magic-string": "^0.26.7",
"micromatch": "^4.0.5",
"mlly": "^0.5.12",
"mlly": "^0.5.16",
"mrmime": "^1.0.1",
"okie": "^1.0.1",
"open": "^8.4.0",
"parse5": "^7.1.1",
"periscopic": "^3.0.4",
"picocolors": "^1.0.0",
"postcss-import": "^14.1.0",
"picomatch": "^2.3.1",
"postcss-import": "^15.0.0",
"postcss-load-config": "^4.0.1",
"postcss-modules": "^4.3.1",
"postcss-modules": "^6.0.0",
"resolve.exports": "^1.1.0",
"rollup-plugin-license": "^2.8.1",
"sirv": "^2.0.2",

@@ -121,16 +125,21 @@ "source-map-js": "^1.0.2",

"strip-ansi": "^7.0.1",
"strip-literal": "^0.4.0",
"strip-literal": "^0.4.2",
"tsconfck": "^2.0.1",
"tslib": "^2.4.0",
"types": "link:./types",
"ufo": "^0.8.5",
"ws": "^8.8.1"
"ufo": "^0.8.6",
"ws": "^8.10.0"
},
"peerDependencies": {
"@types/node": ">= 14",
"less": "*",
"sass": "*",
"stylus": "*",
"sugarss": "*",
"terser": "^5.4.0"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
"sass": {

@@ -145,2 +154,5 @@ "optional": true

},
"sugarss": {
"optional": true
},
"terser": {

@@ -147,0 +159,0 @@ "optional": true

@@ -1,59 +0,6 @@

/**
Types from https://github.com/rollup/plugins/blob/master/packages/alias/types/index.d.ts
Inlined because the plugin is bundled.
https://github.com/rollup/plugins/blob/master/LICENSE
The MIT License (MIT)
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/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.
*/
import type { PluginHooks } from 'rollup'
export interface Alias {
find: string | RegExp
replacement: string
/**
* Instructs the plugin to use an alternative resolving algorithm,
* rather than the Rollup's resolver.
* @default null
*/
customResolver?: ResolverFunction | ResolverObject | null
}
export type ResolverFunction = PluginHooks['resolveId']
export interface ResolverObject {
buildStart?: PluginHooks['buildStart']
resolveId: ResolverFunction
}
/**
* Specifies an `Object`, or an `Array` of `Object`,
* which defines aliases used to replace values in `import` or `require` statements.
* With either format, the order of the entries is important,
* in that the first defined rules are applied first.
*
* This is passed to \@rollup/plugin-alias as the "entries" field
* https://github.com/rollup/plugins/tree/master/packages/alias#entries
*/
export type AliasOptions = readonly Alias[] | { [find: string]: string }
export type {
Alias,
ResolverFunction,
ResolverObject,
AliasOptions
} from '../dist/node'

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

export type AnymatchFn = (testString: string) => boolean
export type AnymatchPattern = string | RegExp | AnymatchFn
type AnymatchMatcher = AnymatchPattern | AnymatchPattern[]
export { AnymatchMatcher as Matcher }
export type { AnymatchFn, AnymatchPattern, Matcher } from '../dist/node'

@@ -1,226 +0,8 @@

// Inlined to avoid extra dependency (chokidar is bundled in the published build)
export type {
FSWatcher,
WatchOptions,
AwaitWriteFinishOptions
} from '../dist/node'
// https://github.com/paulmillr/chokidar/blob/master/types/index.d.ts
// MIT Licensed https://github.com/paulmillr/chokidar/blob/master/LICENSE
/**
The MIT License (MIT)
Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker
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.
*/
/// <reference types="node" />
import type * as fs from 'node:fs'
import { EventEmitter } from 'node:events'
import type { Matcher } from './anymatch'
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
options: WatchOptions
/**
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
constructor(options?: WatchOptions)
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | ReadonlyArray<string>): this
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | ReadonlyArray<string>): this
/**
* Returns an object representing all the paths on the file system being watched by this
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
* the `cwd` option was used), and the values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): {
[directory: string]: string[]
}
/**
* Removes all listeners from watched files.
*/
close(): Promise<void>
on(
event: 'add' | 'addDir' | 'change',
listener: (path: string, stats?: fs.Stats) => void
): this
on(
event: 'all',
listener: (
eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',
path: string,
stats?: fs.Stats
) => void
): this
/**
* Error occurred
*/
on(event: 'error', listener: (error: Error) => void): this
/**
* Exposes the native Node `fs.FSWatcher events`
*/
on(
event: 'raw',
listener: (eventName: string, path: string, details: any) => void
): this
/**
* Fires when the initial scan is complete
*/
on(event: 'ready', listener: () => void): this
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this
on(event: string, listener: (...args: any[]) => void): this
}
export interface WatchOptions {
/**
* Indicates whether the process should continue to run as long as files are being watched. If
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
* even if the process continues to run.
*/
persistent?: boolean
/**
* ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
* with two arguments is provided, it gets called twice per path - once with a single argument
* (the path), second time with two arguments (the path and the
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
*/
ignored?: Matcher
/**
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
*/
ignoreInitial?: boolean
/**
* When `false`, only the symlinks themselves will be watched for changes instead of following
* the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean
/**
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
* be relative to this.
*/
cwd?: string
/**
* If set to true then the strings passed to .watch() and .add() are treated as literal path
* names, even if they look like globs.
*
* @default false
*/
disableGlobbing?: boolean
/**
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
* utilization, consider setting this to `false`. It is typically necessary to **set this to
* `true` to successfully watch files over a network**, and it may be necessary to successfully
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
* the `useFsEvents` default.
*/
usePolling?: boolean
/**
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
* OS X, `usePolling: true` becomes the default.
*/
useFsEvents?: boolean
/**
* If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
* provided even in cases where it wasn't already available from the underlying watch events.
*/
alwaysStat?: boolean
/**
* If set, limits how many levels of subdirectories will be traversed.
*/
depth?: number
/**
* Interval of file system polling.
*/
interval?: number
/**
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
*/
binaryInterval?: number
/**
* Indicates whether to watch files that don't have read permissions if possible. If watching
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
* silently.
*/
ignorePermissionErrors?: boolean
/**
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
* that occur when using editors that use "atomic writes" instead of writing directly to the
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
* you can override it by setting `atomic` to a custom value, in milliseconds.
*/
atomic?: boolean | number
/**
* can be set to an object in order to adjust timing params:
*/
awaitWriteFinish?: AwaitWriteFinishOptions | boolean
}
export interface AwaitWriteFinishOptions {
/**
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
*/
stabilityThreshold?: number
/**
* File size polling interval.
*/
pollInterval?: number
}
/**
* produces an instance of `FSWatcher`.
*/
import type { FSWatcher, WatchOptions } from '../dist/node'
export function watch(

@@ -227,0 +9,0 @@ paths: string | ReadonlyArray<string>,

@@ -1,230 +0,1 @@

/**
* https://github.com/rollup/plugins/blob/master/packages/commonjs/types/index.d.ts
*
* This source code is licensed under the MIT license found in the
* LICENSE file at
* https://github.com/rollup/plugins/blob/master/LICENSE
*/
export interface RollupCommonJSOptions {
/**
* A minimatch pattern, or array of patterns, which specifies the files in
* the build the plugin should operate on. By default, all files with
* extension `".cjs"` or those in `extensions` are included, but you can
* narrow this list by only including specific files. These files will be
* analyzed and transpiled if either the analysis does not find ES module
* specific statements or `transformMixedEsModules` is `true`.
* @default undefined
*/
include?: string | RegExp | readonly (string | RegExp)[]
/**
* A minimatch pattern, or array of patterns, which specifies the files in
* the build the plugin should _ignore_. By default, all files with
* extensions other than those in `extensions` or `".cjs"` are ignored, but you
* can exclude additional files. See also the `include` option.
* @default undefined
*/
exclude?: string | RegExp | readonly (string | RegExp)[]
/**
* For extensionless imports, search for extensions other than .js in the
* order specified. Note that you need to make sure that non-JavaScript files
* are transpiled by another plugin first.
* @default [ '.js' ]
*/
extensions?: ReadonlyArray<string>
/**
* If true then uses of `global` won't be dealt with by this plugin
* @default false
*/
ignoreGlobal?: boolean
/**
* If false, skips source map generation for CommonJS modules. This will
* improve performance.
* @default true
*/
sourceMap?: boolean
/**
* Some `require` calls cannot be resolved statically to be translated to
* imports.
* When this option is set to `false`, the generated code will either
* directly throw an error when such a call is encountered or, when
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
* configured dynamic require target.
* Setting this option to `true` will instead leave the `require` call in the
* code or use it as a fallback for `dynamicRequireTargets`.
* @default false
*/
ignoreDynamicRequires?: boolean
/**
* Instructs the plugin whether to enable mixed module transformations. This
* is useful in scenarios with modules that contain a mix of ES `import`
* statements and CommonJS `require` expressions. Set to `true` if `require`
* calls should be transformed to imports in mixed modules, or `false` if the
* `require` expressions should survive the transformation. The latter can be
* important if the code contains environment detection, or you are coding
* for an environment with special treatment for `require` calls such as
* ElectronJS. See also the `ignore` option.
* @default false
*/
transformMixedEsModules?: boolean
/**
* By default, this plugin will try to hoist `require` statements as imports
* to the top of each file. While this works well for many code bases and
* allows for very efficient ESM output, it does not perfectly capture
* CommonJS semantics as the order of side effects like log statements may
* change. But it is especially problematic when there are circular `require`
* calls between CommonJS modules as those often rely on the lazy execution of
* nested `require` calls.
*
* Setting this option to `true` will wrap all CommonJS files in functions
* which are executed when they are required for the first time, preserving
* NodeJS semantics. Note that this can have an impact on the size and
* performance of the generated code.
*
* The default value of `"auto"` will only wrap CommonJS files when they are
* part of a CommonJS dependency cycle, e.g. an index file that is required by
* many of its dependencies. All other CommonJS files are hoisted. This is the
* recommended setting for most code bases.
*
* `false` will entirely prevent wrapping and hoist all files. This may still
* work depending on the nature of cyclic dependencies but will often cause
* problems.
*
* You can also provide a minimatch pattern, or array of patterns, to only
* specify a subset of files which should be wrapped in functions for proper
* `require` semantics.
*
* `"debug"` works like `"auto"` but after bundling, it will display a warning
* containing a list of ids that have been wrapped which can be used as
* minimatch pattern for fine-tuning.
* @default "auto"
*/
strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[]
/**
* Sometimes you have to leave require statements unconverted. Pass an array
* containing the IDs or a `id => boolean` function.
* @default []
*/
ignore?: ReadonlyArray<string> | ((id: string) => boolean)
/**
* In most cases, where `require` calls are inside a `try-catch` clause,
* they should be left unconverted as it requires an optional dependency
* that may or may not be installed beside the rolled up package.
* Due to the conversion of `require` to a static `import` - the call is
* hoisted to the top of the file, outside of the `try-catch` clause.
*
* - `true`: All `require` calls inside a `try` will be left unconverted.
* - `false`: All `require` calls inside a `try` will be converted as if the
* `try-catch` clause is not there.
* - `remove`: Remove all `require` calls from inside any `try` block.
* - `string[]`: Pass an array containing the IDs to left unconverted.
* - `((id: string) => boolean|'remove')`: Pass a function that control
* individual IDs.
*
* @default false
*/
ignoreTryCatch?:
| boolean
| 'remove'
| ReadonlyArray<string>
| ((id: string) => boolean | 'remove')
/**
* Controls how to render imports from external dependencies. By default,
* this plugin assumes that all external dependencies are CommonJS. This
* means they are rendered as default imports to be compatible with e.g.
* NodeJS where ES modules can only import a default export from a CommonJS
* dependency.
*
* If you set `esmExternals` to `true`, this plugins assumes that all
* external dependencies are ES modules and respect the
* `requireReturnsDefault` option. If that option is not set, they will be
* rendered as namespace imports.
*
* You can also supply an array of ids to be treated as ES modules, or a
* function that will be passed each external id to determine if it is an ES
* module.
* @default false
*/
esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean)
/**
* Controls what is returned when requiring an ES module from a CommonJS file.
* When using the `esmExternals` option, this will also apply to external
* modules. By default, this plugin will render those imports as namespace
* imports i.e.
*
* ```js
* // input
* const foo = require('foo');
*
* // output
* import * as foo from 'foo';
* ```
*
* However there are some situations where this may not be desired.
* For these situations, you can change Rollup's behaviour either globally or
* per module. To change it globally, set the `requireReturnsDefault` option
* to one of the following values:
*
* - `false`: This is the default, requiring an ES module returns its
* namespace. This is the only option that will also add a marker
* `__esModule: true` to the namespace to support interop patterns in
* CommonJS modules that are transpiled ES modules.
* - `"namespace"`: Like `false`, requiring an ES module returns its
* namespace, but the plugin does not add the `__esModule` marker and thus
* creates more efficient code. For external dependencies when using
* `esmExternals: true`, no additional interop code is generated.
* - `"auto"`: This is complementary to how `output.exports: "auto"` works in
* Rollup: If a module has a default export and no named exports, requiring
* that module returns the default export. In all other cases, the namespace
* is returned. For external dependencies when using `esmExternals: true`, a
* corresponding interop helper is added.
* - `"preferred"`: If a module has a default export, requiring that module
* always returns the default export, no matter whether additional named
* exports exist. This is similar to how previous versions of this plugin
* worked. Again for external dependencies when using `esmExternals: true`,
* an interop helper is added.
* - `true`: This will always try to return the default export on require
* without checking if it actually exists. This can throw at build time if
* there is no default export. This is how external dependencies are handled
* when `esmExternals` is not used. The advantage over the other options is
* that, like `false`, this does not add an interop helper for external
* dependencies, keeping the code lean.
*
* To change this for individual modules, you can supply a function for
* `requireReturnsDefault` instead. This function will then be called once for
* each required ES module or external dependency with the corresponding id
* and allows you to return different values for different modules.
* @default false
*/
requireReturnsDefault?:
| boolean
| 'auto'
| 'preferred'
| 'namespace'
| ((id: string) => boolean | 'auto' | 'preferred' | 'namespace')
/**
* @default "auto"
*/
defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto')
/**
* Some modules contain dynamic `require` calls, or require modules that
* contain circular dependencies, which are not handled well by static
* imports. Including those modules as `dynamicRequireTargets` will simulate a
* CommonJS (NodeJS-like) environment for them with support for dynamic
* dependencies. It also enables `strictRequires` for those modules.
*
* Note: In extreme cases, this feature may result in some paths being
* rendered as absolute in the final bundle. The plugin tries to avoid
* exposing paths from the local machine, but if you are `dynamicRequirePaths`
* with paths that are far away from your project's folder, that may require
* replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
*/
dynamicRequireTargets?: string | ReadonlyArray<string>
/**
* To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
* that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
* may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
* home directory name. By default it uses the current working directory.
*/
dynamicRequireRoot?: string
}
export type { RollupCommonJSOptions } from '../dist/node'

@@ -1,111 +0,1 @@

// Inlined to avoid extra dependency
// MIT Licensed https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE
// Type definitions for connect v3.4.0
// Project: https://github.com/senchalabs/connect
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
// Evan Hahn <https://github.com/EvanHahn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as http from 'node:http'
export namespace Connect {
export type ServerHandle = HandleFunction | http.Server
export class IncomingMessage extends http.IncomingMessage {
originalUrl?: http.IncomingMessage['url'] | undefined
}
export type NextFunction = (err?: any) => void
export type SimpleHandleFunction = (
req: IncomingMessage,
res: http.ServerResponse
) => void
export type NextHandleFunction = (
req: IncomingMessage,
res: http.ServerResponse,
next: NextFunction
) => void
export type ErrorHandleFunction = (
err: any,
req: IncomingMessage,
res: http.ServerResponse,
next: NextFunction
) => void
export type HandleFunction =
| SimpleHandleFunction
| NextHandleFunction
| ErrorHandleFunction
export interface ServerStackItem {
route: string
handle: ServerHandle
}
export interface Server extends NodeJS.EventEmitter {
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void
route: string
stack: ServerStackItem[]
/**
* Utilize the given middleware `handle` to the given `route`,
* defaulting to _/_. This "route" is the mount-point for the
* middleware, when given a value other than _/_ the middleware
* is only effective when that segment is present in the request's
* pathname.
*
* For example if we were to mount a function at _/admin_, it would
* be invoked on _/admin_, and _/admin/settings_, however it would
* not be invoked for _/_, or _/posts_.
*/
use(fn: NextHandleFunction): Server
use(fn: HandleFunction): Server
use(route: string, fn: NextHandleFunction): Server
use(route: string, fn: HandleFunction): Server
/**
* Handle server requests, punting them down
* the middleware stack.
*/
handle(
req: http.IncomingMessage,
res: http.ServerResponse,
next: Function
): void
/**
* Listen for connections.
*
* This method takes the same arguments
* as node's `http.Server#listen()`.
*
* HTTP and HTTPS:
*
* If you run your application both as HTTP
* and HTTPS you may wrap them individually,
* since your Connect "server" is really just
* a JavaScript `Function`.
*
* var connect = require('connect')
* , http = require('http')
* , https = require('https');
*
* var app = connect();
*
* http.createServer(app).listen(80);
* https.createServer(options, app).listen(443);
*/
listen(
port: number,
hostname?: string,
backlog?: number,
callback?: Function
): http.Server
listen(port: number, hostname?: string, callback?: Function): http.Server
listen(path: string, callback?: Function): http.Server
listen(handle: any, listeningListener?: Function): http.Server
}
}
export type { Connect } from '../dist/node'

@@ -10,8 +10,14 @@ import type {

'vite:beforeUpdate': UpdatePayload
'vite:afterUpdate': UpdatePayload
'vite:beforePrune': PrunePayload
'vite:beforeFullReload': FullReloadPayload
'vite:error': ErrorPayload
'vite:invalidate': InvalidatePayload
}
export interface InvalidatePayload {
path: string
}
export type InferCustomEventPayload<T extends string> =
T extends keyof CustomEventMap ? CustomEventMap[T] : any

@@ -1,17 +0,1 @@

export interface RollupDynamicImportVarsOptions {
/**
* Files to include in this plugin (default all).
* @default []
*/
include?: string | RegExp | (string | RegExp)[]
/**
* Files to exclude in this plugin (default none).
* @default []
*/
exclude?: string | RegExp | (string | RegExp)[]
/**
* By default, the plugin quits the build process when it encounters an error. If you set this option to true, it will throw a warning instead and leave the code untouched.
* @default false
*/
warnOnError?: boolean
}
export type { RollupDynamicImportVarsOptions } from '../dist/node'

@@ -23,2 +23,6 @@ export type HMRPayload =

timestamp: number
/**
* @experimental internal
*/
explicitImportRequired?: boolean | undefined
}

@@ -25,0 +29,0 @@

@@ -1,250 +0,1 @@

// Inlined to avoid extra dependency
// MIT Licensed https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE
// Type definitions for node-http-proxy 1.17
// Project: https://github.com/nodejitsu/node-http-proxy
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
// Florian Oellerich <https://github.com/Raigen>
// Daniel Schmidt <https://github.com/DanielMSchmidt>
// Jordan Abreu <https://github.com/jabreu610>
// Samuel Bodin <https://github.com/bodinsamuel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import type * as net from 'node:net'
import type * as http from 'node:http'
import * as events from 'node:events'
import type * as url from 'node:url'
import type * as stream from 'node:stream'
export namespace HttpProxy {
export type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed
export type ProxyTargetUrl = string | Partial<url.Url>
export interface ProxyTargetDetailed {
host: string
port: number
protocol?: string | undefined
hostname?: string | undefined
socketPath?: string | undefined
key?: string | undefined
passphrase?: string | undefined
pfx?: Buffer | string | undefined
cert?: string | undefined
ca?: string | undefined
ciphers?: string | undefined
secureProtocol?: string | undefined
}
export type ErrorCallback = (
err: Error,
req: http.IncomingMessage,
res: http.ServerResponse,
target?: ProxyTargetUrl
) => void
export class Server extends events.EventEmitter {
/**
* Creates the proxy server with specified options.
* @param options - Config object passed to the proxy
*/
constructor(options?: ServerOptions)
/**
* Used for proxying regular HTTP(S) requests
* @param req - Client request.
* @param res - Client response.
* @param options - Additional options.
*/
web(
req: http.IncomingMessage,
res: http.ServerResponse,
options?: ServerOptions,
callback?: ErrorCallback
): void
/**
* Used for proxying regular HTTP(S) requests
* @param req - Client request.
* @param socket - Client socket.
* @param head - Client head.
* @param options - Additional options.
*/
ws(
req: http.IncomingMessage,
socket: unknown,
head: unknown,
options?: ServerOptions,
callback?: ErrorCallback
): void
/**
* A function that wraps the object in a webserver, for your convenience
* @param port - Port to listen on
*/
listen(port: number): Server
/**
* A function that closes the inner webserver and stops listening on given port
*/
close(callback?: () => void): void
/**
* Creates the proxy server with specified options.
* @param options - Config object passed to the proxy
* @returns Proxy object with handlers for `ws` and `web` requests
*/
static createProxyServer(options?: ServerOptions): Server
/**
* Creates the proxy server with specified options.
* @param options - Config object passed to the proxy
* @returns Proxy object with handlers for `ws` and `web` requests
*/
static createServer(options?: ServerOptions): Server
/**
* Creates the proxy server with specified options.
* @param options - Config object passed to the proxy
* @returns Proxy object with handlers for `ws` and `web` requests
*/
static createProxy(options?: ServerOptions): Server
addListener(event: string, listener: () => void): this
on(event: string, listener: () => void): this
on(event: 'error', listener: ErrorCallback): this
on(
event: 'start',
listener: (
req: http.IncomingMessage,
res: http.ServerResponse,
target: ProxyTargetUrl
) => void
): this
on(
event: 'proxyReq',
listener: (
proxyReq: http.ClientRequest,
req: http.IncomingMessage,
res: http.ServerResponse,
options: ServerOptions
) => void
): this
on(
event: 'proxyRes',
listener: (
proxyRes: http.IncomingMessage,
req: http.IncomingMessage,
res: http.ServerResponse
) => void
): this
on(
event: 'proxyReqWs',
listener: (
proxyReq: http.ClientRequest,
req: http.IncomingMessage,
socket: net.Socket,
options: ServerOptions,
head: any
) => void
): this
on(
event: 'econnreset',
listener: (
err: Error,
req: http.IncomingMessage,
res: http.ServerResponse,
target: ProxyTargetUrl
) => void
): this
on(
event: 'end',
listener: (
req: http.IncomingMessage,
res: http.ServerResponse,
proxyRes: http.IncomingMessage
) => void
): this
on(
event: 'close',
listener: (
proxyRes: http.IncomingMessage,
proxySocket: net.Socket,
proxyHead: any
) => void
): this
once(event: string, listener: () => void): this
removeListener(event: string, listener: () => void): this
removeAllListeners(event?: string): this
getMaxListeners(): number
setMaxListeners(n: number): this
listeners(event: string): Array<() => void>
emit(event: string, ...args: any[]): boolean
listenerCount(type: string): number
}
export interface ServerOptions {
/** URL string to be parsed with the url module. */
target?: ProxyTarget | undefined
/** URL string to be parsed with the url module. */
forward?: ProxyTargetUrl | undefined
/** Object to be passed to http(s).request. */
agent?: any
/** Object to be passed to https.createServer(). */
ssl?: any
/** If you want to proxy websockets. */
ws?: boolean | undefined
/** Adds x- forward headers. */
xfwd?: boolean | undefined
/** Verify SSL certificate. */
secure?: boolean | undefined
/** Explicitly specify if we are proxying to another proxy. */
toProxy?: boolean | undefined
/** Specify whether you want to prepend the target's path to the proxy path. */
prependPath?: boolean | undefined
/** Specify whether you want to ignore the proxy path of the incoming request. */
ignorePath?: boolean | undefined
/** Local interface string to bind for outgoing connections. */
localAddress?: string | undefined
/** Changes the origin of the host header to the target URL. */
changeOrigin?: boolean | undefined
/** specify whether you want to keep letter case of response header key */
preserveHeaderKeyCase?: boolean | undefined
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
auth?: string | undefined
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
hostRewrite?: string | undefined
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
autoRewrite?: boolean | undefined
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
protocolRewrite?: string | undefined
/** rewrites domain of set-cookie headers. */
cookieDomainRewrite?:
| false
| string
| { [oldDomain: string]: string }
| undefined
/** rewrites path of set-cookie headers. Default: false */
cookiePathRewrite?:
| false
| string
| { [oldPath: string]: string }
| undefined
/** object with extra headers to be added to target requests. */
headers?: { [header: string]: string } | undefined
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
proxyTimeout?: number | undefined
/** Timeout (in milliseconds) for incoming requests */
timeout?: number | undefined
/** Specify whether you want to follow redirects. Default: false */
followRedirects?: boolean | undefined
/** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
selfHandleResponse?: boolean | undefined
/** Buffer */
buffer?: stream.Stream | undefined
}
}
export type { HttpProxy } from '../dist/node'

@@ -7,7 +7,9 @@ // This file is an augmentation to the built-in ImportMeta interface

// Duplicate of import('../src/node/importGlob').GlobOptions in order to
// avoid breaking the production client type. Because this file is referenced
// in vite/client.d.ts and in production src/node/importGlob.ts doesn't exist.
interface GlobOptions {
as?: string
interface ImportMetaEnv {
[key: string]: any
BASE_URL: string
MODE: string
DEV: boolean
PROD: boolean
SSR: boolean
}

@@ -28,10 +30,1 @@

}
interface ImportMetaEnv {
[key: string]: any
BASE_URL: string
MODE: string
DEV: boolean
PROD: boolean
SSR: boolean
}
{
"//": "this file is just here to make pnpm happy with --frozen-lockfile"
"//": "this file is here to make typescript happy when moduleResolution=node16+"
}

@@ -1,250 +0,1 @@

// Modified and inlined to avoid extra dependency
// Source: https://github.com/terser/terser/blob/master/tools/terser.d.ts
// BSD Licensed https://github.com/terser/terser/blob/master/LICENSE
/*
Terser is released under the BSD license:
Copyright 2012-2018 (c) Mihai Bazon <mihai.bazon@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
export namespace Terser {
export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
export interface ParseOptions {
bare_returns?: boolean
/** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
ecma?: ECMA
html5_comments?: boolean
shebang?: boolean
}
export interface CompressOptions {
arguments?: boolean
arrows?: boolean
booleans_as_integers?: boolean
booleans?: boolean
collapse_vars?: boolean
comparisons?: boolean
computed_props?: boolean
conditionals?: boolean
dead_code?: boolean
defaults?: boolean
directives?: boolean
drop_console?: boolean
drop_debugger?: boolean
ecma?: ECMA
evaluate?: boolean
expression?: boolean
global_defs?: object
hoist_funs?: boolean
hoist_props?: boolean
hoist_vars?: boolean
ie8?: boolean
if_return?: boolean
inline?: boolean | InlineFunctions
join_vars?: boolean
keep_classnames?: boolean | RegExp
keep_fargs?: boolean
keep_fnames?: boolean | RegExp
keep_infinity?: boolean
loops?: boolean
module?: boolean
negate_iife?: boolean
passes?: number
properties?: boolean
pure_funcs?: string[]
pure_getters?: boolean | 'strict'
reduce_funcs?: boolean
reduce_vars?: boolean
sequences?: boolean | number
side_effects?: boolean
switches?: boolean
toplevel?: boolean
top_retain?: null | string | string[] | RegExp
typeofs?: boolean
unsafe_arrows?: boolean
unsafe?: boolean
unsafe_comps?: boolean
unsafe_Function?: boolean
unsafe_math?: boolean
unsafe_symbols?: boolean
unsafe_methods?: boolean
unsafe_proto?: boolean
unsafe_regexp?: boolean
unsafe_undefined?: boolean
unused?: boolean
}
export enum InlineFunctions {
Disabled = 0,
SimpleFunctions = 1,
WithArguments = 2,
WithArgumentsAndVariables = 3
}
export interface MangleOptions {
eval?: boolean
keep_classnames?: boolean | RegExp
keep_fnames?: boolean | RegExp
module?: boolean
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
properties?: boolean | ManglePropertiesOptions
reserved?: string[]
safari10?: boolean
toplevel?: boolean
}
/**
* An identifier mangler for which the output is invariant with respect to the source code.
*/
export interface SimpleIdentifierMangler {
/**
* Obtains the nth most favored (usually shortest) identifier to rename a variable to.
* The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
* This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
* @param n - The ordinal of the identifier.
*/
get(n: number): string
}
/**
* An identifier mangler that leverages character frequency analysis to determine identifier precedence.
*/
export interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
/**
* Modifies the internal weighting of the input characters by the specified delta.
* Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
* @param chars - The characters to modify the weighting of.
* @param delta - The numeric weight to add to the characters.
*/
consider(chars: string, delta: number): number
/**
* Resets character weights.
*/
reset(): void
/**
* Sorts identifiers by character frequency, in preparation for calls to get(n).
*/
sort(): void
}
export interface ManglePropertiesOptions {
builtins?: boolean
debug?: boolean
keep_quoted?: boolean | 'strict'
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
regex?: RegExp | string
reserved?: string[]
}
export interface FormatOptions {
ascii_only?: boolean
/** @deprecated Not implemented anymore */
beautify?: boolean
braces?: boolean
comments?:
| boolean
| 'all'
| 'some'
| RegExp
| ((
node: any,
comment: {
value: string
type: 'comment1' | 'comment2' | 'comment3' | 'comment4'
pos: number
line: number
col: number
}
) => boolean)
ecma?: ECMA
ie8?: boolean
keep_numbers?: boolean
indent_level?: number
indent_start?: number
inline_script?: boolean
keep_quoted_props?: boolean
max_line_len?: number | false
preamble?: string
preserve_annotations?: boolean
quote_keys?: boolean
quote_style?: OutputQuoteStyle
safari10?: boolean
semicolons?: boolean
shebang?: boolean
shorthand?: boolean
source_map?: SourceMapOptions
webkit?: boolean
width?: number
wrap_iife?: boolean
wrap_func_args?: boolean
}
export enum OutputQuoteStyle {
PreferDouble = 0,
AlwaysSingle = 1,
AlwaysDouble = 2,
AlwaysOriginal = 3
}
export interface MinifyOptions {
compress?: boolean | CompressOptions
ecma?: ECMA
enclose?: boolean | string
ie8?: boolean
keep_classnames?: boolean | RegExp
keep_fnames?: boolean | RegExp
mangle?: boolean | MangleOptions
module?: boolean
nameCache?: object
format?: FormatOptions
/** @deprecated deprecated */
output?: FormatOptions
parse?: ParseOptions
safari10?: boolean
sourceMap?: boolean | SourceMapOptions
toplevel?: boolean
}
export interface MinifyOutput {
code?: string
map?: object | string
decoded_map?: object | null
}
export interface SourceMapOptions {
/** Source map object, 'inline' or source map file content */
content?: object | string
includeSources?: boolean
filename?: string
root?: string
url?: string | 'inline'
}
}
export type { Terser } from '../dist/node'

@@ -1,553 +0,1 @@

// Modified and inlined to avoid extra dependency
// Source: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ws/index.d.ts
// Type definitions for ws 8.5
// Project: https://github.com/websockets/ws
// Definitions by: Paul Loyd <https://github.com/loyd>
// Margus Lamp <https://github.com/mlamp>
// Philippe D'Alva <https://github.com/TitaneBoy>
// reduckted <https://github.com/reduckted>
// teidesu <https://github.com/teidesu>
// Bartosz Wojtkowiak <https://github.com/wojtkowiak>
// Kyle Hensel <https://github.com/k-yle>
// Samuel Skeen <https://github.com/cwadrupldijjit>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'node:events'
import type {
Agent,
ClientRequest,
ClientRequestArgs,
Server as HTTPServer,
IncomingMessage,
OutgoingHttpHeaders
} from 'node:http'
import type { Server as HTTPSServer } from 'node:https'
import type { Duplex, DuplexOptions } from 'node:stream'
import type { SecureContextOptions } from 'node:tls'
import type { URL } from 'node:url'
import type { ZlibOptions } from 'node:zlib'
// WebSocket socket.
declare class WebSocket extends EventEmitter {
/** The connection is not yet open. */
static readonly CONNECTING: 0
/** The connection is open and ready to communicate. */
static readonly OPEN: 1
/** The connection is in the process of closing. */
static readonly CLOSING: 2
/** The connection is closed. */
static readonly CLOSED: 3
binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
readonly bufferedAmount: number
readonly extensions: string
/** Indicates whether the websocket is paused */
readonly isPaused: boolean
readonly protocol: string
/** The current state of the connection */
readonly readyState:
| typeof WebSocket.CONNECTING
| typeof WebSocket.OPEN
| typeof WebSocket.CLOSING
| typeof WebSocket.CLOSED
readonly url: string
/** The connection is not yet open. */
readonly CONNECTING: 0
/** The connection is open and ready to communicate. */
readonly OPEN: 1
/** The connection is in the process of closing. */
readonly CLOSING: 2
/** The connection is closed. */
readonly CLOSED: 3
onopen: ((event: WebSocket.Event) => void) | null
onerror: ((event: WebSocket.ErrorEvent) => void) | null
onclose: ((event: WebSocket.CloseEvent) => void) | null
onmessage: ((event: WebSocket.MessageEvent) => void) | null
constructor(address: null)
constructor(
address: string | URL,
options?: WebSocket.ClientOptions | ClientRequestArgs
)
constructor(
address: string | URL,
protocols?: string | string[],
options?: WebSocket.ClientOptions | ClientRequestArgs
)
close(code?: number, data?: string | Buffer): void
ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void
pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void
send(data: any, cb?: (err?: Error) => void): void
send(
data: any,
options: {
mask?: boolean | undefined
binary?: boolean | undefined
compress?: boolean | undefined
fin?: boolean | undefined
},
cb?: (err?: Error) => void
): void
terminate(): void
/**
* Pause the websocket causing it to stop emitting events. Some events can still be
* emitted after this is called, until all buffered data is consumed. This method
* is a noop if the ready state is `CONNECTING` or `CLOSED`.
*/
pause(): void
/**
* Make a paused socket resume emitting events. This method is a noop if the ready
* state is `CONNECTING` or `CLOSED`.
*/
resume(): void
// HTML5 WebSocket events
addEventListener(
method: 'message',
cb: (event: WebSocket.MessageEvent) => void,
options?: WebSocket.EventListenerOptions
): void
addEventListener(
method: 'close',
cb: (event: WebSocket.CloseEvent) => void,
options?: WebSocket.EventListenerOptions
): void
addEventListener(
method: 'error',
cb: (event: WebSocket.ErrorEvent) => void,
options?: WebSocket.EventListenerOptions
): void
addEventListener(
method: 'open',
cb: (event: WebSocket.Event) => void,
options?: WebSocket.EventListenerOptions
): void
removeEventListener(
method: 'message',
cb: (event: WebSocket.MessageEvent) => void
): void
removeEventListener(
method: 'close',
cb: (event: WebSocket.CloseEvent) => void
): void
removeEventListener(
method: 'error',
cb: (event: WebSocket.ErrorEvent) => void
): void
removeEventListener(
method: 'open',
cb: (event: WebSocket.Event) => void
): void
// Events
on(
event: 'close',
listener: (this: WebSocket, code: number, reason: Buffer) => void
): this
on(event: 'error', listener: (this: WebSocket, err: Error) => void): this
on(
event: 'upgrade',
listener: (this: WebSocket, request: IncomingMessage) => void
): this
on(
event: 'message',
listener: (
this: WebSocket,
data: WebSocket.RawData,
isBinary: boolean
) => void
): this
on(event: 'open', listener: (this: WebSocket) => void): this
on(
event: 'ping' | 'pong',
listener: (this: WebSocket, data: Buffer) => void
): this
on(
event: 'unexpected-response',
listener: (
this: WebSocket,
request: ClientRequest,
response: IncomingMessage
) => void
): this
on(
event: string | symbol,
listener: (this: WebSocket, ...args: any[]) => void
): this
once(
event: 'close',
listener: (this: WebSocket, code: number, reason: Buffer) => void
): this
once(event: 'error', listener: (this: WebSocket, err: Error) => void): this
once(
event: 'upgrade',
listener: (this: WebSocket, request: IncomingMessage) => void
): this
once(
event: 'message',
listener: (
this: WebSocket,
data: WebSocket.RawData,
isBinary: boolean
) => void
): this
once(event: 'open', listener: (this: WebSocket) => void): this
once(
event: 'ping' | 'pong',
listener: (this: WebSocket, data: Buffer) => void
): this
once(
event: 'unexpected-response',
listener: (
this: WebSocket,
request: ClientRequest,
response: IncomingMessage
) => void
): this
once(
event: string | symbol,
listener: (this: WebSocket, ...args: any[]) => void
): this
off(
event: 'close',
listener: (this: WebSocket, code: number, reason: Buffer) => void
): this
off(event: 'error', listener: (this: WebSocket, err: Error) => void): this
off(
event: 'upgrade',
listener: (this: WebSocket, request: IncomingMessage) => void
): this
off(
event: 'message',
listener: (
this: WebSocket,
data: WebSocket.RawData,
isBinary: boolean
) => void
): this
off(event: 'open', listener: (this: WebSocket) => void): this
off(
event: 'ping' | 'pong',
listener: (this: WebSocket, data: Buffer) => void
): this
off(
event: 'unexpected-response',
listener: (
this: WebSocket,
request: ClientRequest,
response: IncomingMessage
) => void
): this
off(
event: string | symbol,
listener: (this: WebSocket, ...args: any[]) => void
): this
addListener(
event: 'close',
listener: (code: number, reason: Buffer) => void
): this
addListener(event: 'error', listener: (err: Error) => void): this
addListener(
event: 'upgrade',
listener: (request: IncomingMessage) => void
): this
addListener(
event: 'message',
listener: (data: WebSocket.RawData, isBinary: boolean) => void
): this
addListener(event: 'open', listener: () => void): this
addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
addListener(
event: 'unexpected-response',
listener: (request: ClientRequest, response: IncomingMessage) => void
): this
addListener(event: string | symbol, listener: (...args: any[]) => void): this
removeListener(
event: 'close',
listener: (code: number, reason: Buffer) => void
): this
removeListener(event: 'error', listener: (err: Error) => void): this
removeListener(
event: 'upgrade',
listener: (request: IncomingMessage) => void
): this
removeListener(
event: 'message',
listener: (data: WebSocket.RawData, isBinary: boolean) => void
): this
removeListener(event: 'open', listener: () => void): this
removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
removeListener(
event: 'unexpected-response',
listener: (request: ClientRequest, response: IncomingMessage) => void
): this
removeListener(
event: string | symbol,
listener: (...args: any[]) => void
): this
}
declare const WebSocketAlias: typeof WebSocket
interface WebSocketAlias extends WebSocket {} // tslint:disable-line no-empty-interface
declare namespace WebSocket {
/**
* Data represents the raw message payload received over the WebSocket.
*/
type RawData = Buffer | ArrayBuffer | Buffer[]
/**
* Data represents the message payload received over the WebSocket.
*/
type Data = string | Buffer | ArrayBuffer | Buffer[]
/**
* CertMeta represents the accepted types for certificate & key data.
*/
type CertMeta = string | string[] | Buffer | Buffer[]
/**
* VerifyClientCallbackSync is a synchronous callback used to inspect the
* incoming message. The return value (boolean) of the function determines
* whether or not to accept the handshake.
*/
type VerifyClientCallbackSync = (info: {
origin: string
secure: boolean
req: IncomingMessage
}) => boolean
/**
* VerifyClientCallbackAsync is an asynchronous callback used to inspect the
* incoming message. The return value (boolean) of the function determines
* whether or not to accept the handshake.
*/
type VerifyClientCallbackAsync = (
info: { origin: string; secure: boolean; req: IncomingMessage },
callback: (
res: boolean,
code?: number,
message?: string,
headers?: OutgoingHttpHeaders
) => void
) => void
interface ClientOptions extends SecureContextOptions {
protocol?: string | undefined
followRedirects?: boolean | undefined
generateMask?(mask: Buffer): void
handshakeTimeout?: number | undefined
maxRedirects?: number | undefined
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
localAddress?: string | undefined
protocolVersion?: number | undefined
headers?: { [key: string]: string } | undefined
origin?: string | undefined
agent?: Agent | undefined
host?: string | undefined
family?: number | undefined
checkServerIdentity?(servername: string, cert: CertMeta): boolean
rejectUnauthorized?: boolean | undefined
maxPayload?: number | undefined
skipUTF8Validation?: boolean | undefined
}
interface PerMessageDeflateOptions {
serverNoContextTakeover?: boolean | undefined
clientNoContextTakeover?: boolean | undefined
serverMaxWindowBits?: number | undefined
clientMaxWindowBits?: number | undefined
zlibDeflateOptions?:
| {
flush?: number | undefined
finishFlush?: number | undefined
chunkSize?: number | undefined
windowBits?: number | undefined
level?: number | undefined
memLevel?: number | undefined
strategy?: number | undefined
dictionary?: Buffer | Buffer[] | DataView | undefined
info?: boolean | undefined
}
| undefined
zlibInflateOptions?: ZlibOptions | undefined
threshold?: number | undefined
concurrencyLimit?: number | undefined
}
interface Event {
type: string
target: WebSocket
}
interface ErrorEvent {
error: any
message: string
type: string
target: WebSocket
}
interface CloseEvent {
wasClean: boolean
code: number
reason: string
type: string
target: WebSocket
}
interface MessageEvent {
data: Data
type: string
target: WebSocket
}
interface EventListenerOptions {
once?: boolean | undefined
}
interface ServerOptions {
host?: string | undefined
port?: number | undefined
backlog?: number | undefined
server?: HTTPServer | HTTPSServer | undefined
verifyClient?:
| VerifyClientCallbackAsync
| VerifyClientCallbackSync
| undefined
handleProtocols?: (
protocols: Set<string>,
request: IncomingMessage
) => string | false
path?: string | undefined
noServer?: boolean | undefined
clientTracking?: boolean | undefined
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
maxPayload?: number | undefined
skipUTF8Validation?: boolean | undefined
WebSocket?: typeof WebSocket.WebSocket | undefined
}
interface AddressInfo {
address: string
family: string
port: number
}
// WebSocket Server
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
options: ServerOptions
path: string
clients: Set<T>
constructor(options?: ServerOptions, callback?: () => void)
address(): AddressInfo | string
close(cb?: (err?: Error) => void): void
handleUpgrade(
request: IncomingMessage,
socket: Duplex,
upgradeHead: Buffer,
callback: (client: T, request: IncomingMessage) => void
): void
shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
// Events
on(
event: 'connection',
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
): this
on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
on(
event: 'headers',
cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
): this
on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
on(
event: string | symbol,
listener: (this: Server<T>, ...args: any[]) => void
): this
once(
event: 'connection',
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
): this
once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
once(
event: 'headers',
cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
): this
once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
once(
event: string | symbol,
listener: (this: Server<T>, ...args: any[]) => void
): this
off(
event: 'connection',
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
): this
off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
off(
event: 'headers',
cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
): this
off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
off(
event: string | symbol,
listener: (this: Server<T>, ...args: any[]) => void
): this
addListener(
event: 'connection',
cb: (client: T, request: IncomingMessage) => void
): this
addListener(event: 'error', cb: (err: Error) => void): this
addListener(
event: 'headers',
cb: (headers: string[], request: IncomingMessage) => void
): this
addListener(event: 'close' | 'listening', cb: () => void): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void
): this
removeListener(event: 'connection', cb: (client: T) => void): this
removeListener(event: 'error', cb: (err: Error) => void): this
removeListener(
event: 'headers',
cb: (headers: string[], request: IncomingMessage) => void
): this
removeListener(event: 'close' | 'listening', cb: () => void): this
removeListener(
event: string | symbol,
listener: (...args: any[]) => void
): this
}
const WebSocketServer: typeof Server
interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
const WebSocket: typeof WebSocketAlias
interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
// WebSocket stream
function createWebSocketStream(
websocket: WebSocket,
options?: DuplexOptions
): Duplex
}
// export = WebSocket
export { WebSocket, WebSocketAlias }
export type { WebSocket, WebSocketAlias } from '../dist/node'

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display