vite 4.0.0-beta.2 → 4.0.0-beta.4
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-666774f5.js → dep-3f45d7c9.js} +7292 -7202
- package/dist/node/chunks/{dep-1c8247b5.js → dep-504e6b2a.js} +1 -1
- package/dist/node/cli.js +44 -13
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +3 -3
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0__default from 'fs';
|
|
2
2
|
import require$$0 from 'postcss';
|
|
3
|
-
import {
|
|
3
|
+
import { C as commonjsGlobal } from './dep-3f45d7c9.js';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import require$$5 from 'crypto';
|
|
6
6
|
import require$$0$2 from 'util';
|
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 { A as picocolors, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-3f45d7c9.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:module';
|
|
@@ -34,8 +34,8 @@ import 'node:http';
|
|
|
34
34
|
import 'node:https';
|
|
35
35
|
import 'rollup';
|
|
36
36
|
import 'querystring';
|
|
37
|
-
import 'node:readline';
|
|
38
37
|
import 'node:child_process';
|
|
38
|
+
import 'node:readline';
|
|
39
39
|
import 'node:zlib';
|
|
40
40
|
|
|
41
41
|
function toArr(any) {
|
|
@@ -652,22 +652,27 @@ class CAC extends EventEmitter {
|
|
|
652
652
|
const cac = (name = "") => new CAC(name);
|
|
653
653
|
|
|
654
654
|
const cli = cac('vite');
|
|
655
|
+
// @ts-ignore
|
|
656
|
+
let profileSession = global.__vite_profile_session;
|
|
657
|
+
let profileCount = 0;
|
|
655
658
|
const stopProfiler = (log) => {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
+
if (!profileSession)
|
|
660
|
+
return;
|
|
661
|
+
return new Promise((res, rej) => {
|
|
659
662
|
profileSession.post('Profiler.stop', (err, { profile }) => {
|
|
660
663
|
// Write profile to disk, upload, etc.
|
|
661
664
|
if (!err) {
|
|
662
|
-
const outPath = path.resolve(
|
|
665
|
+
const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`);
|
|
663
666
|
fs.writeFileSync(outPath, JSON.stringify(profile));
|
|
664
667
|
log(picocolors.exports.yellow(`CPU profile written to ${picocolors.exports.white(picocolors.exports.dim(outPath))}`));
|
|
668
|
+
profileSession = undefined;
|
|
669
|
+
res();
|
|
665
670
|
}
|
|
666
671
|
else {
|
|
667
|
-
|
|
672
|
+
rej(err);
|
|
668
673
|
}
|
|
669
674
|
});
|
|
670
|
-
}
|
|
675
|
+
});
|
|
671
676
|
};
|
|
672
677
|
const filterDuplicateOptions = (options) => {
|
|
673
678
|
for (const [key, value] of Object.entries(options)) {
|
|
@@ -720,7 +725,7 @@ cli
|
|
|
720
725
|
filterDuplicateOptions(options);
|
|
721
726
|
// output structure is preserved even after bundling so require()
|
|
722
727
|
// is ok here
|
|
723
|
-
const { createServer } = await import('./chunks/dep-
|
|
728
|
+
const { createServer } = await import('./chunks/dep-3f45d7c9.js').then(function (n) { return n.F; });
|
|
724
729
|
try {
|
|
725
730
|
const server = await createServer({
|
|
726
731
|
root,
|
|
@@ -744,7 +749,33 @@ cli
|
|
|
744
749
|
: '';
|
|
745
750
|
info(`\n ${picocolors.exports.green(`${picocolors.exports.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });
|
|
746
751
|
server.printUrls();
|
|
747
|
-
|
|
752
|
+
bindShortcuts(server, {
|
|
753
|
+
print: true,
|
|
754
|
+
customShortcuts: [
|
|
755
|
+
profileSession && {
|
|
756
|
+
key: 'p',
|
|
757
|
+
description: 'start/stop the profiler',
|
|
758
|
+
async action(server) {
|
|
759
|
+
if (profileSession) {
|
|
760
|
+
await stopProfiler(server.config.logger.info);
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
const inspector = await import('node:inspector').then((r) => r.default);
|
|
764
|
+
await new Promise((res) => {
|
|
765
|
+
profileSession = new inspector.Session();
|
|
766
|
+
profileSession.connect();
|
|
767
|
+
profileSession.post('Profiler.enable', () => {
|
|
768
|
+
profileSession.post('Profiler.start', () => {
|
|
769
|
+
server.config.logger.info('Profiler started');
|
|
770
|
+
res();
|
|
771
|
+
});
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
],
|
|
778
|
+
});
|
|
748
779
|
}
|
|
749
780
|
catch (e) {
|
|
750
781
|
const logger = createLogger(options.logLevel);
|
|
@@ -773,7 +804,7 @@ cli
|
|
|
773
804
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
774
805
|
.action(async (root, options) => {
|
|
775
806
|
filterDuplicateOptions(options);
|
|
776
|
-
const { build } = await import('./chunks/dep-
|
|
807
|
+
const { build } = await import('./chunks/dep-3f45d7c9.js').then(function (n) { return n.E; });
|
|
777
808
|
const buildOptions = cleanOptions(options);
|
|
778
809
|
try {
|
|
779
810
|
await build({
|
|
@@ -801,7 +832,7 @@ cli
|
|
|
801
832
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
802
833
|
.action(async (root, options) => {
|
|
803
834
|
filterDuplicateOptions(options);
|
|
804
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
835
|
+
const { optimizeDeps } = await import('./chunks/dep-3f45d7c9.js').then(function (n) { return n.D; });
|
|
805
836
|
try {
|
|
806
837
|
const config = await resolveConfig({
|
|
807
838
|
root,
|
|
@@ -826,7 +857,7 @@ cli
|
|
|
826
857
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
827
858
|
.action(async (root, options) => {
|
|
828
859
|
filterDuplicateOptions(options);
|
|
829
|
-
const { preview } = await import('./chunks/dep-
|
|
860
|
+
const { preview } = await import('./chunks/dep-3f45d7c9.js').then(function (n) { return n.G; });
|
|
830
861
|
try {
|
|
831
862
|
const server = await preview({
|
|
832
863
|
root,
|
package/dist/node/constants.js
CHANGED
|
@@ -37,7 +37,7 @@ const DEFAULT_CONFIG_FILES = [
|
|
|
37
37
|
'vite.config.cts',
|
|
38
38
|
];
|
|
39
39
|
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
40
|
-
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(
|
|
40
|
+
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
41
41
|
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
|
42
42
|
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
43
43
|
/**
|
package/dist/node/index.d.ts
CHANGED
|
@@ -124,6 +124,8 @@ export declare interface AwaitWriteFinishOptions {
|
|
|
124
124
|
*/
|
|
125
125
|
export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
|
|
126
126
|
|
|
127
|
+
export declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
|
128
|
+
|
|
127
129
|
export declare interface BuildOptions {
|
|
128
130
|
/**
|
|
129
131
|
* Compatibility transform target. The transform is performed with esbuild
|
|
@@ -2588,6 +2590,7 @@ export declare interface ViteDevServer {
|
|
|
2588
2590
|
/* Excluded from this release type: _forceOptimizeOnRestart */
|
|
2589
2591
|
/* Excluded from this release type: _pendingRequests */
|
|
2590
2592
|
/* Excluded from this release type: _fsDenyGlob */
|
|
2593
|
+
/* Excluded from this release type: _shortcutsOptions */
|
|
2591
2594
|
}
|
|
2592
2595
|
|
|
2593
2596
|
export declare interface WatchOptions {
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build,
|
|
1
|
+
export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-3f45d7c9.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -34,15 +34,15 @@ import 'tls';
|
|
|
34
34
|
import 'node:http';
|
|
35
35
|
import 'node:https';
|
|
36
36
|
import 'querystring';
|
|
37
|
-
import 'node:readline';
|
|
38
37
|
import 'node:child_process';
|
|
38
|
+
import 'node:readline';
|
|
39
39
|
import 'node:zlib';
|
|
40
40
|
|
|
41
41
|
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
|
42
42
|
// copy from constants.ts
|
|
43
43
|
const CSS_LANGS_RE =
|
|
44
44
|
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
45
|
-
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(
|
|
45
|
+
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
46
46
|
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
47
47
|
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
|
|
48
48
|
// We don't recommend using this strategy as a general solution moving forward
|
|
@@ -29,7 +29,7 @@ path$3.dirname(CLIENT_ENTRY);
|
|
|
29
29
|
// copy from constants.ts
|
|
30
30
|
const CSS_LANGS_RE =
|
|
31
31
|
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
32
|
-
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(
|
|
32
|
+
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
33
33
|
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
34
34
|
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
|
|
35
35
|
// We don't recommend using this strategy as a general solution moving forward
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"esbuild": "^0.
|
|
61
|
+
"esbuild": "^0.16.1",
|
|
62
62
|
"postcss": "^8.4.19",
|
|
63
63
|
"resolve": "^1.22.1",
|
|
64
64
|
"rollup": "^3.6.0"
|