vite 4.4.6 → 4.4.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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -11629,7 +11629,6 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
11629
11629
  var srcExports$1 = src$2.exports;
11630
11630
  var debug$g = /*@__PURE__*/getDefaultExportFromCjs(srcExports$1);
11631
11631
 
11632
- // eslint-disable-next-line @typescript-eslint/consistent-type-imports
11633
11632
  let pnp;
11634
11633
  if (process.versions.pnp) {
11635
11634
  try {
@@ -28587,7 +28586,10 @@ async function tryOptimizedResolve(depsOptimizer, id, importer, preserveSymlinks
28587
28586
  continue;
28588
28587
  // lazily initialize idPkgDir
28589
28588
  if (idPkgDir == null) {
28590
- idPkgDir = resolvePackageData(id, importer, preserveSymlinks, packageCache)?.dir;
28589
+ const pkgName = getNpmPackageName(id);
28590
+ if (!pkgName)
28591
+ break;
28592
+ idPkgDir = resolvePackageData(pkgName, importer, preserveSymlinks, packageCache)?.dir;
28591
28593
  // if still null, it likely means that this id isn't a dep for importer.
28592
28594
  // break to bail early
28593
28595
  if (idPkgDir == null)
@@ -37918,7 +37920,18 @@ function htmlEnvHook(config) {
37918
37920
  for (const key in config.define) {
37919
37921
  if (key.startsWith(`import.meta.env.`)) {
37920
37922
  const val = config.define[key];
37921
- env[key.slice(16)] = typeof val === 'string' ? val : JSON.stringify(val);
37923
+ if (typeof val === 'string') {
37924
+ try {
37925
+ const parsed = JSON.parse(val);
37926
+ env[key.slice(16)] = typeof parsed === 'string' ? parsed : val;
37927
+ }
37928
+ catch {
37929
+ env[key.slice(16)] = val;
37930
+ }
37931
+ }
37932
+ else {
37933
+ env[key.slice(16)] = JSON.stringify(val);
37934
+ }
37922
37935
  }
37923
37936
  }
37924
37937
  return (html, ctx) => {
@@ -38918,8 +38931,8 @@ function createCachedImport(imp) {
38918
38931
  return cached;
38919
38932
  };
38920
38933
  }
38921
- const importPostcssImport = createCachedImport(() => import('./dep-b202fccd.js').then(function (n) { return n.i; }));
38922
- const importPostcssModules = createCachedImport(() => import('./dep-e45589f1.js').then(function (n) { return n.i; }));
38934
+ const importPostcssImport = createCachedImport(() => import('./dep-ebfb454b.js').then(function (n) { return n.i; }));
38935
+ const importPostcssModules = createCachedImport(() => import('./dep-bcdce950.js').then(function (n) { return n.i; }));
38923
38936
  const importPostcss = createCachedImport(() => import('postcss'));
38924
38937
  /**
38925
38938
  * @experimental
@@ -39587,6 +39600,10 @@ async function compileLightningCSS(id, src, config, urlReplacer) {
39587
39600
  if (filePath === filename) {
39588
39601
  return src;
39589
39602
  }
39603
+ // This happens with html-proxy (#13776)
39604
+ if (!filePath.endsWith('.css')) {
39605
+ return src;
39606
+ }
39590
39607
  return fs$l.readFileSync(toAbsolute(filePath), 'utf-8');
39591
39608
  },
39592
39609
  async resolve(id, from) {
@@ -42534,11 +42551,12 @@ function webWorkerPlugin(config) {
42534
42551
  // other type will be import worker by esm
42535
42552
  const workerType = query['type'];
42536
42553
  let injectEnv = '';
42554
+ const scriptPath = JSON.stringify(path$o.posix.join(config.base, ENV_PUBLIC_PATH));
42537
42555
  if (workerType === 'classic') {
42538
- injectEnv = `importScripts('${ENV_PUBLIC_PATH}')\n`;
42556
+ injectEnv = `importScripts(${scriptPath})\n`;
42539
42557
  }
42540
42558
  else if (workerType === 'module') {
42541
- injectEnv = `import '${ENV_PUBLIC_PATH}'\n`;
42559
+ injectEnv = `import ${scriptPath}\n`;
42542
42560
  }
42543
42561
  else if (workerType === 'ignore') {
42544
42562
  if (isBuild) {
@@ -63891,8 +63909,15 @@ function proxyMiddleware(httpServer, options, config) {
63891
63909
  }
63892
63910
  proxy.on('error', (err, req, originalRes) => {
63893
63911
  // When it is ws proxy, res is net.Socket
63912
+ // originalRes can be falsy if the proxy itself errored
63894
63913
  const res = originalRes;
63895
- if ('req' in res) {
63914
+ if (!res) {
63915
+ config.logger.error(`${colors$1.red(`http proxy error: ${err.message}`)}\n${err.stack}`, {
63916
+ timestamp: true,
63917
+ error: err,
63918
+ });
63919
+ }
63920
+ else if ('req' in res) {
63896
63921
  config.logger.error(`${colors$1.red(`http proxy error at ${originalRes.req.url}:`)}\n${err.stack}`, {
63897
63922
  timestamp: true,
63898
63923
  error: err,
@@ -1,4 +1,4 @@
1
- import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-a8e37fae.js';
1
+ import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-3b8eb186.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1,4 +1,4 @@
1
- import { E as getDefaultExportFromCjs } from './dep-a8e37fae.js';
1
+ import { E as getDefaultExportFromCjs } from './dep-3b8eb186.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-c423598f.js';
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 { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-a8e37fae.js';
5
+ import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-3b8eb186.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -738,7 +738,7 @@ cli
738
738
  filterDuplicateOptions(options);
739
739
  // output structure is preserved even after bundling so require()
740
740
  // is ok here
741
- const { createServer } = await import('./chunks/dep-a8e37fae.js').then(function (n) { return n.I; });
741
+ const { createServer } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.I; });
742
742
  try {
743
743
  const server = await createServer({
744
744
  root,
@@ -816,7 +816,7 @@ cli
816
816
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
817
817
  .action(async (root, options) => {
818
818
  filterDuplicateOptions(options);
819
- const { build } = await import('./chunks/dep-a8e37fae.js').then(function (n) { return n.H; });
819
+ const { build } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.H; });
820
820
  const buildOptions = cleanOptions(options);
821
821
  try {
822
822
  await build({
@@ -844,7 +844,7 @@ cli
844
844
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
845
845
  .action(async (root, options) => {
846
846
  filterDuplicateOptions(options);
847
- const { optimizeDeps } = await import('./chunks/dep-a8e37fae.js').then(function (n) { return n.G; });
847
+ const { optimizeDeps } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.G; });
848
848
  try {
849
849
  const config = await resolveConfig({
850
850
  root,
@@ -871,7 +871,7 @@ cli
871
871
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
872
872
  .action(async (root, options) => {
873
873
  filterDuplicateOptions(options);
874
- const { preview } = await import('./chunks/dep-a8e37fae.js').then(function (n) { return n.J; });
874
+ const { preview } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.J; });
875
875
  try {
876
876
  const server = await preview({
877
877
  root,
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-a8e37fae.js';
2
- export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-a8e37fae.js';
1
+ import { i as isInNodeModules } from './chunks/dep-3b8eb186.js';
2
+ export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-3b8eb186.js';
3
3
  export { VERSION as version } from './constants.js';
4
4
  export { version as esbuildVersion } from 'esbuild';
5
5
  export { VERSION as rollupVersion } from 'rollup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.4.6",
3
+ "version": "4.4.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",