vite 6.2.4 → 6.3.0-beta.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.
- package/LICENSE.md +0 -58
- package/dist/client/client.mjs +1 -1
- package/dist/node/chunks/{dep-DrOo5SEf.js → dep-CY3sqczG.js} +14224 -18865
- package/dist/node/chunks/{dep-DfJZxycY.js → dep-DPsCJVuU.js} +1 -1
- package/dist/node/chunks/{dep-DZlHsecg.js → dep-W4lxOTyg.js} +1 -1
- package/dist/node/cli.js +7 -5
- package/dist/node/index.d.ts +41 -11
- package/dist/node/index.js +43 -3
- package/dist/node/module-runner.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +387 -2767
- package/index.cjs +2 -0
- package/package.json +8 -8
- package/types/customEvent.d.ts +6 -1
- package/types/hot.d.ts +7 -4
- package/types/importMeta.d.ts +10 -1
- package/types/metadata.d.ts +25 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-CY3sqczG.js';
|
2
2
|
import require$$0$2 from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
package/dist/node/cli.js
CHANGED
@@ -2,13 +2,14 @@ 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-
|
5
|
+
import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-CY3sqczG.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
9
9
|
import 'node:util';
|
10
10
|
import 'node:module';
|
11
11
|
import 'node:crypto';
|
12
|
+
import 'picomatch';
|
12
13
|
import 'esbuild';
|
13
14
|
import 'path';
|
14
15
|
import 'fs';
|
@@ -33,6 +34,7 @@ import 'module';
|
|
33
34
|
import 'node:readline';
|
34
35
|
import 'node:process';
|
35
36
|
import 'node:events';
|
37
|
+
import 'tinyglobby';
|
36
38
|
import 'crypto';
|
37
39
|
import 'node:assert';
|
38
40
|
import 'node:v8';
|
@@ -745,7 +747,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
745
747
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
746
748
|
).action(async (root, options) => {
|
747
749
|
filterDuplicateOptions(options);
|
748
|
-
const { createServer } = await import('./chunks/dep-
|
750
|
+
const { createServer } = await import('./chunks/dep-CY3sqczG.js').then(function (n) { return n.S; });
|
749
751
|
try {
|
750
752
|
const server = await createServer({
|
751
753
|
root,
|
@@ -840,7 +842,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
840
842
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
841
843
|
async (root, options) => {
|
842
844
|
filterDuplicateOptions(options);
|
843
|
-
const { createBuilder } = await import('./chunks/dep-
|
845
|
+
const { createBuilder } = await import('./chunks/dep-CY3sqczG.js').then(function (n) { return n.T; });
|
844
846
|
const buildOptions = cleanGlobalCLIOptions(
|
845
847
|
cleanBuilderCLIOptions(options)
|
846
848
|
);
|
@@ -879,7 +881,7 @@ cli.command(
|
|
879
881
|
).action(
|
880
882
|
async (root, options) => {
|
881
883
|
filterDuplicateOptions(options);
|
882
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
884
|
+
const { optimizeDeps } = await import('./chunks/dep-CY3sqczG.js').then(function (n) { return n.R; });
|
883
885
|
try {
|
884
886
|
const config = await resolveConfig(
|
885
887
|
{
|
@@ -906,7 +908,7 @@ ${e.stack}`),
|
|
906
908
|
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(
|
907
909
|
async (root, options) => {
|
908
910
|
filterDuplicateOptions(options);
|
909
|
-
const { preview } = await import('./chunks/dep-
|
911
|
+
const { preview } = await import('./chunks/dep-CY3sqczG.js').then(function (n) { return n.U; });
|
910
912
|
try {
|
911
913
|
const server = await preview({
|
912
914
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -31,7 +31,7 @@ export { LightningCSSOptions } from '../../types/internal/lightningcssOptions.js
|
|
31
31
|
import { SassLegacyPreprocessBaseOptions, SassModernPreprocessBaseOptions, LessPreprocessorBaseOptions, StylusPreprocessorBaseOptions } from '../../types/internal/cssPreprocessorOptions.js';
|
32
32
|
import { M as ModuleRunnerTransport } from './moduleRunnerTransport.d-CXw_Ws6P.js';
|
33
33
|
export { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from '../../types/importGlob.js';
|
34
|
-
export { ChunkMetadata } from '../../types/metadata.js';
|
34
|
+
export { ChunkMetadata, CustomPluginOptionsVite } from '../../types/metadata.js';
|
35
35
|
|
36
36
|
interface Alias {
|
37
37
|
find: string | RegExp
|
@@ -848,7 +848,7 @@ declare class BaseEnvironment extends PartialEnvironment {
|
|
848
848
|
* const isDev = environment.mode === 'dev' // good
|
849
849
|
* ```
|
850
850
|
*
|
851
|
-
* You should also not check against `"unknown"`
|
851
|
+
* You should also not check against `"unknown"` specifically. It's
|
852
852
|
* a placeholder for more possible environment types.
|
853
853
|
*/
|
854
854
|
declare class UnknownEnvironment extends BaseEnvironment {
|
@@ -3200,6 +3200,11 @@ type IndexHtmlTransform = IndexHtmlTransformHook | {
|
|
3200
3200
|
handler: IndexHtmlTransformHook;
|
3201
3201
|
};
|
3202
3202
|
|
3203
|
+
type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
|
3204
|
+
include?: Value | Array<Value>;
|
3205
|
+
exclude?: Value | Array<Value>;
|
3206
|
+
};
|
3207
|
+
|
3203
3208
|
/**
|
3204
3209
|
* Vite plugins extends the Rollup plugin interface with a few extra
|
3205
3210
|
* vite-specific options. A valid vite plugin is also a valid Rollup plugin.
|
@@ -3280,13 +3285,26 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
3280
3285
|
custom?: CustomPluginOptions;
|
3281
3286
|
ssr?: boolean;
|
3282
3287
|
isEntry: boolean;
|
3283
|
-
}) => Promise<ResolveIdResult> | ResolveIdResult
|
3288
|
+
}) => Promise<ResolveIdResult> | ResolveIdResult, {
|
3289
|
+
filter?: {
|
3290
|
+
id?: StringFilter<RegExp>;
|
3291
|
+
};
|
3292
|
+
}>;
|
3284
3293
|
load?: ObjectHook<(this: PluginContext, id: string, options?: {
|
3285
3294
|
ssr?: boolean;
|
3286
|
-
}) => Promise<LoadResult> | LoadResult
|
3295
|
+
}) => Promise<LoadResult> | LoadResult, {
|
3296
|
+
filter?: {
|
3297
|
+
id?: StringFilter;
|
3298
|
+
};
|
3299
|
+
}>;
|
3287
3300
|
transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
|
3288
3301
|
ssr?: boolean;
|
3289
|
-
}) => Promise<rollup.TransformResult> | rollup.TransformResult
|
3302
|
+
}) => Promise<rollup.TransformResult> | rollup.TransformResult, {
|
3303
|
+
filter?: {
|
3304
|
+
id?: StringFilter;
|
3305
|
+
code?: StringFilter;
|
3306
|
+
};
|
3307
|
+
}>;
|
3290
3308
|
/**
|
3291
3309
|
* Opt-in this plugin into the shared plugins pipeline.
|
3292
3310
|
* For backward-compatibility, plugins are re-recreated for each environment
|
@@ -3427,7 +3445,7 @@ interface CSSOptions {
|
|
3427
3445
|
/**
|
3428
3446
|
* Using lightningcss is an experimental option to handle CSS modules,
|
3429
3447
|
* assets and imports via Lightning CSS. It requires to install it as a
|
3430
|
-
* peer dependency.
|
3448
|
+
* peer dependency.
|
3431
3449
|
*
|
3432
3450
|
* @default 'postcss'
|
3433
3451
|
* @experimental
|
@@ -3484,7 +3502,7 @@ interface CSSModulesOptions {
|
|
3484
3502
|
*/
|
3485
3503
|
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
|
3486
3504
|
}
|
3487
|
-
type ResolvedCSSOptions = Omit<CSSOptions, 'lightningcss'> & Required<Pick<CSSOptions, 'transformer'>> & {
|
3505
|
+
type ResolvedCSSOptions = Omit<CSSOptions, 'lightningcss'> & Required<Pick<CSSOptions, 'transformer' | 'devSourcemap'>> & {
|
3488
3506
|
lightningcss?: LightningCSSOptions;
|
3489
3507
|
};
|
3490
3508
|
interface PreprocessCSSResult {
|
@@ -3837,7 +3855,7 @@ interface UserConfig extends DefaultEnvironmentOptions {
|
|
3837
3855
|
* root.
|
3838
3856
|
* @default root
|
3839
3857
|
*/
|
3840
|
-
envDir?: string;
|
3858
|
+
envDir?: string | false;
|
3841
3859
|
/**
|
3842
3860
|
* Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
|
3843
3861
|
* @default 'VITE_'
|
@@ -3965,6 +3983,7 @@ interface InlineConfig extends UserConfig {
|
|
3965
3983
|
configFile?: string | false;
|
3966
3984
|
/** @experimental */
|
3967
3985
|
configLoader?: 'bundle' | 'runner' | 'native';
|
3986
|
+
/** @deprecated */
|
3968
3987
|
envFile?: false;
|
3969
3988
|
forceOptimizeDeps?: boolean;
|
3970
3989
|
}
|
@@ -3980,7 +3999,7 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, 'plugins' | 'css' | '
|
|
3980
3999
|
mode: string;
|
3981
4000
|
isWorker: boolean;
|
3982
4001
|
isProduction: boolean;
|
3983
|
-
envDir: string;
|
4002
|
+
envDir: string | false;
|
3984
4003
|
env: Record<string, any>;
|
3985
4004
|
resolve: Required<ResolveOptions> & {
|
3986
4005
|
alias: Alias[];
|
@@ -4081,6 +4100,17 @@ declare class RunnableDevEnvironment extends DevEnvironment {
|
|
4081
4100
|
close(): Promise<void>;
|
4082
4101
|
}
|
4083
4102
|
|
4103
|
+
interface FetchableDevEnvironmentContext extends DevEnvironmentContext {
|
4104
|
+
handleRequest(request: Request): Promise<Response> | Response;
|
4105
|
+
}
|
4106
|
+
declare function createFetchableDevEnvironment(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext): FetchableDevEnvironment;
|
4107
|
+
declare function isFetchableDevEnvironment(environment: Environment): environment is FetchableDevEnvironment;
|
4108
|
+
declare class FetchableDevEnvironment extends DevEnvironment {
|
4109
|
+
private _handleRequest;
|
4110
|
+
constructor(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext);
|
4111
|
+
dispatchFetch(request: Request): Promise<Response>;
|
4112
|
+
}
|
4113
|
+
|
4084
4114
|
interface RunnerImportResult<T> {
|
4085
4115
|
module: T;
|
4086
4116
|
dependencies: string[];
|
@@ -4175,7 +4205,7 @@ declare function isFileServingAllowed(config: ResolvedConfig, url: string): bool
|
|
4175
4205
|
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
4176
4206
|
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
4177
4207
|
|
4178
|
-
declare function loadEnv(mode: string, envDir: string, prefixes?: string | string[]): Record<string, string>;
|
4208
|
+
declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
|
4179
4209
|
declare function resolveEnvPrefix({ envPrefix, }: UserConfig): string[];
|
4180
4210
|
|
4181
4211
|
type Manifest = Record<string, ManifestChunk>;
|
@@ -4191,4 +4221,4 @@ interface ManifestChunk {
|
|
4191
4221
|
dynamicImports?: string[];
|
4192
4222
|
}
|
4193
4223
|
|
4194
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, 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 HotChannelListener, 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 NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, 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, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, type SkipInformation, 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, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
4224
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, 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, FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, 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 NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, 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, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, type SkipInformation, 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, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { a as arraify, i as isInNodeModules } from './chunks/dep-
|
3
|
-
export { B as BuildEnvironment,
|
2
|
+
import { a as arraify, i as isInNodeModules, D as DevEnvironment } from './chunks/dep-CY3sqczG.js';
|
3
|
+
export { B as BuildEnvironment, 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-CY3sqczG.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';
|
@@ -11,6 +11,7 @@ import 'node:util';
|
|
11
11
|
import 'node:perf_hooks';
|
12
12
|
import 'node:module';
|
13
13
|
import 'node:crypto';
|
14
|
+
import 'picomatch';
|
14
15
|
import 'path';
|
15
16
|
import 'fs';
|
16
17
|
import 'node:child_process';
|
@@ -34,6 +35,7 @@ import 'module';
|
|
34
35
|
import 'node:readline';
|
35
36
|
import 'node:process';
|
36
37
|
import 'node:events';
|
38
|
+
import 'tinyglobby';
|
37
39
|
import 'crypto';
|
38
40
|
import 'node:assert';
|
39
41
|
import 'node:v8';
|
@@ -150,4 +152,42 @@ function splitVendorChunkPlugin() {
|
|
150
152
|
};
|
151
153
|
}
|
152
154
|
|
153
|
-
|
155
|
+
function createFetchableDevEnvironment(name, config, context) {
|
156
|
+
if (typeof Request === "undefined" || typeof Response === "undefined") {
|
157
|
+
throw new TypeError(
|
158
|
+
"FetchableDevEnvironment requires a global `Request` and `Response` object."
|
159
|
+
);
|
160
|
+
}
|
161
|
+
if (!context.handleRequest) {
|
162
|
+
throw new TypeError(
|
163
|
+
"FetchableDevEnvironment requires a `handleRequest` method during initialisation."
|
164
|
+
);
|
165
|
+
}
|
166
|
+
return new FetchableDevEnvironment(name, config, context);
|
167
|
+
}
|
168
|
+
function isFetchableDevEnvironment(environment) {
|
169
|
+
return environment instanceof FetchableDevEnvironment;
|
170
|
+
}
|
171
|
+
class FetchableDevEnvironment extends DevEnvironment {
|
172
|
+
_handleRequest;
|
173
|
+
constructor(name, config, context) {
|
174
|
+
super(name, config, context);
|
175
|
+
this._handleRequest = context.handleRequest;
|
176
|
+
}
|
177
|
+
async dispatchFetch(request) {
|
178
|
+
if (!(request instanceof Request)) {
|
179
|
+
throw new TypeError(
|
180
|
+
"FetchableDevEnvironment `dispatchFetch` must receive a `Request` object."
|
181
|
+
);
|
182
|
+
}
|
183
|
+
const response = await this._handleRequest(request);
|
184
|
+
if (!(response instanceof Response)) {
|
185
|
+
throw new TypeError(
|
186
|
+
"FetchableDevEnvironment `context.handleRequest` must return a `Response` object."
|
187
|
+
);
|
188
|
+
}
|
189
|
+
return response;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
export { DevEnvironment, createFetchableDevEnvironment, isCSSRequest, isFetchableDevEnvironment, splitVendorChunk, splitVendorChunkPlugin };
|
@@ -466,7 +466,7 @@ class HMRClient {
|
|
466
466
|
});
|
467
467
|
}
|
468
468
|
warnFailedUpdate(err, path) {
|
469
|
-
err.message.includes("fetch")
|
469
|
+
(!(err instanceof Error) || !err.message.includes("fetch")) && this.logger.error(err), this.logger.error(
|
470
470
|
`Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`
|
471
471
|
);
|
472
472
|
}
|