vite 8.0.16 → 8.1.0
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 +57 -0
- package/bin/openChrome.js +1 -1
- package/client.d.ts +3 -0
- package/dist/client/client.mjs +5 -7
- package/dist/node/chunks/build.js +1 -11
- package/dist/node/chunks/dist.js +23 -23
- package/dist/node/chunks/logger.js +11 -4
- package/dist/node/chunks/node.js +12264 -11603
- package/dist/node/cli.js +3 -3
- package/dist/node/index.d.ts +140 -16
- package/dist/node/index.js +1 -1
- package/dist/node/module-runner.js +2 -2
- package/package.json +54 -52
- package/types/importGlob.d.ts +48 -6
package/dist/node/cli.js
CHANGED
|
@@ -703,7 +703,7 @@ const convertBase = (v) => {
|
|
|
703
703
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
704
704
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).option("--experimentalBundle", `[boolean] use experimental full bundle mode (this is highly experimental)`).action(async (root, options) => {
|
|
705
705
|
filterDuplicateOptions(options);
|
|
706
|
-
const { createServer } = await import("./chunks/node.js").then((n) => n.
|
|
706
|
+
const { createServer } = await import("./chunks/node.js").then((n) => n.M);
|
|
707
707
|
try {
|
|
708
708
|
const server = await createServer({
|
|
709
709
|
root,
|
|
@@ -760,7 +760,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
760
760
|
});
|
|
761
761
|
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'baseline-widely-available')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("--assetsDir <dir>", `[string] directory under outDir to place assets in (default: assets)`).option("--assetsInlineLimit <number>", `[number] static asset base64 inline threshold in bytes (default: 4096)`).option("--ssr [entry]", `[string] build specified entry for server-side rendering`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"oxc\" | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: oxc)").option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(async (root, options) => {
|
|
762
762
|
filterDuplicateOptions(options);
|
|
763
|
-
const { createBuilder } = await import("./chunks/node.js").then((n) => n.
|
|
763
|
+
const { createBuilder } = await import("./chunks/node.js").then((n) => n.E);
|
|
764
764
|
const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
|
|
765
765
|
try {
|
|
766
766
|
const builder = await createBuilder({
|
|
@@ -786,7 +786,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
786
786
|
cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
|
|
787
787
|
filterDuplicateOptions(options);
|
|
788
788
|
const { resolveConfig } = await import("./chunks/node.js").then((n) => n.f);
|
|
789
|
-
const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.
|
|
789
|
+
const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.k);
|
|
790
790
|
try {
|
|
791
791
|
await optimizeDeps(await resolveConfig({
|
|
792
792
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -27,11 +27,11 @@ import * as PostCSS from "postcss";
|
|
|
27
27
|
import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_LightningCSSOptions } from "#types/internal/lightningcssOptions";
|
|
28
28
|
import { LessPreprocessorBaseOptions, SassModernPreprocessBaseOptions, StylusPreprocessorBaseOptions } from "#types/internal/cssPreprocessorOptions";
|
|
29
29
|
import { withFilter } from "rolldown/filter";
|
|
30
|
-
import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from "#types/importGlob";
|
|
30
|
+
import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap, KnownQueryTypeMap } from "#types/importGlob";
|
|
31
31
|
|
|
32
32
|
//#region \0rolldown/runtime.js
|
|
33
33
|
//#endregion
|
|
34
|
-
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.
|
|
34
|
+
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.3_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
|
|
35
35
|
//#region src/node/cli-commands.d.ts
|
|
36
36
|
interface StartOptions {
|
|
37
37
|
root?: string;
|
|
@@ -41,7 +41,7 @@ interface StartOptions {
|
|
|
41
41
|
open?: boolean;
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.
|
|
44
|
+
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.3_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
|
|
45
45
|
//#region src/node/config.d.ts
|
|
46
46
|
interface DevToolsConfig extends Partial<StartOptions> {
|
|
47
47
|
enabled: boolean;
|
|
@@ -336,7 +336,7 @@ declare namespace Connect {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
//#endregion
|
|
339
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
339
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
|
|
340
340
|
interface ProxyTargetDetailed {
|
|
341
341
|
host: string;
|
|
342
342
|
port: number;
|
|
@@ -524,7 +524,7 @@ declare class ProxyServer<TIncomingMessage extends typeof http.IncomingMessage =
|
|
|
524
524
|
after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
527
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.d.ts
|
|
528
528
|
declare function numOpenSockets(): number;
|
|
529
529
|
declare namespace index_d_exports {
|
|
530
530
|
export { ErrorCallback, ProxyServer, ProxyTarget, ProxyTargetUrl, ServerOptions$3 as ServerOptions, createProxyServer as createProxy, createProxyServer, createProxyServer as createServer, ProxyServer as default, numOpenSockets };
|
|
@@ -1157,14 +1157,44 @@ declare class ModuleGraph {
|
|
|
1157
1157
|
type ModuleSetNames = "acceptedHmrDeps" | "importedModules";
|
|
1158
1158
|
//#endregion
|
|
1159
1159
|
//#region src/node/server/hmr.d.ts
|
|
1160
|
+
interface WsOptions {
|
|
1161
|
+
protocol?: string;
|
|
1162
|
+
host?: string;
|
|
1163
|
+
port?: number;
|
|
1164
|
+
clientPort?: number;
|
|
1165
|
+
path?: string;
|
|
1166
|
+
timeout?: number;
|
|
1167
|
+
server?: HttpServer;
|
|
1168
|
+
}
|
|
1160
1169
|
interface HmrOptions {
|
|
1170
|
+
/**
|
|
1171
|
+
* @deprecated Use `server.ws.protocol` instead.
|
|
1172
|
+
*/
|
|
1161
1173
|
protocol?: string;
|
|
1174
|
+
/**
|
|
1175
|
+
* @deprecated Use `server.ws.host` instead.
|
|
1176
|
+
*/
|
|
1162
1177
|
host?: string;
|
|
1178
|
+
/**
|
|
1179
|
+
* @deprecated Use `server.ws.port` instead.
|
|
1180
|
+
*/
|
|
1163
1181
|
port?: number;
|
|
1182
|
+
/**
|
|
1183
|
+
* @deprecated Use `server.ws.clientPort` instead.
|
|
1184
|
+
*/
|
|
1164
1185
|
clientPort?: number;
|
|
1186
|
+
/**
|
|
1187
|
+
* @deprecated Use `server.ws.path` instead.
|
|
1188
|
+
*/
|
|
1165
1189
|
path?: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* @deprecated Use `server.ws.timeout` instead.
|
|
1192
|
+
*/
|
|
1166
1193
|
timeout?: number;
|
|
1167
1194
|
overlay?: boolean;
|
|
1195
|
+
/**
|
|
1196
|
+
* @deprecated Use `server.ws.server` instead.
|
|
1197
|
+
*/
|
|
1168
1198
|
server?: HttpServer;
|
|
1169
1199
|
}
|
|
1170
1200
|
interface HotUpdateOptions {
|
|
@@ -1576,6 +1606,45 @@ interface WebSocketClient extends NormalizedHotChannelClient {
|
|
|
1576
1606
|
socket: WebSocket;
|
|
1577
1607
|
}
|
|
1578
1608
|
//#endregion
|
|
1609
|
+
//#region src/node/server/bundledDev.d.ts
|
|
1610
|
+
type MemoryFile = {
|
|
1611
|
+
source: string | Uint8Array;
|
|
1612
|
+
etag?: string;
|
|
1613
|
+
};
|
|
1614
|
+
declare class MemoryFiles {
|
|
1615
|
+
private files;
|
|
1616
|
+
get size(): number;
|
|
1617
|
+
get(file: string): MemoryFile | undefined;
|
|
1618
|
+
set(file: string, content: MemoryFile | (() => MemoryFile)): void;
|
|
1619
|
+
has(file: string): boolean;
|
|
1620
|
+
clear(): void;
|
|
1621
|
+
}
|
|
1622
|
+
declare class BundledDev {
|
|
1623
|
+
private environment;
|
|
1624
|
+
private _devEngine;
|
|
1625
|
+
private initialBuildCompleted;
|
|
1626
|
+
private clients;
|
|
1627
|
+
private invalidateCalledModules;
|
|
1628
|
+
private debouncedFullReload;
|
|
1629
|
+
private fullReloadPending;
|
|
1630
|
+
private lastBuildError;
|
|
1631
|
+
memoryFiles: MemoryFiles;
|
|
1632
|
+
constructor(environment: DevEnvironment);
|
|
1633
|
+
private get devEngine();
|
|
1634
|
+
listen(): Promise<void>;
|
|
1635
|
+
private waitForInitialBuildFinish;
|
|
1636
|
+
invalidateModule(m: {
|
|
1637
|
+
path: string;
|
|
1638
|
+
message?: string;
|
|
1639
|
+
firstInvalidatedBy: string;
|
|
1640
|
+
}, client: NormalizedHotChannelClient): Promise<void>;
|
|
1641
|
+
triggerBundleRegenerationIfStale(): Promise<boolean>;
|
|
1642
|
+
triggerLazyBundling(moduleId: string | null, clientId: string | null): Promise<string | undefined>;
|
|
1643
|
+
close(): Promise<void>;
|
|
1644
|
+
private getRolldownOptions;
|
|
1645
|
+
private handleHmrOutput;
|
|
1646
|
+
}
|
|
1647
|
+
//#endregion
|
|
1579
1648
|
//#region src/node/server/environment.d.ts
|
|
1580
1649
|
interface DevEnvironmentContext {
|
|
1581
1650
|
hot: boolean;
|
|
@@ -1599,6 +1668,7 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1599
1668
|
* environment.hot.send({ type: 'full-reload' })
|
|
1600
1669
|
*/
|
|
1601
1670
|
hot: NormalizedHotChannel;
|
|
1671
|
+
bundledDev?: BundledDev;
|
|
1602
1672
|
constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext);
|
|
1603
1673
|
init(options?: {
|
|
1604
1674
|
watcher?: FSWatcher;
|
|
@@ -2086,13 +2156,19 @@ interface BuildEnvironmentOptions {
|
|
|
2086
2156
|
*/
|
|
2087
2157
|
terserOptions?: TerserOptions;
|
|
2088
2158
|
/**
|
|
2159
|
+
* Whether to use import maps feature to optimize chunk caching efficiency.
|
|
2160
|
+
* @default false
|
|
2161
|
+
* @experimental
|
|
2162
|
+
*/
|
|
2163
|
+
chunkImportMap?: boolean;
|
|
2164
|
+
/**
|
|
2089
2165
|
* Alias to `rolldownOptions`
|
|
2090
2166
|
* @deprecated Use `rolldownOptions` instead.
|
|
2091
2167
|
*/
|
|
2092
2168
|
rollupOptions?: RolldownOptions;
|
|
2093
2169
|
/**
|
|
2094
2170
|
* Will be merged with internal rolldown options.
|
|
2095
|
-
* https://rolldown.rs/reference/
|
|
2171
|
+
* https://rolldown.rs/reference/Interface.RolldownOptions
|
|
2096
2172
|
*/
|
|
2097
2173
|
rolldownOptions?: RolldownOptions;
|
|
2098
2174
|
/**
|
|
@@ -2154,7 +2230,7 @@ interface BuildEnvironmentOptions {
|
|
|
2154
2230
|
lib?: LibraryOptions | false;
|
|
2155
2231
|
/**
|
|
2156
2232
|
* Produce SSR oriented build. Note this requires specifying SSR entry via
|
|
2157
|
-
* `
|
|
2233
|
+
* `rolldownOptions.input`.
|
|
2158
2234
|
* @default false
|
|
2159
2235
|
*/
|
|
2160
2236
|
ssr?: boolean | string;
|
|
@@ -2327,7 +2403,7 @@ type SkipInformation = {
|
|
|
2327
2403
|
};
|
|
2328
2404
|
declare class EnvironmentPluginContainer<Env extends Environment = Environment> {
|
|
2329
2405
|
private _pluginContextMap;
|
|
2330
|
-
private
|
|
2406
|
+
private _resolvedRolldownOptions?;
|
|
2331
2407
|
private _processesing;
|
|
2332
2408
|
private _seenResolves;
|
|
2333
2409
|
private _moduleNodeToLoadAddedImports;
|
|
@@ -2344,7 +2420,7 @@ declare class EnvironmentPluginContainer<Env extends Environment = Environment>
|
|
|
2344
2420
|
getModuleInfo(id: string): ModuleInfo | null;
|
|
2345
2421
|
private handleHookPromise;
|
|
2346
2422
|
get options(): InputOptions;
|
|
2347
|
-
|
|
2423
|
+
resolveRolldownOptions(): Promise<InputOptions>;
|
|
2348
2424
|
private _getPluginContext;
|
|
2349
2425
|
private hookParallel;
|
|
2350
2426
|
buildStart(_options?: InputOptions): Promise<void>;
|
|
@@ -2440,10 +2516,10 @@ interface ServerOptions$1 extends CommonServerOptions {
|
|
|
2440
2516
|
*/
|
|
2441
2517
|
hmr?: HmrOptions | boolean;
|
|
2442
2518
|
/**
|
|
2443
|
-
*
|
|
2444
|
-
*
|
|
2519
|
+
* Configure WebSocket connection options.
|
|
2520
|
+
* Set to `false` to disable the WebSocket server and connection.
|
|
2445
2521
|
*/
|
|
2446
|
-
ws?: false;
|
|
2522
|
+
ws?: WsOptions | false;
|
|
2447
2523
|
/**
|
|
2448
2524
|
* Warm-up files to transform and cache the results in advance. This improves the
|
|
2449
2525
|
* initial page load during server starts and prevents transform waterfalls.
|
|
@@ -2548,7 +2624,7 @@ interface FileSystemServeOptions {
|
|
|
2548
2624
|
* This will have higher priority than `allow`.
|
|
2549
2625
|
* picomatch patterns are supported.
|
|
2550
2626
|
*
|
|
2551
|
-
* @default ['.env', '.env.*', '*.{crt,pem}', '**\/.git/**']
|
|
2627
|
+
* @default ['.env', '.env.*', '*.{crt,pem,key,p12,pfx,cer,der}', '.npmrc', '.yarnrc.yml', '**\/.git/**']
|
|
2552
2628
|
*/
|
|
2553
2629
|
deny?: string[];
|
|
2554
2630
|
}
|
|
@@ -3128,6 +3204,33 @@ interface JsonOptions {
|
|
|
3128
3204
|
stringify?: boolean | "auto";
|
|
3129
3205
|
}
|
|
3130
3206
|
//#endregion
|
|
3207
|
+
//#region src/node/assetSource.d.ts
|
|
3208
|
+
/**
|
|
3209
|
+
* Defines which attributes of an HTML element should be treated as asset sources.
|
|
3210
|
+
* Used in `html.additionalAssetSources` configuration.
|
|
3211
|
+
*/
|
|
3212
|
+
interface HtmlAssetSource {
|
|
3213
|
+
/**
|
|
3214
|
+
* Attributes that contain a single asset URL.
|
|
3215
|
+
* @example ['src', 'data-src-dark']
|
|
3216
|
+
*/
|
|
3217
|
+
srcAttributes?: string[];
|
|
3218
|
+
/**
|
|
3219
|
+
* Attributes that contain srcset-format URLs.
|
|
3220
|
+
* @example ['srcset', 'imagesrcset']
|
|
3221
|
+
*/
|
|
3222
|
+
srcsetAttributes?: string[];
|
|
3223
|
+
/**
|
|
3224
|
+
* Called before handling an attribute to determine if it should be processed.
|
|
3225
|
+
*/
|
|
3226
|
+
filter?: (data: HtmlAssetSourceFilterData) => boolean;
|
|
3227
|
+
}
|
|
3228
|
+
interface HtmlAssetSourceFilterData {
|
|
3229
|
+
key: string;
|
|
3230
|
+
value: string;
|
|
3231
|
+
attributes: Record<string, string>;
|
|
3232
|
+
}
|
|
3233
|
+
//#endregion
|
|
3131
3234
|
//#region src/node/ssr/index.d.ts
|
|
3132
3235
|
type SSRTarget = "node" | "webworker";
|
|
3133
3236
|
type SsrDepOptimizationConfig = DepOptimizationConfig;
|
|
@@ -3518,6 +3621,23 @@ interface HTMLOptions {
|
|
|
3518
3621
|
* Make sure that this placeholder will be replaced with a unique value for each request by the server.
|
|
3519
3622
|
*/
|
|
3520
3623
|
cspNonce?: string;
|
|
3624
|
+
/**
|
|
3625
|
+
* Define additional HTML elements and attributes to be treated as asset sources.
|
|
3626
|
+
* This extends the built-in list that includes standard elements like `<img src>`, `<video src>`, etc.
|
|
3627
|
+
*
|
|
3628
|
+
* @example
|
|
3629
|
+
* ```ts
|
|
3630
|
+
* html: {
|
|
3631
|
+
* additionalAssetSources: {
|
|
3632
|
+
* // Custom web component
|
|
3633
|
+
* 'html-import': { srcAttributes: ['src'] },
|
|
3634
|
+
* // Add data-* attributes to existing element
|
|
3635
|
+
* 'img': { srcAttributes: ['data-src-dark', 'data-src-light'] }
|
|
3636
|
+
* }
|
|
3637
|
+
* }
|
|
3638
|
+
* ```
|
|
3639
|
+
*/
|
|
3640
|
+
additionalAssetSources?: Record<string, HtmlAssetSource>;
|
|
3521
3641
|
}
|
|
3522
3642
|
interface FutureOptions {
|
|
3523
3643
|
removePluginHookHandleHotUpdate?: "warn";
|
|
@@ -3824,6 +3944,10 @@ declare function isFileServingAllowed(url: string, server: ViteDevServer): boole
|
|
|
3824
3944
|
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
|
3825
3945
|
//#endregion
|
|
3826
3946
|
//#region src/node/env.d.ts
|
|
3947
|
+
/**
|
|
3948
|
+
* Load `.env` files within the `envDir` and merge them with the matching
|
|
3949
|
+
* variables already present in `process.env`.
|
|
3950
|
+
*/
|
|
3827
3951
|
declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
|
|
3828
3952
|
declare function resolveEnvPrefix({
|
|
3829
3953
|
envPrefix
|
|
@@ -3877,10 +4001,10 @@ interface ManifestChunk {
|
|
|
3877
4001
|
}
|
|
3878
4002
|
//#endregion
|
|
3879
4003
|
//#region src/node/index.d.ts
|
|
3880
|
-
/** @deprecated - use `
|
|
4004
|
+
/** @deprecated - use `parseSync` instead */
|
|
3881
4005
|
declare const parseAst: typeof parseAst$1;
|
|
3882
|
-
/** @deprecated - use `
|
|
4006
|
+
/** @deprecated - use `parse` instead */
|
|
3883
4007
|
declare const parseAstAsync: typeof parseAstAsync$1;
|
|
3884
4008
|
declare const esbuildVersion = "0.25.0";
|
|
3885
4009
|
//#endregion
|
|
3886
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type LegacyOptions, type LessPreprocessorOptions, 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, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, 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 Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type 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_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
|
|
4010
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlAssetSource, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type KnownQueryTypeMap, type LegacyOptions, type LessPreprocessorOptions, 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, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, 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 Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, type WsOptions, 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_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
|
package/dist/node/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { F as defaultAllowedOrigins, N as VERSION, _ as DEFAULT_SERVER_CONDITIONS, d as DEFAULT_CLIENT_MAIN_FIELDS, h as DEFAULT_EXTERNAL_CONDITIONS, n as createLogger, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS } from "./chunks/logger.js";
|
|
2
|
-
import { $ as mergeConfig, B as
|
|
2
|
+
import { $ as mergeConfig, A as createServerHotChannel, B as send, C as fetchModule, D as createBuilder, F as searchForWorkspaceRoot, G as loadEnv, H as createServerModuleRunner, I as createIdResolver, J as transformWithEsbuild, K as resolveEnvPrefix, L as perEnvironmentState, N as formatPostcssSourceMap, O as optimizeDeps, P as preprocessCSS, Q as mergeAlias, R as isFileLoadingAllowed, S as DevEnvironment, T as build, U as createServerModuleRunnerTransport, V as ssrTransform, W as buildErrorMessage, X as createFilter, Y as perEnvironmentPlugin, Z as isCSSRequest, _ as runnerImport, a as minifySync, b as createRunnableDevEnvironment, c as parseAstAsync, d as isFetchableDevEnvironment, et as normalizePath, g as sortUserPlugins, h as resolveConfig, i as minify, j as createServer, l as parseSync, m as loadConfigFromFile, n as esbuildVersion, nt as rollupVersion, o as parse, p as defineConfig, q as transformWithOxc, r as esmExternalRequirePlugin, rt as withFilter, s as parseAst, t as Visitor, tt as rolldownVersion, u as createFetchableDevEnvironment, v as preview, w as BuildEnvironment, x as isRunnableDevEnvironment, z as isFileServingAllowed } from "./chunks/node.js";
|
|
3
3
|
export { BuildEnvironment, DevEnvironment, Visitor, 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_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
|
|
@@ -102,7 +102,7 @@ function toWindowsPath(path) {
|
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
105
|
-
var comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
|
|
105
|
+
var comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = /* @__PURE__ */ new Uint8Array(64), charToInt = /* @__PURE__ */ new Uint8Array(128);
|
|
106
106
|
for (let i = 0; i < chars.length; i++) {
|
|
107
107
|
let c = chars.charCodeAt(i);
|
|
108
108
|
intToChar[i] = c, charToInt[c] = i;
|
|
@@ -340,7 +340,7 @@ var EvaluatedModuleNode = class {
|
|
|
340
340
|
this.idToModuleMap.clear(), this.fileToModulesMap.clear(), this.urlToIdModuleMap.clear();
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
|
-
const prefixedBuiltins = new Set([
|
|
343
|
+
const prefixedBuiltins = /* @__PURE__ */ new Set([
|
|
344
344
|
"node:sea",
|
|
345
345
|
"node:sqlite",
|
|
346
346
|
"node:test",
|
package/package.json
CHANGED
|
@@ -1,21 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "8.0
|
|
4
|
-
"type": "module",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Evan You",
|
|
3
|
+
"version": "8.1.0",
|
|
7
4
|
"description": "Native-ESM powered web dev build tool",
|
|
8
|
-
"bin": {
|
|
9
|
-
"vite": "bin/vite.js"
|
|
10
|
-
},
|
|
11
5
|
"keywords": [
|
|
12
|
-
"
|
|
6
|
+
"build-tool",
|
|
7
|
+
"dev-server",
|
|
13
8
|
"framework",
|
|
9
|
+
"frontend",
|
|
14
10
|
"hmr",
|
|
15
|
-
"dev-server",
|
|
16
|
-
"build-tool",
|
|
17
11
|
"vite"
|
|
18
12
|
],
|
|
13
|
+
"homepage": "https://vite.dev",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/vitejs/vite/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Evan You",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/vitejs/vite.git",
|
|
22
|
+
"directory": "packages/vite"
|
|
23
|
+
},
|
|
24
|
+
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
25
|
+
"bin": {
|
|
26
|
+
"vite": "bin/vite.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"bin",
|
|
30
|
+
"dist",
|
|
31
|
+
"misc/**/*.js",
|
|
32
|
+
"client.d.ts",
|
|
33
|
+
"types"
|
|
34
|
+
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"imports": {
|
|
37
|
+
"#module-sync-enabled": {
|
|
38
|
+
"module-sync": "./misc/true.js",
|
|
39
|
+
"default": "./misc/false.js"
|
|
40
|
+
},
|
|
41
|
+
"#types/*": "./types/*.d.ts",
|
|
42
|
+
"#dep-types/*": "./src/types/*.d.ts"
|
|
43
|
+
},
|
|
19
44
|
"exports": {
|
|
20
45
|
".": "./dist/node/index.js",
|
|
21
46
|
"./client": {
|
|
@@ -30,45 +55,13 @@
|
|
|
30
55
|
"./types/internal/*": null,
|
|
31
56
|
"./package.json": "./package.json"
|
|
32
57
|
},
|
|
33
|
-
"imports": {
|
|
34
|
-
"#module-sync-enabled": {
|
|
35
|
-
"module-sync": "./misc/true.js",
|
|
36
|
-
"default": "./misc/false.js"
|
|
37
|
-
},
|
|
38
|
-
"#types/*": "./types/*.d.ts",
|
|
39
|
-
"#dep-types/*": "./src/types/*.d.ts"
|
|
40
|
-
},
|
|
41
|
-
"files": [
|
|
42
|
-
"bin",
|
|
43
|
-
"dist",
|
|
44
|
-
"misc/**/*.js",
|
|
45
|
-
"client.d.ts",
|
|
46
|
-
"types"
|
|
47
|
-
],
|
|
48
|
-
"engines": {
|
|
49
|
-
"node": "^20.19.0 || >=22.12.0"
|
|
50
|
-
},
|
|
51
|
-
"repository": {
|
|
52
|
-
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/vitejs/vite.git",
|
|
54
|
-
"directory": "packages/vite"
|
|
55
|
-
},
|
|
56
|
-
"bugs": {
|
|
57
|
-
"url": "https://github.com/vitejs/vite/issues"
|
|
58
|
-
},
|
|
59
|
-
"homepage": "https://vite.dev",
|
|
60
|
-
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
61
|
-
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
62
58
|
"dependencies": {
|
|
63
59
|
"lightningcss": "^1.32.0",
|
|
64
60
|
"picomatch": "^4.0.4",
|
|
65
61
|
"postcss": "^8.5.15",
|
|
66
|
-
"rolldown": "1.
|
|
62
|
+
"rolldown": "~1.1.2",
|
|
67
63
|
"tinyglobby": "^0.2.17"
|
|
68
64
|
},
|
|
69
|
-
"optionalDependencies": {
|
|
70
|
-
"fsevents": "~2.3.3"
|
|
71
|
-
},
|
|
72
65
|
"devDependencies": {
|
|
73
66
|
"@babel/parser": "^7.29.7",
|
|
74
67
|
"@jridgewell/remapping": "^2.3.5",
|
|
@@ -77,13 +70,14 @@
|
|
|
77
70
|
"@rollup/plugin-alias": "^6.0.0",
|
|
78
71
|
"@rollup/plugin-dynamic-import-vars": "2.1.4",
|
|
79
72
|
"@rollup/pluginutils": "^5.4.0",
|
|
80
|
-
"@vercel/detect-agent": "^1.2.3",
|
|
81
73
|
"@types/escape-html": "^1.0.4",
|
|
82
74
|
"@types/pnpapi": "^0.0.5",
|
|
83
|
-
"@
|
|
84
|
-
"@vitejs/devtools": "^0.3.
|
|
75
|
+
"@vercel/detect-agent": "^1.2.3",
|
|
76
|
+
"@vitejs/devtools": "^0.3.3",
|
|
77
|
+
"@vitest/utils": "4.1.8",
|
|
78
|
+
"@voidzero-dev/vite-task-client": "^0.2.0",
|
|
85
79
|
"artichokie": "^0.4.3",
|
|
86
|
-
"baseline-browser-mapping": "^2.10.
|
|
80
|
+
"baseline-browser-mapping": "^2.10.37",
|
|
87
81
|
"cac": "^7.0.0",
|
|
88
82
|
"chokidar": "^3.6.0",
|
|
89
83
|
"connect": "^3.7.0",
|
|
@@ -91,13 +85,14 @@
|
|
|
91
85
|
"cors": "^2.8.6",
|
|
92
86
|
"cross-spawn": "^7.0.6",
|
|
93
87
|
"dotenv-expand": "^13.0.0",
|
|
94
|
-
"es-module-lexer": "^1.
|
|
95
|
-
"esbuild": "^0.28.
|
|
88
|
+
"es-module-lexer": "^2.1.0",
|
|
89
|
+
"esbuild": "^0.28.1",
|
|
96
90
|
"escape-html": "^1.0.3",
|
|
97
91
|
"estree-walker": "^3.0.3",
|
|
98
92
|
"etag": "^1.8.1",
|
|
93
|
+
"fresh-import": "^0.2.1",
|
|
99
94
|
"host-validation-middleware": "^0.1.4",
|
|
100
|
-
"http-proxy-3": "^1.23.
|
|
95
|
+
"http-proxy-3": "^1.23.3",
|
|
101
96
|
"launch-editor-middleware": "^2.14.1",
|
|
102
97
|
"magic-string": "^0.30.21",
|
|
103
98
|
"mlly": "^1.8.2",
|
|
@@ -117,7 +112,7 @@
|
|
|
117
112
|
"rolldown-plugin-dts": "^0.25.2",
|
|
118
113
|
"rollup": "^4.59.0",
|
|
119
114
|
"rollup-plugin-license": "^3.7.1",
|
|
120
|
-
"sass": "^1.
|
|
115
|
+
"sass": "^1.101.0",
|
|
121
116
|
"sass-embedded": "^1.100.0",
|
|
122
117
|
"sirv": "^3.0.2",
|
|
123
118
|
"strip-literal": "^3.1.0",
|
|
@@ -127,7 +122,7 @@
|
|
|
127
122
|
},
|
|
128
123
|
"peerDependencies": {
|
|
129
124
|
"@types/node": "^20.19.0 || >=22.12.0",
|
|
130
|
-
"@vitejs/devtools": "^0.
|
|
125
|
+
"@vitejs/devtools": "^0.3.0",
|
|
131
126
|
"esbuild": "^0.27.0 || ^0.28.0",
|
|
132
127
|
"jiti": ">=1.21.0",
|
|
133
128
|
"less": "^4.0.0",
|
|
@@ -177,6 +172,13 @@
|
|
|
177
172
|
"optional": true
|
|
178
173
|
}
|
|
179
174
|
},
|
|
175
|
+
"optionalDependencies": {
|
|
176
|
+
"fsevents": "~2.3.3"
|
|
177
|
+
},
|
|
178
|
+
"engines": {
|
|
179
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
180
|
+
},
|
|
181
|
+
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
180
182
|
"scripts": {
|
|
181
183
|
"dev": "premove dist && pnpm build-bundle -w",
|
|
182
184
|
"build": "premove dist && pnpm build-bundle && pnpm build-types",
|
package/types/importGlob.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
// make input suggestions work
|
|
2
|
+
type StringQueryType = `?${keyof KnownAsTypeMap}` | (string & {})
|
|
3
|
+
type BaseQueryType = StringQueryType | Record<string, string | number | boolean>
|
|
4
|
+
|
|
1
5
|
export interface ImportGlobOptions<
|
|
2
6
|
Eager extends boolean,
|
|
3
7
|
AsType extends string,
|
|
8
|
+
QueryType extends BaseQueryType,
|
|
4
9
|
> {
|
|
5
10
|
/**
|
|
6
11
|
* Import type for the import url.
|
|
@@ -21,7 +26,7 @@ export interface ImportGlobOptions<
|
|
|
21
26
|
/**
|
|
22
27
|
* Custom queries
|
|
23
28
|
*/
|
|
24
|
-
query?:
|
|
29
|
+
query?: QueryType
|
|
25
30
|
/**
|
|
26
31
|
* Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
|
|
27
32
|
*
|
|
@@ -32,9 +37,24 @@ export interface ImportGlobOptions<
|
|
|
32
37
|
* Base path to resolve relative paths.
|
|
33
38
|
*/
|
|
34
39
|
base?: string
|
|
40
|
+
/**
|
|
41
|
+
* Whether the glob pattern matching should be case-sensitive. Defaults to `true`.
|
|
42
|
+
*/
|
|
43
|
+
caseSensitive?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ImportGlobOptionsWithoutAs<
|
|
47
|
+
Eager extends boolean,
|
|
48
|
+
QueryType extends BaseQueryType,
|
|
49
|
+
> = Omit<ImportGlobOptions<Eager, string, QueryType>, 'as'> & {
|
|
50
|
+
as?: never
|
|
35
51
|
}
|
|
36
52
|
|
|
37
|
-
export type GeneralImportGlobOptions = ImportGlobOptions<
|
|
53
|
+
export type GeneralImportGlobOptions = ImportGlobOptions<
|
|
54
|
+
boolean,
|
|
55
|
+
string,
|
|
56
|
+
BaseQueryType
|
|
57
|
+
>
|
|
38
58
|
|
|
39
59
|
/**
|
|
40
60
|
* Declare Worker in case DOM is not added to the tsconfig lib causing
|
|
@@ -52,11 +72,33 @@ export interface KnownAsTypeMap {
|
|
|
52
72
|
worker: Worker
|
|
53
73
|
}
|
|
54
74
|
|
|
75
|
+
type KnownQueryTypeMap = {
|
|
76
|
+
[K in keyof KnownAsTypeMap as `?${K}`]: KnownAsTypeMap[K]
|
|
77
|
+
}
|
|
78
|
+
|
|
55
79
|
export interface ImportGlobFunction {
|
|
56
80
|
/**
|
|
57
81
|
* Import a list of files with a glob pattern.
|
|
58
82
|
*
|
|
59
|
-
* Overload
|
|
83
|
+
* Overload 1A: No generic provided, infer the type from `eager` and `query`
|
|
84
|
+
*/
|
|
85
|
+
<
|
|
86
|
+
Eager extends boolean,
|
|
87
|
+
Query extends BaseQueryType,
|
|
88
|
+
T = Query extends keyof KnownQueryTypeMap
|
|
89
|
+
? KnownQueryTypeMap[Query]
|
|
90
|
+
: unknown,
|
|
91
|
+
>(
|
|
92
|
+
glob: string | string[],
|
|
93
|
+
options?: ImportGlobOptionsWithoutAs<Eager, Query>,
|
|
94
|
+
): (Eager extends true ? true : false) extends true
|
|
95
|
+
? Record<string, T>
|
|
96
|
+
: Record<string, () => Promise<T>>
|
|
97
|
+
/**
|
|
98
|
+
* Import a list of files with a glob pattern.
|
|
99
|
+
*
|
|
100
|
+
* Overload 1B: No generic provided, infer the type from `eager` and `as`
|
|
101
|
+
* (deprecated, use `query` instead)
|
|
60
102
|
*/
|
|
61
103
|
<
|
|
62
104
|
Eager extends boolean,
|
|
@@ -64,7 +106,7 @@ export interface ImportGlobFunction {
|
|
|
64
106
|
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown,
|
|
65
107
|
>(
|
|
66
108
|
glob: string | string[],
|
|
67
|
-
options?: ImportGlobOptions<Eager, As>,
|
|
109
|
+
options?: ImportGlobOptions<Eager, As, BaseQueryType>,
|
|
68
110
|
): (Eager extends true ? true : false) extends true
|
|
69
111
|
? Record<string, T>
|
|
70
112
|
: Record<string, () => Promise<T>>
|
|
@@ -75,7 +117,7 @@ export interface ImportGlobFunction {
|
|
|
75
117
|
*/
|
|
76
118
|
<M>(
|
|
77
119
|
glob: string | string[],
|
|
78
|
-
options?: ImportGlobOptions<false, string>,
|
|
120
|
+
options?: ImportGlobOptions<false, string, BaseQueryType>,
|
|
79
121
|
): Record<string, () => Promise<M>>
|
|
80
122
|
/**
|
|
81
123
|
* Import a list of files with a glob pattern.
|
|
@@ -84,6 +126,6 @@ export interface ImportGlobFunction {
|
|
|
84
126
|
*/
|
|
85
127
|
<M>(
|
|
86
128
|
glob: string | string[],
|
|
87
|
-
options: ImportGlobOptions<true, string>,
|
|
129
|
+
options: ImportGlobOptions<true, string, BaseQueryType>,
|
|
88
130
|
): Record<string, M>
|
|
89
131
|
}
|