vite 4.2.0-beta.1 → 4.2.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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  import require$$0__default from 'fs';
2
2
  import require$$0 from 'postcss';
3
- import { C as commonjsGlobal } from './dep-a18b8a7b.js';
3
+ import { C as commonjsGlobal } from './dep-84d7cc5e.js';
4
4
  import require$$0$1 from 'path';
5
5
  import require$$5 from 'crypto';
6
6
  import require$$0$2 from 'util';
@@ -22,7 +22,7 @@ import { createHash as createHash$2 } from 'node:crypto';
22
22
  import { promisify as promisify$4, format as format$2, inspect } from 'node:util';
23
23
  import { promises } from 'node:dns';
24
24
  import resolve$4 from 'resolve';
25
- import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, KNOWN_ASSET_TYPES, CSS_LANGS_RE, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
25
+ import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, CSS_LANGS_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
26
26
  import require$$5$1 from 'crypto';
27
27
  import { Buffer as Buffer$1 } from 'node:buffer';
28
28
  import fsp from 'node:fs/promises';
@@ -12124,6 +12124,13 @@ async function getLocalhostAddressIfDiffersFromDNS() {
12124
12124
  nodeResult.address === dnsResult.address;
12125
12125
  return isSame ? undefined : nodeResult.address;
12126
12126
  }
12127
+ function diffDnsOrderChange(oldUrls, newUrls) {
12128
+ return !(oldUrls === newUrls ||
12129
+ (oldUrls &&
12130
+ newUrls &&
12131
+ arrayEqual(oldUrls.local, newUrls.local) &&
12132
+ arrayEqual(oldUrls.network, newUrls.network)));
12133
+ }
12127
12134
  async function resolveHostname(optionsHost) {
12128
12135
  let host;
12129
12136
  if (optionsHost === undefined || optionsHost === false) {
@@ -12173,9 +12180,9 @@ async function resolveServerUrls(server, options, config) {
12173
12180
  .flatMap((nInterface) => nInterface ?? [])
12174
12181
  .filter((detail) => detail &&
12175
12182
  detail.address &&
12176
- ((typeof detail.family === 'string' && detail.family === 'IPv4') ||
12183
+ (detail.family === 'IPv4' ||
12177
12184
  // @ts-expect-error Node 18.0 - 18.3 returns number
12178
- (typeof detail.family === 'number' && detail.family === 4)))
12185
+ detail.family === 4))
12179
12186
  .forEach((detail) => {
12180
12187
  let host = detail.address.replace('127.0.0.1', hostname.name);
12181
12188
  // ipv6 host
@@ -12733,7 +12740,7 @@ function buildReporterPlugin(config) {
12733
12740
  const mapPad = displaySize(biggestMap).length;
12734
12741
  const compressPad = displaySize(biggestCompressSize).length;
12735
12742
  const relativeOutDir = normalizePath$3(path$o.relative(config.root, path$o.resolve(config.root, outDir ?? config.build.outDir)));
12736
- const assetsDir = `${config.build.assetsDir}/`;
12743
+ const assetsDir = path$o.join(config.build.assetsDir, '/');
12737
12744
  for (const group of groups) {
12738
12745
  const filtered = entries.filter((e) => e.group === group.name);
12739
12746
  if (!filtered.length)
@@ -12744,12 +12751,13 @@ function buildReporterPlugin(config) {
12744
12751
  hasLargeChunks = true;
12745
12752
  const sizeColor = isLarge ? picocolorsExports.yellow : picocolorsExports.dim;
12746
12753
  let log = picocolorsExports.dim(relativeOutDir + '/');
12747
- log += entry.name.startsWith(assetsDir)
12748
- ? picocolorsExports.dim(assetsDir) +
12749
- group.color(entry.name
12750
- .slice(assetsDir.length)
12751
- .padEnd(longest + 2 - assetsDir.length))
12752
- : group.color(entry.name.padEnd(longest + 2));
12754
+ log +=
12755
+ !config.build.lib && entry.name.startsWith(assetsDir)
12756
+ ? picocolorsExports.dim(assetsDir) +
12757
+ group.color(entry.name
12758
+ .slice(assetsDir.length)
12759
+ .padEnd(longest + 2 - assetsDir.length))
12760
+ : group.color(entry.name.padEnd(longest + 2));
12753
12761
  log += picocolorsExports.bold(sizeColor(displaySize(entry.size).padStart(sizePad)));
12754
12762
  if (entry.compressedSize) {
12755
12763
  log += picocolorsExports.dim(` │ gzip: ${displaySize(entry.compressedSize).padStart(compressPad)}`);
@@ -13231,18 +13239,41 @@ async function parseExtends(result, cache) {
13231
13239
  const extended = [
13232
13240
  { tsconfigFile: result.tsconfigFile, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) }
13233
13241
  ];
13234
- while (extended[extended.length - 1].tsconfig.extends) {
13235
- const extending = extended[extended.length - 1];
13236
- const extendedTSConfigFile = resolveExtends(extending.tsconfig.extends, extending.tsconfigFile);
13237
- if (extended.some((x) => x.tsconfigFile === extendedTSConfigFile)) {
13238
- const circle = extended.concat({ tsconfigFile: extendedTSConfigFile, tsconfig: null }).map((e) => e.tsconfigFile).join(" -> ");
13239
- throw new TSConfckParseError(
13240
- `Circular dependency in "extends": ${circle}`,
13241
- "EXTENDS_CIRCULAR",
13242
- result.tsconfigFile
13242
+ let pos = 0;
13243
+ const extendsPath = [];
13244
+ let currentBranchDepth = 0;
13245
+ while (pos < extended.length) {
13246
+ const extending = extended[pos];
13247
+ extendsPath.push(extending.tsconfigFile);
13248
+ if (extending.tsconfig.extends) {
13249
+ currentBranchDepth += 1;
13250
+ let resolvedExtends;
13251
+ if (!Array.isArray(extending.tsconfig.extends)) {
13252
+ resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
13253
+ } else {
13254
+ resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
13255
+ }
13256
+ const circularExtends = resolvedExtends.find(
13257
+ (tsconfigFile) => extendsPath.includes(tsconfigFile)
13258
+ );
13259
+ if (circularExtends) {
13260
+ const circle = extendsPath.concat([circularExtends]).join(" -> ");
13261
+ throw new TSConfckParseError(
13262
+ `Circular dependency in "extends": ${circle}`,
13263
+ "EXTENDS_CIRCULAR",
13264
+ result.tsconfigFile
13265
+ );
13266
+ }
13267
+ extended.splice(
13268
+ pos + 1,
13269
+ 0,
13270
+ ...await Promise.all(resolvedExtends.map((file) => parseFile$1(file, cache)))
13243
13271
  );
13272
+ } else {
13273
+ extendsPath.splice(-currentBranchDepth);
13274
+ currentBranchDepth = 0;
13244
13275
  }
13245
- extended.push(await parseFile$1(extendedTSConfigFile, cache));
13276
+ pos = pos + 1;
13246
13277
  }
13247
13278
  result.extended = extended;
13248
13279
  for (const ext of result.extended.slice(1)) {
@@ -13319,9 +13350,11 @@ function extendTSConfig(extending, extended) {
13319
13350
  }
13320
13351
  }
13321
13352
  var REBASE_KEYS = [
13353
+ // root
13322
13354
  "files",
13323
13355
  "include",
13324
13356
  "exclude",
13357
+ // compilerOptions
13325
13358
  "baseUrl",
13326
13359
  "rootDir",
13327
13360
  "rootDirs",
@@ -13329,6 +13362,7 @@ var REBASE_KEYS = [
13329
13362
  "outDir",
13330
13363
  "outFile",
13331
13364
  "declarationDir",
13365
+ // watchOptions
13332
13366
  "excludeDirectories",
13333
13367
  "excludeFiles"
13334
13368
  ];
@@ -13496,7 +13530,7 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13496
13530
  throw e;
13497
13531
  }
13498
13532
  }
13499
- function esbuildPlugin(options = {}) {
13533
+ function esbuildPlugin(options) {
13500
13534
  const filter = createFilter(options.include || /\.(m?ts|[jt]sx)$/, options.exclude || /\.js$/);
13501
13535
  // Remove optimization options for dev as we only need to transpile them,
13502
13536
  // and for build as the final optimization is in `buildEsbuildPlugin`
@@ -22349,6 +22383,14 @@ function webWorkerPlugin(config) {
22349
22383
  const isBuild = config.command === 'build';
22350
22384
  let server;
22351
22385
  const isWorker = config.isWorker;
22386
+ const isWorkerQueryId = (id) => {
22387
+ const parsedQuery = parseRequest(id);
22388
+ if (parsedQuery &&
22389
+ (parsedQuery.worker ?? parsedQuery.sharedworker) != null) {
22390
+ return true;
22391
+ }
22392
+ return false;
22393
+ };
22352
22394
  return {
22353
22395
  name: 'vite:worker',
22354
22396
  configureServer(_server) {
@@ -22365,13 +22407,15 @@ function webWorkerPlugin(config) {
22365
22407
  });
22366
22408
  },
22367
22409
  load(id) {
22368
- if (isBuild) {
22369
- const parsedQuery = parseRequest(id);
22370
- if (parsedQuery &&
22371
- (parsedQuery.worker ?? parsedQuery.sharedworker) != null) {
22372
- return '';
22373
- }
22410
+ if (isBuild && isWorkerQueryId(id)) {
22411
+ return '';
22412
+ }
22413
+ },
22414
+ shouldTransformCachedModule({ id }) {
22415
+ if (isBuild && isWorkerQueryId(id) && config.build.watch) {
22416
+ return true;
22374
22417
  }
22418
+ return false;
22375
22419
  },
22376
22420
  async transform(raw, id, options) {
22377
22421
  const ssr = options?.ssr === true;
@@ -23497,9 +23541,12 @@ function esbuildDepPlugin(qualified, external, config, ssr) {
23497
23541
  });
23498
23542
  build.onLoad({ filter: /./, namespace: externalWithConversionNamespace }, (args) => {
23499
23543
  // import itself with prefix (this is the actual part of require-import conversion)
23544
+ const modulePath = `"${convertedExternalPrefix}${args.path}"`;
23500
23545
  return {
23501
- contents: `export { default } from "${convertedExternalPrefix}${args.path}";` +
23502
- `export * from "${convertedExternalPrefix}${args.path}";`,
23546
+ contents: CSS_LANGS_RE.test(args.path)
23547
+ ? `import ${modulePath};`
23548
+ : `export { default } from ${modulePath};` +
23549
+ `export * from ${modulePath};`,
23503
23550
  loader: 'js',
23504
23551
  };
23505
23552
  });
@@ -36345,9 +36392,9 @@ const withTypeScriptLoader = (rcFunc) => {
36345
36392
 
36346
36393
  try {
36347
36394
  // Register TypeScript compiler instance
36348
- registerer = eval('require')('ts-node').register();
36395
+ registerer = __require('ts-node').register();
36349
36396
 
36350
- return eval('require')(configFile)
36397
+ return __require(configFile)
36351
36398
  } catch (err) {
36352
36399
  if (err.code === 'MODULE_NOT_FOUND') {
36353
36400
  throw new Error(
@@ -37906,7 +37953,7 @@ function cssPostPlugin(config) {
37906
37953
  }
37907
37954
  else {
37908
37955
  let content = css;
37909
- if (config.build.minify) {
37956
+ if (config.build.cssMinify) {
37910
37957
  content = await minifyCSS(content, config);
37911
37958
  }
37912
37959
  code = `export default ${JSON.stringify(content)}`;
@@ -38264,7 +38311,7 @@ async function compileCSS(id, code, config, urlReplacer) {
38264
38311
  }));
38265
38312
  }
38266
38313
  if (isModule) {
38267
- postcssPlugins.unshift((await import('./dep-d2a7fe01.js').then(function (n) { return n.i; })).default({
38314
+ postcssPlugins.unshift((await import('./dep-80b98891.js').then(function (n) { return n.i; })).default({
38268
38315
  ...modulesOptions,
38269
38316
  localsConvention: modulesOptions?.localsConvention,
38270
38317
  getJSON(cssFileName, _modules, outputFileName) {
@@ -38415,7 +38462,7 @@ async function finalizeCss(css, minify, config) {
38415
38462
  if (css.includes('@import') || css.includes('@charset')) {
38416
38463
  css = await hoistAtRules(css);
38417
38464
  }
38418
- if (minify && config.build.minify) {
38465
+ if (minify && config.build.cssMinify) {
38419
38466
  css = await minifyCSS(css, config);
38420
38467
  }
38421
38468
  return css;
@@ -41205,7 +41252,7 @@ function importAnalysisPlugin(config) {
41205
41252
  if (!_env) {
41206
41253
  _env = `import.meta.env = ${JSON.stringify({
41207
41254
  ...config.env,
41208
- SSR: '__vite__ssr__vite__',
41255
+ SSR: '__vite__ssr__',
41209
41256
  })};`;
41210
41257
  // account for user env defines
41211
41258
  for (const key in config.define) {
@@ -41215,7 +41262,7 @@ function importAnalysisPlugin(config) {
41215
41262
  }
41216
41263
  }
41217
41264
  }
41218
- return _env.replace('"__vite__ssr__vite__"', ssr + '');
41265
+ return _env.replace('"__vite__ssr__"', ssr + '');
41219
41266
  }
41220
41267
  return {
41221
41268
  name: 'vite:import-analysis',
@@ -42016,7 +42063,7 @@ function definePlugin(config) {
42016
42063
  // stringified for `import.meta.env`, we can remove the quotes and
42017
42064
  // retain being an identifier
42018
42065
  typeof val === 'string' && /^[\p{L}_$]/u.test(val.trim())
42019
- ? `__vite__${val}__vite__`
42066
+ ? `__vite__define__${val}`
42020
42067
  : val;
42021
42068
  }
42022
42069
  }
@@ -42025,27 +42072,43 @@ function definePlugin(config) {
42025
42072
  const importMetaKeys = {};
42026
42073
  const importMetaFallbackKeys = {};
42027
42074
  if (isBuild) {
42028
- const env = {
42029
- ...config.env,
42030
- SSR: !!config.build.ssr,
42031
- };
42032
42075
  // set here to allow override with config.define
42033
42076
  importMetaKeys['import.meta.hot'] = `undefined`;
42034
- for (const key in env) {
42035
- importMetaKeys[`import.meta.env.${key}`] = JSON.stringify(env[key]);
42077
+ for (const key in config.env) {
42078
+ importMetaKeys[`import.meta.env.${key}`] = JSON.stringify(config.env[key]);
42036
42079
  }
42037
42080
  Object.assign(importMetaFallbackKeys, {
42038
42081
  'import.meta.env.': `({}).`,
42039
- 'import.meta.env': JSON.stringify({ ...env, ...userDefineEnv }).replace(/"__vite__(.+?)__vite__"/g, (_, val) => val),
42082
+ 'import.meta.env': JSON.stringify({
42083
+ ...config.env,
42084
+ SSR: '__vite__ssr__',
42085
+ ...userDefineEnv,
42086
+ }).replace(/"__vite__define__(.+?)"/g, (_, val) => val),
42040
42087
  });
42041
42088
  }
42089
+ function getImportMetaKeys(ssr) {
42090
+ if (!isBuild)
42091
+ return {};
42092
+ return {
42093
+ ...importMetaKeys,
42094
+ 'import.meta.env.SSR': ssr + '',
42095
+ };
42096
+ }
42097
+ function getImportMetaFallbackKeys(ssr) {
42098
+ if (!isBuild)
42099
+ return {};
42100
+ return {
42101
+ ...importMetaFallbackKeys,
42102
+ 'import.meta.env': importMetaFallbackKeys['import.meta.env'].replace('"__vite__ssr__"', ssr + ''),
42103
+ };
42104
+ }
42042
42105
  function generatePattern(ssr) {
42043
42106
  const replaceProcessEnv = !ssr || config.ssr?.target === 'webworker';
42044
42107
  const replacements = {
42045
42108
  ...(replaceProcessEnv ? processNodeEnv : {}),
42046
- ...importMetaKeys,
42109
+ ...getImportMetaKeys(ssr),
42047
42110
  ...userDefine,
42048
- ...importMetaFallbackKeys,
42111
+ ...getImportMetaFallbackKeys(ssr),
42049
42112
  ...(replaceProcessEnv ? processEnv : {}),
42050
42113
  };
42051
42114
  if (isBuild && !replaceProcessEnv) {
@@ -43412,6 +43475,11 @@ function scanImports(config) {
43412
43475
  });
43413
43476
  })
43414
43477
  .catch(async (e) => {
43478
+ if (e.errors && e.message.includes('The build was canceled')) {
43479
+ // esbuild logs an error when cancelling, but this is expected so
43480
+ // return an empty result instead
43481
+ return { deps: {}, missing: {} };
43482
+ }
43415
43483
  const prependMessage = picocolorsExports.red(`\
43416
43484
  Failed to scan for dependencies from entries:
43417
43485
  ${entries.join('\n')}
@@ -44668,6 +44736,14 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
44668
44736
  writeFile(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
44669
44737
  debug$7(`deps bundled in ${(performance.now() - start).toFixed(2)}ms`);
44670
44738
  return createProcessingResult();
44739
+ })
44740
+ .catch((e) => {
44741
+ if (e.errors && e.message.includes('The build was canceled')) {
44742
+ // esbuild logs an error when cancelling, but this is expected so
44743
+ // return an empty result instead
44744
+ return createProcessingResult();
44745
+ }
44746
+ throw e;
44671
44747
  })
44672
44748
  .finally(() => {
44673
44749
  return disposeContext();
@@ -45945,6 +46021,9 @@ function resolveBuildOptions(raw, logger, root) {
45945
46021
  if (resolved.minify === true) {
45946
46022
  resolved.minify = 'esbuild';
45947
46023
  }
46024
+ if (resolved.cssMinify == null) {
46025
+ resolved.cssMinify = !!resolved.minify;
46026
+ }
45948
46027
  return resolved;
45949
46028
  }
45950
46029
  async function resolveBuildPlugins(config) {
@@ -53894,12 +53973,14 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
53894
53973
  mod.ssrError = e;
53895
53974
  if (e.stack && fixStacktrace) {
53896
53975
  ssrFixStacktrace(e, moduleGraph);
53897
- server.config.logger.error(`Error when evaluating SSR module ${url}:\n${e.stack}`, {
53898
- timestamp: true,
53899
- clear: server.config.clearScreen,
53900
- error: e,
53901
- });
53902
53976
  }
53977
+ server.config.logger.error(picocolorsExports.red(`Error when evaluating SSR module ${url}:` +
53978
+ (e.importee ? ` failed to import "${e.importee}"\n` : '\n')), {
53979
+ timestamp: true,
53980
+ clear: server.config.clearScreen,
53981
+ error: e,
53982
+ });
53983
+ delete e.importee;
53903
53984
  throw e;
53904
53985
  }
53905
53986
  return Object.freeze(ssrModule);
@@ -53932,7 +54013,11 @@ async function nodeImport(id, importer, resolveOptions) {
53932
54013
  const mod = await dynamicImport(url);
53933
54014
  return proxyESM(mod);
53934
54015
  }
53935
- catch { }
54016
+ catch (err) {
54017
+ // tell external error handler which mod was imported with error
54018
+ err.importee = id;
54019
+ throw err;
54020
+ }
53936
54021
  }
53937
54022
  // rollup-style default import interop for cjs
53938
54023
  function proxyESM(mod) {
@@ -62652,7 +62737,9 @@ async function createServer(inlineConfig = {}) {
62652
62737
  if (httpServer) {
62653
62738
  setClientErrorHandler(httpServer, config.logger);
62654
62739
  }
62655
- const watcher = chokidar.watch(path$o.resolve(root), resolvedWatchOptions);
62740
+ const watcher = chokidar.watch(
62741
+ // config file dependencies and env file might be outside of root
62742
+ [root, ...config.configFileDependencies, config.envDir], resolvedWatchOptions);
62656
62743
  const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
62657
62744
  const container = await createPluginContainer(config, moduleGraph, watcher);
62658
62745
  const closeHttpServer = createServerCloseFn(httpServer);
@@ -63012,6 +63099,7 @@ async function restartServer(server) {
63012
63099
  global.__vite_start_time = performance.now();
63013
63100
  const { port: prevPort, host: prevHost } = server.config.server;
63014
63101
  const shortcutsOptions = server._shortcutsOptions;
63102
+ const oldUrls = server.resolvedUrls;
63015
63103
  await server.close();
63016
63104
  let inlineConfig = server.config.inlineConfig;
63017
63105
  if (server._forceOptimizeOnRestart) {
@@ -63039,7 +63127,8 @@ async function restartServer(server) {
63039
63127
  await server.listen(port, true);
63040
63128
  logger.info('server restarted.', { timestamp: true });
63041
63129
  if ((port ?? DEFAULT_DEV_PORT) !== (prevPort ?? DEFAULT_DEV_PORT) ||
63042
- host !== prevHost) {
63130
+ host !== prevHost ||
63131
+ diffDnsOrderChange(oldUrls, newServer.resolvedUrls)) {
63043
63132
  logger.info('');
63044
63133
  server.printUrls();
63045
63134
  }
@@ -63539,9 +63628,16 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
63539
63628
  mainConfig: null,
63540
63629
  isProduction,
63541
63630
  plugins: userPlugins,
63631
+ esbuild: config.esbuild === false
63632
+ ? false
63633
+ : {
63634
+ jsxDev: !isProduction,
63635
+ ...config.esbuild,
63636
+ },
63542
63637
  server,
63543
63638
  build: resolvedBuildOptions,
63544
63639
  preview: resolvePreviewOptions(config.preview, server),
63640
+ envDir,
63545
63641
  env: {
63546
63642
  ...userEnv,
63547
63643
  BASE_URL,
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 { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-a18b8a7b.js';
5
+ import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-84d7cc5e.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:url';
8
8
  import 'node:module';
@@ -729,7 +729,7 @@ cli
729
729
  filterDuplicateOptions(options);
730
730
  // output structure is preserved even after bundling so require()
731
731
  // is ok here
732
- const { createServer } = await import('./chunks/dep-a18b8a7b.js').then(function (n) { return n.F; });
732
+ const { createServer } = await import('./chunks/dep-84d7cc5e.js').then(function (n) { return n.F; });
733
733
  try {
734
734
  const server = await createServer({
735
735
  root,
@@ -807,7 +807,7 @@ cli
807
807
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
808
808
  .action(async (root, options) => {
809
809
  filterDuplicateOptions(options);
810
- const { build } = await import('./chunks/dep-a18b8a7b.js').then(function (n) { return n.E; });
810
+ const { build } = await import('./chunks/dep-84d7cc5e.js').then(function (n) { return n.E; });
811
811
  const buildOptions = cleanOptions(options);
812
812
  try {
813
813
  await build({
@@ -835,7 +835,7 @@ cli
835
835
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
836
836
  .action(async (root, options) => {
837
837
  filterDuplicateOptions(options);
838
- const { optimizeDeps } = await import('./chunks/dep-a18b8a7b.js').then(function (n) { return n.D; });
838
+ const { optimizeDeps } = await import('./chunks/dep-84d7cc5e.js').then(function (n) { return n.D; });
839
839
  try {
840
840
  const config = await resolveConfig({
841
841
  root,
@@ -860,7 +860,7 @@ cli
860
860
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
861
861
  .action(async (root, options) => {
862
862
  filterDuplicateOptions(options);
863
- const { preview } = await import('./chunks/dep-a18b8a7b.js').then(function (n) { return n.G; });
863
+ const { preview } = await import('./chunks/dep-84d7cc5e.js').then(function (n) { return n.G; });
864
864
  try {
865
865
  const server = await preview({
866
866
  root,
@@ -17,7 +17,6 @@ import { version as esbuildVersion } from 'esbuild';
17
17
  import { EventEmitter } from 'node:events';
18
18
  import * as events from 'node:events';
19
19
  import type { ExistingRawSourceMap } from 'rollup';
20
- import type { Exports } from 'resolve.exports';
21
20
  import type * as fs from 'node:fs';
22
21
  import { FullReloadPayload } from "../../types/hmrPayload";
23
22
  import { GeneralImportGlobOptions } from "../../types/importGlob";
@@ -27,7 +26,6 @@ import * as http from 'node:http';
27
26
  import { ImportGlobEagerFunction } from "../../types/importGlob";
28
27
  import { ImportGlobFunction } from "../../types/importGlob";
29
28
  import { ImportGlobOptions } from "../../types/importGlob";
30
- import type { Imports } from 'resolve.exports';
31
29
  import type { IncomingMessage } from 'node:http';
32
30
  import { InferCustomEventPayload } from "../../types/customEvent";
33
31
  import type { InputOption } from 'rollup';
@@ -50,6 +48,7 @@ import type { PluginHooks } from 'rollup';
50
48
  import type * as PostCSS from 'postcss';
51
49
  import { PrunePayload } from "../../types/hmrPayload";
52
50
  import type { ResolveIdResult } from 'rollup';
51
+ import type * as Rollup from 'rollup';
53
52
  import type { RollupError } from 'rollup';
54
53
  import type { RollupOptions } from 'rollup';
55
54
  import type { RollupOutput } from 'rollup';
@@ -196,6 +195,12 @@ export declare interface BuildOptions {
196
195
  * @default target
197
196
  */
198
197
  cssTarget?: EsbuildTransformOptions['target'] | false;
198
+ /**
199
+ * Override CSS minification specifically instead of defaulting to `build.minify`,
200
+ * so you can configure minification for JS and CSS separately.
201
+ * @default minify
202
+ */
203
+ cssMinify?: boolean;
199
204
  /**
200
205
  * If `true`, a separate sourcemap file will be created. If 'inline', the
201
206
  * sourcemap will be appended to the resulting output file as data URI.
@@ -1420,8 +1425,8 @@ export declare interface PackageData {
1420
1425
  main: string;
1421
1426
  module: string;
1422
1427
  browser: string | Record<string, string | false>;
1423
- exports: Exports;
1424
- imports: Imports;
1428
+ exports: string | Record<string, any> | string[];
1429
+ imports: Record<string, any>;
1425
1430
  dependencies: Record<string, string>;
1426
1431
  };
1427
1432
  }
@@ -1674,11 +1679,13 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
1674
1679
  isWorker: boolean;
1675
1680
  /* Excluded from this release type: mainConfig */
1676
1681
  isProduction: boolean;
1682
+ envDir: string;
1677
1683
  env: Record<string, any>;
1678
1684
  resolve: Required<ResolveOptions> & {
1679
1685
  alias: Alias[];
1680
1686
  };
1681
1687
  plugins: readonly Plugin_2[];
1688
+ esbuild: ESBuildOptions | false;
1682
1689
  server: ResolvedServerOptions;
1683
1690
  build: ResolvedBuildOptions;
1684
1691
  preview: ResolvedPreviewOptions;
@@ -1772,6 +1779,8 @@ export declare interface ResolveWorkerOptions extends PluginHookUtils {
1772
1779
  rollupOptions: RollupOptions;
1773
1780
  }
1774
1781
 
1782
+ export { Rollup }
1783
+
1775
1784
  /**
1776
1785
  * https://github.com/rollup/plugins/blob/master/packages/commonjs/types/index.d.ts
1777
1786
  *
@@ -1,4 +1,4 @@
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-a18b8a7b.js';
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-84d7cc5e.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.2.0-beta.1",
3
+ "version": "4.2.0-beta.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -126,10 +126,10 @@
126
126
  "source-map-support": "^0.5.21",
127
127
  "strip-ansi": "^7.0.1",
128
128
  "strip-literal": "^1.0.1",
129
- "tsconfck": "^2.0.3",
129
+ "tsconfck": "^2.1.0",
130
130
  "tslib": "^2.5.0",
131
131
  "types": "link:./types",
132
- "ufo": "^1.1.0",
132
+ "ufo": "^1.1.1",
133
133
  "ws": "^8.12.1"
134
134
  },
135
135
  "peerDependencies": {