vite 6.1.0-beta.1 → 6.1.0
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/dist/node/chunks/{dep-BFhA-Un-.js → dep-BUK8RJ2R.js} +1 -1
- package/dist/node/chunks/{dep-ChTE610F.js → dep-CfG9u7Cn.js} +122 -46
- package/dist/node/chunks/{dep-B0BOsDX1.js → dep-DWzCYIjV.js} +1 -1
- package/dist/node/cli.js +10 -7
- package/dist/node/index.d.ts +4 -2
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +5 -3
- package/package.json +1 -1
@@ -10210,7 +10210,7 @@ async function resolveHostname(optionsHost) {
|
|
10210
10210
|
}
|
10211
10211
|
return { host, name };
|
10212
10212
|
}
|
10213
|
-
async function resolveServerUrls(server, options, config) {
|
10213
|
+
async function resolveServerUrls(server, options, httpsOptions, config) {
|
10214
10214
|
const address = server.address();
|
10215
10215
|
const isAddressInfo = (x) => x?.address;
|
10216
10216
|
if (!isAddressInfo(address)) {
|
@@ -10250,8 +10250,46 @@ async function resolveServerUrls(server, options, config) {
|
|
10250
10250
|
}
|
10251
10251
|
});
|
10252
10252
|
}
|
10253
|
+
const cert = httpsOptions?.cert && !Array.isArray(httpsOptions.cert) ? new crypto$2.X509Certificate(httpsOptions.cert) : undefined;
|
10254
|
+
const hostnameFromCert = cert?.subjectAltName ? extractHostnamesFromSubjectAltName(cert.subjectAltName) : [];
|
10255
|
+
if (hostnameFromCert.length > 0) {
|
10256
|
+
const existings = /* @__PURE__ */ new Set([...local, ...network]);
|
10257
|
+
local.push(
|
10258
|
+
...hostnameFromCert.map((hostname2) => `https://${hostname2}:${port}${base}`).filter((url) => !existings.has(url))
|
10259
|
+
);
|
10260
|
+
}
|
10253
10261
|
return { local, network };
|
10254
10262
|
}
|
10263
|
+
function extractHostnamesFromSubjectAltName(subjectAltName) {
|
10264
|
+
const hostnames = [];
|
10265
|
+
let remaining = subjectAltName;
|
10266
|
+
while (remaining) {
|
10267
|
+
const nameEndIndex = remaining.indexOf(":");
|
10268
|
+
const name = remaining.slice(0, nameEndIndex);
|
10269
|
+
remaining = remaining.slice(nameEndIndex + 1);
|
10270
|
+
if (!remaining) break;
|
10271
|
+
const isQuoted = remaining[0] === '"';
|
10272
|
+
let value;
|
10273
|
+
if (isQuoted) {
|
10274
|
+
const endQuoteIndex = remaining.indexOf('"', 1);
|
10275
|
+
value = JSON.parse(remaining.slice(0, endQuoteIndex + 1));
|
10276
|
+
remaining = remaining.slice(endQuoteIndex + 1);
|
10277
|
+
} else {
|
10278
|
+
const maybeEndIndex = remaining.indexOf(",");
|
10279
|
+
const endIndex = maybeEndIndex === -1 ? remaining.length : maybeEndIndex;
|
10280
|
+
value = remaining.slice(0, endIndex);
|
10281
|
+
remaining = remaining.slice(endIndex);
|
10282
|
+
}
|
10283
|
+
remaining = remaining.slice(
|
10284
|
+
/* for , */
|
10285
|
+
1
|
10286
|
+
).trimStart();
|
10287
|
+
if (name === "DNS" && value !== "[::1]") {
|
10288
|
+
hostnames.push(value.replace("*", "vite"));
|
10289
|
+
}
|
10290
|
+
}
|
10291
|
+
return hostnames;
|
10292
|
+
}
|
10255
10293
|
function arraify(target) {
|
10256
10294
|
return Array.isArray(target) ? target : [target];
|
10257
10295
|
}
|
@@ -13699,6 +13737,7 @@ function manifestPlugin() {
|
|
13699
13737
|
manifest: {},
|
13700
13738
|
outputCount: 0,
|
13701
13739
|
reset() {
|
13740
|
+
this.manifest = {};
|
13702
13741
|
this.outputCount = 0;
|
13703
13742
|
}
|
13704
13743
|
};
|
@@ -17989,7 +18028,9 @@ class ScanEnvironment extends BaseEnvironment {
|
|
17989
18028
|
this._plugins = await resolveEnvironmentPlugins(this);
|
17990
18029
|
this._pluginContainer = await createEnvironmentPluginContainer(
|
17991
18030
|
this,
|
17992
|
-
this.plugins
|
18031
|
+
this.plugins,
|
18032
|
+
undefined,
|
18033
|
+
false
|
17993
18034
|
);
|
17994
18035
|
}
|
17995
18036
|
}
|
@@ -18625,6 +18666,11 @@ function isDepOptimizationDisabled(optimizeDeps2) {
|
|
18625
18666
|
}
|
18626
18667
|
async function optimizeDeps(config, force = config.optimizeDeps.force, asCommand = false) {
|
18627
18668
|
const log = asCommand ? config.logger.info : debug$c;
|
18669
|
+
config.logger.warn(
|
18670
|
+
colors$1.yellow(
|
18671
|
+
"manually calling optimizeDeps is deprecated. This is done automatically and does not need to be called manually."
|
18672
|
+
)
|
18673
|
+
);
|
18628
18674
|
const environment = new ScanEnvironment("client", config);
|
18629
18675
|
await environment.init();
|
18630
18676
|
const cachedMetadata = await loadCachedDepOptimizationMetadata(
|
@@ -20146,7 +20192,7 @@ function expandValue (value, processEnv, runningParsed) {
|
|
20146
20192
|
|
20147
20193
|
function expand$2 (options) {
|
20148
20194
|
// for use with progressive expansion
|
20149
|
-
const runningParsed = {}
|
20195
|
+
// const runningParsed = {}
|
20150
20196
|
|
20151
20197
|
let processEnv = process.env;
|
20152
20198
|
if (options && options.processEnv != null) {
|
@@ -20161,13 +20207,15 @@ function expand$2 (options) {
|
|
20161
20207
|
if (processEnv[key] && processEnv[key] !== value) {
|
20162
20208
|
value = processEnv[key];
|
20163
20209
|
} else {
|
20164
|
-
|
20210
|
+
// PATCH: we pass options.parsed instead of runningParsed
|
20211
|
+
// to allow variables declared in other files to be used
|
20212
|
+
value = expandValue(value, processEnv, options.parsed);
|
20165
20213
|
}
|
20166
20214
|
|
20167
20215
|
options.parsed[key] = _resolveEscapeSequences(value);
|
20168
20216
|
|
20169
20217
|
// for use with progressive expansion
|
20170
|
-
runningParsed[key] = _resolveEscapeSequences(value)
|
20218
|
+
// runningParsed[key] = _resolveEscapeSequences(value)
|
20171
20219
|
}
|
20172
20220
|
|
20173
20221
|
for (const processKey in options.parsed) {
|
@@ -20241,7 +20289,7 @@ function resolveEnvPrefix({
|
|
20241
20289
|
return envPrefix;
|
20242
20290
|
}
|
20243
20291
|
|
20244
|
-
const docsURL = "https://
|
20292
|
+
const docsURL = "https://vite.dev";
|
20245
20293
|
const deprecationCode = {
|
20246
20294
|
removePluginHookSsrArgument: "changes/this-environment-in-hooks",
|
20247
20295
|
removePluginHookHandleHotUpdate: "changes/hotupdate-hook",
|
@@ -42014,7 +42062,7 @@ ${js}`;
|
|
42014
42062
|
}
|
42015
42063
|
},
|
42016
42064
|
async generateBundle(options, bundle) {
|
42017
|
-
const
|
42065
|
+
const analyzedImportedCssFiles = /* @__PURE__ */ new Map();
|
42018
42066
|
const inlineEntryChunk = /* @__PURE__ */ new Set();
|
42019
42067
|
const getImportedChunks = (chunk, seen = /* @__PURE__ */ new Set()) => {
|
42020
42068
|
const chunks = [];
|
@@ -42055,32 +42103,44 @@ ${js}`;
|
|
42055
42103
|
href: toOutputPath(filename)
|
42056
42104
|
}
|
42057
42105
|
});
|
42058
|
-
const
|
42059
|
-
|
42060
|
-
|
42061
|
-
|
42062
|
-
|
42063
|
-
|
42064
|
-
if (importee?.type === "chunk") {
|
42065
|
-
tags.push(...getCssTagsForChunk(importee, toOutputPath, seen));
|
42066
|
-
}
|
42067
|
-
});
|
42106
|
+
const toStyleSheetLinkTag = (file, toOutputPath) => ({
|
42107
|
+
tag: "link",
|
42108
|
+
attrs: {
|
42109
|
+
rel: "stylesheet",
|
42110
|
+
crossorigin: true,
|
42111
|
+
href: toOutputPath(file)
|
42068
42112
|
}
|
42113
|
+
});
|
42114
|
+
const getCssFilesForChunk = (chunk, seenChunks = /* @__PURE__ */ new Set(), seenCss = /* @__PURE__ */ new Set()) => {
|
42115
|
+
if (seenChunks.has(chunk.fileName)) {
|
42116
|
+
return [];
|
42117
|
+
}
|
42118
|
+
seenChunks.add(chunk.fileName);
|
42119
|
+
if (analyzedImportedCssFiles.has(chunk)) {
|
42120
|
+
const files2 = analyzedImportedCssFiles.get(chunk);
|
42121
|
+
const additionals = files2.filter((file) => !seenCss.has(file));
|
42122
|
+
additionals.forEach((file) => seenCss.add(file));
|
42123
|
+
return additionals;
|
42124
|
+
}
|
42125
|
+
const files = [];
|
42126
|
+
chunk.imports.forEach((file) => {
|
42127
|
+
const importee = bundle[file];
|
42128
|
+
if (importee?.type === "chunk") {
|
42129
|
+
files.push(...getCssFilesForChunk(importee, seenChunks, seenCss));
|
42130
|
+
}
|
42131
|
+
});
|
42132
|
+
analyzedImportedCssFiles.set(chunk, files);
|
42069
42133
|
chunk.viteMetadata.importedCss.forEach((file) => {
|
42070
|
-
if (!
|
42071
|
-
|
42072
|
-
|
42073
|
-
tag: "link",
|
42074
|
-
attrs: {
|
42075
|
-
rel: "stylesheet",
|
42076
|
-
crossorigin: true,
|
42077
|
-
href: toOutputPath(file)
|
42078
|
-
}
|
42079
|
-
});
|
42134
|
+
if (!seenCss.has(file)) {
|
42135
|
+
seenCss.add(file);
|
42136
|
+
files.push(file);
|
42080
42137
|
}
|
42081
42138
|
});
|
42082
|
-
return
|
42139
|
+
return files;
|
42083
42140
|
};
|
42141
|
+
const getCssTagsForChunk = (chunk, toOutputPath) => getCssFilesForChunk(chunk).map(
|
42142
|
+
(file) => toStyleSheetLinkTag(file, toOutputPath)
|
42143
|
+
);
|
42084
42144
|
for (const [normalizedId, html] of processedHtml(this)) {
|
42085
42145
|
const relativeUrlPath = normalizePath$3(
|
42086
42146
|
path$d.relative(config.root, normalizedId)
|
@@ -43931,6 +43991,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
43931
43991
|
server.resolvedUrls = await resolveServerUrls(
|
43932
43992
|
httpServer,
|
43933
43993
|
config.server,
|
43994
|
+
httpsOptions,
|
43934
43995
|
config
|
43935
43996
|
);
|
43936
43997
|
if (!isRestart && config.server.open) server.openBrowser();
|
@@ -44292,6 +44353,10 @@ function resolveServerOptions(root, raw, logger) {
|
|
44292
44353
|
)
|
44293
44354
|
);
|
44294
44355
|
}
|
44356
|
+
if (process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS && Array.isArray(server.allowedHosts)) {
|
44357
|
+
const additionalHost = process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS;
|
44358
|
+
server.allowedHosts = [...server.allowedHosts, additionalHost];
|
44359
|
+
}
|
44295
44360
|
return server;
|
44296
44361
|
}
|
44297
44362
|
async function restartServer(server) {
|
@@ -47273,11 +47338,12 @@ function throwClosedServerError() {
|
|
47273
47338
|
err.code = ERR_CLOSED_SERVER;
|
47274
47339
|
throw err;
|
47275
47340
|
}
|
47276
|
-
async function createEnvironmentPluginContainer(environment, plugins, watcher) {
|
47341
|
+
async function createEnvironmentPluginContainer(environment, plugins, watcher, autoStart = true) {
|
47277
47342
|
const container = new EnvironmentPluginContainer(
|
47278
47343
|
environment,
|
47279
47344
|
plugins,
|
47280
|
-
watcher
|
47345
|
+
watcher,
|
47346
|
+
autoStart
|
47281
47347
|
);
|
47282
47348
|
await container.resolveRollupOptions();
|
47283
47349
|
return container;
|
@@ -47286,10 +47352,11 @@ class EnvironmentPluginContainer {
|
|
47286
47352
|
/**
|
47287
47353
|
* @internal use `createEnvironmentPluginContainer` instead
|
47288
47354
|
*/
|
47289
|
-
constructor(environment, plugins, watcher) {
|
47355
|
+
constructor(environment, plugins, watcher, autoStart = true) {
|
47290
47356
|
this.environment = environment;
|
47291
47357
|
this.plugins = plugins;
|
47292
47358
|
this.watcher = watcher;
|
47359
|
+
this._started = !autoStart;
|
47293
47360
|
this.minimalContext = new MinimalPluginContext(
|
47294
47361
|
{ rollupVersion, watchMode: true },
|
47295
47362
|
environment
|
@@ -48034,7 +48101,9 @@ function createIdResolver(config, options) {
|
|
48034
48101
|
// Ignore sideEffects and other computations as we only need the id
|
48035
48102
|
idOnly: true
|
48036
48103
|
})
|
48037
|
-
]
|
48104
|
+
],
|
48105
|
+
undefined,
|
48106
|
+
false
|
48038
48107
|
);
|
48039
48108
|
pluginContainerMap.set(environment, pluginContainer);
|
48040
48109
|
}
|
@@ -48046,7 +48115,9 @@ function createIdResolver(config, options) {
|
|
48046
48115
|
if (!pluginContainer) {
|
48047
48116
|
pluginContainer = await createEnvironmentPluginContainer(
|
48048
48117
|
environment,
|
48049
|
-
[alias$1({ entries: environment.config.resolve.alias })]
|
48118
|
+
[alias$1({ entries: environment.config.resolve.alias })],
|
48119
|
+
undefined,
|
48120
|
+
false
|
48050
48121
|
);
|
48051
48122
|
aliasOnlyPluginContainerMap.set(environment, pluginContainer);
|
48052
48123
|
}
|
@@ -49048,8 +49119,8 @@ function createCachedImport(imp) {
|
|
49048
49119
|
return cached;
|
49049
49120
|
};
|
49050
49121
|
}
|
49051
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
49052
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
49122
|
+
const importPostcssImport = createCachedImport(() => import('./dep-BUK8RJ2R.js').then(function (n) { return n.i; }));
|
49123
|
+
const importPostcssModules = createCachedImport(() => import('./dep-DWzCYIjV.js').then(function (n) { return n.i; }));
|
49053
49124
|
const importPostcss = createCachedImport(() => import('postcss'));
|
49054
49125
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
49055
49126
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -50319,7 +50390,7 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
|
|
50319
50390
|
} else if (typeof libOptions.fileName === "string") {
|
50320
50391
|
return `${libOptions.fileName}.css`;
|
50321
50392
|
}
|
50322
|
-
const packageJson =
|
50393
|
+
const packageJson = findNearestMainPackageData(root, packageCache)?.data;
|
50323
50394
|
const name = packageJson ? getPkgName(packageJson.name) : undefined;
|
50324
50395
|
if (!name)
|
50325
50396
|
throw new Error(
|
@@ -51345,7 +51416,7 @@ function resolveLibFilename(libOptions, format, entryName, root, extension, pack
|
|
51345
51416
|
if (typeof libOptions.fileName === "function") {
|
51346
51417
|
return libOptions.fileName(format, entryName);
|
51347
51418
|
}
|
51348
|
-
const packageJson =
|
51419
|
+
const packageJson = findNearestMainPackageData(root, packageCache)?.data;
|
51349
51420
|
const name = libOptions.fileName || (packageJson && typeof libOptions.entry === "string" ? getPkgName(packageJson.name) : entryName);
|
51350
51421
|
if (!name)
|
51351
51422
|
throw new Error(
|
@@ -53277,12 +53348,9 @@ async function preview(inlineConfig = {}) {
|
|
53277
53348
|
`The directory "${clientOutDir}" does not exist. Did you build your project?`
|
53278
53349
|
);
|
53279
53350
|
}
|
53351
|
+
const httpsOptions = await resolveHttpsConfig(config.server.https);
|
53280
53352
|
const app = connect$1();
|
53281
|
-
const httpServer = await resolveHttpServer(
|
53282
|
-
config.preview,
|
53283
|
-
app,
|
53284
|
-
await resolveHttpsConfig(config.preview.https)
|
53285
|
-
);
|
53353
|
+
const httpServer = await resolveHttpServer(config.preview, app, httpsOptions);
|
53286
53354
|
setClientErrorHandler(httpServer, config.logger);
|
53287
53355
|
const options = config.preview;
|
53288
53356
|
const logger = config.logger;
|
@@ -53380,6 +53448,7 @@ async function preview(inlineConfig = {}) {
|
|
53380
53448
|
server.resolvedUrls = await resolveServerUrls(
|
53381
53449
|
httpServer,
|
53382
53450
|
config.preview,
|
53451
|
+
httpsOptions,
|
53383
53452
|
config
|
53384
53453
|
);
|
53385
53454
|
if (options.open) {
|
@@ -54225,9 +54294,9 @@ function sortUserPlugins(plugins) {
|
|
54225
54294
|
return [prePlugins, normalPlugins, postPlugins];
|
54226
54295
|
}
|
54227
54296
|
async function loadConfigFromFile(configEnv, configFile, configRoot = process.cwd(), logLevel, customLogger, configLoader = "bundle") {
|
54228
|
-
if (configLoader !== "bundle" && configLoader !== "runner") {
|
54297
|
+
if (configLoader !== "bundle" && configLoader !== "runner" && configLoader !== "native") {
|
54229
54298
|
throw new Error(
|
54230
|
-
`Unsupported configLoader: ${configLoader}. Accepted values are 'bundle' and '
|
54299
|
+
`Unsupported configLoader: ${configLoader}. Accepted values are 'bundle', 'runner', and 'native'.`
|
54231
54300
|
);
|
54232
54301
|
}
|
54233
54302
|
const start = performance.now();
|
@@ -54248,7 +54317,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
54248
54317
|
return null;
|
54249
54318
|
}
|
54250
54319
|
try {
|
54251
|
-
const resolver = configLoader === "bundle" ? bundleAndLoadConfigFile :
|
54320
|
+
const resolver = configLoader === "bundle" ? bundleAndLoadConfigFile : configLoader === "runner" ? runnerImportConfigFile : nativeImportConfigFile;
|
54252
54321
|
const { configExport, dependencies } = await resolver(resolvedPath);
|
54253
54322
|
debug?.(`config file loaded in ${getTime()}`);
|
54254
54323
|
const config = await (typeof configExport === "function" ? configExport(configEnv) : configExport);
|
@@ -54270,7 +54339,14 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
54270
54339
|
throw e;
|
54271
54340
|
}
|
54272
54341
|
}
|
54273
|
-
async function
|
54342
|
+
async function nativeImportConfigFile(resolvedPath) {
|
54343
|
+
const module = await import(pathToFileURL$1(resolvedPath).href + "?t=" + Date.now());
|
54344
|
+
return {
|
54345
|
+
configExport: module.default,
|
54346
|
+
dependencies: []
|
54347
|
+
};
|
54348
|
+
}
|
54349
|
+
async function runnerImportConfigFile(resolvedPath) {
|
54274
54350
|
const { module, dependencies } = await runnerImport(resolvedPath);
|
54275
54351
|
return {
|
54276
54352
|
configExport: module.default,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-CfG9u7Cn.js';
|
2
2
|
import require$$0$2 from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
2
2
|
import fs__default from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-CfG9u7Cn.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -738,14 +738,14 @@ cli.option("-c, --config <file>", `[string] use specified config file`).option("
|
|
738
738
|
type: [convertBase]
|
739
739
|
}).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option(
|
740
740
|
"--configLoader <loader>",
|
741
|
-
`[string] use 'bundle' to bundle the config with esbuild or 'runner' (experimental) to process it on the fly (default: bundle)`
|
741
|
+
`[string] use 'bundle' to bundle the config with esbuild, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`
|
742
742
|
).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
743
743
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option(
|
744
744
|
"--force",
|
745
745
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
746
746
|
).action(async (root, options) => {
|
747
747
|
filterDuplicateOptions(options);
|
748
|
-
const { createServer } = await import('./chunks/dep-
|
748
|
+
const { createServer } = await import('./chunks/dep-CfG9u7Cn.js').then(function (n) { return n.S; });
|
749
749
|
try {
|
750
750
|
const server = await createServer({
|
751
751
|
root,
|
@@ -839,7 +839,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
839
839
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
840
840
|
async (root, options) => {
|
841
841
|
filterDuplicateOptions(options);
|
842
|
-
const { createBuilder } = await import('./chunks/dep-
|
842
|
+
const { createBuilder } = await import('./chunks/dep-CfG9u7Cn.js').then(function (n) { return n.T; });
|
843
843
|
const buildOptions = cleanGlobalCLIOptions(
|
844
844
|
cleanBuilderCLIOptions(options)
|
845
845
|
);
|
@@ -869,13 +869,16 @@ ${e.stack}`),
|
|
869
869
|
}
|
870
870
|
}
|
871
871
|
);
|
872
|
-
cli.command(
|
872
|
+
cli.command(
|
873
|
+
"optimize [root]",
|
874
|
+
"pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)"
|
875
|
+
).option(
|
873
876
|
"--force",
|
874
877
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
875
878
|
).action(
|
876
879
|
async (root, options) => {
|
877
880
|
filterDuplicateOptions(options);
|
878
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
881
|
+
const { optimizeDeps } = await import('./chunks/dep-CfG9u7Cn.js').then(function (n) { return n.R; });
|
879
882
|
try {
|
880
883
|
const config = await resolveConfig(
|
881
884
|
{
|
@@ -902,7 +905,7 @@ ${e.stack}`),
|
|
902
905
|
cli.command("preview [root]", "locally preview production build").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("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
|
903
906
|
async (root, options) => {
|
904
907
|
filterDuplicateOptions(options);
|
905
|
-
const { preview } = await import('./chunks/dep-
|
908
|
+
const { preview } = await import('./chunks/dep-CfG9u7Cn.js').then(function (n) { return n.U; });
|
906
909
|
try {
|
907
910
|
const server = await preview({
|
908
911
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -1025,6 +1025,8 @@ interface DepOptimizationMetadata {
|
|
1025
1025
|
/**
|
1026
1026
|
* Scan and optimize dependencies within a project.
|
1027
1027
|
* Used by Vite CLI when running `vite optimize`.
|
1028
|
+
*
|
1029
|
+
* @deprecated the optimization process runs automatically and does not need to be called
|
1028
1030
|
*/
|
1029
1031
|
declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
1030
1032
|
|
@@ -3962,7 +3964,7 @@ interface ResolvedWorkerOptions {
|
|
3962
3964
|
interface InlineConfig extends UserConfig {
|
3963
3965
|
configFile?: string | false;
|
3964
3966
|
/** @experimental */
|
3965
|
-
configLoader?: 'bundle' | 'runner';
|
3967
|
+
configLoader?: 'bundle' | 'runner' | 'native';
|
3966
3968
|
envFile?: false;
|
3967
3969
|
forceOptimizeDeps?: boolean;
|
3968
3970
|
}
|
@@ -4024,7 +4026,7 @@ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 's
|
|
4024
4026
|
|
4025
4027
|
): Promise<ResolvedConfig>;
|
4026
4028
|
declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
4027
|
-
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: 'bundle' | 'runner'): Promise<{
|
4029
|
+
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: 'bundle' | 'runner' | 'native'): Promise<{
|
4028
4030
|
path: string;
|
4029
4031
|
config: UserConfig;
|
4030
4032
|
dependencies: string[];
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, a as arraify } from './chunks/dep-
|
3
|
-
export { B as BuildEnvironment, D as DevEnvironment, 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-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-CfG9u7Cn.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, 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-CfG9u7Cn.js';
|
4
4
|
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';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import 'node:fs';
|
@@ -6311,7 +6311,7 @@ function expandValue (value, processEnv, runningParsed) {
|
|
6311
6311
|
|
6312
6312
|
function expand (options) {
|
6313
6313
|
// for use with progressive expansion
|
6314
|
-
const runningParsed = {}
|
6314
|
+
// const runningParsed = {}
|
6315
6315
|
|
6316
6316
|
let processEnv = process.env;
|
6317
6317
|
if (options && options.processEnv != null) {
|
@@ -6326,13 +6326,15 @@ function expand (options) {
|
|
6326
6326
|
if (processEnv[key] && processEnv[key] !== value) {
|
6327
6327
|
value = processEnv[key];
|
6328
6328
|
} else {
|
6329
|
-
|
6329
|
+
// PATCH: we pass options.parsed instead of runningParsed
|
6330
|
+
// to allow variables declared in other files to be used
|
6331
|
+
value = expandValue(value, processEnv, options.parsed);
|
6330
6332
|
}
|
6331
6333
|
|
6332
6334
|
options.parsed[key] = _resolveEscapeSequences(value);
|
6333
6335
|
|
6334
6336
|
// for use with progressive expansion
|
6335
|
-
runningParsed[key] = _resolveEscapeSequences(value)
|
6337
|
+
// runningParsed[key] = _resolveEscapeSequences(value)
|
6336
6338
|
}
|
6337
6339
|
|
6338
6340
|
for (const processKey in options.parsed) {
|