vite 6.3.0-beta.2 → 6.3.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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/dist/client/client.mjs +19 -9
- package/dist/node/chunks/{dep-jcjTW_IO.js → dep-BuM4AdeL.js} +35 -23
- package/dist/node/chunks/{dep-B8BdvHtp.js → dep-CQ6IcQaf.js} +1 -1
- package/dist/node/chunks/{dep-BVYvZuv7.js → dep-KUFMcaC7.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +1 -0
- package/dist/node/module-runner.js +20 -9
- package/package.json +1 -1
- package/types/customEvent.d.ts +1 -0
- package/types/hmrPayload.d.ts +2 -0
package/dist/client/client.mjs
CHANGED
@@ -56,13 +56,16 @@ class HMRContext {
|
|
56
56
|
decline() {
|
57
57
|
}
|
58
58
|
invalidate(message) {
|
59
|
+
const firstInvalidatedBy = this.hmrClient.currentFirstInvalidatedBy ?? this.ownerPath;
|
59
60
|
this.hmrClient.notifyListeners("vite:invalidate", {
|
60
61
|
path: this.ownerPath,
|
61
|
-
message
|
62
|
+
message,
|
63
|
+
firstInvalidatedBy
|
62
64
|
});
|
63
65
|
this.send("vite:invalidate", {
|
64
66
|
path: this.ownerPath,
|
65
|
-
message
|
67
|
+
message,
|
68
|
+
firstInvalidatedBy
|
66
69
|
});
|
67
70
|
this.hmrClient.logger.debug(
|
68
71
|
`invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`
|
@@ -184,7 +187,7 @@ class HMRClient {
|
|
184
187
|
}
|
185
188
|
}
|
186
189
|
async fetchUpdate(update) {
|
187
|
-
const { path, acceptedPath } = update;
|
190
|
+
const { path, acceptedPath, firstInvalidatedBy } = update;
|
188
191
|
const mod = this.hotModulesMap.get(path);
|
189
192
|
if (!mod) {
|
190
193
|
return;
|
@@ -204,13 +207,20 @@ class HMRClient {
|
|
204
207
|
}
|
205
208
|
}
|
206
209
|
return () => {
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
210
|
+
try {
|
211
|
+
this.currentFirstInvalidatedBy = firstInvalidatedBy;
|
212
|
+
for (const { deps, fn } of qualifiedCallbacks) {
|
213
|
+
fn(
|
214
|
+
deps.map(
|
215
|
+
(dep) => dep === acceptedPath ? fetchedModule : void 0
|
216
|
+
)
|
217
|
+
);
|
218
|
+
}
|
219
|
+
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
220
|
+
this.logger.debug(`hot updated: ${loggedPath}`);
|
221
|
+
} finally {
|
222
|
+
this.currentFirstInvalidatedBy = void 0;
|
211
223
|
}
|
212
|
-
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
213
|
-
this.logger.debug(`hot updated: ${loggedPath}`);
|
214
224
|
};
|
215
225
|
}
|
216
226
|
}
|
@@ -7510,6 +7510,15 @@ const teardownSIGTERMListener = (callback) => {
|
|
7510
7510
|
}
|
7511
7511
|
}
|
7512
7512
|
};
|
7513
|
+
function getServerUrlByHost(server, host) {
|
7514
|
+
if (typeof host !== "string") {
|
7515
|
+
return server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];
|
7516
|
+
}
|
7517
|
+
return [
|
7518
|
+
...server.resolvedUrls?.local ?? [],
|
7519
|
+
...server.resolvedUrls?.network ?? []
|
7520
|
+
].find((url) => url.includes(host));
|
7521
|
+
}
|
7513
7522
|
|
7514
7523
|
const LogLevels = {
|
7515
7524
|
silent: 0,
|
@@ -38416,15 +38425,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
38416
38425
|
},
|
38417
38426
|
openBrowser() {
|
38418
38427
|
const options2 = server.config.server;
|
38419
|
-
const
|
38420
|
-
let url;
|
38421
|
-
if (typeof host === "string") {
|
38422
|
-
url = [
|
38423
|
-
...server.resolvedUrls?.local ?? [],
|
38424
|
-
...server.resolvedUrls?.network ?? []
|
38425
|
-
].find((url2) => url2.includes(host));
|
38426
|
-
}
|
38427
|
-
url ??= server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];
|
38428
|
+
const url = getServerUrlByHost(server, options2.host);
|
38428
38429
|
if (url) {
|
38429
38430
|
const path2 = typeof options2.open === "string" ? new URL(options2.open, url).href : url;
|
38430
38431
|
if (server.config.server.preTransformRequests) {
|
@@ -39222,7 +39223,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
39222
39223
|
});
|
39223
39224
|
await hotUpdateEnvironments(server, hmr);
|
39224
39225
|
}
|
39225
|
-
function updateModules(environment, file, modules, timestamp,
|
39226
|
+
function updateModules(environment, file, modules, timestamp, firstInvalidatedBy) {
|
39226
39227
|
const { hot } = environment;
|
39227
39228
|
const updates = [];
|
39228
39229
|
const invalidatedModules = /* @__PURE__ */ new Set();
|
@@ -39244,6 +39245,12 @@ function updateModules(environment, file, modules, timestamp, afterInvalidation)
|
|
39244
39245
|
needFullReload = hasDeadEnd;
|
39245
39246
|
continue;
|
39246
39247
|
}
|
39248
|
+
if (firstInvalidatedBy && boundaries.some(
|
39249
|
+
({ acceptedVia }) => normalizeHmrUrl(acceptedVia.url) === firstInvalidatedBy
|
39250
|
+
)) {
|
39251
|
+
needFullReload = "circular import invalidate";
|
39252
|
+
continue;
|
39253
|
+
}
|
39247
39254
|
updates.push(
|
39248
39255
|
...boundaries.map(
|
39249
39256
|
({ boundary, acceptedVia, isWithinCircularImport }) => ({
|
@@ -39252,7 +39259,8 @@ function updateModules(environment, file, modules, timestamp, afterInvalidation)
|
|
39252
39259
|
path: normalizeHmrUrl(boundary.url),
|
39253
39260
|
acceptedPath: normalizeHmrUrl(acceptedVia.url),
|
39254
39261
|
explicitImportRequired: boundary.type === "js" ? isExplicitImportRequired(acceptedVia.url) : false,
|
39255
|
-
isWithinCircularImport
|
39262
|
+
isWithinCircularImport,
|
39263
|
+
firstInvalidatedBy
|
39256
39264
|
})
|
39257
39265
|
)
|
39258
39266
|
);
|
@@ -39261,7 +39269,7 @@ function updateModules(environment, file, modules, timestamp, afterInvalidation)
|
|
39261
39269
|
const reason = typeof needFullReload === "string" ? colors$1.dim(` (${needFullReload})`) : "";
|
39262
39270
|
environment.logger.info(
|
39263
39271
|
colors$1.green(`page reload `) + colors$1.dim(file) + reason,
|
39264
|
-
{ clear: !
|
39272
|
+
{ clear: !firstInvalidatedBy, timestamp: true }
|
39265
39273
|
);
|
39266
39274
|
hot.send({
|
39267
39275
|
type: "full-reload",
|
@@ -39275,7 +39283,7 @@ function updateModules(environment, file, modules, timestamp, afterInvalidation)
|
|
39275
39283
|
}
|
39276
39284
|
environment.logger.info(
|
39277
39285
|
colors$1.green(`hmr update `) + colors$1.dim([...new Set(updates.map((u) => u.path))].join(", ")),
|
39278
|
-
{ clear: !
|
39286
|
+
{ clear: !firstInvalidatedBy, timestamp: true }
|
39279
39287
|
);
|
39280
39288
|
hot.send({
|
39281
39289
|
type: "update",
|
@@ -43818,8 +43826,8 @@ function createCachedImport(imp) {
|
|
43818
43826
|
return cached;
|
43819
43827
|
};
|
43820
43828
|
}
|
43821
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
43822
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
43829
|
+
const importPostcssImport = createCachedImport(() => import('./dep-KUFMcaC7.js').then(function (n) { return n.i; }));
|
43830
|
+
const importPostcssModules = createCachedImport(() => import('./dep-CQ6IcQaf.js').then(function (n) { return n.i; }));
|
43823
43831
|
const importPostcss = createCachedImport(() => import('postcss'));
|
43824
43832
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
43825
43833
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -47754,12 +47762,16 @@ class DevEnvironment extends BaseEnvironment {
|
|
47754
47762
|
return this.fetchModule(id, importer, options2);
|
47755
47763
|
}
|
47756
47764
|
});
|
47757
|
-
this.hot.on(
|
47758
|
-
|
47759
|
-
|
47760
|
-
|
47761
|
-
|
47762
|
-
|
47765
|
+
this.hot.on(
|
47766
|
+
"vite:invalidate",
|
47767
|
+
async ({ path, message, firstInvalidatedBy }) => {
|
47768
|
+
invalidateModule(this, {
|
47769
|
+
path,
|
47770
|
+
message,
|
47771
|
+
firstInvalidatedBy
|
47772
|
+
});
|
47773
|
+
}
|
47774
|
+
);
|
47763
47775
|
const { optimizeDeps } = this.config;
|
47764
47776
|
if (context.depsOptimizer) {
|
47765
47777
|
this.depsOptimizer = context.depsOptimizer;
|
@@ -47873,7 +47885,7 @@ function invalidateModule(environment, m) {
|
|
47873
47885
|
file,
|
47874
47886
|
[...mod.importers],
|
47875
47887
|
mod.lastHMRTimestamp,
|
47876
|
-
|
47888
|
+
m.firstInvalidatedBy
|
47877
47889
|
);
|
47878
47890
|
}
|
47879
47891
|
}
|
@@ -48214,7 +48226,7 @@ async function preview(inlineConfig = {}) {
|
|
48214
48226
|
config
|
48215
48227
|
);
|
48216
48228
|
if (options.open) {
|
48217
|
-
const url = server
|
48229
|
+
const url = getServerUrlByHost(server, options.host);
|
48218
48230
|
if (url) {
|
48219
48231
|
const path2 = typeof options.open === "string" ? new URL(options.open, url).href : url;
|
48220
48232
|
openBrowser(path2, true, logger);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-BuM4AdeL.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-BuM4AdeL.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -748,7 +748,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
748
748
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
749
749
|
).action(async (root, options) => {
|
750
750
|
filterDuplicateOptions(options);
|
751
|
-
const { createServer } = await import('./chunks/dep-
|
751
|
+
const { createServer } = await import('./chunks/dep-BuM4AdeL.js').then(function (n) { return n.S; });
|
752
752
|
try {
|
753
753
|
const server = await createServer({
|
754
754
|
root,
|
@@ -843,7 +843,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
843
843
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
844
844
|
async (root, options) => {
|
845
845
|
filterDuplicateOptions(options);
|
846
|
-
const { createBuilder } = await import('./chunks/dep-
|
846
|
+
const { createBuilder } = await import('./chunks/dep-BuM4AdeL.js').then(function (n) { return n.T; });
|
847
847
|
const buildOptions = cleanGlobalCLIOptions(
|
848
848
|
cleanBuilderCLIOptions(options)
|
849
849
|
);
|
@@ -882,7 +882,7 @@ cli.command(
|
|
882
882
|
).action(
|
883
883
|
async (root, options) => {
|
884
884
|
filterDuplicateOptions(options);
|
885
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
885
|
+
const { optimizeDeps } = await import('./chunks/dep-BuM4AdeL.js').then(function (n) { return n.R; });
|
886
886
|
try {
|
887
887
|
const config = await resolveConfig(
|
888
888
|
{
|
@@ -909,7 +909,7 @@ ${e.stack}`),
|
|
909
909
|
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(
|
910
910
|
async (root, options) => {
|
911
911
|
filterDuplicateOptions(options);
|
912
|
-
const { preview } = await import('./chunks/dep-
|
912
|
+
const { preview } = await import('./chunks/dep-BuM4AdeL.js').then(function (n) { return n.U; });
|
913
913
|
try {
|
914
914
|
const server = await preview({
|
915
915
|
root,
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { a as arraify, i as isInNodeModules, D as DevEnvironment } from './chunks/dep-
|
3
|
-
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-
|
2
|
+
import { a as arraify, i as isInNodeModules, D as DevEnvironment } from './chunks/dep-BuM4AdeL.js';
|
3
|
+
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-BuM4AdeL.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';
|
@@ -51,6 +51,7 @@ declare class HMRClient {
|
|
51
51
|
dataMap: Map<string, any>;
|
52
52
|
customListenersMap: CustomListenersMap;
|
53
53
|
ctxToListenersMap: Map<string, CustomListenersMap>;
|
54
|
+
currentFirstInvalidatedBy: string | undefined;
|
54
55
|
constructor(logger: HMRLogger, transport: NormalizedModuleRunnerTransport, importUpdatedModule: (update: Update) => Promise<ModuleNamespace>);
|
55
56
|
notifyListeners<T extends string>(event: T, data: InferCustomEventPayload<T>): Promise<void>;
|
56
57
|
send(payload: HotPayload): void;
|
@@ -383,12 +383,15 @@ class HMRContext {
|
|
383
383
|
decline() {
|
384
384
|
}
|
385
385
|
invalidate(message) {
|
386
|
+
const firstInvalidatedBy = this.hmrClient.currentFirstInvalidatedBy ?? this.ownerPath;
|
386
387
|
this.hmrClient.notifyListeners("vite:invalidate", {
|
387
388
|
path: this.ownerPath,
|
388
|
-
message
|
389
|
+
message,
|
390
|
+
firstInvalidatedBy
|
389
391
|
}), this.send("vite:invalidate", {
|
390
392
|
path: this.ownerPath,
|
391
|
-
message
|
393
|
+
message,
|
394
|
+
firstInvalidatedBy
|
392
395
|
}), this.hmrClient.logger.debug(
|
393
396
|
`invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`
|
394
397
|
);
|
@@ -439,6 +442,7 @@ class HMRClient {
|
|
439
442
|
dataMap = /* @__PURE__ */ new Map();
|
440
443
|
customListenersMap = /* @__PURE__ */ new Map();
|
441
444
|
ctxToListenersMap = /* @__PURE__ */ new Map();
|
445
|
+
currentFirstInvalidatedBy;
|
442
446
|
async notifyListeners(event, data) {
|
443
447
|
const cbs = this.customListenersMap.get(event);
|
444
448
|
cbs && await Promise.allSettled(cbs.map((cb) => cb(data)));
|
@@ -485,7 +489,7 @@ class HMRClient {
|
|
485
489
|
}
|
486
490
|
}
|
487
491
|
async fetchUpdate(update) {
|
488
|
-
const { path, acceptedPath } = update, mod = this.hotModulesMap.get(path);
|
492
|
+
const { path, acceptedPath, firstInvalidatedBy } = update, mod = this.hotModulesMap.get(path);
|
489
493
|
if (!mod)
|
490
494
|
return;
|
491
495
|
let fetchedModule;
|
@@ -502,12 +506,19 @@ class HMRClient {
|
|
502
506
|
}
|
503
507
|
}
|
504
508
|
return () => {
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
509
|
+
try {
|
510
|
+
this.currentFirstInvalidatedBy = firstInvalidatedBy;
|
511
|
+
for (const { deps, fn } of qualifiedCallbacks)
|
512
|
+
fn(
|
513
|
+
deps.map(
|
514
|
+
(dep) => dep === acceptedPath ? fetchedModule : void 0
|
515
|
+
)
|
516
|
+
);
|
517
|
+
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
518
|
+
this.logger.debug(`hot updated: ${loggedPath}`);
|
519
|
+
} finally {
|
520
|
+
this.currentFirstInvalidatedBy = void 0;
|
521
|
+
}
|
511
522
|
};
|
512
523
|
}
|
513
524
|
}
|
package/package.json
CHANGED
package/types/customEvent.d.ts
CHANGED