vite 6.0.0-beta.4 → 6.0.0-beta.6

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 { L as getDefaultExportFromCjs } from './dep-Cpgpmu8-.js';
1
+ import { L as getDefaultExportFromCjs } from './dep-D4jOq5eU.js';
2
2
  import require$$0$1 from 'path';
3
3
  import require$$0 from 'fs';
4
4
  import { r as requireLib } from './dep-mtw2NpNs.js';
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 { K as colors, E as createLogger, r as resolveConfig } from './chunks/dep-Cpgpmu8-.js';
5
+ import { K as colors, E as createLogger, r as resolveConfig } from './chunks/dep-D4jOq5eU.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -740,7 +740,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
740
740
  `[boolean] force the optimizer to ignore the cache and re-bundle`
741
741
  ).action(async (root, options) => {
742
742
  filterDuplicateOptions(options);
743
- const { createServer } = await import('./chunks/dep-Cpgpmu8-.js').then(function (n) { return n.O; });
743
+ const { createServer } = await import('./chunks/dep-D4jOq5eU.js').then(function (n) { return n.O; });
744
744
  try {
745
745
  const server = await createServer({
746
746
  root,
@@ -833,7 +833,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
833
833
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
834
834
  async (root, options) => {
835
835
  filterDuplicateOptions(options);
836
- const { createBuilder } = await import('./chunks/dep-Cpgpmu8-.js').then(function (n) { return n.P; });
836
+ const { createBuilder } = await import('./chunks/dep-D4jOq5eU.js').then(function (n) { return n.P; });
837
837
  const buildOptions = cleanGlobalCLIOptions(
838
838
  cleanBuilderCLIOptions(options)
839
839
  );
@@ -868,7 +868,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
868
868
  ).action(
869
869
  async (root, options) => {
870
870
  filterDuplicateOptions(options);
871
- const { optimizeDeps } = await import('./chunks/dep-Cpgpmu8-.js').then(function (n) { return n.N; });
871
+ const { optimizeDeps } = await import('./chunks/dep-D4jOq5eU.js').then(function (n) { return n.N; });
872
872
  try {
873
873
  const config = await resolveConfig(
874
874
  {
@@ -894,7 +894,7 @@ ${e.stack}`),
894
894
  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(
895
895
  async (root, options) => {
896
896
  filterDuplicateOptions(options);
897
- const { preview } = await import('./chunks/dep-Cpgpmu8-.js').then(function (n) { return n.Q; });
897
+ const { preview } = await import('./chunks/dep-D4jOq5eU.js').then(function (n) { return n.Q; });
898
898
  try {
899
899
  const server = await preview({
900
900
  root,
@@ -26,6 +26,9 @@ export { CustomEventMap, InferCustomEventPayload, InvalidatePayload } from '../.
26
26
  import { SecureContextOptions } from 'node:tls';
27
27
  import { ZlibOptions } from 'node:zlib';
28
28
  import * as PostCSS from 'postcss';
29
+ import { LightningCSSOptions } from '../../types/internal/lightningcssOptions.js';
30
+ export { LightningCSSOptions } from '../../types/internal/lightningcssOptions.js';
31
+ import { SassLegacyPreprocessBaseOptions, SassModernPreprocessBaseOptions, LessPreprocessorBaseOptions, StylusPreprocessorBaseOptions } from '../../types/internal/cssPreprocessorOptions.js';
29
32
  export { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from '../../types/importGlob.js';
30
33
  export { ChunkMetadata } from '../../types/metadata.js';
31
34
 
@@ -649,6 +652,7 @@ interface LoggerOptions {
649
652
  prefix?: string;
650
653
  allowClearScreen?: boolean;
651
654
  customLogger?: Logger;
655
+ console?: Console;
652
656
  }
653
657
  declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
654
658
 
@@ -754,8 +758,8 @@ interface PreviewServer {
754
758
  */
755
759
  httpServer: HttpServer;
756
760
  /**
757
- * The resolved urls Vite prints on the CLI.
758
- * null before server is listening.
761
+ * The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
762
+ * if the server is not listening on any port.
759
763
  */
760
764
  resolvedUrls: ResolvedServerUrls | null;
761
765
  /**
@@ -1128,6 +1132,7 @@ declare class ModuleGraph {
1128
1132
  idToModuleMap: Map<string, ModuleNode>;
1129
1133
  etagToModuleMap: Map<string, ModuleNode>;
1130
1134
  fileToModulesMap: Map<string, Set<ModuleNode>>;
1135
+ private moduleNodeCache;
1131
1136
  constructor(moduleGraphs: {
1132
1137
  client: () => EnvironmentModuleGraph;
1133
1138
  ssr: () => EnvironmentModuleGraph;
@@ -2976,8 +2981,8 @@ interface ViteDevServer {
2976
2981
  */
2977
2982
  moduleGraph: ModuleGraph;
2978
2983
  /**
2979
- * The resolved urls Vite prints on the CLI. null in middleware mode or
2980
- * before `server.listen` is called.
2984
+ * The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
2985
+ * in middleware mode or if the server is not listening on any port.
2981
2986
  */
2982
2987
  resolvedUrls: ResolvedServerUrls | null;
2983
2988
  /**
@@ -3074,69 +3079,6 @@ type ESBuildTransformResult = Omit<esbuild_TransformResult, 'map'> & {
3074
3079
  };
3075
3080
  declare function transformWithEsbuild(code: string, filename: string, options?: esbuild_TransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
3076
3081
 
3077
- // This file is autogenerated by build-prefixes.js. DO NOT EDIT!
3078
-
3079
- interface Targets {
3080
- android?: number,
3081
- chrome?: number,
3082
- edge?: number,
3083
- firefox?: number,
3084
- ie?: number,
3085
- ios_saf?: number,
3086
- opera?: number,
3087
- safari?: number,
3088
- samsung?: number
3089
- }
3090
-
3091
- interface Drafts {
3092
- /** Whether to enable @custom-media rules. */
3093
- customMedia?: boolean
3094
- }
3095
-
3096
- interface NonStandard {
3097
- /** Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue. */
3098
- deepSelectorCombinator?: boolean
3099
- }
3100
-
3101
- interface PseudoClasses {
3102
- hover?: string,
3103
- active?: string,
3104
- focus?: string,
3105
- focusVisible?: string,
3106
- focusWithin?: string
3107
- }
3108
-
3109
- interface CSSModulesConfig {
3110
- /** The pattern to use when renaming class names and other identifiers. Default is `[hash]_[local]`. */
3111
- pattern?: string,
3112
- /** Whether to rename dashed identifiers, e.g. custom properties. */
3113
- dashedIdents?: boolean,
3114
- /** Whether to enable hashing for `@keyframes`. */
3115
- animation?: boolean,
3116
- /** Whether to enable hashing for CSS grid identifiers. */
3117
- grid?: boolean,
3118
- /** Whether to enable hashing for custom identifiers. */
3119
- customIdents?: boolean,
3120
- /** Whether to require at least one class or id selector in each rule. */
3121
- pure?: boolean
3122
- }
3123
-
3124
- /**
3125
- * Options are spread, so you can also use options that are not typed here like
3126
- * visitor (not exposed because it would impact too much the bundle size)
3127
- */
3128
- type LightningCSSOptions = {
3129
- targets?: Targets
3130
- include?: number
3131
- exclude?: number
3132
- drafts?: Drafts
3133
- nonStandard?: NonStandard
3134
- pseudoClasses?: PseudoClasses
3135
- unusedSymbols?: string[]
3136
- cssModules?: CSSModulesConfig
3137
- errorRecovery?: boolean
3138
- }
3139
-
3140
3082
  interface CSSOptions {
3141
3083
  /**
3142
3084
  * Using lightningcss is an experimental option to handle CSS modules,
@@ -3157,7 +3099,13 @@ interface CSSOptions {
3157
3099
  * In addition to options specific to each processors, Vite supports `additionalData` option.
3158
3100
  * The `additionalData` option can be used to inject extra code for each style content.
3159
3101
  */
3160
- preprocessorOptions?: Record<string, any>;
3102
+ preprocessorOptions?: {
3103
+ scss?: SassPreprocessorOptions;
3104
+ sass?: SassPreprocessorOptions;
3105
+ less?: LessPreprocessorOptions;
3106
+ styl?: StylusPreprocessorOptions;
3107
+ stylus?: StylusPreprocessorOptions;
3108
+ };
3161
3109
  /**
3162
3110
  * If this option is set, preprocessors will run in workers when possible.
3163
3111
  * `true` means the number of CPUs minus 1.
@@ -3193,9 +3141,7 @@ interface CSSModulesOptions {
3193
3141
  localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
3194
3142
  }
3195
3143
  type ResolvedCSSOptions = Omit<CSSOptions, 'lightningcss'> & {
3196
- lightningcss?: LightningCSSOptions & {
3197
- targets: LightningCSSOptions['targets'];
3198
- };
3144
+ lightningcss?: LightningCSSOptions;
3199
3145
  };
3200
3146
  interface PreprocessCSSResult {
3201
3147
  code: string;
@@ -3208,6 +3154,24 @@ interface PreprocessCSSResult {
3208
3154
  */
3209
3155
  declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
3210
3156
  declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
3157
+ type PreprocessorAdditionalDataResult = string | {
3158
+ content: string;
3159
+ map?: ExistingRawSourceMap;
3160
+ };
3161
+ type PreprocessorAdditionalData = string | ((source: string, filename: string) => PreprocessorAdditionalDataResult | Promise<PreprocessorAdditionalDataResult>);
3162
+ type SassPreprocessorOptions = {
3163
+ additionalData?: PreprocessorAdditionalData;
3164
+ } & (({
3165
+ api: 'legacy';
3166
+ } & SassLegacyPreprocessBaseOptions) | ({
3167
+ api?: 'modern' | 'modern-compiler';
3168
+ } & SassModernPreprocessBaseOptions));
3169
+ type LessPreprocessorOptions = {
3170
+ additionalData?: PreprocessorAdditionalData;
3171
+ } & LessPreprocessorBaseOptions;
3172
+ type StylusPreprocessorOptions = {
3173
+ additionalData?: PreprocessorAdditionalData;
3174
+ } & StylusPreprocessorBaseOptions;
3211
3175
 
3212
3176
  interface HtmlTagDescriptor {
3213
3177
  tag: string;
@@ -3476,10 +3440,11 @@ interface JsonOptions {
3476
3440
  namedExports?: boolean;
3477
3441
  /**
3478
3442
  * Generate performant output as JSON.parse("stringified").
3479
- * Enabling this will disable namedExports.
3480
- * @default false
3443
+ *
3444
+ * When set to 'auto', the data will be stringified only if the data is bigger than 10kB.
3445
+ * @default 'auto'
3481
3446
  */
3482
- stringify?: boolean;
3447
+ stringify?: boolean | 'auto';
3483
3448
  }
3484
3449
 
3485
3450
  type SSRTarget = 'node' | 'webworker';
@@ -3589,10 +3554,6 @@ interface DevEnvironmentOptions {
3589
3554
  * sourcemap path and returns whether to ignore the source path.
3590
3555
  */
3591
3556
  sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
3592
- /**
3593
- * Optimize deps config
3594
- */
3595
- optimizeDeps?: DepOptimizationOptions;
3596
3557
  /**
3597
3558
  * create the Dev Environment instance
3598
3559
  */
@@ -3635,6 +3596,10 @@ interface SharedEnvironmentOptions {
3635
3596
  * Temporal options, we should remove these in favor of fine-grained control
3636
3597
  */
3637
3598
  webCompatible?: boolean;
3599
+ /**
3600
+ * Optimize deps config
3601
+ */
3602
+ optimizeDeps?: DepOptimizationOptions;
3638
3603
  }
3639
3604
  interface EnvironmentOptions extends SharedEnvironmentOptions {
3640
3605
  /**
@@ -3652,6 +3617,7 @@ type ResolvedEnvironmentOptions = {
3652
3617
  resolve: ResolvedResolveOptions;
3653
3618
  consumer: 'client' | 'server';
3654
3619
  webCompatible: boolean;
3620
+ optimizeDeps: DepOptimizationOptions;
3655
3621
  dev: ResolvedDevEnvironmentOptions;
3656
3622
  build: ResolvedBuildEnvironmentOptions;
3657
3623
  };
@@ -4096,4 +4062,4 @@ interface ManifestChunk {
4096
4062
  dynamicImports?: string[];
4097
4063
  }
4098
4064
 
4099
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type EnvironmentOptions, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotUpdateOptions, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
4065
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type EnvironmentOptions, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotUpdateOptions, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-Cpgpmu8-.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, z as createFilter, f as createIdResolver, E as createLogger, k as createRunnableDevEnvironment, c as createServer, u as createServerHotChannel, q as createServerModuleRunner, d as defineConfig, n as fetchModule, g as formatPostcssSourceMap, H as isFileLoadingAllowed, G as isFileServingAllowed, m as isRunnableDevEnvironment, l as loadConfigFromFile, I as loadEnv, y as mergeAlias, x as mergeConfig, v as moduleRunnerTransform, w as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, J as resolveEnvPrefix, A as rollupVersion, F as searchForWorkspaceRoot, C as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Cpgpmu8-.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-D4jOq5eU.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, z as createFilter, f as createIdResolver, E as createLogger, k as createRunnableDevEnvironment, c as createServer, u as createServerHotChannel, q as createServerModuleRunner, d as defineConfig, n as fetchModule, g as formatPostcssSourceMap, H as isFileLoadingAllowed, G as isFileServingAllowed, m as isRunnableDevEnvironment, l as loadConfigFromFile, I as loadEnv, y as mergeAlias, x as mergeConfig, v as moduleRunnerTransform, w as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, J as resolveEnvPrefix, A as rollupVersion, F as searchForWorkspaceRoot, C as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-D4jOq5eU.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
@@ -17,11 +17,17 @@ function isPrimitive(value) {
17
17
  return !value || typeof value != "object" && typeof value != "function";
18
18
  }
19
19
  const AsyncFunction = async function() {
20
- }.constructor, asyncFunctionDeclarationPaddingLineCount = /* @__PURE__ */ (() => {
21
- const body = "/*code*/", source = new AsyncFunction("a", "b", body).toString();
22
- return source.slice(0, source.indexOf(body)).split(`
20
+ }.constructor;
21
+ let asyncFunctionDeclarationPaddingLineCount;
22
+ function getAsyncFunctionDeclarationPaddingLineCount() {
23
+ if (typeof asyncFunctionDeclarationPaddingLineCount > "u") {
24
+ const body = "/*code*/", source = new AsyncFunction("a", "b", body).toString();
25
+ asyncFunctionDeclarationPaddingLineCount = source.slice(0, source.indexOf(body)).split(`
23
26
  `).length - 1;
24
- })(), _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
27
+ }
28
+ return asyncFunctionDeclarationPaddingLineCount;
29
+ }
30
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
25
31
  function normalizeWindowsPath(input = "") {
26
32
  return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
27
33
  }
@@ -1052,7 +1058,7 @@ function exportAll(exports, sourceModule) {
1052
1058
  }
1053
1059
  }
1054
1060
  class ESModulesEvaluator {
1055
- startOffset = asyncFunctionDeclarationPaddingLineCount;
1061
+ startOffset = getAsyncFunctionDeclarationPaddingLineCount();
1056
1062
  async runInlinedModule(context, code) {
1057
1063
  await new AsyncFunction(
1058
1064
  ssrModuleExportsKey,
@@ -8,9 +8,9 @@ var node_child_process = require('node:child_process');
8
8
  var node_module = require('node:module');
9
9
  var require$$0 = require('tty');
10
10
  var require$$1 = require('util');
11
- var require$$0$1 = require('path');
12
- var require$$0$2 = require('crypto');
13
- var require$$1$1 = require('fs');
11
+ var require$$1$1 = require('path');
12
+ var require$$0$1 = require('crypto');
13
+ var require$$1$2 = require('fs');
14
14
  var readline = require('node:readline');
15
15
  var require$$2 = require('os');
16
16
 
@@ -1257,7 +1257,6 @@ function requireConstants () {
1257
1257
  if (hasRequiredConstants) return constants;
1258
1258
  hasRequiredConstants = 1;
1259
1259
 
1260
- const path = require$$0$1;
1261
1260
  const WIN_SLASH = '\\\\/';
1262
1261
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1263
1262
 
@@ -1280,6 +1279,7 @@ function requireConstants () {
1280
1279
  const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1281
1280
  const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1282
1281
  const STAR = `${QMARK}*?`;
1282
+ const SEP = '/';
1283
1283
 
1284
1284
  const POSIX_CHARS = {
1285
1285
  DOT_LITERAL,
@@ -1296,7 +1296,8 @@ function requireConstants () {
1296
1296
  NO_DOTS_SLASH,
1297
1297
  QMARK_NO_DOT,
1298
1298
  STAR,
1299
- START_ANCHOR
1299
+ START_ANCHOR,
1300
+ SEP
1300
1301
  };
1301
1302
 
1302
1303
  /**
@@ -1316,7 +1317,8 @@ function requireConstants () {
1316
1317
  NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1317
1318
  QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
1318
1319
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
1319
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
1320
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
1321
+ SEP: '\\'
1320
1322
  };
1321
1323
 
1322
1324
  /**
@@ -1410,8 +1412,6 @@ function requireConstants () {
1410
1412
  CHAR_VERTICAL_LINE: 124, /* | */
1411
1413
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
1412
1414
 
1413
- SEP: path.sep,
1414
-
1415
1415
  /**
1416
1416
  * Create EXTGLOB_CHARS
1417
1417
  */
@@ -1437,6 +1437,8 @@ function requireConstants () {
1437
1437
  return constants;
1438
1438
  }
1439
1439
 
1440
+ /*global navigator*/
1441
+
1440
1442
  var hasRequiredUtils;
1441
1443
 
1442
1444
  function requireUtils () {
@@ -1444,8 +1446,6 @@ function requireUtils () {
1444
1446
  hasRequiredUtils = 1;
1445
1447
  (function (exports) {
1446
1448
 
1447
- const path = require$$0$1;
1448
- const win32 = process.platform === 'win32';
1449
1449
  const {
1450
1450
  REGEX_BACKSLASH,
1451
1451
  REGEX_REMOVE_BACKSLASH,
@@ -1459,25 +1459,23 @@ function requireUtils () {
1459
1459
  exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
1460
1460
  exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
1461
1461
 
1462
- exports.removeBackslashes = str => {
1463
- return str.replace(REGEX_REMOVE_BACKSLASH, match => {
1464
- return match === '\\' ? '' : match;
1465
- });
1466
- };
1462
+ exports.isWindows = () => {
1463
+ if (typeof navigator !== 'undefined' && navigator.platform) {
1464
+ const platform = navigator.platform.toLowerCase();
1465
+ return platform === 'win32' || platform === 'windows';
1466
+ }
1467
1467
 
1468
- exports.supportsLookbehinds = () => {
1469
- const segs = process.version.slice(1).split('.').map(Number);
1470
- if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
1471
- return true;
1468
+ if (typeof process !== 'undefined' && process.platform) {
1469
+ return process.platform === 'win32';
1472
1470
  }
1471
+
1473
1472
  return false;
1474
1473
  };
1475
1474
 
1476
- exports.isWindows = options => {
1477
- if (options && typeof options.windows === 'boolean') {
1478
- return options.windows;
1479
- }
1480
- return win32 === true || path.sep === '\\';
1475
+ exports.removeBackslashes = str => {
1476
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
1477
+ return match === '\\' ? '' : match;
1478
+ });
1481
1479
  };
1482
1480
 
1483
1481
  exports.escapeLast = (input, char, lastIdx) => {
@@ -1505,6 +1503,17 @@ function requireUtils () {
1505
1503
  output = `(?:^(?!${output}).*$)`;
1506
1504
  }
1507
1505
  return output;
1506
+ };
1507
+
1508
+ exports.basename = (path, { windows } = {}) => {
1509
+ const segs = path.split(windows ? /[\\/]/ : '/');
1510
+ const last = segs[segs.length - 1];
1511
+
1512
+ if (last === '') {
1513
+ return segs[segs.length - 2];
1514
+ }
1515
+
1516
+ return last;
1508
1517
  };
1509
1518
  } (utils));
1510
1519
  return utils;
@@ -1980,10 +1989,9 @@ function requireParse () {
1980
1989
  const tokens = [bos];
1981
1990
 
1982
1991
  const capture = opts.capture ? '' : '?:';
1983
- const win32 = utils.isWindows(options);
1984
1992
 
1985
1993
  // create constants based on platform, for windows or posix
1986
- const PLATFORM_CHARS = constants.globChars(win32);
1994
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
1987
1995
  const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
1988
1996
 
1989
1997
  const {
@@ -2119,8 +2127,8 @@ function requireParse () {
2119
2127
 
2120
2128
  if (tok.value || tok.output) append(tok);
2121
2129
  if (prev && prev.type === 'text' && tok.type === 'text') {
2130
+ prev.output = (prev.output || prev.value) + tok.value;
2122
2131
  prev.value += tok.value;
2123
- prev.output = (prev.output || '') + tok.value;
2124
2132
  return;
2125
2133
  }
2126
2134
 
@@ -2608,10 +2616,6 @@ function requireParse () {
2608
2616
  const next = peek();
2609
2617
  let output = value;
2610
2618
 
2611
- if (next === '<' && !utils.supportsLookbehinds()) {
2612
- throw new Error('Node.js v10 or higher is required for regex lookbehinds');
2613
- }
2614
-
2615
2619
  if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
2616
2620
  output = `\\${value}`;
2617
2621
  }
@@ -2919,7 +2923,6 @@ function requireParse () {
2919
2923
  }
2920
2924
 
2921
2925
  input = REPLACEMENTS[input] || input;
2922
- const win32 = utils.isWindows(options);
2923
2926
 
2924
2927
  // create constants based on platform, for windows or posix
2925
2928
  const {
@@ -2932,7 +2935,7 @@ function requireParse () {
2932
2935
  NO_DOTS_SLASH,
2933
2936
  STAR,
2934
2937
  START_ANCHOR
2935
- } = constants.globChars(win32);
2938
+ } = constants.globChars(opts.windows);
2936
2939
 
2937
2940
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
2938
2941
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
@@ -3001,14 +3004,13 @@ function requireParse () {
3001
3004
  return parse_1;
3002
3005
  }
3003
3006
 
3004
- var picomatch_1;
3007
+ var picomatch_1$1;
3005
3008
  var hasRequiredPicomatch$1;
3006
3009
 
3007
3010
  function requirePicomatch$1 () {
3008
- if (hasRequiredPicomatch$1) return picomatch_1;
3011
+ if (hasRequiredPicomatch$1) return picomatch_1$1;
3009
3012
  hasRequiredPicomatch$1 = 1;
3010
3013
 
3011
- const path = require$$0$1;
3012
3014
  const scan = requireScan();
3013
3015
  const parse = requireParse();
3014
3016
  const utils = requireUtils();
@@ -3057,7 +3059,7 @@ function requirePicomatch$1 () {
3057
3059
  }
3058
3060
 
3059
3061
  const opts = options || {};
3060
- const posix = utils.isWindows(options);
3062
+ const posix = opts.windows;
3061
3063
  const regex = isState
3062
3064
  ? picomatch.compileRe(glob, options)
3063
3065
  : picomatch.makeRe(glob, options, false, true);
@@ -3166,9 +3168,9 @@ function requirePicomatch$1 () {
3166
3168
  * @api public
3167
3169
  */
3168
3170
 
3169
- picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3171
+ picomatch.matchBase = (input, glob, options) => {
3170
3172
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
3171
- return regex.test(path.basename(input));
3173
+ return regex.test(utils.basename(input));
3172
3174
  };
3173
3175
 
3174
3176
  /**
@@ -3347,22 +3349,36 @@ function requirePicomatch$1 () {
3347
3349
  * Expose "picomatch"
3348
3350
  */
3349
3351
 
3350
- picomatch_1 = picomatch;
3351
- return picomatch_1;
3352
+ picomatch_1$1 = picomatch;
3353
+ return picomatch_1$1;
3352
3354
  }
3353
3355
 
3354
- var picomatch;
3356
+ var picomatch_1;
3355
3357
  var hasRequiredPicomatch;
3356
3358
 
3357
3359
  function requirePicomatch () {
3358
- if (hasRequiredPicomatch) return picomatch;
3360
+ if (hasRequiredPicomatch) return picomatch_1;
3359
3361
  hasRequiredPicomatch = 1;
3360
3362
 
3361
- picomatch = requirePicomatch$1();
3362
- return picomatch;
3363
+ const pico = requirePicomatch$1();
3364
+ const utils = requireUtils();
3365
+
3366
+ function picomatch(glob, options, returnState = false) {
3367
+ // default to os.platform()
3368
+ if (options && (options.windows === null || options.windows === undefined)) {
3369
+ // don't mutate the original options object
3370
+ options = { ...options, windows: utils.isWindows() };
3371
+ }
3372
+
3373
+ return pico(glob, options, returnState);
3374
+ }
3375
+
3376
+ Object.assign(picomatch, pico);
3377
+ picomatch_1 = picomatch;
3378
+ return picomatch_1;
3363
3379
  }
3364
3380
 
3365
- var picomatchExports = requirePicomatch();
3381
+ var picomatchExports = /*@__PURE__*/ requirePicomatch();
3366
3382
  var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
3367
3383
 
3368
3384
  // Helper since Typescript can't detect readonly arrays with Array.isArray
@@ -3377,24 +3393,24 @@ function ensureArray(thing) {
3377
3393
  return [thing];
3378
3394
  }
3379
3395
 
3380
- const normalizePathRegExp = new RegExp(`\\${require$$0$1.win32.sep}`, 'g');
3396
+ const normalizePathRegExp = new RegExp(`\\${require$$1$1.win32.sep}`, 'g');
3381
3397
  const normalizePath$1 = function normalizePath(filename) {
3382
- return filename.replace(normalizePathRegExp, require$$0$1.posix.sep);
3398
+ return filename.replace(normalizePathRegExp, require$$1$1.posix.sep);
3383
3399
  };
3384
3400
 
3385
3401
  function getMatcherString(id, resolutionBase) {
3386
- if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('**')) {
3402
+ if (resolutionBase === false || require$$1$1.isAbsolute(id) || id.startsWith('**')) {
3387
3403
  return normalizePath$1(id);
3388
3404
  }
3389
3405
  // resolve('') is valid and will default to process.cwd()
3390
- const basePath = normalizePath$1(require$$0$1.resolve(resolutionBase || ''))
3406
+ const basePath = normalizePath$1(require$$1$1.resolve(resolutionBase || ''))
3391
3407
  // escape all possible (posix + win) path characters that might interfere with regex
3392
3408
  .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
3393
3409
  // Note that we use posix.join because:
3394
3410
  // 1. the basePath has been normalized to use /
3395
3411
  // 2. the incoming glob (id) matcher, also uses /
3396
3412
  // otherwise Node will force backslash (\) on windows
3397
- return require$$0$1.posix.join(basePath, normalizePath$1(id));
3413
+ return require$$1$1.posix.join(basePath, normalizePath$1(id));
3398
3414
  }
3399
3415
  const createFilter$1 = function createFilter(include, exclude, options) {
3400
3416
  const resolutionBase = options && options.resolve;
@@ -4149,8 +4165,8 @@ function requireEtag () {
4149
4165
  * @private
4150
4166
  */
4151
4167
 
4152
- var crypto = require$$0$2;
4153
- var Stats = require$$1$1.Stats;
4168
+ var crypto = require$$0$1;
4169
+ var Stats = require$$1$2.Stats;
4154
4170
 
4155
4171
  /**
4156
4172
  * Module variables.
@@ -5634,7 +5650,11 @@ function createLogger(level = "info", options = {}) {
5634
5650
  return options.customLogger;
5635
5651
  }
5636
5652
  const loggedErrors = /* @__PURE__ */ new WeakSet();
5637
- const { prefix = "[vite]", allowClearScreen = true } = options;
5653
+ const {
5654
+ prefix = "[vite]",
5655
+ allowClearScreen = true,
5656
+ console: console2 = globalThis.console
5657
+ } = options;
5638
5658
  const thresh = LogLevels[level];
5639
5659
  const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
5640
5660
  const clear = canClearScreen ? clearScreen : () => {
@@ -5665,7 +5685,7 @@ function createLogger(level = "info", options = {}) {
5665
5685
  if (type === lastType && msg === lastMsg) {
5666
5686
  sameCount++;
5667
5687
  clear();
5668
- console[method](
5688
+ console2[method](
5669
5689
  format(type, msg, options2),
5670
5690
  colors.yellow(`(x${sameCount + 1})`)
5671
5691
  );
@@ -5676,10 +5696,10 @@ function createLogger(level = "info", options = {}) {
5676
5696
  if (options2.clear) {
5677
5697
  clear();
5678
5698
  }
5679
- console[method](format(type, msg, options2));
5699
+ console2[method](format(type, msg, options2));
5680
5700
  }
5681
5701
  } else {
5682
- console[method](format(type, msg, options2));
5702
+ console2[method](format(type, msg, options2));
5683
5703
  }
5684
5704
  }
5685
5705
  }
@@ -5867,10 +5887,10 @@ var hasRequiredMain$1;
5867
5887
  function requireMain$1 () {
5868
5888
  if (hasRequiredMain$1) return main$2.exports;
5869
5889
  hasRequiredMain$1 = 1;
5870
- const fs = require$$1$1;
5871
- const path = require$$0$1;
5890
+ const fs = require$$1$2;
5891
+ const path = require$$1$1;
5872
5892
  const os = require$$2;
5873
- const crypto = require$$0$2;
5893
+ const crypto = require$$0$1;
5874
5894
  const packageJson = require$$4;
5875
5895
 
5876
5896
  const version = packageJson.version;