vite 5.2.7 → 6.0.0-alpha.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/client/client.mjs +4 -1
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-C1QONNHf.js → dep-DUc_OVe8.js} +1 -1
- package/dist/node/chunks/{dep-ThQVBShq.js → dep-b2YSXG5U.js} +1 -1
- package/dist/node/chunks/{dep-C-KAszbv.js → dep-hQh5_mg-.js} +35156 -34048
- package/dist/node/cli.js +52 -23
- package/dist/node/index.d.ts +746 -388
- package/dist/node/index.js +57 -15
- package/dist/node/{types.d-aGj9QkWt.d.ts → module-runner.d.ts} +135 -82
- package/dist/node/{runtime.js → module-runner.js} +115 -83
- package/dist/node-cjs/publicUtils.cjs +2 -2
- package/package.json +6 -6
- package/types/hmrPayload.d.ts +1 -1
- package/dist/node/runtime.d.ts +0 -63
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import {
|
5
|
+
import { E as colors, x as createLogger, r as resolveConfig, F as Environment } from './chunks/dep-hQh5_mg-.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -26,20 +26,20 @@ import 'child_process';
|
|
26
26
|
import 'node:os';
|
27
27
|
import 'node:crypto';
|
28
28
|
import 'node:dns';
|
29
|
-
import 'crypto';
|
30
|
-
import 'module';
|
31
29
|
import 'node:assert';
|
32
30
|
import 'node:v8';
|
31
|
+
import 'module';
|
33
32
|
import 'node:worker_threads';
|
34
|
-
import 'node:buffer';
|
35
|
-
import 'node:events';
|
36
33
|
import 'rollup/parseAst';
|
37
|
-
import '
|
34
|
+
import 'node:events';
|
35
|
+
import 'crypto';
|
36
|
+
import 'node:buffer';
|
38
37
|
import 'node:readline';
|
39
38
|
import 'zlib';
|
40
39
|
import 'buffer';
|
41
40
|
import 'https';
|
42
41
|
import 'tls';
|
42
|
+
import 'querystring';
|
43
43
|
import 'node:zlib';
|
44
44
|
|
45
45
|
function toArr(any) {
|
@@ -687,7 +687,7 @@ const filterDuplicateOptions = (options) => {
|
|
687
687
|
/**
|
688
688
|
* removing global flags before passing as command specific sub-configs
|
689
689
|
*/
|
690
|
-
function
|
690
|
+
function cleanGlobalCLIOptions(options) {
|
691
691
|
const ret = { ...options };
|
692
692
|
delete ret['--'];
|
693
693
|
delete ret.c;
|
@@ -714,6 +714,15 @@ function cleanOptions(options) {
|
|
714
714
|
}
|
715
715
|
return ret;
|
716
716
|
}
|
717
|
+
/**
|
718
|
+
* removing builder flags before passing as command specific sub-configs
|
719
|
+
*/
|
720
|
+
function cleanBuilderCLIOptions(options) {
|
721
|
+
const ret = { ...options };
|
722
|
+
delete ret.environment;
|
723
|
+
delete ret.all;
|
724
|
+
return ret;
|
725
|
+
}
|
717
726
|
/**
|
718
727
|
* host may be a number (like 0), should convert to string
|
719
728
|
*/
|
@@ -757,7 +766,7 @@ cli
|
|
757
766
|
filterDuplicateOptions(options);
|
758
767
|
// output structure is preserved even after bundling so require()
|
759
768
|
// is ok here
|
760
|
-
const { createServer } = await import('./chunks/dep-
|
769
|
+
const { createServer } = await import('./chunks/dep-hQh5_mg-.js').then(function (n) { return n.I; });
|
761
770
|
try {
|
762
771
|
const server = await createServer({
|
763
772
|
root,
|
@@ -767,7 +776,7 @@ cli
|
|
767
776
|
logLevel: options.logLevel,
|
768
777
|
clearScreen: options.clearScreen,
|
769
778
|
optimizeDeps: { force: options.force },
|
770
|
-
server:
|
779
|
+
server: cleanGlobalCLIOptions(options),
|
771
780
|
});
|
772
781
|
if (!server.httpServer) {
|
773
782
|
throw new Error('HTTP server not available');
|
@@ -834,20 +843,39 @@ cli
|
|
834
843
|
.option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`)
|
835
844
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
836
845
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
846
|
+
.option('--environment [name]', `[string] build a single environment`)
|
847
|
+
.option('--all', `[boolean] build all environments`)
|
837
848
|
.action(async (root, options) => {
|
838
849
|
filterDuplicateOptions(options);
|
839
|
-
const { build } = await import('./chunks/dep-
|
840
|
-
const buildOptions =
|
850
|
+
const { build, createViteBuilder } = await import('./chunks/dep-hQh5_mg-.js').then(function (n) { return n.K; });
|
851
|
+
const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
|
852
|
+
const config = {
|
853
|
+
root,
|
854
|
+
base: options.base,
|
855
|
+
mode: options.mode,
|
856
|
+
configFile: options.config,
|
857
|
+
logLevel: options.logLevel,
|
858
|
+
clearScreen: options.clearScreen,
|
859
|
+
build: buildOptions,
|
860
|
+
};
|
841
861
|
try {
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
862
|
+
if (options.all || options.environment) {
|
863
|
+
const builder = await createViteBuilder({}, config);
|
864
|
+
if (options.environment) {
|
865
|
+
const environment = builder.environments[options.environment];
|
866
|
+
if (!environment) {
|
867
|
+
throw new Error(`The environment ${options.environment} isn't configured.`);
|
868
|
+
}
|
869
|
+
await builder.build(environment);
|
870
|
+
}
|
871
|
+
else {
|
872
|
+
// --all: build all environments
|
873
|
+
await builder.buildEnvironments();
|
874
|
+
}
|
875
|
+
}
|
876
|
+
else {
|
877
|
+
await build(config);
|
878
|
+
}
|
851
879
|
}
|
852
880
|
catch (e) {
|
853
881
|
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
|
@@ -863,7 +891,7 @@ cli
|
|
863
891
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
864
892
|
.action(async (root, options) => {
|
865
893
|
filterDuplicateOptions(options);
|
866
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
894
|
+
const { optimizeDeps } = await import('./chunks/dep-hQh5_mg-.js').then(function (n) { return n.J; });
|
867
895
|
try {
|
868
896
|
const config = await resolveConfig({
|
869
897
|
root,
|
@@ -872,7 +900,8 @@ cli
|
|
872
900
|
logLevel: options.logLevel,
|
873
901
|
mode: options.mode,
|
874
902
|
}, 'serve');
|
875
|
-
|
903
|
+
const environment = new Environment('client', config);
|
904
|
+
await optimizeDeps(environment, options.force, true);
|
876
905
|
}
|
877
906
|
catch (e) {
|
878
907
|
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
@@ -889,7 +918,7 @@ cli
|
|
889
918
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
890
919
|
.action(async (root, options) => {
|
891
920
|
filterDuplicateOptions(options);
|
892
|
-
const { preview } = await import('./chunks/dep-
|
921
|
+
const { preview } = await import('./chunks/dep-hQh5_mg-.js').then(function (n) { return n.L; });
|
893
922
|
try {
|
894
923
|
const server = await preview({
|
895
924
|
root,
|