vite 2.9.4 → 2.9.5

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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('postcss');
4
- var index$1 = require('./dep-2fd39086.js');
4
+ var index$1 = require('./dep-27bc1ab8.js');
5
5
  var path$2 = require('path');
6
6
  var require$$1 = require('crypto');
7
7
  var fs = require('fs');
@@ -1150,20 +1150,6 @@ const DEFAULT_MAIN_FIELDS = [
1150
1150
  'jsnext:main',
1151
1151
  'jsnext'
1152
1152
  ];
1153
- /**
1154
- * A non-exhaustive list of known-to-be-ES-module entry names.
1155
- * From <https://github.com/stereobooster/package.json#package-bundlers>
1156
- */
1157
- const KNOWN_ESM_MAIN_FIELDS = [
1158
- 'module',
1159
- 'jsnext:main',
1160
- 'jsnext',
1161
- 'esnext',
1162
- 'es2015',
1163
- 'es2020',
1164
- 'fesm2015',
1165
- 'fesm2020'
1166
- ];
1167
1153
  const DEFAULT_EXTENSIONS$1 = [
1168
1154
  '.mjs',
1169
1155
  '.js',
@@ -26851,7 +26837,7 @@ const assetAttrsConfig = {
26851
26837
  const isAsyncScriptMap = new WeakMap();
26852
26838
  async function traverseHtml(html, filePath, visitor) {
26853
26839
  // lazy load compiler
26854
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-a2c7fba7.js'); }).then(function (n) { return n.compilerDom_cjs; });
26840
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-e037a5fe.js'); }).then(function (n) { return n.compilerDom_cjs; });
26855
26841
  // @vue/compiler-core doesn't like lowercase doctypes
26856
26842
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
26857
26843
  try {
@@ -27951,7 +27937,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
27951
27937
  replacer: urlReplacer
27952
27938
  }));
27953
27939
  if (isModule) {
27954
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-f0683f19.js'); }).then(function (n) { return n.index; })).default({
27940
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-17497ab4.js'); }).then(function (n) { return n.index; })).default({
27955
27941
  ...modulesOptions,
27956
27942
  getJSON(cssFileName, _modules, outputFileName) {
27957
27943
  modules = _modules;
@@ -28216,16 +28202,26 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
28216
28202
  return `@import ${wrap}${await replacer(rawUrl)}${wrap}`;
28217
28203
  }
28218
28204
  async function minifyCSS(css, config) {
28219
- const { code, warnings } = await esbuild.transform(css, {
28220
- loader: 'css',
28221
- minify: true,
28222
- target: config.build.cssTarget || undefined
28223
- });
28224
- if (warnings.length) {
28225
- const msgs = await esbuild.formatMessages(warnings, { kind: 'warning' });
28226
- config.logger.warn(colors$1.yellow(`warnings when minifying css:\n${msgs.join('\n')}`));
28205
+ try {
28206
+ const { code, warnings } = await esbuild.transform(css, {
28207
+ loader: 'css',
28208
+ minify: true,
28209
+ target: config.build.cssTarget || undefined
28210
+ });
28211
+ if (warnings.length) {
28212
+ const msgs = await esbuild.formatMessages(warnings, { kind: 'warning' });
28213
+ config.logger.warn(colors$1.yellow(`warnings when minifying css:\n${msgs.join('\n')}`));
28214
+ }
28215
+ return code;
28216
+ }
28217
+ catch (e) {
28218
+ if (e.errors) {
28219
+ const msgs = await esbuild.formatMessages(e.errors, { kind: 'error' });
28220
+ e.frame = '\n' + msgs.join('\n');
28221
+ e.loc = e.errors[0].location;
28222
+ }
28223
+ throw e;
28227
28224
  }
28228
- return code;
28229
28225
  }
28230
28226
  async function hoistAtRules(css) {
28231
28227
  const s = new MagicString(css);
@@ -38390,10 +38386,6 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
38390
38386
  }
38391
38387
  if (!entryPoint || entryPoint.endsWith('.mjs')) {
38392
38388
  for (const field of options.mainFields || DEFAULT_MAIN_FIELDS) {
38393
- // If the initiator is a `require` call, don't use the ESM entries
38394
- if (options.isRequire && KNOWN_ESM_MAIN_FIELDS.includes(field)) {
38395
- continue;
38396
- }
38397
38389
  if (typeof data[field] === 'string') {
38398
38390
  entryPoint = data[field];
38399
38391
  break;
@@ -47142,7 +47134,7 @@ async function getCertificate(cacheDir) {
47142
47134
  return content;
47143
47135
  }
47144
47136
  catch {
47145
- const content = (await Promise.resolve().then(function () { return require('./dep-b006c17c.js'); })).createCertificate();
47137
+ const content = (await Promise.resolve().then(function () { return require('./dep-566e34ef.js'); })).createCertificate();
47146
47138
  fs$n.promises
47147
47139
  .mkdir(cacheDir, { recursive: true })
47148
47140
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./dep-2fd39086.js');
3
+ var index = require('./dep-27bc1ab8.js');
4
4
  var require$$1 = require('crypto');
5
5
  require('fs');
6
6
  require('path');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./dep-2fd39086.js');
3
+ var index = require('./dep-27bc1ab8.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
package/dist/node/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('events');
4
- var index = require('./chunks/dep-2fd39086.js');
4
+ var index = require('./chunks/dep-27bc1ab8.js');
5
5
  var perf_hooks = require('perf_hooks');
6
6
  require('fs');
7
7
  require('path');
@@ -683,7 +683,7 @@ cli
683
683
  .action(async (root, options) => {
684
684
  // output structure is preserved even after bundling so require()
685
685
  // is ok here
686
- const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-2fd39086.js'); }).then(function (n) { return n.index$1; });
686
+ const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-27bc1ab8.js'); }).then(function (n) { return n.index$1; });
687
687
  try {
688
688
  const server = await createServer({
689
689
  root,
@@ -732,7 +732,7 @@ cli
732
732
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
733
733
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
734
734
  .action(async (root, options) => {
735
- const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-2fd39086.js'); }).then(function (n) { return n.build$1; });
735
+ const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-27bc1ab8.js'); }).then(function (n) { return n.build$1; });
736
736
  const buildOptions = cleanOptions(options);
737
737
  try {
738
738
  await build({
@@ -755,7 +755,7 @@ cli
755
755
  .command('optimize [root]', 'pre-bundle dependencies')
756
756
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
757
757
  .action(async (root, options) => {
758
- const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-2fd39086.js'); }).then(function (n) { return n.index; });
758
+ const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-27bc1ab8.js'); }).then(function (n) { return n.index; });
759
759
  try {
760
760
  const config = await index.resolveConfig({
761
761
  root,
@@ -778,7 +778,7 @@ cli
778
778
  .option('--https', `[boolean] use TLS + HTTP/2`)
779
779
  .option('--open [path]', `[boolean | string] open browser on startup`)
780
780
  .action(async (root, options) => {
781
- const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-2fd39086.js'); }).then(function (n) { return n.preview$1; });
781
+ const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-27bc1ab8.js'); }).then(function (n) { return n.preview$1; });
782
782
  try {
783
783
  const server = await preview({
784
784
  root,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./chunks/dep-2fd39086.js');
5
+ var index = require('./chunks/dep-27bc1ab8.js');
6
6
  require('fs');
7
7
  require('path');
8
8
  require('tty');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "description": "Native-ESM powered web dev build tool",