full site update
This commit is contained in:
171
node_modules/vite/dist/node/index.js
generated
vendored
171
node_modules/vite/dist/node/index.js
generated
vendored
@@ -1,26 +1,24 @@
|
||||
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
||||
import { i as isInNodeModules, a as arraify } from './chunks/dep-C6uTJdX2.js';
|
||||
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, y as isFileLoadingAllowed, x as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-C6uTJdX2.js';
|
||||
export { VERSION as version } from './constants.js';
|
||||
import { a as arraify, i as isInNodeModules, D as DevEnvironment } from './chunks/dep-DBxKXgDP.js';
|
||||
export { B as BuildEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DBxKXgDP.js';
|
||||
export { defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, VERSION as version } from './constants.js';
|
||||
export { version as esbuildVersion } from 'esbuild';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { ViteRuntime, ESModulesRunner } from 'vite/runtime';
|
||||
import 'node:fs/promises';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:fs/promises';
|
||||
import 'node:url';
|
||||
import 'node:util';
|
||||
import 'node:perf_hooks';
|
||||
import 'node:module';
|
||||
import 'node:crypto';
|
||||
import 'tty';
|
||||
import 'picomatch';
|
||||
import 'path';
|
||||
import 'fs';
|
||||
import 'node:events';
|
||||
import 'node:stream';
|
||||
import 'node:string_decoder';
|
||||
import 'fdir';
|
||||
import 'node:child_process';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'tty';
|
||||
import 'util';
|
||||
import 'net';
|
||||
import 'events';
|
||||
@@ -30,21 +28,25 @@ import 'stream';
|
||||
import 'os';
|
||||
import 'child_process';
|
||||
import 'node:os';
|
||||
import 'node:net';
|
||||
import 'node:dns';
|
||||
import 'crypto';
|
||||
import 'vite/module-runner';
|
||||
import 'node:buffer';
|
||||
import 'module';
|
||||
import 'node:readline';
|
||||
import 'node:process';
|
||||
import 'node:events';
|
||||
import 'tinyglobby';
|
||||
import 'crypto';
|
||||
import 'node:assert';
|
||||
import 'node:v8';
|
||||
import 'node:worker_threads';
|
||||
import 'node:buffer';
|
||||
import 'querystring';
|
||||
import 'node:readline';
|
||||
import 'zlib';
|
||||
import 'buffer';
|
||||
import 'https';
|
||||
import 'tls';
|
||||
import 'node:net';
|
||||
import 'zlib';
|
||||
import 'buffer';
|
||||
import 'assert';
|
||||
import 'node:querystring';
|
||||
import 'node:zlib';
|
||||
|
||||
const CSS_LANGS_RE = (
|
||||
@@ -103,7 +105,7 @@ function splitVendorChunkPlugin() {
|
||||
const cache = new SplitVendorChunkCache();
|
||||
caches.push(cache);
|
||||
const build = config.build ?? {};
|
||||
const format = output?.format;
|
||||
const format = output.format;
|
||||
if (!build.ssr && !build.lib && format !== "umd" && format !== "iife") {
|
||||
return splitVendorChunk({ cache });
|
||||
}
|
||||
@@ -111,7 +113,7 @@ function splitVendorChunkPlugin() {
|
||||
return {
|
||||
name: "vite:split-vendor-chunk",
|
||||
config(config) {
|
||||
let outputs = config?.build?.rollupOptions?.output;
|
||||
let outputs = config.build?.rollupOptions?.output;
|
||||
if (outputs) {
|
||||
outputs = arraify(outputs);
|
||||
for (const output of outputs) {
|
||||
@@ -151,111 +153,42 @@ function splitVendorChunkPlugin() {
|
||||
};
|
||||
}
|
||||
|
||||
class ServerHMRBroadcasterClient {
|
||||
constructor(hmrChannel) {
|
||||
this.hmrChannel = hmrChannel;
|
||||
function createFetchableDevEnvironment(name, config, context) {
|
||||
if (typeof Request === "undefined" || typeof Response === "undefined") {
|
||||
throw new TypeError(
|
||||
"FetchableDevEnvironment requires a global `Request` and `Response` object."
|
||||
);
|
||||
}
|
||||
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);
|
||||
if (!context.handleRequest) {
|
||||
throw new TypeError(
|
||||
"FetchableDevEnvironment requires a `handleRequest` method during initialisation."
|
||||
);
|
||||
}
|
||||
return new FetchableDevEnvironment(name, config, context);
|
||||
}
|
||||
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."
|
||||
function isFetchableDevEnvironment(environment) {
|
||||
return environment instanceof FetchableDevEnvironment;
|
||||
}
|
||||
class FetchableDevEnvironment extends DevEnvironment {
|
||||
_handleRequest;
|
||||
constructor(name, config, context) {
|
||||
super(name, config, context);
|
||||
this._handleRequest = context.handleRequest;
|
||||
}
|
||||
async dispatchFetch(request) {
|
||||
if (!(request instanceof Request)) {
|
||||
throw new TypeError(
|
||||
"FetchableDevEnvironment `dispatchFetch` must receive a `Request` object."
|
||||
);
|
||||
}
|
||||
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;
|
||||
const response = await this._handleRequest(request);
|
||||
if (!(response instanceof Response)) {
|
||||
throw new TypeError(
|
||||
"FetchableDevEnvironment `context.handleRequest` must return a `Response` object."
|
||||
);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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 };
|
||||
export { DevEnvironment, createFetchableDevEnvironment, isCSSRequest, isFetchableDevEnvironment, splitVendorChunk, splitVendorChunkPlugin };
|
||||
|
Reference in New Issue
Block a user