vite 6.3.5 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +29 -0
- package/bin/vite.js +4 -4
- package/dist/client/client.mjs +793 -921
- package/dist/client/env.mjs +14 -19
- package/dist/node/chunks/dep-3PhSlasG.js +5 -0
- package/dist/node/chunks/dep-B4i1tHPo.js +30 -0
- package/dist/node/chunks/dep-BO5GbxpL.js +7345 -0
- package/dist/node/chunks/dep-BaSfMtGz.js +5 -0
- package/dist/node/chunks/dep-Bb92EWrU.js +5 -0
- package/dist/node/chunks/dep-C9KS6hrN.js +5 -0
- package/dist/node/chunks/dep-Ctugieod.js +150 -0
- package/dist/node/chunks/dep-D5HXLrlI.js +378 -0
- package/dist/node/chunks/dep-Da5Rc_CS.js +36548 -0
- package/dist/node/chunks/dep-Dg4W3IAQ.js +5597 -0
- package/dist/node/chunks/dep-uSUFJk9A.js +446 -0
- package/dist/node/cli.js +617 -865
- package/dist/node/constants.js +3 -148
- package/dist/node/index.d.ts +2724 -3124
- package/dist/node/index.js +25 -188
- package/dist/node/module-runner.d.ts +243 -234
- package/dist/node/module-runner.js +1043 -1172
- package/dist/node/moduleRunnerTransport-BWUZBVLX.d.ts +88 -0
- package/package.json +38 -41
- package/types/importGlob.d.ts +4 -0
- package/types/internal/cssPreprocessorOptions.d.ts +3 -22
- package/dist/node/chunks/dep-3RmXg9uo.js +0 -553
- package/dist/node/chunks/dep-AiMcmC_f.js +0 -822
- package/dist/node/chunks/dep-CvfTChi5.js +0 -8218
- package/dist/node/chunks/dep-DBxKXgDP.js +0 -49496
- package/dist/node/chunks/dep-SgSik2vo.js +0 -7113
- package/dist/node/moduleRunnerTransport.d-DJ_mE5sf.d.ts +0 -87
- package/dist/node-cjs/publicUtils.cjs +0 -3986
- package/index.cjs +0 -96
- package/index.d.cts +0 -6
package/dist/node/index.js
CHANGED
@@ -1,194 +1,31 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
import 'node:fs';
|
7
|
-
import 'node:path';
|
8
|
-
import 'node:fs/promises';
|
9
|
-
import 'node:url';
|
10
|
-
import 'node:util';
|
11
|
-
import 'node:perf_hooks';
|
12
|
-
import 'node:module';
|
13
|
-
import 'node:crypto';
|
14
|
-
import 'picomatch';
|
15
|
-
import 'path';
|
16
|
-
import 'fs';
|
17
|
-
import 'fdir';
|
18
|
-
import 'node:child_process';
|
19
|
-
import 'node:http';
|
20
|
-
import 'node:https';
|
21
|
-
import 'tty';
|
22
|
-
import 'util';
|
23
|
-
import 'net';
|
24
|
-
import 'events';
|
25
|
-
import 'url';
|
26
|
-
import 'http';
|
27
|
-
import 'stream';
|
28
|
-
import 'os';
|
29
|
-
import 'child_process';
|
30
|
-
import 'node:os';
|
31
|
-
import 'node:net';
|
32
|
-
import 'node:dns';
|
33
|
-
import 'vite/module-runner';
|
34
|
-
import 'node:buffer';
|
35
|
-
import 'module';
|
36
|
-
import 'node:readline';
|
37
|
-
import 'node:process';
|
38
|
-
import 'node:events';
|
39
|
-
import 'tinyglobby';
|
40
|
-
import 'crypto';
|
41
|
-
import 'node:assert';
|
42
|
-
import 'node:v8';
|
43
|
-
import 'node:worker_threads';
|
44
|
-
import 'https';
|
45
|
-
import 'tls';
|
46
|
-
import 'zlib';
|
47
|
-
import 'buffer';
|
48
|
-
import 'assert';
|
49
|
-
import 'node:querystring';
|
50
|
-
import 'node:zlib';
|
51
|
-
|
52
|
-
const CSS_LANGS_RE = (
|
53
|
-
// eslint-disable-next-line regexp/no-unused-capturing-group
|
54
|
-
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/
|
55
|
-
);
|
56
|
-
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
57
|
-
class SplitVendorChunkCache {
|
58
|
-
cache;
|
59
|
-
constructor() {
|
60
|
-
this.cache = /* @__PURE__ */ new Map();
|
61
|
-
}
|
62
|
-
reset() {
|
63
|
-
this.cache = /* @__PURE__ */ new Map();
|
64
|
-
}
|
65
|
-
}
|
66
|
-
function splitVendorChunk(options = {}) {
|
67
|
-
const cache = options.cache ?? new SplitVendorChunkCache();
|
68
|
-
return (id, { getModuleInfo }) => {
|
69
|
-
if (isInNodeModules(id) && !isCSSRequest(id) && staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
70
|
-
return "vendor";
|
71
|
-
}
|
72
|
-
};
|
73
|
-
}
|
74
|
-
function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
75
|
-
if (cache.has(id)) {
|
76
|
-
return cache.get(id);
|
77
|
-
}
|
78
|
-
if (importStack.includes(id)) {
|
79
|
-
cache.set(id, false);
|
80
|
-
return false;
|
81
|
-
}
|
82
|
-
const mod = getModuleInfo(id);
|
83
|
-
if (!mod) {
|
84
|
-
cache.set(id, false);
|
85
|
-
return false;
|
86
|
-
}
|
87
|
-
if (mod.isEntry) {
|
88
|
-
cache.set(id, true);
|
89
|
-
return true;
|
90
|
-
}
|
91
|
-
const someImporterIs = mod.importers.some(
|
92
|
-
(importer) => staticImportedByEntry(
|
93
|
-
importer,
|
94
|
-
getModuleInfo,
|
95
|
-
cache,
|
96
|
-
importStack.concat(id)
|
97
|
-
)
|
98
|
-
);
|
99
|
-
cache.set(id, someImporterIs);
|
100
|
-
return someImporterIs;
|
101
|
-
}
|
102
|
-
function splitVendorChunkPlugin() {
|
103
|
-
const caches = [];
|
104
|
-
function createSplitVendorChunk(output, config) {
|
105
|
-
const cache = new SplitVendorChunkCache();
|
106
|
-
caches.push(cache);
|
107
|
-
const build = config.build ?? {};
|
108
|
-
const format = output.format;
|
109
|
-
if (!build.ssr && !build.lib && format !== "umd" && format !== "iife") {
|
110
|
-
return splitVendorChunk({ cache });
|
111
|
-
}
|
112
|
-
}
|
113
|
-
return {
|
114
|
-
name: "vite:split-vendor-chunk",
|
115
|
-
config(config) {
|
116
|
-
let outputs = config.build?.rollupOptions?.output;
|
117
|
-
if (outputs) {
|
118
|
-
outputs = arraify(outputs);
|
119
|
-
for (const output of outputs) {
|
120
|
-
const viteManualChunks = createSplitVendorChunk(output, config);
|
121
|
-
if (viteManualChunks) {
|
122
|
-
if (output.manualChunks) {
|
123
|
-
if (typeof output.manualChunks === "function") {
|
124
|
-
const userManualChunks = output.manualChunks;
|
125
|
-
output.manualChunks = (id, api) => {
|
126
|
-
return userManualChunks(id, api) ?? viteManualChunks(id, api);
|
127
|
-
};
|
128
|
-
} else {
|
129
|
-
console.warn(
|
130
|
-
"(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead."
|
131
|
-
);
|
132
|
-
}
|
133
|
-
} else {
|
134
|
-
output.manualChunks = viteManualChunks;
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
} else {
|
139
|
-
return {
|
140
|
-
build: {
|
141
|
-
rollupOptions: {
|
142
|
-
output: {
|
143
|
-
manualChunks: createSplitVendorChunk({}, config)
|
144
|
-
}
|
145
|
-
}
|
146
|
-
}
|
147
|
-
};
|
148
|
-
}
|
149
|
-
},
|
150
|
-
buildStart() {
|
151
|
-
caches.forEach((cache) => cache.reset());
|
152
|
-
}
|
153
|
-
};
|
154
|
-
}
|
1
|
+
import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
|
2
|
+
import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-Da5Rc_CS.js";
|
3
|
+
import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, defaultAllowedOrigins } from "./chunks/dep-Ctugieod.js";
|
4
|
+
import { parseAst, parseAstAsync } from "rollup/parseAst";
|
5
|
+
import { version as esbuildVersion } from "esbuild";
|
155
6
|
|
7
|
+
//#region src/node/server/environments/fetchableEnvironments.ts
|
156
8
|
function createFetchableDevEnvironment(name, config, context) {
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
);
|
161
|
-
}
|
162
|
-
if (!context.handleRequest) {
|
163
|
-
throw new TypeError(
|
164
|
-
"FetchableDevEnvironment requires a `handleRequest` method during initialisation."
|
165
|
-
);
|
166
|
-
}
|
167
|
-
return new FetchableDevEnvironment(name, config, context);
|
9
|
+
if (typeof Request === "undefined" || typeof Response === "undefined") throw new TypeError("FetchableDevEnvironment requires a global `Request` and `Response` object.");
|
10
|
+
if (!context.handleRequest) throw new TypeError("FetchableDevEnvironment requires a `handleRequest` method during initialisation.");
|
11
|
+
return new FetchableDevEnvironment(name, config, context);
|
168
12
|
}
|
169
13
|
function isFetchableDevEnvironment(environment) {
|
170
|
-
|
171
|
-
}
|
172
|
-
class FetchableDevEnvironment extends DevEnvironment {
|
173
|
-
_handleRequest;
|
174
|
-
constructor(name, config, context) {
|
175
|
-
super(name, config, context);
|
176
|
-
this._handleRequest = context.handleRequest;
|
177
|
-
}
|
178
|
-
async dispatchFetch(request) {
|
179
|
-
if (!(request instanceof Request)) {
|
180
|
-
throw new TypeError(
|
181
|
-
"FetchableDevEnvironment `dispatchFetch` must receive a `Request` object."
|
182
|
-
);
|
183
|
-
}
|
184
|
-
const response = await this._handleRequest(request);
|
185
|
-
if (!(response instanceof Response)) {
|
186
|
-
throw new TypeError(
|
187
|
-
"FetchableDevEnvironment `context.handleRequest` must return a `Response` object."
|
188
|
-
);
|
189
|
-
}
|
190
|
-
return response;
|
191
|
-
}
|
14
|
+
return environment instanceof FetchableDevEnvironment;
|
192
15
|
}
|
16
|
+
var FetchableDevEnvironment = class extends DevEnvironment {
|
17
|
+
_handleRequest;
|
18
|
+
constructor(name, config, context) {
|
19
|
+
super(name, config, context);
|
20
|
+
this._handleRequest = context.handleRequest;
|
21
|
+
}
|
22
|
+
async dispatchFetch(request) {
|
23
|
+
if (!(request instanceof Request)) throw new TypeError("FetchableDevEnvironment `dispatchFetch` must receive a `Request` object.");
|
24
|
+
const response = await this._handleRequest(request);
|
25
|
+
if (!(response instanceof Response)) throw new TypeError("FetchableDevEnvironment `context.handleRequest` must return a `Response` object.");
|
26
|
+
return response;
|
27
|
+
}
|
28
|
+
};
|
193
29
|
|
194
|
-
|
30
|
+
//#endregion
|
31
|
+
export { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parseAst, parseAstAsync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, VERSION as version };
|