vite 6.3.5 → 7.1.5
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 +81 -314
- package/bin/openChrome.js +68 -0
- package/bin/vite.js +7 -7
- package/dist/client/client.mjs +886 -922
- package/dist/client/env.mjs +14 -19
- package/dist/node/chunks/dep-BuoK8Wda.js +377 -0
- package/dist/node/chunks/dep-BvyJBvVx.js +4 -0
- package/dist/node/chunks/dep-Cs9lwdKu.js +4 -0
- package/dist/node/chunks/dep-DCVhRpiz.js +5595 -0
- package/dist/node/chunks/dep-DDbTn5rw.js +482 -0
- package/dist/node/chunks/dep-D_YDhiNx.js +4 -0
- package/dist/node/chunks/dep-M_KD0XSK.js +36707 -0
- package/dist/node/chunks/dep-SmwnYDP9.js +320 -0
- package/dist/node/chunks/dep-cWFO4sv4.js +4 -0
- package/dist/node/chunks/dep-lCKrEJQm.js +31 -0
- package/dist/node/chunks/dep-sDKrrA4S.js +6814 -0
- package/dist/node/chunks/dep-yxQqhtZq.js +4 -0
- package/dist/node/cli.js +624 -865
- package/dist/node/index.d.ts +2723 -3277
- package/dist/node/index.js +24 -188
- package/dist/node/module-runner.d.ts +256 -234
- package/dist/node/module-runner.js +1000 -1178
- package/dist/node/moduleRunnerTransport-BWUZBVLX.d.ts +88 -0
- package/package.json +52 -55
- package/types/importGlob.d.ts +14 -0
- package/types/internal/cssPreprocessorOptions.d.ts +3 -22
- package/types/internal/terserOptions.d.ts +11 -0
- package/types/metadata.d.ts +0 -2
- package/bin/openChrome.applescript +0 -95
- 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/constants.js +0 -149
- 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,30 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
export { version as esbuildVersion } from 'esbuild';
|
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 { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, createLogger, defaultAllowedOrigins } from "./chunks/dep-SmwnYDP9.js";
|
2
|
+
import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, 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-M_KD0XSK.js";
|
3
|
+
import { parseAst, parseAstAsync } from "rollup/parseAst";
|
4
|
+
import { version as esbuildVersion } from "esbuild";
|
155
5
|
|
6
|
+
//#region src/node/server/environments/fetchableEnvironments.ts
|
156
7
|
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);
|
8
|
+
if (typeof Request === "undefined" || typeof Response === "undefined") throw new TypeError("FetchableDevEnvironment requires a global `Request` and `Response` object.");
|
9
|
+
if (!context.handleRequest) throw new TypeError("FetchableDevEnvironment requires a `handleRequest` method during initialisation.");
|
10
|
+
return new FetchableDevEnvironment(name, config, context);
|
168
11
|
}
|
169
12
|
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
|
-
}
|
13
|
+
return environment instanceof FetchableDevEnvironment;
|
192
14
|
}
|
15
|
+
var FetchableDevEnvironment = class extends DevEnvironment {
|
16
|
+
_handleRequest;
|
17
|
+
constructor(name, config, context) {
|
18
|
+
super(name, config, context);
|
19
|
+
this._handleRequest = context.handleRequest;
|
20
|
+
}
|
21
|
+
async dispatchFetch(request) {
|
22
|
+
if (!(request instanceof Request)) throw new TypeError("FetchableDevEnvironment `dispatchFetch` must receive a `Request` object.");
|
23
|
+
const response = await this._handleRequest(request);
|
24
|
+
if (!(response instanceof Response)) throw new TypeError("FetchableDevEnvironment `context.handleRequest` must return a `Response` object.");
|
25
|
+
return response;
|
26
|
+
}
|
27
|
+
};
|
193
28
|
|
194
|
-
|
29
|
+
//#endregion
|
30
|
+
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_EXTERNAL_CONDITIONS as defaultExternalConditions, 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 };
|