vite 6.3.0-beta.1 → 6.3.0-beta.2
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 +0 -15
- package/dist/client/client.mjs +43 -10
- package/dist/node/chunks/{dep-DPsCJVuU.js → dep-B8BdvHtp.js} +1 -1
- package/dist/node/chunks/{dep-W4lxOTyg.js → dep-BVYvZuv7.js} +1 -1
- package/dist/node/chunks/{dep-CY3sqczG.js → dep-jcjTW_IO.js} +106 -810
- package/dist/node/cli.js +6 -5
- package/dist/node/index.d.ts +8 -3
- package/dist/node/index.js +3 -2
- package/dist/node/module-runner.js +63 -61
- package/package.json +2 -1
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-jcjTW_IO.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -13,6 +13,7 @@ import 'picomatch';
|
|
13
13
|
import 'esbuild';
|
14
14
|
import 'path';
|
15
15
|
import 'fs';
|
16
|
+
import 'fdir';
|
16
17
|
import 'node:child_process';
|
17
18
|
import 'node:http';
|
18
19
|
import 'node:https';
|
@@ -747,7 +748,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
747
748
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
748
749
|
).action(async (root, options) => {
|
749
750
|
filterDuplicateOptions(options);
|
750
|
-
const { createServer } = await import('./chunks/dep-
|
751
|
+
const { createServer } = await import('./chunks/dep-jcjTW_IO.js').then(function (n) { return n.S; });
|
751
752
|
try {
|
752
753
|
const server = await createServer({
|
753
754
|
root,
|
@@ -842,7 +843,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
842
843
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
843
844
|
async (root, options) => {
|
844
845
|
filterDuplicateOptions(options);
|
845
|
-
const { createBuilder } = await import('./chunks/dep-
|
846
|
+
const { createBuilder } = await import('./chunks/dep-jcjTW_IO.js').then(function (n) { return n.T; });
|
846
847
|
const buildOptions = cleanGlobalCLIOptions(
|
847
848
|
cleanBuilderCLIOptions(options)
|
848
849
|
);
|
@@ -881,7 +882,7 @@ cli.command(
|
|
881
882
|
).action(
|
882
883
|
async (root, options) => {
|
883
884
|
filterDuplicateOptions(options);
|
884
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
885
|
+
const { optimizeDeps } = await import('./chunks/dep-jcjTW_IO.js').then(function (n) { return n.R; });
|
885
886
|
try {
|
886
887
|
const config = await resolveConfig(
|
887
888
|
{
|
@@ -908,7 +909,7 @@ ${e.stack}`),
|
|
908
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(
|
909
910
|
async (root, options) => {
|
910
911
|
filterDuplicateOptions(options);
|
911
|
-
const { preview } = await import('./chunks/dep-
|
912
|
+
const { preview } = await import('./chunks/dep-jcjTW_IO.js').then(function (n) { return n.U; });
|
912
913
|
try {
|
913
914
|
const server = await preview({
|
914
915
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -3401,8 +3401,13 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
3401
3401
|
* The hook receives the following arguments:
|
3402
3402
|
*
|
3403
3403
|
* - html: string
|
3404
|
-
* - ctx
|
3405
|
-
*
|
3404
|
+
* - ctx: IndexHtmlTransformContext, which contains:
|
3405
|
+
* - path: public path when served
|
3406
|
+
* - filename: filename on disk
|
3407
|
+
* - server?: ViteDevServer (only present during serve)
|
3408
|
+
* - bundle?: rollup.OutputBundle (only present during build)
|
3409
|
+
* - chunk?: rollup.OutputChunk
|
3410
|
+
* - originalUrl?: string
|
3406
3411
|
*
|
3407
3412
|
* It can either return a transformed string, or a list of html tag
|
3408
3413
|
* descriptors that will be injected into the `<head>` or `<body>`.
|
@@ -3741,7 +3746,7 @@ type ResolvedEnvironmentOptions = {
|
|
3741
3746
|
dev: ResolvedDevEnvironmentOptions;
|
3742
3747
|
build: ResolvedBuildEnvironmentOptions;
|
3743
3748
|
};
|
3744
|
-
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'consumer' | 'resolve'> & {
|
3749
|
+
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'consumer' | 'resolve' | 'keepProcessEnv'> & {
|
3745
3750
|
resolve?: AllResolveOptions;
|
3746
3751
|
};
|
3747
3752
|
interface UserConfig extends DefaultEnvironmentOptions {
|
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-jcjTW_IO.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-jcjTW_IO.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';
|
@@ -14,6 +14,7 @@ import 'node:crypto';
|
|
14
14
|
import 'picomatch';
|
15
15
|
import 'path';
|
16
16
|
import 'fs';
|
17
|
+
import 'fdir';
|
17
18
|
import 'node:child_process';
|
18
19
|
import 'node:http';
|
19
20
|
import 'node:https';
|
@@ -722,67 +722,9 @@ const createInvokeableTransport = (transport) => {
|
|
722
722
|
debug: (...msg) => console.log("[vite]", ...msg),
|
723
723
|
error: (error) => console.log("[vite]", error)
|
724
724
|
};
|
725
|
-
function createHMRHandler(
|
725
|
+
function createHMRHandler(handler) {
|
726
726
|
const queue = new Queue();
|
727
|
-
return (payload) => queue.enqueue(() =>
|
728
|
-
}
|
729
|
-
async function handleHotPayload(runner, payload) {
|
730
|
-
const hmrClient = runner.hmrClient;
|
731
|
-
if (!(!hmrClient || runner.isClosed()))
|
732
|
-
switch (payload.type) {
|
733
|
-
case "connected":
|
734
|
-
hmrClient.logger.debug("connected.");
|
735
|
-
break;
|
736
|
-
case "update":
|
737
|
-
await hmrClient.notifyListeners("vite:beforeUpdate", payload), await Promise.all(
|
738
|
-
payload.updates.map(async (update) => {
|
739
|
-
if (update.type === "js-update")
|
740
|
-
return update.acceptedPath = unwrapId(update.acceptedPath), update.path = unwrapId(update.path), hmrClient.queueUpdate(update);
|
741
|
-
hmrClient.logger.error("css hmr is not supported in runner mode.");
|
742
|
-
})
|
743
|
-
), await hmrClient.notifyListeners("vite:afterUpdate", payload);
|
744
|
-
break;
|
745
|
-
case "custom": {
|
746
|
-
await hmrClient.notifyListeners(payload.event, payload.data);
|
747
|
-
break;
|
748
|
-
}
|
749
|
-
case "full-reload": {
|
750
|
-
const { triggeredBy } = payload, clearEntrypointUrls = triggeredBy ? getModulesEntrypoints(
|
751
|
-
runner,
|
752
|
-
getModulesByFile(runner, slash(triggeredBy))
|
753
|
-
) : findAllEntrypoints(runner);
|
754
|
-
if (!clearEntrypointUrls.size) break;
|
755
|
-
hmrClient.logger.debug("program reload"), await hmrClient.notifyListeners("vite:beforeFullReload", payload), runner.evaluatedModules.clear();
|
756
|
-
for (const url of clearEntrypointUrls)
|
757
|
-
try {
|
758
|
-
await runner.import(url);
|
759
|
-
} catch (err) {
|
760
|
-
err.code !== ERR_OUTDATED_OPTIMIZED_DEP && hmrClient.logger.error(
|
761
|
-
`An error happened during full reload
|
762
|
-
${err.message}
|
763
|
-
${err.stack}`
|
764
|
-
);
|
765
|
-
}
|
766
|
-
break;
|
767
|
-
}
|
768
|
-
case "prune":
|
769
|
-
await hmrClient.notifyListeners("vite:beforePrune", payload), await hmrClient.prunePaths(payload.paths);
|
770
|
-
break;
|
771
|
-
case "error": {
|
772
|
-
await hmrClient.notifyListeners("vite:error", payload);
|
773
|
-
const err = payload.err;
|
774
|
-
hmrClient.logger.error(
|
775
|
-
`Internal Server Error
|
776
|
-
${err.message}
|
777
|
-
${err.stack}`
|
778
|
-
);
|
779
|
-
break;
|
780
|
-
}
|
781
|
-
case "ping":
|
782
|
-
break;
|
783
|
-
default:
|
784
|
-
return payload;
|
785
|
-
}
|
727
|
+
return (payload) => queue.enqueue(() => handler(payload));
|
786
728
|
}
|
787
729
|
class Queue {
|
788
730
|
queue = [];
|
@@ -805,6 +747,66 @@ class Queue {
|
|
805
747
|
}), !0) : !1;
|
806
748
|
}
|
807
749
|
}
|
750
|
+
function createHMRHandlerForRunner(runner) {
|
751
|
+
return createHMRHandler(async (payload) => {
|
752
|
+
const hmrClient = runner.hmrClient;
|
753
|
+
if (!(!hmrClient || runner.isClosed()))
|
754
|
+
switch (payload.type) {
|
755
|
+
case "connected":
|
756
|
+
hmrClient.logger.debug("connected.");
|
757
|
+
break;
|
758
|
+
case "update":
|
759
|
+
await hmrClient.notifyListeners("vite:beforeUpdate", payload), await Promise.all(
|
760
|
+
payload.updates.map(async (update) => {
|
761
|
+
if (update.type === "js-update")
|
762
|
+
return update.acceptedPath = unwrapId(update.acceptedPath), update.path = unwrapId(update.path), hmrClient.queueUpdate(update);
|
763
|
+
hmrClient.logger.error("css hmr is not supported in runner mode.");
|
764
|
+
})
|
765
|
+
), await hmrClient.notifyListeners("vite:afterUpdate", payload);
|
766
|
+
break;
|
767
|
+
case "custom": {
|
768
|
+
await hmrClient.notifyListeners(payload.event, payload.data);
|
769
|
+
break;
|
770
|
+
}
|
771
|
+
case "full-reload": {
|
772
|
+
const { triggeredBy } = payload, clearEntrypointUrls = triggeredBy ? getModulesEntrypoints(
|
773
|
+
runner,
|
774
|
+
getModulesByFile(runner, slash(triggeredBy))
|
775
|
+
) : findAllEntrypoints(runner);
|
776
|
+
if (!clearEntrypointUrls.size) break;
|
777
|
+
hmrClient.logger.debug("program reload"), await hmrClient.notifyListeners("vite:beforeFullReload", payload), runner.evaluatedModules.clear();
|
778
|
+
for (const url of clearEntrypointUrls)
|
779
|
+
try {
|
780
|
+
await runner.import(url);
|
781
|
+
} catch (err) {
|
782
|
+
err.code !== ERR_OUTDATED_OPTIMIZED_DEP && hmrClient.logger.error(
|
783
|
+
`An error happened during full reload
|
784
|
+
${err.message}
|
785
|
+
${err.stack}`
|
786
|
+
);
|
787
|
+
}
|
788
|
+
break;
|
789
|
+
}
|
790
|
+
case "prune":
|
791
|
+
await hmrClient.notifyListeners("vite:beforePrune", payload), await hmrClient.prunePaths(payload.paths);
|
792
|
+
break;
|
793
|
+
case "error": {
|
794
|
+
await hmrClient.notifyListeners("vite:error", payload);
|
795
|
+
const err = payload.err;
|
796
|
+
hmrClient.logger.error(
|
797
|
+
`Internal Server Error
|
798
|
+
${err.message}
|
799
|
+
${err.stack}`
|
800
|
+
);
|
801
|
+
break;
|
802
|
+
}
|
803
|
+
case "ping":
|
804
|
+
break;
|
805
|
+
default:
|
806
|
+
return payload;
|
807
|
+
}
|
808
|
+
});
|
809
|
+
}
|
808
810
|
function getModulesByFile(runner, file) {
|
809
811
|
const nodes = runner.evaluatedModules.getModulesByFile(file);
|
810
812
|
return nodes ? [...nodes].map((node) => node.id) : [];
|
@@ -1078,7 +1080,7 @@ class ModuleRunner {
|
|
1078
1080
|
throw new Error(
|
1079
1081
|
"HMR is not supported by this runner transport, but `hmr` option was set to true"
|
1080
1082
|
);
|
1081
|
-
this.transport.connect(
|
1083
|
+
this.transport.connect(createHMRHandlerForRunner(this));
|
1082
1084
|
} else
|
1083
1085
|
this.transport.connect?.();
|
1084
1086
|
options.sourcemapInterceptor !== !1 && (this.resetSourceMapSupport = enableSourceMapSupport(this));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "6.3.0-beta.
|
3
|
+
"version": "6.3.0-beta.2",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -73,6 +73,7 @@
|
|
73
73
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
74
74
|
"dependencies": {
|
75
75
|
"esbuild": "^0.25.0",
|
76
|
+
"fdir": "^6.4.3",
|
76
77
|
"picomatch": "^4.0.2",
|
77
78
|
"postcss": "^8.5.3",
|
78
79
|
"rollup": "^4.34.9",
|