Comparing version 3.2.7 to 5.0.2
@@ -16,3 +16,3 @@ #!/usr/bin/env node | ||
const filterIndex = process.argv.findIndex((arg) => | ||
/^(?:-f|--filter)$/.test(arg) | ||
/^(?:-f|--filter)$/.test(arg), | ||
) | ||
@@ -19,0 +19,0 @@ const profileIndex = process.argv.indexOf('--profile') |
@@ -40,34 +40,10 @@ /// <reference path="./types/importMeta.d.ts" /> | ||
// CSS | ||
declare module '*.css' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.scss' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.sass' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.less' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.styl' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.stylus' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.pcss' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.sss' { | ||
const css: string | ||
export default css | ||
} | ||
declare module '*.css' {} | ||
declare module '*.scss' {} | ||
declare module '*.sass' {} | ||
declare module '*.less' {} | ||
declare module '*.styl' {} | ||
declare module '*.stylus' {} | ||
declare module '*.pcss' {} | ||
declare module '*.sss' {} | ||
@@ -78,2 +54,6 @@ // Built-in asset types | ||
// images | ||
declare module '*.apng' { | ||
const src: string | ||
export default src | ||
} | ||
declare module '*.png' { | ||
@@ -154,2 +134,7 @@ const src: string | ||
declare module '*.opus' { | ||
const src: string | ||
export default src | ||
} | ||
// fonts | ||
@@ -194,3 +179,3 @@ declare module '*.woff' { | ||
const initWasm: ( | ||
options: WebAssembly.Imports | ||
options?: WebAssembly.Imports, | ||
) => Promise<WebAssembly.Instance> | ||
@@ -203,3 +188,3 @@ export default initWasm | ||
const workerConstructor: { | ||
new (): Worker | ||
new (options?: { name?: string }): Worker | ||
} | ||
@@ -211,3 +196,3 @@ export default workerConstructor | ||
const workerConstructor: { | ||
new (): Worker | ||
new (options?: { name?: string }): Worker | ||
} | ||
@@ -224,3 +209,3 @@ export default workerConstructor | ||
const sharedWorkerConstructor: { | ||
new (): SharedWorker | ||
new (options?: { name?: string }): SharedWorker | ||
} | ||
@@ -232,3 +217,3 @@ export default sharedWorkerConstructor | ||
const sharedWorkerConstructor: { | ||
new (): SharedWorker | ||
new (options?: { name?: string }): SharedWorker | ||
} | ||
@@ -235,0 +220,0 @@ export default sharedWorkerConstructor |
@@ -0,8 +1,10 @@ | ||
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
import { performance } from 'node:perf_hooks'; | ||
import { EventEmitter } from 'events'; | ||
import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-2faf2534.js'; | ||
import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-ErEj4WmL.js'; | ||
import { VERSION } from './constants.js'; | ||
import 'node:fs'; | ||
import 'node:path'; | ||
import 'node:fs/promises'; | ||
import 'node:url'; | ||
import 'node:util'; | ||
import 'node:module'; | ||
@@ -14,2 +16,4 @@ import 'tty'; | ||
import 'assert'; | ||
import 'node:http'; | ||
import 'node:https'; | ||
import 'util'; | ||
@@ -23,19 +27,22 @@ import 'net'; | ||
import 'node:os'; | ||
import 'node:child_process'; | ||
import 'node:crypto'; | ||
import 'node:util'; | ||
import 'node:dns'; | ||
import 'resolve'; | ||
import 'crypto'; | ||
import 'node:buffer'; | ||
import 'module'; | ||
import 'worker_threads'; | ||
import 'node:assert'; | ||
import 'node:process'; | ||
import 'node:v8'; | ||
import 'rollup'; | ||
import 'rollup/parseAst'; | ||
import 'querystring'; | ||
import 'node:readline'; | ||
import 'node:events'; | ||
import 'zlib'; | ||
import 'buffer'; | ||
import 'https'; | ||
import 'tls'; | ||
import 'node:http'; | ||
import 'node:https'; | ||
import 'querystring'; | ||
import 'node:readline'; | ||
import 'node:child_process'; | ||
import 'node:zlib'; | ||
import 'worker_threads'; | ||
@@ -656,2 +663,23 @@ function toArr(any) { | ||
const cli = cac('vite'); | ||
let profileSession = global.__vite_profile_session; | ||
let profileCount = 0; | ||
const stopProfiler = (log) => { | ||
if (!profileSession) | ||
return; | ||
return new Promise((res, rej) => { | ||
profileSession.post('Profiler.stop', (err, { profile }) => { | ||
// Write profile to disk, upload, etc. | ||
if (!err) { | ||
const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`); | ||
fs.writeFileSync(outPath, JSON.stringify(profile)); | ||
log(colors.yellow(`CPU profile written to ${colors.white(colors.dim(outPath))}`)); | ||
profileSession = undefined; | ||
res(); | ||
} | ||
else { | ||
rej(err); | ||
} | ||
}); | ||
}); | ||
}; | ||
const filterDuplicateOptions = (options) => { | ||
@@ -682,7 +710,37 @@ for (const [key, value] of Object.entries(options)) { | ||
delete ret.mode; | ||
// convert the sourcemap option to a boolean if necessary | ||
if ('sourcemap' in ret) { | ||
const sourcemap = ret.sourcemap; | ||
ret.sourcemap = | ||
sourcemap === 'true' | ||
? true | ||
: sourcemap === 'false' | ||
? false | ||
: ret.sourcemap; | ||
} | ||
return ret; | ||
} | ||
/** | ||
* host may be a number (like 0), should convert to string | ||
*/ | ||
const convertHost = (v) => { | ||
if (typeof v === 'number') { | ||
return String(v); | ||
} | ||
return v; | ||
}; | ||
/** | ||
* base may be a number (like 0), should convert to empty string | ||
*/ | ||
const convertBase = (v) => { | ||
if (v === 0) { | ||
return ''; | ||
} | ||
return v; | ||
}; | ||
cli | ||
.option('-c, --config <file>', `[string] use specified config file`) | ||
.option('--base <path>', `[string] public base path (default: /)`) | ||
.option('--base <path>', `[string] public base path (default: /)`, { | ||
type: [convertBase], | ||
}) | ||
.option('-l, --logLevel <level>', `[string] info | warn | error | silent`) | ||
@@ -698,5 +756,4 @@ .option('--clearScreen', `[boolean] allow/disable clear screen when logging`) | ||
.alias('dev') // alias to align with the script name | ||
.option('--host [host]', `[string] specify hostname`) | ||
.option('--host [host]', `[string] specify hostname`, { type: [convertHost] }) | ||
.option('--port <port>', `[number] specify port`) | ||
.option('--https', `[boolean] use TLS + HTTP/2`) | ||
.option('--open [path]', `[boolean | string] open browser on startup`) | ||
@@ -710,3 +767,3 @@ .option('--cors', `[boolean] enable CORS`) | ||
// is ok here | ||
const { createServer } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.D; }); | ||
const { createServer } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.A; }); | ||
try { | ||
@@ -721,3 +778,3 @@ const server = await createServer({ | ||
optimizeDeps: { force: options.force }, | ||
server: cleanOptions(options) | ||
server: cleanOptions(options), | ||
}); | ||
@@ -729,12 +786,44 @@ if (!server.httpServer) { | ||
const info = server.config.logger.info; | ||
// @ts-ignore | ||
const viteStartTime = global.__vite_start_time ?? false; | ||
const startupDurationString = viteStartTime | ||
? picocolors.exports.dim(`ready in ${picocolors.exports.reset(picocolors.exports.bold(Math.ceil(performance.now() - viteStartTime)))} ms`) | ||
? colors.dim(`ready in ${colors.reset(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`) | ||
: ''; | ||
info(`\n ${picocolors.exports.green(`${picocolors.exports.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned }); | ||
const hasExistingLogs = process.stdout.bytesWritten > 0 || process.stderr.bytesWritten > 0; | ||
info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { | ||
clear: !hasExistingLogs, | ||
}); | ||
server.printUrls(); | ||
const customShortcuts = []; | ||
if (profileSession) { | ||
customShortcuts.push({ | ||
key: 'p', | ||
description: 'start/stop the profiler', | ||
async action(server) { | ||
if (profileSession) { | ||
await stopProfiler(server.config.logger.info); | ||
} | ||
else { | ||
const inspector = await import('node:inspector').then((r) => r.default); | ||
await new Promise((res) => { | ||
profileSession = new inspector.Session(); | ||
profileSession.connect(); | ||
profileSession.post('Profiler.enable', () => { | ||
profileSession.post('Profiler.start', () => { | ||
server.config.logger.info('Profiler started'); | ||
res(); | ||
}); | ||
}); | ||
}); | ||
} | ||
}, | ||
}); | ||
} | ||
server.bindCLIShortcuts({ print: true, customShortcuts }); | ||
} | ||
catch (e) { | ||
createLogger(options.logLevel).error(picocolors.exports.red(`error when starting dev server:\n${e.stack}`), { error: e }); | ||
const logger = createLogger(options.logLevel); | ||
logger.error(colors.red(`error when starting dev server:\n${e.stack}`), { | ||
error: e, | ||
}); | ||
stopProfiler(logger.info); | ||
process.exit(1); | ||
@@ -751,3 +840,3 @@ } | ||
.option('--ssr [entry]', `[string] build specified entry for server-side rendering`) | ||
.option('--sourcemap', `[boolean] output source maps for build (default: false)`) | ||
.option('--sourcemap [output]', `[boolean | "inline" | "hidden"] output source maps for build (default: false)`) | ||
.option('--minify [minifier]', `[boolean | "terser" | "esbuild"] enable/disable minification, ` + | ||
@@ -762,3 +851,3 @@ `or specify minifier to use (default: esbuild)`) | ||
filterDuplicateOptions(options); | ||
const { build } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.C; }); | ||
const { build } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.C; }); | ||
const buildOptions = cleanOptions(options); | ||
@@ -774,9 +863,12 @@ try { | ||
optimizeDeps: { force: options.force }, | ||
build: buildOptions | ||
build: buildOptions, | ||
}); | ||
} | ||
catch (e) { | ||
createLogger(options.logLevel).error(picocolors.exports.red(`error during build:\n${e.stack}`), { error: e }); | ||
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e }); | ||
process.exit(1); | ||
} | ||
finally { | ||
stopProfiler((message) => createLogger(options.logLevel).info(message)); | ||
} | ||
}); | ||
@@ -789,3 +881,3 @@ // optimize | ||
filterDuplicateOptions(options); | ||
const { optimizeDeps } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.B; }); | ||
const { optimizeDeps } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.B; }); | ||
try { | ||
@@ -796,17 +888,18 @@ const config = await resolveConfig({ | ||
configFile: options.config, | ||
logLevel: options.logLevel | ||
}, 'build', 'development'); | ||
logLevel: options.logLevel, | ||
mode: options.mode, | ||
}, 'serve'); | ||
await optimizeDeps(config, options.force, true); | ||
} | ||
catch (e) { | ||
createLogger(options.logLevel).error(picocolors.exports.red(`error when optimizing deps:\n${e.stack}`), { error: e }); | ||
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e }); | ||
process.exit(1); | ||
} | ||
}); | ||
// preview | ||
cli | ||
.command('preview [root]', 'locally preview production build') | ||
.option('--host [host]', `[string] specify hostname`) | ||
.option('--host [host]', `[string] specify hostname`, { type: [convertHost] }) | ||
.option('--port <port>', `[number] specify port`) | ||
.option('--strictPort', `[boolean] exit if specified port is already in use`) | ||
.option('--https', `[boolean] use TLS + HTTP/2`) | ||
.option('--open [path]', `[boolean | string] open browser on startup`) | ||
@@ -816,3 +909,3 @@ .option('--outDir <dir>', `[string] output directory (default: dist)`) | ||
filterDuplicateOptions(options); | ||
const { preview } = await import('./chunks/dep-2faf2534.js').then(function (n) { return n.E; }); | ||
const { preview } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.D; }); | ||
try { | ||
@@ -826,3 +919,3 @@ const server = await preview({ | ||
build: { | ||
outDir: options.outDir | ||
outDir: options.outDir, | ||
}, | ||
@@ -833,12 +926,15 @@ preview: { | ||
host: options.host, | ||
https: options.https, | ||
open: options.open | ||
} | ||
open: options.open, | ||
}, | ||
}); | ||
server.printUrls(); | ||
server.bindCLIShortcuts({ print: true }); | ||
} | ||
catch (e) { | ||
createLogger(options.logLevel).error(picocolors.exports.red(`error when starting preview server:\n${e.stack}`), { error: e }); | ||
createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), { error: e }); | ||
process.exit(1); | ||
} | ||
finally { | ||
stopProfiler((message) => createLogger(options.logLevel).info(message)); | ||
} | ||
}); | ||
@@ -848,1 +944,3 @@ cli.help(); | ||
cli.parse(); | ||
export { stopProfiler }; |
import path, { resolve } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { readFileSync } from 'node:fs'; | ||
var version = "3.2.7"; | ||
const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString()); | ||
const VERSION = version; | ||
const DEFAULT_MAIN_FIELDS = [ | ||
'browser', | ||
'module', | ||
'jsnext:main', | ||
'jsnext' | ||
'jsnext', | ||
]; | ||
@@ -20,3 +21,3 @@ // Baseline support browserslist | ||
'chrome87', | ||
'safari13' // transpile nullish coalescing | ||
'safari14', | ||
]; | ||
@@ -30,3 +31,3 @@ const DEFAULT_EXTENSIONS = [ | ||
'.tsx', | ||
'.json' | ||
'.json', | ||
]; | ||
@@ -39,7 +40,8 @@ const DEFAULT_CONFIG_FILES = [ | ||
'vite.config.mts', | ||
'vite.config.cts' | ||
'vite.config.cts', | ||
]; | ||
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/; | ||
const OPTIMIZABLE_ENTRY_RE = /\.(?:[cm]?[jt]s)$/; | ||
const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/; | ||
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/; | ||
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/; | ||
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/; | ||
/** | ||
@@ -81,2 +83,3 @@ * Prefix for resolved fs paths, since windows paths may not be valid as URLs. | ||
// images | ||
'apng', | ||
'png', | ||
@@ -100,2 +103,3 @@ 'jpe?g', | ||
'aac', | ||
'opus', | ||
// fonts | ||
@@ -109,6 +113,6 @@ 'woff2?', | ||
'pdf', | ||
'txt' | ||
'txt', | ||
]; | ||
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`); | ||
const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/; | ||
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/; | ||
const loopbackHosts = new Set([ | ||
@@ -118,3 +122,3 @@ 'localhost', | ||
'::1', | ||
'0000:0000:0000:0000:0000:0000:0000:0001' | ||
'0000:0000:0000:0000:0000:0000:0000:0001', | ||
]); | ||
@@ -124,5 +128,7 @@ const wildcardHosts = new Set([ | ||
'::', | ||
'0000:0000:0000:0000:0000:0000:0000:0000' | ||
'0000:0000:0000:0000:0000:0000:0000:0000', | ||
]); | ||
const DEFAULT_DEV_PORT = 5173; | ||
const DEFAULT_PREVIEW_PORT = 4173; | ||
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts }; | ||
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts }; |
@@ -1,2 +0,4 @@ | ||
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 { parseAst, parseAstAsync } from 'rollup/parseAst'; | ||
import { i as isInNodeModules } from './chunks/dep-ErEj4WmL.js'; | ||
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ErEj4WmL.js'; | ||
export { VERSION as version } from './constants.js'; | ||
@@ -6,4 +8,6 @@ export { version as esbuildVersion } from 'esbuild'; | ||
import 'node:fs'; | ||
import 'node:fs/promises'; | ||
import 'node:path'; | ||
import 'node:url'; | ||
import 'node:util'; | ||
import 'node:perf_hooks'; | ||
@@ -16,2 +20,4 @@ import 'node:module'; | ||
import 'assert'; | ||
import 'node:http'; | ||
import 'node:https'; | ||
import 'util'; | ||
@@ -25,24 +31,27 @@ import 'net'; | ||
import 'node:os'; | ||
import 'node:child_process'; | ||
import 'node:crypto'; | ||
import 'node:util'; | ||
import 'node:dns'; | ||
import 'resolve'; | ||
import 'crypto'; | ||
import 'node:buffer'; | ||
import 'module'; | ||
import 'worker_threads'; | ||
import 'node:assert'; | ||
import 'node:process'; | ||
import 'node:v8'; | ||
import 'querystring'; | ||
import 'node:readline'; | ||
import 'node:events'; | ||
import 'zlib'; | ||
import 'buffer'; | ||
import 'https'; | ||
import 'tls'; | ||
import 'node:http'; | ||
import 'node:https'; | ||
import 'querystring'; | ||
import 'node:readline'; | ||
import 'node:child_process'; | ||
import 'node:zlib'; | ||
import 'worker_threads'; | ||
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible. | ||
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`; | ||
const cssLangRE = new RegExp(cssLangs); | ||
const isCSSRequest = (request) => cssLangRE.test(request); | ||
// copy from constants.ts | ||
const CSS_LANGS_RE = | ||
// eslint-disable-next-line regexp/no-unused-capturing-group | ||
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/; | ||
const isCSSRequest = (request) => CSS_LANGS_RE.test(request); | ||
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7 | ||
@@ -56,2 +65,3 @@ // We don't recommend using this strategy as a general solution moving forward | ||
class SplitVendorChunkCache { | ||
cache; | ||
constructor() { | ||
@@ -67,3 +77,3 @@ this.cache = new Map(); | ||
return (id, { getModuleInfo }) => { | ||
if (id.includes('node_modules') && | ||
if (isInNodeModules(id) && | ||
!isCSSRequest(id) && | ||
@@ -124,4 +134,8 @@ staticImportedByEntry(id, getModuleInfo, cache.cache)) { | ||
} | ||
// else, leave the object form of manualChunks untouched, as | ||
// we can't safely replicate rollup handling. | ||
else { | ||
// else, leave the object form of manualChunks untouched, as | ||
// we can't safely replicate rollup handling. | ||
// eslint-disable-next-line no-console | ||
console.warn("(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead."); | ||
} | ||
} | ||
@@ -139,6 +153,6 @@ else { | ||
output: { | ||
manualChunks: createSplitVendorChunk({}, config) | ||
} | ||
} | ||
} | ||
manualChunks: createSplitVendorChunk({}, config), | ||
}, | ||
}, | ||
}, | ||
}; | ||
@@ -149,6 +163,6 @@ } | ||
caches.forEach((cache) => cache.reset()); | ||
} | ||
}, | ||
}; | ||
} | ||
export { splitVendorChunk, splitVendorChunkPlugin }; | ||
export { isCSSRequest, splitVendorChunk, splitVendorChunkPlugin }; |
149
package.json
{ | ||
"name": "vite", | ||
"version": "3.2.7", | ||
"version": "5.0.2", | ||
"type": "module", | ||
@@ -11,10 +11,22 @@ "license": "MIT", | ||
}, | ||
"keywords": [ | ||
"frontend", | ||
"framework", | ||
"hmr", | ||
"dev-server", | ||
"build-tool", | ||
"vite" | ||
], | ||
"main": "./dist/node/index.js", | ||
"module": "./dist/node/index.js", | ||
"types": "./dist/node/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/node/index.d.ts", | ||
"import": "./dist/node/index.js", | ||
"require": "./index.cjs" | ||
"import": { | ||
"types": "./dist/node/index.d.ts", | ||
"default": "./dist/node/index.js" | ||
}, | ||
"require": { | ||
"types": "./index.d.cts", | ||
"default": "./index.cjs" | ||
} | ||
}, | ||
@@ -25,2 +37,5 @@ "./client": { | ||
"./dist/client/*": "./dist/client/*", | ||
"./types/*": { | ||
"types": "./types/*" | ||
}, | ||
"./package.json": "./package.json" | ||
@@ -33,6 +48,7 @@ }, | ||
"index.cjs", | ||
"index.d.cts", | ||
"types" | ||
], | ||
"engines": { | ||
"node": "^14.18.0 || >=16.0.0" | ||
"node": "^18.0.0 || >=20.0.0" | ||
}, | ||
@@ -48,46 +64,31 @@ "repository": { | ||
"homepage": "https://github.com/vitejs/vite/tree/main/#readme", | ||
"scripts": { | ||
"dev": "rimraf dist && pnpm run build-bundle -w", | ||
"build": "rimraf dist && run-s build-bundle build-types", | ||
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", | ||
"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/**", | ||
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"funding": "https://github.com/vitejs/vite?sponsor=1", | ||
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!", | ||
"dependencies": { | ||
"esbuild": "^0.15.9", | ||
"postcss": "^8.4.18", | ||
"resolve": "^1.22.1", | ||
"rollup": "^2.79.1" | ||
"esbuild": "^0.19.3", | ||
"postcss": "^8.4.31", | ||
"rollup": "^4.2.0" | ||
}, | ||
"optionalDependencies": { | ||
"fsevents": "~2.3.2" | ||
"fsevents": "~2.3.3" | ||
}, | ||
"devDependencies": { | ||
"@ampproject/remapping": "^2.2.0", | ||
"@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": "14.1.0", | ||
"@rollup/plugin-typescript": "^8.5.0", | ||
"@rollup/pluginutils": "^4.2.1", | ||
"@types/escape-html": "^1.0.0", | ||
"acorn": "^8.8.1", | ||
"acorn-walk": "^8.2.0", | ||
"@ampproject/remapping": "^2.2.1", | ||
"@babel/parser": "^7.23.3", | ||
"@jridgewell/trace-mapping": "^0.3.20", | ||
"@rollup/plugin-alias": "^5.0.1", | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-dynamic-import-vars": "^2.1.0", | ||
"@rollup/plugin-json": "^6.0.1", | ||
"@rollup/plugin-node-resolve": "15.2.3", | ||
"@rollup/plugin-typescript": "^11.1.5", | ||
"@rollup/pluginutils": "^5.0.5", | ||
"@types/escape-html": "^1.0.4", | ||
"@types/pnpapi": "^0.0.5", | ||
"acorn": "^8.11.2", | ||
"acorn-walk": "^8.3.0", | ||
"cac": "^6.7.14", | ||
"chokidar": "^3.5.3", | ||
"connect": "^3.7.0", | ||
"connect-history-api-fallback": "^2.0.0", | ||
"convert-source-map": "^1.9.0", | ||
"convert-source-map": "^2.0.0", | ||
"cors": "^2.8.5", | ||
@@ -97,40 +98,43 @@ "cross-spawn": "^7.0.3", | ||
"dep-types": "link:./src/types", | ||
"dotenv": "^14.3.2", | ||
"dotenv-expand": "^5.1.0", | ||
"es-module-lexer": "^1.1.0", | ||
"dotenv": "^16.3.1", | ||
"dotenv-expand": "^10.0.0", | ||
"es-module-lexer": "^1.4.1", | ||
"escape-html": "^1.0.3", | ||
"estree-walker": "^3.0.1", | ||
"estree-walker": "^3.0.3", | ||
"etag": "^1.8.1", | ||
"fast-glob": "^3.2.12", | ||
"fast-glob": "^3.3.2", | ||
"http-proxy": "^1.18.1", | ||
"json5": "^2.2.1", | ||
"launch-editor-middleware": "^2.6.0", | ||
"magic-string": "^0.26.7", | ||
"json-stable-stringify": "^1.0.2", | ||
"launch-editor-middleware": "^2.6.1", | ||
"lightningcss": "^1.22.1", | ||
"magic-string": "^0.30.5", | ||
"micromatch": "^4.0.5", | ||
"mlly": "^0.5.16", | ||
"mlly": "^1.4.2", | ||
"mrmime": "^1.0.1", | ||
"okie": "^1.0.1", | ||
"open": "^8.4.0", | ||
"parse5": "^7.1.1", | ||
"periscopic": "^3.0.4", | ||
"open": "^8.4.2", | ||
"parse5": "^7.1.2", | ||
"periscopic": "^4.0.2", | ||
"picocolors": "^1.0.0", | ||
"picomatch": "^2.3.1", | ||
"postcss-import": "^15.0.0", | ||
"postcss-import": "^15.1.0", | ||
"postcss-load-config": "^4.0.1", | ||
"postcss-modules": "^6.0.0", | ||
"resolve.exports": "^1.1.0", | ||
"sirv": "^2.0.2", | ||
"source-map-js": "^1.0.2", | ||
"resolve.exports": "^2.0.2", | ||
"rollup-plugin-dts": "^6.1.0", | ||
"rollup-plugin-license": "^3.2.0", | ||
"sirv": "^2.0.3", | ||
"source-map-support": "^0.5.21", | ||
"strip-ansi": "^7.0.1", | ||
"strip-literal": "^0.4.2", | ||
"tsconfck": "^2.0.1", | ||
"tslib": "^2.4.0", | ||
"strip-ansi": "^7.1.0", | ||
"strip-literal": "^1.3.0", | ||
"tsconfck": "^3.0.0", | ||
"tslib": "^2.6.2", | ||
"types": "link:./types", | ||
"ufo": "^0.8.6", | ||
"ws": "^8.10.0" | ||
"ufo": "^1.3.1", | ||
"ws": "^8.14.2" | ||
}, | ||
"peerDependencies": { | ||
"@types/node": ">= 14", | ||
"@types/node": "^18.0.0 || >=20.0.0", | ||
"less": "*", | ||
"lightningcss": "^1.21.0", | ||
"sass": "*", | ||
@@ -157,6 +161,21 @@ "stylus": "*", | ||
}, | ||
"lightningcss": { | ||
"optional": true | ||
}, | ||
"terser": { | ||
"optional": true | ||
} | ||
}, | ||
"scripts": { | ||
"dev": "rimraf dist && pnpm run build-bundle -w", | ||
"build": "rimraf dist && run-s build-bundle build-types", | ||
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", | ||
"build-types": "run-s build-types-temp build-types-roll build-types-check", | ||
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node", | ||
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", | ||
"build-types-check": "tsc --project tsconfig.check.json", | ||
"typecheck": "tsc --noEmit", | ||
"lint": "eslint --cache --ext .ts src/**", | ||
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"" | ||
} | ||
} | ||
} |
@@ -5,3 +5,3 @@ import type { | ||
PrunePayload, | ||
UpdatePayload | ||
UpdatePayload, | ||
} from './hmrPayload' | ||
@@ -16,6 +16,19 @@ | ||
'vite:invalidate': InvalidatePayload | ||
'vite:ws:connect': WebSocketConnectionPayload | ||
'vite:ws:disconnect': WebSocketConnectionPayload | ||
} | ||
export interface WebSocketConnectionPayload { | ||
/** | ||
* @experimental | ||
* We expose this instance experimentally to see potential usage. | ||
* This might be removed in the future if we didn't find reasonable use cases. | ||
* If you find this useful, please open an issue with details so we can discuss and make it stable API. | ||
*/ | ||
webSocket: WebSocket | ||
} | ||
export interface InvalidatePayload { | ||
path: string | ||
message: string | undefined | ||
} | ||
@@ -22,0 +35,0 @@ |
@@ -15,20 +15,23 @@ import type { InferCustomEventPayload } from './customEvent' | ||
deps: readonly string[], | ||
cb: (mods: Array<ModuleNamespace | undefined>) => void | ||
cb: (mods: Array<ModuleNamespace | undefined>) => void, | ||
): void | ||
acceptExports(exportNames: string | readonly string[]): void | ||
acceptExports( | ||
exportNames: string | readonly string[], | ||
cb: (mod: ModuleNamespace | undefined) => void | ||
cb?: (mod: ModuleNamespace | undefined) => void, | ||
): void | ||
dispose(cb: (data: any) => void): void | ||
decline(): void | ||
invalidate(): void | ||
prune(cb: (data: any) => void): void | ||
invalidate(message?: string): void | ||
on<T extends string>( | ||
event: T, | ||
cb: (payload: InferCustomEventPayload<T>) => void | ||
cb: (payload: InferCustomEventPayload<T>) => void, | ||
): void | ||
off<T extends string>( | ||
event: T, | ||
cb: (payload: InferCustomEventPayload<T>) => void, | ||
): void | ||
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void | ||
} |
export interface ImportGlobOptions< | ||
Eager extends boolean, | ||
AsType extends string | ||
AsType extends string, | ||
> { | ||
@@ -48,6 +48,6 @@ /** | ||
As extends string, | ||
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown | ||
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown, | ||
>( | ||
glob: string | string[], | ||
options?: ImportGlobOptions<Eager, As> | ||
options?: ImportGlobOptions<Eager, As>, | ||
): (Eager extends true ? true : false) extends true | ||
@@ -63,3 +63,3 @@ ? Record<string, T> | ||
glob: string | string[], | ||
options?: ImportGlobOptions<false, string> | ||
options?: ImportGlobOptions<false, string>, | ||
): Record<string, () => Promise<M>> | ||
@@ -73,28 +73,4 @@ /** | ||
glob: string | string[], | ||
options: ImportGlobOptions<true, string> | ||
options: ImportGlobOptions<true, string>, | ||
): Record<string, M> | ||
} | ||
export interface ImportGlobEagerFunction { | ||
/** | ||
* Eagerly import a list of files with a glob pattern. | ||
* | ||
* Overload 1: No generic provided, infer the type from `as` | ||
*/ | ||
< | ||
As extends string, | ||
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown | ||
>( | ||
glob: string | string[], | ||
options?: Omit<ImportGlobOptions<boolean, As>, 'eager'> | ||
): Record<string, T> | ||
/** | ||
* Eagerly import a list of files with a glob pattern. | ||
* | ||
* Overload 2: Module generic provided | ||
*/ | ||
<M>( | ||
glob: string | string[], | ||
options?: Omit<ImportGlobOptions<boolean, string>, 'eager'> | ||
): Record<string, M> | ||
} |
@@ -5,4 +5,2 @@ // This file is an augmentation to the built-in ImportMeta interface | ||
/* eslint-disable @typescript-eslint/consistent-type-imports */ | ||
interface ImportMetaEnv { | ||
@@ -25,6 +23,2 @@ [key: string]: any | ||
glob: import('./importGlob').ImportGlobFunction | ||
/** | ||
* @deprecated Use `import.meta.glob('*', { eager: true })` instead | ||
*/ | ||
globEager: import('./importGlob').ImportGlobEagerFunction | ||
} |
{ | ||
"//": "this file is here to make typescript happy when moduleResolution=node16+" | ||
"//": "this file is here to make typescript happy when moduleResolution=node16+", | ||
"version": "0.0.0" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
3384671
87260
14
58
30
54
+ Added@esbuild/aix-ppc64@0.19.12(transitive)
+ Added@esbuild/android-arm@0.19.12(transitive)
+ Added@esbuild/android-arm64@0.19.12(transitive)
+ Added@esbuild/android-x64@0.19.12(transitive)
+ Added@esbuild/darwin-arm64@0.19.12(transitive)
+ Added@esbuild/darwin-x64@0.19.12(transitive)
+ Added@esbuild/freebsd-arm64@0.19.12(transitive)
+ Added@esbuild/freebsd-x64@0.19.12(transitive)
+ Added@esbuild/linux-arm@0.19.12(transitive)
+ Added@esbuild/linux-arm64@0.19.12(transitive)
+ Added@esbuild/linux-ia32@0.19.12(transitive)
+ Added@esbuild/linux-loong64@0.19.12(transitive)
+ Added@esbuild/linux-mips64el@0.19.12(transitive)
+ Added@esbuild/linux-ppc64@0.19.12(transitive)
+ Added@esbuild/linux-riscv64@0.19.12(transitive)
+ Added@esbuild/linux-s390x@0.19.12(transitive)
+ Added@esbuild/linux-x64@0.19.12(transitive)
+ Added@esbuild/netbsd-x64@0.19.12(transitive)
+ Added@esbuild/openbsd-x64@0.19.12(transitive)
+ Added@esbuild/sunos-x64@0.19.12(transitive)
+ Added@esbuild/win32-arm64@0.19.12(transitive)
+ Added@esbuild/win32-ia32@0.19.12(transitive)
+ Added@esbuild/win32-x64@0.19.12(transitive)
+ Added@rollup/rollup-android-arm-eabi@4.24.0(transitive)
+ Added@rollup/rollup-android-arm64@4.24.0(transitive)
+ Added@rollup/rollup-darwin-arm64@4.24.0(transitive)
+ Added@rollup/rollup-darwin-x64@4.24.0(transitive)
+ Added@rollup/rollup-linux-arm-gnueabihf@4.24.0(transitive)
+ Added@rollup/rollup-linux-arm-musleabihf@4.24.0(transitive)
+ Added@rollup/rollup-linux-arm64-gnu@4.24.0(transitive)
+ Added@rollup/rollup-linux-arm64-musl@4.24.0(transitive)
+ Added@rollup/rollup-linux-powerpc64le-gnu@4.24.0(transitive)
+ Added@rollup/rollup-linux-riscv64-gnu@4.24.0(transitive)
+ Added@rollup/rollup-linux-s390x-gnu@4.24.0(transitive)
+ Added@rollup/rollup-linux-x64-gnu@4.24.0(transitive)
+ Added@rollup/rollup-linux-x64-musl@4.24.0(transitive)
+ Added@rollup/rollup-win32-arm64-msvc@4.24.0(transitive)
+ Added@rollup/rollup-win32-ia32-msvc@4.24.0(transitive)
+ Added@rollup/rollup-win32-x64-msvc@4.24.0(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/node@22.7.5(transitive)
+ Addeddetect-libc@1.0.3(transitive)
+ Addedesbuild@0.19.12(transitive)
+ Addedlightningcss@1.27.0(transitive)
+ Addedlightningcss-darwin-arm64@1.27.0(transitive)
+ Addedlightningcss-darwin-x64@1.27.0(transitive)
+ Addedlightningcss-freebsd-x64@1.27.0(transitive)
+ Addedlightningcss-linux-arm-gnueabihf@1.27.0(transitive)
+ Addedlightningcss-linux-arm64-gnu@1.27.0(transitive)
+ Addedlightningcss-linux-arm64-musl@1.27.0(transitive)
+ Addedlightningcss-linux-x64-gnu@1.27.0(transitive)
+ Addedlightningcss-linux-x64-musl@1.27.0(transitive)
+ Addedlightningcss-win32-arm64-msvc@1.27.0(transitive)
+ Addedlightningcss-win32-x64-msvc@1.27.0(transitive)
+ Addedrollup@4.24.0(transitive)
- Removedresolve@^1.22.1
- Removed@esbuild/android-arm@0.15.18(transitive)
- Removed@esbuild/linux-loong64@0.15.18(transitive)
- Removed@types/node@22.7.4(transitive)
- Removedesbuild@0.15.18(transitive)
- Removedesbuild-android-64@0.15.18(transitive)
- Removedesbuild-android-arm64@0.15.18(transitive)
- Removedesbuild-darwin-64@0.15.18(transitive)
- Removedesbuild-darwin-arm64@0.15.18(transitive)
- Removedesbuild-freebsd-64@0.15.18(transitive)
- Removedesbuild-freebsd-arm64@0.15.18(transitive)
- Removedesbuild-linux-32@0.15.18(transitive)
- Removedesbuild-linux-64@0.15.18(transitive)
- Removedesbuild-linux-arm@0.15.18(transitive)
- Removedesbuild-linux-arm64@0.15.18(transitive)
- Removedesbuild-linux-mips64le@0.15.18(transitive)
- Removedesbuild-linux-ppc64le@0.15.18(transitive)
- Removedesbuild-linux-riscv64@0.15.18(transitive)
- Removedesbuild-linux-s390x@0.15.18(transitive)
- Removedesbuild-netbsd-64@0.15.18(transitive)
- Removedesbuild-openbsd-64@0.15.18(transitive)
- Removedesbuild-sunos-64@0.15.18(transitive)
- Removedesbuild-windows-32@0.15.18(transitive)
- Removedesbuild-windows-64@0.15.18(transitive)
- Removedesbuild-windows-arm64@0.15.18(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedresolve@1.22.8(transitive)
- Removedrollup@2.79.2(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
Updatedesbuild@^0.19.3
Updatedpostcss@^8.4.31
Updatedrollup@^4.2.0