vite 2.8.3 → 2.8.4

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-f9d9421a.js');
4
+ var build$2 = require('./dep-971d9e33.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-f9d9421a.js');
3
+ var build = require('./dep-971d9e33.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
@@ -18880,7 +18880,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
18880
18880
  replacer: urlReplacer
18881
18881
  }));
18882
18882
  if (isModule) {
18883
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-cc251a32.js'); }).then(function (n) { return n.index; })).default({
18883
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-32e0ec2c.js'); }).then(function (n) { return n.index; })).default({
18884
18884
  ...modulesOptions,
18885
18885
  getJSON(cssFileName, _modules, outputFileName) {
18886
18886
  modules = _modules;
@@ -18921,7 +18921,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
18921
18921
  // record CSS dependencies from @imports
18922
18922
  for (const message of postcssResult.messages) {
18923
18923
  if (message.type === 'dependency') {
18924
- deps.add(message.file);
18924
+ deps.add(normalizePath$4(message.file));
18925
18925
  }
18926
18926
  else if (message.type === 'dir-dependency') {
18927
18927
  // https://github.com/postcss/postcss/blob/main/docs/guidelines/plugin.md#3-dependencies
@@ -21303,7 +21303,7 @@ const assetAttrsConfig = {
21303
21303
  const isAsyncScriptMap = new WeakMap();
21304
21304
  async function traverseHtml(html, filePath, visitor) {
21305
21305
  // lazy load compiler
21306
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-d44e59ba.js'); }).then(function (n) { return n.compilerDom_cjs; });
21306
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-4e686eeb.js'); }).then(function (n) { return n.compilerDom_cjs; });
21307
21307
  // @vue/compiler-core doesn't like lowercase doctypes
21308
21308
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
21309
21309
  try {
@@ -45049,7 +45049,7 @@ async function getCertificate(cacheDir) {
45049
45049
  return content;
45050
45050
  }
45051
45051
  catch {
45052
- const content = (await Promise.resolve().then(function () { return require('./dep-8a5027b8.js'); })).createCertificate();
45052
+ const content = (await Promise.resolve().then(function () { return require('./dep-98e8af53.js'); })).createCertificate();
45053
45053
  fs$n.promises
45054
45054
  .mkdir(cacheDir, { recursive: true })
45055
45055
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -70189,7 +70189,7 @@ const normalizedEnvEntry = normalizePath$4(ENV_ENTRY);
70189
70189
  function clientInjectionsPlugin(config) {
70190
70190
  return {
70191
70191
  name: 'vite:client-inject',
70192
- transform(code, id) {
70192
+ transform(code, id, options) {
70193
70193
  if (id === normalizedClientEntry || id === normalizedEnvEntry) {
70194
70194
  let options = config.server.hmr;
70195
70195
  options = options && typeof options !== 'boolean' ? options : {};
@@ -70224,8 +70224,10 @@ function clientInjectionsPlugin(config) {
70224
70224
  .replace(`__HMR_TIMEOUT__`, JSON.stringify(timeout))
70225
70225
  .replace(`__HMR_ENABLE_OVERLAY__`, JSON.stringify(overlay));
70226
70226
  }
70227
- else if (code.includes('process.env.NODE_ENV')) {
70228
- // replace process.env.NODE_ENV
70227
+ else if (!(options === null || options === void 0 ? void 0 : options.ssr) && code.includes('process.env.NODE_ENV')) {
70228
+ // replace process.env.NODE_ENV instead of defining a global
70229
+ // for it to avoid shimming a `process` object during dev,
70230
+ // avoiding inconsistencies between dev and build
70229
70231
  return code.replace(/\bprocess\.env\.NODE_ENV\b/g, JSON.stringify(config.mode));
70230
70232
  }
70231
70233
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var build = require('./dep-f9d9421a.js');
3
+ var build = require('./dep-971d9e33.js');
4
4
  var require$$1 = require('crypto');
5
5
  require('fs');
6
6
  require('path');
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-f9d9421a.js');
4
+ var build = require('./chunks/dep-971d9e33.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-f9d9421a.js'); }).then(function (n) { return n.index$1; });
686
+ const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-971d9e33.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-f9d9421a.js'); }).then(function (n) { return n.build$1; });
735
+ const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-971d9e33.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]')
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-f9d9421a.js'); }).then(function (n) { return n.index; });
758
+ const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-971d9e33.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-f9d9421a.js'); }).then(function (n) { return n.preview$1; });
781
+ const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-971d9e33.js'); }).then(function (n) { return n.preview$1; });
782
782
  try {
783
783
  const server = await preview({
784
784
  root,
@@ -515,8 +515,8 @@ export declare interface DepOptimizationMetadata {
515
515
 
516
516
  export declare interface DepOptimizationOptions {
517
517
  /**
518
- * By default, Vite will crawl your index.html to detect dependencies that
519
- * need to be pre-bundled. If build.rollupOptions.input is specified, Vite
518
+ * By default, Vite will crawl your `index.html` to detect dependencies that
519
+ * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
520
520
  * will crawl those entry points instead.
521
521
  *
522
522
  * If neither of these fit your needs, you can specify custom entries using
@@ -1907,7 +1907,7 @@ export declare interface UserConfig {
1907
1907
  * the performance. You can use `--force` flag or manually delete the directory
1908
1908
  * to regenerate the cache files. The value can be either an absolute file
1909
1909
  * system path or a path relative to <root>.
1910
- * Default to `.vite` when no package.json is detected.
1910
+ * Default to `.vite` when no `package.json` is detected.
1911
1911
  * @default 'node_modules/.vite'
1912
1912
  */
1913
1913
  cacheDir?: string;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var build = require('./chunks/dep-f9d9421a.js');
5
+ var build = require('./chunks/dep-971d9e33.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.3",
3
+ "version": "2.8.4",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "description": "Native-ESM powered web dev build tool",