vite 4.4.12 → 4.5.1

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,4 +1,4 @@
1
- import { E as getDefaultExportFromCjs } from './dep-063880ad.js';
1
+ import { E as getDefaultExportFromCjs } from './dep-68d1a114.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';
@@ -11982,7 +11982,7 @@ const dataUrlRE = /^\s*data:/i;
11982
11982
  const isDataUrl = (url) => dataUrlRE.test(url);
11983
11983
  const virtualModuleRE = /^virtual-module:.*/;
11984
11984
  const virtualModulePrefix = 'virtual-module:';
11985
- const knownJsSrcRE = /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba)(?:$|\?)/;
11985
+ const knownJsSrcRE = /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba|mdx)(?:$|\?)/;
11986
11986
  const isJSRequest = (url) => {
11987
11987
  url = cleanUrl(url);
11988
11988
  if (knownJsSrcRE.test(url)) {
@@ -28068,10 +28068,15 @@ function resolvePlugin(resolveOptions) {
28068
28068
  const targetWeb = !ssr || ssrTarget === 'webworker';
28069
28069
  // this is passed by @rollup/plugin-commonjs
28070
28070
  const isRequire = resolveOpts?.custom?.['node-resolve']?.isRequire ?? false;
28071
+ // end user can configure different conditions for ssr and client.
28072
+ // falls back to client conditions if no ssr conditions supplied
28073
+ const ssrConditions = resolveOptions.ssrConfig?.resolve?.conditions ||
28074
+ resolveOptions.conditions;
28071
28075
  const options = {
28072
28076
  isRequire,
28073
28077
  ...resolveOptions,
28074
28078
  scan: resolveOpts?.scan ?? resolveOptions.scan,
28079
+ conditions: ssr ? ssrConditions : resolveOptions.conditions,
28075
28080
  };
28076
28081
  const resolvedImports = resolveSubpathImports(id, importer, options, targetWeb);
28077
28082
  if (resolvedImports) {
@@ -38989,8 +38994,8 @@ function createCachedImport(imp) {
38989
38994
  return cached;
38990
38995
  };
38991
38996
  }
38992
- const importPostcssImport = createCachedImport(() => import('./dep-2bac6217.js').then(function (n) { return n.i; }));
38993
- const importPostcssModules = createCachedImport(() => import('./dep-cadf9240.js').then(function (n) { return n.i; }));
38997
+ const importPostcssImport = createCachedImport(() => import('./dep-197d0dbf.js').then(function (n) { return n.i; }));
38998
+ const importPostcssModules = createCachedImport(() => import('./dep-d279f98e.js').then(function (n) { return n.i; }));
38994
38999
  const importPostcss = createCachedImport(() => import('postcss'));
38995
39000
  /**
38996
39001
  * @experimental
@@ -40128,11 +40133,13 @@ function createIsConfiguredAsSsrExternal(config) {
40128
40133
  const noExternalFilter = noExternal !== 'undefined' &&
40129
40134
  typeof noExternal !== 'boolean' &&
40130
40135
  createFilter(undefined, noExternal, { resolve: false });
40136
+ const targetConditions = config.ssr.resolve?.externalConditions || [];
40131
40137
  const resolveOptions = {
40132
40138
  ...config.resolve,
40133
40139
  root,
40134
40140
  isProduction: false,
40135
40141
  isBuild: true,
40142
+ conditions: targetConditions,
40136
40143
  };
40137
40144
  const isExternalizable = (id, importer, configuredAsExternal) => {
40138
40145
  if (!bareImportRE.test(id) || id.includes('\0')) {
@@ -44882,7 +44889,11 @@ function shouldExternalizeDep(resolvedId, rawId) {
44882
44889
  return false;
44883
44890
  }
44884
44891
  function isScannable(id) {
44885
- return JS_TYPES_RE.test(id) || htmlTypesRE.test(id);
44892
+ // From Vite 5, all optimizeDeps.extensions are scannable. We hardcode .marko for 4.5.0 to avoid
44893
+ // potential regressions. See https://github.com/vitejs/vite/pull/14543
44894
+ return (JS_TYPES_RE.test(id) ||
44895
+ htmlTypesRE.test(id) ||
44896
+ path$o.extname(id) === '.marko');
44886
44897
  }
44887
44898
  // esbuild v0.18 only transforms decorators when `experimentalDecorators` is set to `true`.
44888
44899
  // To preserve compat with the esbuild breaking change, we set `experimentalDecorators` to
@@ -55955,18 +55966,20 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
55955
55966
  };
55956
55967
  urlStack = urlStack.concat(url);
55957
55968
  const isCircular = (url) => urlStack.includes(url);
55958
- const { isProduction, resolve: { dedupe, preserveSymlinks }, root, } = server.config;
55969
+ const { isProduction, resolve: { dedupe, preserveSymlinks }, root, ssr, } = server.config;
55970
+ const overrideConditions = ssr.resolve?.externalConditions || [];
55959
55971
  const resolveOptions = {
55960
55972
  mainFields: ['main'],
55961
55973
  browserField: true,
55962
55974
  conditions: [],
55963
- overrideConditions: ['production', 'development'],
55975
+ overrideConditions: [...overrideConditions, 'production', 'development'],
55964
55976
  extensions: ['.js', '.cjs', '.json'],
55965
55977
  dedupe,
55966
55978
  preserveSymlinks,
55967
55979
  isBuild: false,
55968
55980
  isProduction,
55969
55981
  root,
55982
+ ssrConfig: ssr,
55970
55983
  };
55971
55984
  // Since dynamic imports can happen in parallel, we need to
55972
55985
  // account for multiple pending deps and duplicate imports.
@@ -56070,7 +56083,7 @@ async function nodeImport(id, importer, resolveOptions) {
56070
56083
  // @ts-expect-error jest only exists when running Jest
56071
56084
  typeof jest === 'undefined'
56072
56085
  ? { ...resolveOptions, tryEsmOnly: true }
56073
- : resolveOptions, false);
56086
+ : resolveOptions, false, undefined, true);
56074
56087
  if (!resolved) {
56075
56088
  const err = new Error(`Cannot find module '${id}' imported from '${importer}'`);
56076
56089
  err.code = 'ERR_MODULE_NOT_FOUND';
@@ -1,4 +1,4 @@
1
- import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-063880ad.js';
1
+ import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-68d1a114.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
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-063880ad.js';
5
+ import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-68d1a114.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -758,7 +758,7 @@ cli
758
758
  filterDuplicateOptions(options);
759
759
  // output structure is preserved even after bundling so require()
760
760
  // is ok here
761
- const { createServer } = await import('./chunks/dep-063880ad.js').then(function (n) { return n.I; });
761
+ const { createServer } = await import('./chunks/dep-68d1a114.js').then(function (n) { return n.I; });
762
762
  try {
763
763
  const server = await createServer({
764
764
  root,
@@ -836,7 +836,7 @@ cli
836
836
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
837
837
  .action(async (root, options) => {
838
838
  filterDuplicateOptions(options);
839
- const { build } = await import('./chunks/dep-063880ad.js').then(function (n) { return n.H; });
839
+ const { build } = await import('./chunks/dep-68d1a114.js').then(function (n) { return n.H; });
840
840
  const buildOptions = cleanOptions(options);
841
841
  try {
842
842
  await build({
@@ -864,7 +864,7 @@ cli
864
864
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
865
865
  .action(async (root, options) => {
866
866
  filterDuplicateOptions(options);
867
- const { optimizeDeps } = await import('./chunks/dep-063880ad.js').then(function (n) { return n.G; });
867
+ const { optimizeDeps } = await import('./chunks/dep-68d1a114.js').then(function (n) { return n.G; });
868
868
  try {
869
869
  const config = await resolveConfig({
870
870
  root,
@@ -891,7 +891,7 @@ cli
891
891
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
892
892
  .action(async (root, options) => {
893
893
  filterDuplicateOptions(options);
894
- const { preview } = await import('./chunks/dep-063880ad.js').then(function (n) { return n.J; });
894
+ const { preview } = await import('./chunks/dep-68d1a114.js').then(function (n) { return n.J; });
895
895
  try {
896
896
  const server = await preview({
897
897
  root,
@@ -2269,6 +2269,22 @@ export declare interface SSROptions {
2269
2269
  * @experimental
2270
2270
  */
2271
2271
  optimizeDeps?: SsrDepOptimizationOptions;
2272
+ resolve?: {
2273
+ /**
2274
+ * Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
2275
+ *
2276
+ * Use this to override the default ssr conditions for the ssr build.
2277
+ *
2278
+ * @default rootConfig.resolve.conditions
2279
+ */
2280
+ conditions?: string[];
2281
+ /**
2282
+ * Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
2283
+ *
2284
+ * @default []
2285
+ */
2286
+ externalConditions?: string[];
2287
+ };
2272
2288
  }
2273
2289
 
2274
2290
  export declare type SSRTarget = 'node' | 'webworker';
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-063880ad.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-063880ad.js';
1
+ import { i as isInNodeModules } from './chunks/dep-68d1a114.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-68d1a114.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.12",
3
+ "version": "4.5.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",