vite 5.0.0-beta.9 → 5.0.1

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/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 { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-ffdf177d.js';
5
+ import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-VPh1kAXQ.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -14,6 +14,7 @@ import 'path';
14
14
  import 'fs';
15
15
  import 'assert';
16
16
  import 'node:http';
17
+ import 'node:https';
17
18
  import 'util';
18
19
  import 'net';
19
20
  import 'url';
@@ -32,10 +33,10 @@ import 'node:assert';
32
33
  import 'node:process';
33
34
  import 'node:v8';
34
35
  import 'rollup';
36
+ import 'rollup/parseAst';
35
37
  import 'querystring';
36
38
  import 'node:readline';
37
39
  import 'node:events';
38
- import 'node:https';
39
40
  import 'zlib';
40
41
  import 'buffer';
41
42
  import 'https';
@@ -750,7 +751,6 @@ cli
750
751
  .alias('dev') // alias to align with the script name
751
752
  .option('--host [host]', `[string] specify hostname`, { type: [convertHost] })
752
753
  .option('--port <port>', `[number] specify port`)
753
- .option('--https', `[boolean] use TLS + HTTP/2`)
754
754
  .option('--open [path]', `[boolean | string] open browser on startup`)
755
755
  .option('--cors', `[boolean] enable CORS`)
756
756
  .option('--strictPort', `[boolean] exit if specified port is already in use`)
@@ -759,7 +759,7 @@ cli
759
759
  filterDuplicateOptions(options);
760
760
  // output structure is preserved even after bundling so require()
761
761
  // is ok here
762
- const { createServer } = await import('./chunks/dep-ffdf177d.js').then(function (n) { return n.C; });
762
+ const { createServer } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.A; });
763
763
  try {
764
764
  const server = await createServer({
765
765
  root,
@@ -780,38 +780,37 @@ cli
780
780
  const startupDurationString = viteStartTime
781
781
  ? colors.dim(`ready in ${colors.reset(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
782
782
  : '';
783
+ const hasExistingLogs = process.stdout.bytesWritten > 0 || process.stderr.bytesWritten > 0;
783
784
  info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, {
784
- clear: !server.config.logger.hasWarned &&
785
- !globalThis.__vite_cjs_skip_clear_screen,
785
+ clear: !hasExistingLogs,
786
786
  });
787
787
  server.printUrls();
788
- server.bindCLIShortcuts({
789
- print: true,
790
- customShortcuts: [
791
- profileSession && {
792
- key: 'p',
793
- description: 'start/stop the profiler',
794
- async action(server) {
795
- if (profileSession) {
796
- await stopProfiler(server.config.logger.info);
797
- }
798
- else {
799
- const inspector = await import('node:inspector').then((r) => r.default);
800
- await new Promise((res) => {
801
- profileSession = new inspector.Session();
802
- profileSession.connect();
803
- profileSession.post('Profiler.enable', () => {
804
- profileSession.post('Profiler.start', () => {
805
- server.config.logger.info('Profiler started');
806
- res();
807
- });
788
+ const customShortcuts = [];
789
+ if (profileSession) {
790
+ customShortcuts.push({
791
+ key: 'p',
792
+ description: 'start/stop the profiler',
793
+ async action(server) {
794
+ if (profileSession) {
795
+ await stopProfiler(server.config.logger.info);
796
+ }
797
+ else {
798
+ const inspector = await import('node:inspector').then((r) => r.default);
799
+ await new Promise((res) => {
800
+ profileSession = new inspector.Session();
801
+ profileSession.connect();
802
+ profileSession.post('Profiler.enable', () => {
803
+ profileSession.post('Profiler.start', () => {
804
+ server.config.logger.info('Profiler started');
805
+ res();
808
806
  });
809
807
  });
810
- }
811
- },
808
+ });
809
+ }
812
810
  },
813
- ],
814
- });
811
+ });
812
+ }
813
+ server.bindCLIShortcuts({ print: true, customShortcuts });
815
814
  }
816
815
  catch (e) {
817
816
  const logger = createLogger(options.logLevel);
@@ -840,7 +839,7 @@ cli
840
839
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
841
840
  .action(async (root, options) => {
842
841
  filterDuplicateOptions(options);
843
- const { build } = await import('./chunks/dep-ffdf177d.js').then(function (n) { return n.B; });
842
+ const { build } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.C; });
844
843
  const buildOptions = cleanOptions(options);
845
844
  try {
846
845
  await build({
@@ -868,7 +867,7 @@ cli
868
867
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
869
868
  .action(async (root, options) => {
870
869
  filterDuplicateOptions(options);
871
- const { optimizeDeps } = await import('./chunks/dep-ffdf177d.js').then(function (n) { return n.A; });
870
+ const { optimizeDeps } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.B; });
872
871
  try {
873
872
  const config = await resolveConfig({
874
873
  root,
@@ -890,12 +889,11 @@ cli
890
889
  .option('--host [host]', `[string] specify hostname`, { type: [convertHost] })
891
890
  .option('--port <port>', `[number] specify port`)
892
891
  .option('--strictPort', `[boolean] exit if specified port is already in use`)
893
- .option('--https', `[boolean] use TLS + HTTP/2`)
894
892
  .option('--open [path]', `[boolean | string] open browser on startup`)
895
893
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
896
894
  .action(async (root, options) => {
897
895
  filterDuplicateOptions(options);
898
- const { preview } = await import('./chunks/dep-ffdf177d.js').then(function (n) { return n.D; });
896
+ const { preview } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.D; });
899
897
  try {
900
898
  const server = await preview({
901
899
  root,
@@ -910,7 +908,6 @@ cli
910
908
  port: options.port,
911
909
  strictPort: options.strictPort,
912
910
  host: options.host,
913
- https: options.https,
914
911
  open: options.open,
915
912
  },
916
913
  });
@@ -5,6 +5,7 @@ import { readFileSync } from 'node:fs';
5
5
  const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
8
+ 'browser',
8
9
  'module',
9
10
  'jsnext:main',
10
11
  'jsnext',