vite 6.1.0-beta.1 → 6.1.0-beta.2

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.
@@ -1,4 +1,4 @@
1
- import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-ChTE610F.js';
1
+ import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-De0zV__s.js';
2
2
  import require$$0$2 from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1,4 +1,4 @@
1
- import { P as getDefaultExportFromCjs } from './dep-ChTE610F.js';
1
+ import { P as getDefaultExportFromCjs } from './dep-De0zV__s.js';
2
2
  import require$$0 from 'path';
3
3
  import { l as lib } from './dep-3RmXg9uo.js';
4
4
 
@@ -20146,7 +20146,7 @@ function expandValue (value, processEnv, runningParsed) {
20146
20146
 
20147
20147
  function expand$2 (options) {
20148
20148
  // for use with progressive expansion
20149
- const runningParsed = {};
20149
+ // const runningParsed = {}
20150
20150
 
20151
20151
  let processEnv = process.env;
20152
20152
  if (options && options.processEnv != null) {
@@ -20161,13 +20161,15 @@ function expand$2 (options) {
20161
20161
  if (processEnv[key] && processEnv[key] !== value) {
20162
20162
  value = processEnv[key];
20163
20163
  } else {
20164
- value = expandValue(value, processEnv, runningParsed);
20164
+ // PATCH: we pass options.parsed instead of runningParsed
20165
+ // to allow variables declared in other files to be used
20166
+ value = expandValue(value, processEnv, options.parsed);
20165
20167
  }
20166
20168
 
20167
20169
  options.parsed[key] = _resolveEscapeSequences(value);
20168
20170
 
20169
20171
  // for use with progressive expansion
20170
- runningParsed[key] = _resolveEscapeSequences(value);
20172
+ // runningParsed[key] = _resolveEscapeSequences(value)
20171
20173
  }
20172
20174
 
20173
20175
  for (const processKey in options.parsed) {
@@ -20241,7 +20243,7 @@ function resolveEnvPrefix({
20241
20243
  return envPrefix;
20242
20244
  }
20243
20245
 
20244
- const docsURL = "https://main.vite.dev";
20246
+ const docsURL = "https://vite.dev";
20245
20247
  const deprecationCode = {
20246
20248
  removePluginHookSsrArgument: "changes/this-environment-in-hooks",
20247
20249
  removePluginHookHandleHotUpdate: "changes/hotupdate-hook",
@@ -42014,7 +42016,7 @@ ${js}`;
42014
42016
  }
42015
42017
  },
42016
42018
  async generateBundle(options, bundle) {
42017
- const analyzedChunk = /* @__PURE__ */ new Map();
42019
+ const analyzedImportedCssFiles = /* @__PURE__ */ new Map();
42018
42020
  const inlineEntryChunk = /* @__PURE__ */ new Set();
42019
42021
  const getImportedChunks = (chunk, seen = /* @__PURE__ */ new Set()) => {
42020
42022
  const chunks = [];
@@ -42055,32 +42057,44 @@ ${js}`;
42055
42057
  href: toOutputPath(filename)
42056
42058
  }
42057
42059
  });
42058
- const getCssTagsForChunk = (chunk, toOutputPath, seen = /* @__PURE__ */ new Set()) => {
42059
- const tags = [];
42060
- if (!analyzedChunk.has(chunk)) {
42061
- analyzedChunk.set(chunk, 1);
42062
- chunk.imports.forEach((file) => {
42063
- const importee = bundle[file];
42064
- if (importee?.type === "chunk") {
42065
- tags.push(...getCssTagsForChunk(importee, toOutputPath, seen));
42066
- }
42067
- });
42060
+ const toStyleSheetLinkTag = (file, toOutputPath) => ({
42061
+ tag: "link",
42062
+ attrs: {
42063
+ rel: "stylesheet",
42064
+ crossorigin: true,
42065
+ href: toOutputPath(file)
42068
42066
  }
42067
+ });
42068
+ const getCssFilesForChunk = (chunk, seenChunks = /* @__PURE__ */ new Set(), seenCss = /* @__PURE__ */ new Set()) => {
42069
+ if (seenChunks.has(chunk.fileName)) {
42070
+ return [];
42071
+ }
42072
+ seenChunks.add(chunk.fileName);
42073
+ if (analyzedImportedCssFiles.has(chunk)) {
42074
+ const files2 = analyzedImportedCssFiles.get(chunk);
42075
+ const additionals = files2.filter((file) => !seenCss.has(file));
42076
+ additionals.forEach((file) => seenCss.add(file));
42077
+ return additionals;
42078
+ }
42079
+ const files = [];
42080
+ chunk.imports.forEach((file) => {
42081
+ const importee = bundle[file];
42082
+ if (importee?.type === "chunk") {
42083
+ files.push(...getCssFilesForChunk(importee, seenChunks, seenCss));
42084
+ }
42085
+ });
42086
+ analyzedImportedCssFiles.set(chunk, files);
42069
42087
  chunk.viteMetadata.importedCss.forEach((file) => {
42070
- if (!seen.has(file)) {
42071
- seen.add(file);
42072
- tags.push({
42073
- tag: "link",
42074
- attrs: {
42075
- rel: "stylesheet",
42076
- crossorigin: true,
42077
- href: toOutputPath(file)
42078
- }
42079
- });
42088
+ if (!seenCss.has(file)) {
42089
+ seenCss.add(file);
42090
+ files.push(file);
42080
42091
  }
42081
42092
  });
42082
- return tags;
42093
+ return files;
42083
42094
  };
42095
+ const getCssTagsForChunk = (chunk, toOutputPath) => getCssFilesForChunk(chunk).map(
42096
+ (file) => toStyleSheetLinkTag(file, toOutputPath)
42097
+ );
42084
42098
  for (const [normalizedId, html] of processedHtml(this)) {
42085
42099
  const relativeUrlPath = normalizePath$3(
42086
42100
  path$d.relative(config.root, normalizedId)
@@ -49048,8 +49062,8 @@ function createCachedImport(imp) {
49048
49062
  return cached;
49049
49063
  };
49050
49064
  }
49051
- const importPostcssImport = createCachedImport(() => import('./dep-BFhA-Un-.js').then(function (n) { return n.i; }));
49052
- const importPostcssModules = createCachedImport(() => import('./dep-B0BOsDX1.js').then(function (n) { return n.i; }));
49065
+ const importPostcssImport = createCachedImport(() => import('./dep-C64BF_qg.js').then(function (n) { return n.i; }));
49066
+ const importPostcssModules = createCachedImport(() => import('./dep-B-U7Afbv.js').then(function (n) { return n.i; }));
49053
49067
  const importPostcss = createCachedImport(() => import('postcss'));
49054
49068
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
49055
49069
  let alwaysFakeWorkerWorkerControllerCache;
@@ -50319,7 +50333,7 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
50319
50333
  } else if (typeof libOptions.fileName === "string") {
50320
50334
  return `${libOptions.fileName}.css`;
50321
50335
  }
50322
- const packageJson = findNearestPackageData(root, packageCache)?.data;
50336
+ const packageJson = findNearestMainPackageData(root, packageCache)?.data;
50323
50337
  const name = packageJson ? getPkgName(packageJson.name) : undefined;
50324
50338
  if (!name)
50325
50339
  throw new Error(
@@ -51345,7 +51359,7 @@ function resolveLibFilename(libOptions, format, entryName, root, extension, pack
51345
51359
  if (typeof libOptions.fileName === "function") {
51346
51360
  return libOptions.fileName(format, entryName);
51347
51361
  }
51348
- const packageJson = findNearestPackageData(root, packageCache)?.data;
51362
+ const packageJson = findNearestMainPackageData(root, packageCache)?.data;
51349
51363
  const name = libOptions.fileName || (packageJson && typeof libOptions.entry === "string" ? getPkgName(packageJson.name) : entryName);
51350
51364
  if (!name)
51351
51365
  throw new Error(
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-ChTE610F.js';
5
+ import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-De0zV__s.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -745,7 +745,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
745
745
  `[boolean] force the optimizer to ignore the cache and re-bundle`
746
746
  ).action(async (root, options) => {
747
747
  filterDuplicateOptions(options);
748
- const { createServer } = await import('./chunks/dep-ChTE610F.js').then(function (n) { return n.S; });
748
+ const { createServer } = await import('./chunks/dep-De0zV__s.js').then(function (n) { return n.S; });
749
749
  try {
750
750
  const server = await createServer({
751
751
  root,
@@ -839,7 +839,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
839
839
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
840
840
  async (root, options) => {
841
841
  filterDuplicateOptions(options);
842
- const { createBuilder } = await import('./chunks/dep-ChTE610F.js').then(function (n) { return n.T; });
842
+ const { createBuilder } = await import('./chunks/dep-De0zV__s.js').then(function (n) { return n.T; });
843
843
  const buildOptions = cleanGlobalCLIOptions(
844
844
  cleanBuilderCLIOptions(options)
845
845
  );
@@ -875,7 +875,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
875
875
  ).action(
876
876
  async (root, options) => {
877
877
  filterDuplicateOptions(options);
878
- const { optimizeDeps } = await import('./chunks/dep-ChTE610F.js').then(function (n) { return n.R; });
878
+ const { optimizeDeps } = await import('./chunks/dep-De0zV__s.js').then(function (n) { return n.R; });
879
879
  try {
880
880
  const config = await resolveConfig(
881
881
  {
@@ -902,7 +902,7 @@ ${e.stack}`),
902
902
  cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
903
903
  async (root, options) => {
904
904
  filterDuplicateOptions(options);
905
- const { preview } = await import('./chunks/dep-ChTE610F.js').then(function (n) { return n.U; });
905
+ const { preview } = await import('./chunks/dep-De0zV__s.js').then(function (n) { return n.U; });
906
906
  try {
907
907
  const server = await preview({
908
908
  root,
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-ChTE610F.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ChTE610F.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-De0zV__s.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-De0zV__s.js';
4
4
  export { defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
@@ -6311,7 +6311,7 @@ function expandValue (value, processEnv, runningParsed) {
6311
6311
 
6312
6312
  function expand (options) {
6313
6313
  // for use with progressive expansion
6314
- const runningParsed = {};
6314
+ // const runningParsed = {}
6315
6315
 
6316
6316
  let processEnv = process.env;
6317
6317
  if (options && options.processEnv != null) {
@@ -6326,13 +6326,15 @@ function expand (options) {
6326
6326
  if (processEnv[key] && processEnv[key] !== value) {
6327
6327
  value = processEnv[key];
6328
6328
  } else {
6329
- value = expandValue(value, processEnv, runningParsed);
6329
+ // PATCH: we pass options.parsed instead of runningParsed
6330
+ // to allow variables declared in other files to be used
6331
+ value = expandValue(value, processEnv, options.parsed);
6330
6332
  }
6331
6333
 
6332
6334
  options.parsed[key] = _resolveEscapeSequences(value);
6333
6335
 
6334
6336
  // for use with progressive expansion
6335
- runningParsed[key] = _resolveEscapeSequences(value);
6337
+ // runningParsed[key] = _resolveEscapeSequences(value)
6336
6338
  }
6337
6339
 
6338
6340
  for (const processKey in options.parsed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.1.0-beta.1",
3
+ "version": "6.1.0-beta.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",