vite 4.0.0-beta.2 → 4.0.0-beta.3

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.
@@ -1,6 +1,6 @@
1
1
  import require$$0__default from 'fs';
2
2
  import require$$0 from 'postcss';
3
- import { A as commonjsGlobal } from './dep-666774f5.js';
3
+ import { B as commonjsGlobal } from './dep-704b2c30.js';
4
4
  import require$$0$1 from 'path';
5
5
  import require$$5 from 'crypto';
6
6
  import require$$0$2 from 'util';
@@ -13391,6 +13391,8 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13391
13391
  };
13392
13392
  }
13393
13393
  const resolvedOptions = {
13394
+ // esbuild 0.16.0 & 0.16.1 defaults to 'browser': https://github.com/evanw/esbuild/issues/2718
13395
+ platform: 'neutral',
13394
13396
  sourcemap: true,
13395
13397
  // ensure source file name contains full query
13396
13398
  sourcefile: filename,
@@ -22843,6 +22845,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
22843
22845
  if (data.exports) {
22844
22846
  entryPoint = resolveExports(data, '.', options, targetWeb);
22845
22847
  }
22848
+ const resolvedFromExports = !!entryPoint;
22846
22849
  // if exports resolved to .mjs, still resolve other fields.
22847
22850
  // This is because .mjs files can technically import .cjs files which would
22848
22851
  // make them invalid for pure ESM environments - so if other module/browser
@@ -22885,7 +22888,9 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
22885
22888
  }
22886
22889
  }
22887
22890
  }
22888
- if (!entryPoint || entryPoint.endsWith('.mjs')) {
22891
+ // fallback to mainFields if still not resolved
22892
+ // TODO: review if `.mjs` check is still needed
22893
+ if (!resolvedFromExports && (!entryPoint || entryPoint.endsWith('.mjs'))) {
22889
22894
  for (const field of options.mainFields) {
22890
22895
  if (field === 'browser')
22891
22896
  continue; // already checked above
@@ -37607,7 +37612,7 @@ async function compileCSS(id, code, config, urlReplacer) {
37607
37612
  }));
37608
37613
  }
37609
37614
  if (isModule) {
37610
- postcssPlugins.unshift((await import('./dep-1c8247b5.js').then(function (n) { return n.i; })).default({
37615
+ postcssPlugins.unshift((await import('./dep-237da91e.js').then(function (n) { return n.i; })).default({
37611
37616
  ...modulesOptions,
37612
37617
  localsConvention: modulesOptions?.localsConvention,
37613
37618
  getJSON(cssFileName, _modules, outputFileName) {
@@ -43122,9 +43127,13 @@ async function createDepsOptimizer(config, server) {
43122
43127
  // If there wasn't a cache or it is outdated, we need to prepare a first run
43123
43128
  let firstRunCalled = !!cachedMetadata;
43124
43129
  let postScanOptimizationResult;
43130
+ let discoverProjectDependenciesPromise;
43125
43131
  let optimizingNewDeps;
43126
43132
  async function close() {
43127
43133
  closed = true;
43134
+ await discoverProjectDependenciesPromise?.catch(() => {
43135
+ /* ignore error for scanner because it's not important */
43136
+ });
43128
43137
  await postScanOptimizationResult;
43129
43138
  await optimizingNewDeps;
43130
43139
  }
@@ -43150,7 +43159,9 @@ async function createDepsOptimizer(config, server) {
43150
43159
  setTimeout(async () => {
43151
43160
  try {
43152
43161
  debuggerViteDeps(picocolors.exports.green(`scanning for dependencies...`));
43153
- const deps = await discoverProjectDependencies(config);
43162
+ discoverProjectDependenciesPromise =
43163
+ discoverProjectDependencies(config);
43164
+ const deps = await discoverProjectDependenciesPromise;
43154
43165
  debuggerViteDeps(picocolors.exports.green(Object.keys(deps).length > 0
43155
43166
  ? `dependencies found by scanner: ${depsLogString(Object.keys(deps))}`
43156
43167
  : `no dependencies found by scanner`));
@@ -63031,4 +63042,4 @@ function isDepsOptimizerEnabled(config, ssr) {
63031
63042
  (command === 'serve' && disabled === 'dev'));
63032
63043
  }
63033
63044
 
63034
- export { commonjsGlobal as A, index$1 as B, build$1 as C, index as D, preview$1 as E, preprocessCSS as a, build as b, createServer as c, resolvePackageData as d, defineConfig as e, formatPostcssSourceMap as f, resolveConfig as g, resolveBaseUrl as h, getDepOptimizationConfig as i, isDepsOptimizerEnabled as j, mergeAlias as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, createFilter as q, resolvePackageEntry as r, sortUserPlugins as s, transformWithEsbuild as t, send$1 as u, createLogger as v, searchForWorkspaceRoot as w, loadEnv as x, resolveEnvPrefix as y, picocolors as z };
63045
+ export { picocolors as A, commonjsGlobal as B, index$1 as C, build$1 as D, index as E, preview$1 as F, preprocessCSS as a, build as b, createServer as c, resolvePackageData as d, buildErrorMessage as e, formatPostcssSourceMap as f, defineConfig as g, resolveConfig as h, resolveBaseUrl as i, getDepOptimizationConfig as j, isDepsOptimizerEnabled as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, mergeAlias as q, resolvePackageEntry as r, sortUserPlugins as s, transformWithEsbuild as t, createFilter as u, send$1 as v, createLogger as w, searchForWorkspaceRoot as x, loadEnv as y, resolveEnvPrefix as z };
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-666774f5.js';
5
+ import { A as picocolors, w as createLogger, h as resolveConfig } from './chunks/dep-704b2c30.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-666774f5.js').then(function (n) { return n.D; });
723
+ const { createServer } = await import('./chunks/dep-704b2c30.js').then(function (n) { return n.E; });
724
724
  try {
725
725
  const server = await createServer({
726
726
  root,
@@ -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-666774f5.js').then(function (n) { return n.C; });
776
+ const { build } = await import('./chunks/dep-704b2c30.js').then(function (n) { return n.D; });
777
777
  const buildOptions = cleanOptions(options);
778
778
  try {
779
779
  await build({
@@ -801,7 +801,7 @@ 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-666774f5.js').then(function (n) { return n.B; });
804
+ const { optimizeDeps } = await import('./chunks/dep-704b2c30.js').then(function (n) { return n.C; });
805
805
  try {
806
806
  const config = await resolveConfig({
807
807
  root,
@@ -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-666774f5.js').then(function (n) { return n.E; });
829
+ const { preview } = await import('./chunks/dep-704b2c30.js').then(function (n) { return n.F; });
830
830
  try {
831
831
  const server = await preview({
832
832
  root,
@@ -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
  /**
@@ -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
@@ -1,4 +1,4 @@
1
- export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-666774f5.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-704b2c30.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';
@@ -42,7 +42,7 @@ import 'node:zlib';
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.2",
3
+ "version": "4.0.0-beta.3",
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.15.18",
61
+ "esbuild": "^0.16.1",
62
62
  "postcss": "^8.4.19",
63
63
  "resolve": "^1.22.1",
64
64
  "rollup": "^3.6.0"