vite 2.8.5 → 2.8.6

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 build$2 = require('./dep-ff3ab196.js');
4
+ var build$2 = require('./dep-9c153816.js');
5
5
  var path$2 = require('path');
6
6
  var require$$1 = require('crypto');
7
7
  var fs = require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var build = require('./dep-ff3ab196.js');
3
+ var build = require('./dep-9c153816.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 build = require('./dep-ff3ab196.js');
3
+ var build = require('./dep-9c153816.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
@@ -18888,7 +18888,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
18888
18888
  replacer: urlReplacer
18889
18889
  }));
18890
18890
  if (isModule) {
18891
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-1a638407.js'); }).then(function (n) { return n.index; })).default({
18891
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-00df106d.js'); }).then(function (n) { return n.index; })).default({
18892
18892
  ...modulesOptions,
18893
18893
  getJSON(cssFileName, _modules, outputFileName) {
18894
18894
  modules = _modules;
@@ -20972,7 +20972,7 @@ function preload(baseModule, deps) {
20972
20972
  if (isCss) {
20973
20973
  return new Promise((res, rej) => {
20974
20974
  link.addEventListener('load', res);
20975
- link.addEventListener('error', rej);
20975
+ link.addEventListener('error', () => rej(new Error(`Unable to preload CSS for ${dep}`)));
20976
20976
  });
20977
20977
  }
20978
20978
  })).then(() => baseModule());
@@ -21315,7 +21315,7 @@ const assetAttrsConfig = {
21315
21315
  const isAsyncScriptMap = new WeakMap();
21316
21316
  async function traverseHtml(html, filePath, visitor) {
21317
21317
  // lazy load compiler
21318
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-b09e7447.js'); }).then(function (n) { return n.compilerDom_cjs; });
21318
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-56143c31.js'); }).then(function (n) { return n.compilerDom_cjs; });
21319
21319
  // @vue/compiler-core doesn't like lowercase doctypes
21320
21320
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
21321
21321
  try {
@@ -45065,7 +45065,7 @@ async function getCertificate(cacheDir) {
45065
45065
  return content;
45066
45066
  }
45067
45067
  catch {
45068
- const content = (await Promise.resolve().then(function () { return require('./dep-7e724347.js'); })).createCertificate();
45068
+ const content = (await Promise.resolve().then(function () { return require('./dep-383194a7.js'); })).createCertificate();
45069
45069
  fs$n.promises
45070
45070
  .mkdir(cacheDir, { recursive: true })
45071
45071
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -53241,25 +53241,8 @@ const devHtmlHook = async (html, { path: htmlPath, server, originalUrl }) => {
53241
53241
  const { config, moduleGraph } = server;
53242
53242
  const base = config.base || '/';
53243
53243
  const s = new MagicString(html);
53244
- let inlineModuleIndex = -1;
53244
+ let scriptModuleIndex = -1;
53245
53245
  const filePath = cleanUrl(htmlPath);
53246
- const addInlineModule = (node, ext) => {
53247
- inlineModuleIndex++;
53248
- const url = filePath.replace(normalizePath$4(config.root), '');
53249
- const contents = node.children
53250
- .map((child) => child.content || '')
53251
- .join('');
53252
- // add HTML Proxy to Map
53253
- addToHTMLProxyCache(config, url, inlineModuleIndex, contents);
53254
- // inline js module. convert to src="proxy"
53255
- const modulePath = `${config.base + htmlPath.slice(1)}?html-proxy&index=${inlineModuleIndex}.${ext}`;
53256
- // invalidate the module so the newly cached contents will be served
53257
- const module = server === null || server === void 0 ? void 0 : server.moduleGraph.getModuleById(modulePath);
53258
- if (module) {
53259
- server === null || server === void 0 ? void 0 : server.moduleGraph.invalidateModule(module);
53260
- }
53261
- s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${modulePath}"></script>`);
53262
- };
53263
53246
  await traverseHtml(html, htmlPath, (node) => {
53264
53247
  if (node.type !== 1 /* ELEMENT */) {
53265
53248
  return;
@@ -53267,16 +53250,29 @@ const devHtmlHook = async (html, { path: htmlPath, server, originalUrl }) => {
53267
53250
  // script tags
53268
53251
  if (node.tag === 'script') {
53269
53252
  const { src, isModule } = getScriptInfo(node);
53253
+ if (isModule) {
53254
+ scriptModuleIndex++;
53255
+ }
53270
53256
  if (src) {
53271
53257
  processNodeUrl(src, s, config, htmlPath, originalUrl, moduleGraph);
53272
53258
  }
53273
53259
  else if (isModule) {
53274
- addInlineModule(node, 'js');
53260
+ const url = filePath.replace(normalizePath$4(config.root), '');
53261
+ const contents = node.children
53262
+ .map((child) => child.content || '')
53263
+ .join('');
53264
+ // add HTML Proxy to Map
53265
+ addToHTMLProxyCache(config, url, scriptModuleIndex, contents);
53266
+ // inline js module. convert to src="proxy"
53267
+ const modulePath = `${config.base + htmlPath.slice(1)}?html-proxy&index=${scriptModuleIndex}.js`;
53268
+ // invalidate the module so the newly cached contents will be served
53269
+ const module = server === null || server === void 0 ? void 0 : server.moduleGraph.getModuleById(modulePath);
53270
+ if (module) {
53271
+ server === null || server === void 0 ? void 0 : server.moduleGraph.invalidateModule(module);
53272
+ }
53273
+ s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${modulePath}"></script>`);
53275
53274
  }
53276
53275
  }
53277
- if (node.tag === 'style' && node.children.length) {
53278
- addInlineModule(node, 'css');
53279
- }
53280
53276
  // elements with [href/src] attrs
53281
53277
  const assetAttrs = assetAttrsConfig[node.tag];
53282
53278
  if (assetAttrs) {
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 build = require('./chunks/dep-ff3ab196.js');
4
+ var build = require('./chunks/dep-9c153816.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-ff3ab196.js'); }).then(function (n) { return n.index$1; });
686
+ const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-9c153816.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: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-ff3ab196.js'); }).then(function (n) { return n.build$1; });
735
+ const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-9c153816.js'); }).then(function (n) { return n.build$1; });
736
736
  const buildOptions = cleanOptions(options);
737
737
  try {
738
738
  await build$1({
@@ -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-ff3ab196.js'); }).then(function (n) { return n.index; });
758
+ const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-9c153816.js'); }).then(function (n) { return n.index; });
759
759
  try {
760
760
  const config = await build.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-ff3ab196.js'); }).then(function (n) { return n.preview$1; });
781
+ const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-9c153816.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 build = require('./chunks/dep-ff3ab196.js');
5
+ var build = require('./chunks/dep-9c153816.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.8.5",
3
+ "version": "2.8.6",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "description": "Native-ESM powered web dev build tool",