vite 4.0.0-alpha.5 → 4.0.0-beta.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/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 { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-fadb3c21.js';
5
+ import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-a5101d9f.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:url';
8
8
  import 'node:module';
@@ -720,7 +720,7 @@ cli
720
720
  filterDuplicateOptions(options);
721
721
  // output structure is preserved even after bundling so require()
722
722
  // is ok here
723
- const { createServer } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.D; });
723
+ const { createServer } = await import('./chunks/dep-a5101d9f.js').then(function (n) { return n.D; });
724
724
  try {
725
725
  const server = await createServer({
726
726
  root,
@@ -730,7 +730,7 @@ cli
730
730
  logLevel: options.logLevel,
731
731
  clearScreen: options.clearScreen,
732
732
  optimizeDeps: { force: options.force },
733
- server: cleanOptions(options)
733
+ server: cleanOptions(options),
734
734
  });
735
735
  if (!server.httpServer) {
736
736
  throw new Error('HTTP server not available');
@@ -749,7 +749,7 @@ cli
749
749
  catch (e) {
750
750
  const logger = createLogger(options.logLevel);
751
751
  logger.error(picocolors.exports.red(`error when starting dev server:\n${e.stack}`), {
752
- error: e
752
+ error: e,
753
753
  });
754
754
  stopProfiler(logger.info);
755
755
  process.exit(1);
@@ -773,7 +773,7 @@ cli
773
773
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
774
774
  .action(async (root, options) => {
775
775
  filterDuplicateOptions(options);
776
- const { build } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.C; });
776
+ const { build } = await import('./chunks/dep-a5101d9f.js').then(function (n) { return n.C; });
777
777
  const buildOptions = cleanOptions(options);
778
778
  try {
779
779
  await build({
@@ -784,7 +784,7 @@ cli
784
784
  logLevel: options.logLevel,
785
785
  clearScreen: options.clearScreen,
786
786
  optimizeDeps: { force: options.force },
787
- build: buildOptions
787
+ build: buildOptions,
788
788
  });
789
789
  }
790
790
  catch (e) {
@@ -801,14 +801,14 @@ cli
801
801
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
802
802
  .action(async (root, options) => {
803
803
  filterDuplicateOptions(options);
804
- const { optimizeDeps } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.B; });
804
+ const { optimizeDeps } = await import('./chunks/dep-a5101d9f.js').then(function (n) { return n.B; });
805
805
  try {
806
806
  const config = await resolveConfig({
807
807
  root,
808
808
  base: options.base,
809
809
  configFile: options.config,
810
- logLevel: options.logLevel
811
- }, 'build', 'development');
810
+ logLevel: options.logLevel,
811
+ }, 'build');
812
812
  await optimizeDeps(config, options.force, true);
813
813
  }
814
814
  catch (e) {
@@ -826,7 +826,7 @@ cli
826
826
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
827
827
  .action(async (root, options) => {
828
828
  filterDuplicateOptions(options);
829
- const { preview } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.E; });
829
+ const { preview } = await import('./chunks/dep-a5101d9f.js').then(function (n) { return n.E; });
830
830
  try {
831
831
  const server = await preview({
832
832
  root,
@@ -835,15 +835,15 @@ cli
835
835
  logLevel: options.logLevel,
836
836
  mode: options.mode,
837
837
  build: {
838
- outDir: options.outDir
838
+ outDir: options.outDir,
839
839
  },
840
840
  preview: {
841
841
  port: options.port,
842
842
  strictPort: options.strictPort,
843
843
  host: options.host,
844
844
  https: options.https,
845
- open: options.open
846
- }
845
+ open: options.open,
846
+ },
847
847
  });
848
848
  server.printUrls();
849
849
  }
@@ -7,7 +7,7 @@ const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
8
8
  'module',
9
9
  'jsnext:main',
10
- 'jsnext'
10
+ 'jsnext',
11
11
  ];
12
12
  // Baseline support browserslist
13
13
  // "defaults and supports es6-module and supports es6-module-dynamic-import"
@@ -17,7 +17,7 @@ const ESBUILD_MODULES_TARGET = [
17
17
  'edge88',
18
18
  'firefox78',
19
19
  'chrome87',
20
- 'safari13' // transpile nullish coalescing
20
+ 'safari14',
21
21
  ];
22
22
  const DEFAULT_EXTENSIONS = [
23
23
  '.mjs',
@@ -26,7 +26,7 @@ const DEFAULT_EXTENSIONS = [
26
26
  '.ts',
27
27
  '.jsx',
28
28
  '.tsx',
29
- '.json'
29
+ '.json',
30
30
  ];
31
31
  const DEFAULT_CONFIG_FILES = [
32
32
  'vite.config.js',
@@ -34,9 +34,10 @@ const DEFAULT_CONFIG_FILES = [
34
34
  'vite.config.ts',
35
35
  'vite.config.cjs',
36
36
  'vite.config.mts',
37
- 'vite.config.cts'
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
41
  const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
41
42
  const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
42
43
  /**
@@ -101,7 +102,7 @@ const KNOWN_ASSET_TYPES = [
101
102
  // other
102
103
  'webmanifest',
103
104
  'pdf',
104
- 'txt'
105
+ 'txt',
105
106
  ];
106
107
  const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
107
108
  const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
@@ -109,12 +110,12 @@ const loopbackHosts = new Set([
109
110
  'localhost',
110
111
  '127.0.0.1',
111
112
  '::1',
112
- '0000:0000:0000:0000:0000:0000:0000:0001'
113
+ '0000:0000:0000:0000:0000:0000:0000:0001',
113
114
  ]);
114
115
  const wildcardHosts = new Set([
115
116
  '0.0.0.0',
116
117
  '::',
117
- '0000:0000:0000:0000:0000:0000:0000:0000'
118
+ '0000:0000:0000:0000:0000:0000:0000:0000',
118
119
  ]);
119
120
 
120
- export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
121
+ export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };