vite 3.1.5 → 3.1.7

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.
@@ -44520,7 +44520,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
44520
44520
  logger: config.logger
44521
44521
  }));
44522
44522
  if (isModule) {
44523
- postcssPlugins.unshift((await import('./dep-42389c84.js').then(function (n) { return n.i; })).default({
44523
+ postcssPlugins.unshift((await import('./dep-77359784.js').then(function (n) { return n.i; })).default({
44524
44524
  ...modulesOptions,
44525
44525
  getJSON(cssFileName, _modules, outputFileName) {
44526
44526
  modules = _modules;
@@ -53055,6 +53055,7 @@ const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
53055
53055
  */
53056
53056
  function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
53057
53057
  const parentStack = [];
53058
+ const varKindStack = [];
53058
53059
  const scopeMap = new WeakMap();
53059
53060
  const identifiers = [];
53060
53061
  const setScope = (node, name) => {
@@ -53113,6 +53114,10 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
53113
53114
  !(parent.type === 'IfStatement' && node === parent.alternate)) {
53114
53115
  parentStack.unshift(parent);
53115
53116
  }
53117
+ // track variable declaration kind stack used by VariableDeclarator
53118
+ if (node.type === 'VariableDeclaration') {
53119
+ varKindStack.unshift(node.kind);
53120
+ }
53116
53121
  if (node.type === 'MetaProperty' && node.meta.name === 'import') {
53117
53122
  onImportMeta(node);
53118
53123
  }
@@ -53171,7 +53176,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
53171
53176
  setIsNodeInPattern(node);
53172
53177
  }
53173
53178
  else if (node.type === 'VariableDeclarator') {
53174
- const parentFunction = findParentScope(parentStack);
53179
+ const parentFunction = findParentScope(parentStack, varKindStack[0] === 'var');
53175
53180
  if (parentFunction) {
53176
53181
  handlePattern(node.id, parentFunction);
53177
53182
  }
@@ -53183,6 +53188,9 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
53183
53188
  !(parent.type === 'IfStatement' && node === parent.alternate)) {
53184
53189
  parentStack.shift();
53185
53190
  }
53191
+ if (node.type === 'VariableDeclaration') {
53192
+ varKindStack.shift();
53193
+ }
53186
53194
  }
53187
53195
  });
53188
53196
  // emit the identifier events in BFS so the hoisted declarations
@@ -53249,8 +53257,9 @@ function isFunction(node) {
53249
53257
  return functionNodeTypeRE.test(node.type);
53250
53258
  }
53251
53259
  const scopeNodeTypeRE = /(?:Function|Class)(?:Expression|Declaration)$|Method$|^IfStatement$/;
53252
- function findParentScope(parentStack) {
53253
- return parentStack.find((i) => scopeNodeTypeRE.test(i.type));
53260
+ function findParentScope(parentStack, isVar = false) {
53261
+ const regex = isVar ? functionNodeTypeRE : scopeNodeTypeRE;
53262
+ return parentStack.find((i) => regex.test(i.type));
53254
53263
  }
53255
53264
  function isInDestructuringAssignment(parent, parentStack) {
53256
53265
  if (parent &&
@@ -63447,7 +63456,7 @@ async function bundleConfigFile(fileName, isESM) {
63447
63456
  isRequire: !isESM,
63448
63457
  preferRelative: false,
63449
63458
  tryIndex: true,
63450
- mainFields: DEFAULT_MAIN_FIELDS,
63459
+ mainFields: [],
63451
63460
  conditions: [],
63452
63461
  dedupe: [],
63453
63462
  extensions: DEFAULT_EXTENSIONS$1,
@@ -1,5 +1,5 @@
1
1
  import require$$0$1 from 'postcss';
2
- import { z as commonjsGlobal } from './dep-49b3b5ea.js';
2
+ import { z as commonjsGlobal } from './dep-0ebb5606.js';
3
3
  import require$$0 from 'path';
4
4
  import require$$5 from 'crypto';
5
5
  import require$$0__default from 'fs';
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-49b3b5ea.js';
3
+ import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-0ebb5606.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -695,7 +695,7 @@ cli
695
695
  .action(async (root, options) => {
696
696
  // output structure is preserved even after bundling so require()
697
697
  // is ok here
698
- const { createServer } = await import('./chunks/dep-49b3b5ea.js').then(function (n) { return n.C; });
698
+ const { createServer } = await import('./chunks/dep-0ebb5606.js').then(function (n) { return n.C; });
699
699
  try {
700
700
  const server = await createServer({
701
701
  root,
@@ -742,7 +742,7 @@ cli
742
742
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
743
743
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
744
744
  .action(async (root, options) => {
745
- const { build } = await import('./chunks/dep-49b3b5ea.js').then(function (n) { return n.B; });
745
+ const { build } = await import('./chunks/dep-0ebb5606.js').then(function (n) { return n.B; });
746
746
  const buildOptions = cleanOptions(options);
747
747
  try {
748
748
  await build({
@@ -766,7 +766,7 @@ cli
766
766
  .command('optimize [root]', 'pre-bundle dependencies')
767
767
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
768
768
  .action(async (root, options) => {
769
- const { optimizeDeps } = await import('./chunks/dep-49b3b5ea.js').then(function (n) { return n.A; });
769
+ const { optimizeDeps } = await import('./chunks/dep-0ebb5606.js').then(function (n) { return n.A; });
770
770
  try {
771
771
  const config = await resolveConfig({
772
772
  root,
@@ -789,7 +789,7 @@ cli
789
789
  .option('--https', `[boolean] use TLS + HTTP/2`)
790
790
  .option('--open [path]', `[boolean | string] open browser on startup`)
791
791
  .action(async (root, options) => {
792
- const { preview } = await import('./chunks/dep-49b3b5ea.js').then(function (n) { return n.D; });
792
+ const { preview } = await import('./chunks/dep-0ebb5606.js').then(function (n) { return n.D; });
793
793
  try {
794
794
  const server = await preview({
795
795
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
- var version = "3.1.5";
4
+ var version = "3.1.7";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -1,4 +1,4 @@
1
- export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-49b3b5ea.js';
1
+ export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-0ebb5606.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';
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
31
  var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
32
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
33
 
34
- var version = "3.1.5";
34
+ var version = "3.1.7";
35
35
 
36
36
  const VERSION = version;
37
37
  const VITE_PACKAGE_DIR = path$3.resolve(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.1.5",
3
+ "version": "3.1.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",