Socket
Socket
Sign inDemoInstall

vite

Package Overview
Dependencies
181
Maintainers
5
Versions
550
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.1.0-beta.5 to 5.1.0-beta.6

dist/node/chunks/dep-0ozvs92U.js

12

dist/node/cli.js

@@ -5,3 +5,3 @@ import path from 'node:path';

import { EventEmitter } from 'events';
import { z as colors, u as createLogger, r as resolveConfig } from './chunks/dep-Y86Adl1p.js';
import { c as colors, a as createLogger, r as resolveConfig } from './chunks/dep-ZX7UfftI.js';
import { VERSION } from './constants.js';

@@ -36,6 +36,6 @@ import 'node:fs/promises';

import 'node:buffer';
import 'node:events';
import 'rollup/parseAst';
import 'querystring';
import 'node:readline';
import 'node:events';
import 'zlib';

@@ -762,3 +762,3 @@ import 'buffer';

// is ok here
const { createServer } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.D; });
const { createServer } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.E; });
try {

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

filterDuplicateOptions(options);
const { build } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.E; });
const { build } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.F; });
const buildOptions = cleanOptions(options);

@@ -872,3 +872,3 @@ try {

filterDuplicateOptions(options);
const { optimizeDeps } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.C; });
const { optimizeDeps } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.D; });
try {

@@ -899,3 +899,3 @@ const config = await resolveConfig({

filterDuplicateOptions(options);
const { preview } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.F; });
const { preview } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.G; });
try {

@@ -902,0 +902,0 @@ const server = await preview({

export { parseAst, parseAstAsync } from 'rollup/parseAst';
import { i as isInNodeModules, a as arraify } from './chunks/dep-Y86Adl1p.js';
export { b as build, g as buildErrorMessage, j as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, w as isFileServingAllowed, l as loadConfigFromFile, x as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, y as resolveEnvPrefix, k as rollupVersion, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Y86Adl1p.js';
import { i as isInNodeModules, b as arraify } from './chunks/dep-ZX7UfftI.js';
export { f as build, j as buildErrorMessage, u as createFilter, a as createLogger, e as createServer, d as defineConfig, k as fetchModule, g as formatPostcssSourceMap, y as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, v as rollupVersion, x as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ZX7UfftI.js';
export { VERSION as version } from './constants.js';
export { version as esbuildVersion } from 'esbuild';
import 'node:fs';
import { existsSync, readFileSync } from 'node:fs';
import { ViteRuntime, ESModulesRunner } from './runtime.js';
import 'node:fs/promises';

@@ -37,5 +38,5 @@ import 'node:path';

import 'node:buffer';
import 'node:events';
import 'querystring';
import 'node:readline';
import 'node:events';
import 'zlib';

@@ -159,2 +160,106 @@ import 'buffer';

export { isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };
class ServerHMRBroadcasterClient {
hmrChannel;
constructor(hmrChannel) {
this.hmrChannel = hmrChannel;
}
send(...args) {
let payload;
if (typeof args[0] === 'string') {
payload = {
type: 'custom',
event: args[0],
data: args[1],
};
}
else {
payload = args[0];
}
if (payload.type !== 'custom') {
throw new Error('Cannot send non-custom events from the client to the server.');
}
this.hmrChannel.send(payload);
}
}
/**
* The connector class to establish HMR communication between the server and the Vite runtime.
* @experimental
*/
class ServerHMRConnector {
handlers = [];
hmrChannel;
hmrClient;
connected = false;
constructor(server) {
const hmrChannel = server.hot?.channels.find((c) => c.name === 'ssr');
if (!hmrChannel) {
throw new Error("Your version of Vite doesn't support HMR during SSR. Please, use Vite 5.1 or higher.");
}
this.hmrClient = new ServerHMRBroadcasterClient(hmrChannel);
hmrChannel.api.outsideEmitter.on('send', (payload) => {
this.handlers.forEach((listener) => listener(payload));
});
this.hmrChannel = hmrChannel;
}
isReady() {
return this.connected;
}
send(message) {
const payload = JSON.parse(message);
this.hmrChannel.api.innerEmitter.emit(payload.event, payload.data, this.hmrClient);
}
onUpdate(handler) {
this.handlers.push(handler);
handler({ type: 'connected' });
this.connected = true;
}
}
function createHMROptions(server, options) {
if (server.config.server.hmr === false || options.hmr === false) {
return false;
}
const connection = new ServerHMRConnector(server);
return {
connection,
logger: options.hmr?.logger,
};
}
const prepareStackTrace = {
retrieveFile(id) {
if (existsSync(id)) {
return readFileSync(id, 'utf-8');
}
},
};
function resolveSourceMapOptions(options) {
if (options.sourcemapInterceptor != null) {
if (options.sourcemapInterceptor === 'prepareStackTrace') {
return prepareStackTrace;
}
if (typeof options.sourcemapInterceptor === 'object') {
return { ...prepareStackTrace, ...options.sourcemapInterceptor };
}
return options.sourcemapInterceptor;
}
if (typeof process !== 'undefined' && 'setSourceMapsEnabled' in process) {
return 'node';
}
return prepareStackTrace;
}
/**
* Create an instance of the Vite SSR runtime that support HMR.
* @experimental
*/
async function createViteRuntime(server, options = {}) {
const hmr = createHMROptions(server, options);
return new ViteRuntime({
...options,
root: server.config.root,
fetchModule: server.ssrFetchModule,
hmr,
sourcemapInterceptor: resolveSourceMapOptions(options),
}, options.runner || new ESModulesRunner());
}
export { ServerHMRConnector, createViteRuntime, isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };
{
"name": "vite",
"version": "5.1.0-beta.5",
"version": "5.1.0-beta.6",
"type": "module",

@@ -35,2 +35,6 @@ "license": "MIT",

},
"./runtime": {
"types": "./dist/node/runtime.d.ts",
"import": "./dist/node/runtime.js"
},
"./dist/client/*": "./dist/client/*",

@@ -42,2 +46,9 @@ "./types/*": {

},
"typesVersions": {
"*": {
"runtime": [
"dist/node/runtime.d.ts"
]
}
},
"files": [

@@ -169,3 +180,3 @@ "bin",

"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-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",

@@ -172,0 +183,0 @@ "build-types-check": "tsc --project tsconfig.check.json",

@@ -27,2 +27,4 @@ export type HMRPayload =

isWithinCircularImport?: boolean
/** @internal */
ssrInvalidates?: string[]
}

@@ -29,0 +31,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 too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc