vite 5.1.3 → 5.1.5
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/dist/client/client.mjs +1 -1
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-stQc5rCc.js → dep-G-px366b.js} +298 -236
- package/dist/node/chunks/{dep-ZEDYRkoC.js → dep-OHeF5w5D.js} +14 -27
- package/dist/node/chunks/{dep-PB-S7R_m.js → dep-WMYkPWs9.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -17
- package/dist/node/index.d.ts +3 -2
- package/dist/node/index.js +3 -3
- package/dist/node/runtime.d.ts +54 -3
- package/dist/node/runtime.js +929 -1525
- package/dist/node/{types.d-jgA8ss1A.d.ts → types.d-AKzkD8vd.d.ts} +6 -52
- package/dist/node-cjs/publicUtils.cjs +69 -64
- package/package.json +9 -7
- package/types/hmrPayload.d.ts +2 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { B as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { B as getDefaultExportFromCjs } from './dep-G-px366b.js';
|
2
2
|
import require$$0 from 'path';
|
3
3
|
import require$$0__default from 'fs';
|
4
4
|
import { l as lib } from './dep-8a-6Quh6.js';
|
@@ -389,20 +389,6 @@ const valueParser = lib;
|
|
389
389
|
// extended tooling
|
390
390
|
const { stringify } = valueParser;
|
391
391
|
|
392
|
-
function split(params, start) {
|
393
|
-
const list = [];
|
394
|
-
const last = params.reduce((item, node, index) => {
|
395
|
-
if (index < start) return ""
|
396
|
-
if (node.type === "div" && node.value === ",") {
|
397
|
-
list.push(item);
|
398
|
-
return ""
|
399
|
-
}
|
400
|
-
return item + stringify(node)
|
401
|
-
}, "");
|
402
|
-
list.push(last);
|
403
|
-
return list
|
404
|
-
}
|
405
|
-
|
406
392
|
var parseStatements$1 = function parseStatements(result, styles, conditions, from) {
|
407
393
|
const statements = [];
|
408
394
|
let nodes = [];
|
@@ -606,7 +592,7 @@ function parseImport(result, atRule, conditions, from) {
|
|
606
592
|
continue
|
607
593
|
}
|
608
594
|
|
609
|
-
media =
|
595
|
+
media = stringify(params.slice(i));
|
610
596
|
break
|
611
597
|
}
|
612
598
|
|
@@ -913,19 +899,20 @@ function isProcessableURL(uri) {
|
|
913
899
|
return false
|
914
900
|
}
|
915
901
|
|
916
|
-
//
|
917
|
-
|
918
|
-
|
919
|
-
|
902
|
+
// PATCH: comment out this part to support resolving imports field
|
903
|
+
// // check for fragment or query
|
904
|
+
// try {
|
905
|
+
// // needs a base to parse properly
|
906
|
+
// const url = new URL(uri, "https://example.com")
|
920
907
|
|
921
|
-
|
922
|
-
|
923
|
-
|
908
|
+
// if (url.hash) {
|
909
|
+
// return false
|
910
|
+
// }
|
924
911
|
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
} catch {} // Ignore
|
912
|
+
// if (url.search) {
|
913
|
+
// return false
|
914
|
+
// }
|
915
|
+
// } catch {} // Ignore
|
929
916
|
|
930
917
|
return true
|
931
918
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-G-px366b.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import {
|
5
|
+
import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-G-px366b.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -757,7 +757,7 @@ cli
|
|
757
757
|
filterDuplicateOptions(options);
|
758
758
|
// output structure is preserved even after bundling so require()
|
759
759
|
// is ok here
|
760
|
-
const { createServer } = await import('./chunks/dep-
|
760
|
+
const { createServer } = await import('./chunks/dep-G-px366b.js').then(function (n) { return n.E; });
|
761
761
|
try {
|
762
762
|
const server = await createServer({
|
763
763
|
root,
|
@@ -836,7 +836,7 @@ cli
|
|
836
836
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
837
837
|
.action(async (root, options) => {
|
838
838
|
filterDuplicateOptions(options);
|
839
|
-
const { build } = await import('./chunks/dep-
|
839
|
+
const { build } = await import('./chunks/dep-G-px366b.js').then(function (n) { return n.F; });
|
840
840
|
const buildOptions = cleanOptions(options);
|
841
841
|
try {
|
842
842
|
await build({
|
@@ -863,7 +863,7 @@ cli
|
|
863
863
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
864
864
|
.action(async (root, options) => {
|
865
865
|
filterDuplicateOptions(options);
|
866
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
866
|
+
const { optimizeDeps } = await import('./chunks/dep-G-px366b.js').then(function (n) { return n.D; });
|
867
867
|
try {
|
868
868
|
const config = await resolveConfig({
|
869
869
|
root,
|
@@ -889,7 +889,7 @@ cli
|
|
889
889
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
890
890
|
.action(async (root, options) => {
|
891
891
|
filterDuplicateOptions(options);
|
892
|
-
const { preview } = await import('./chunks/dep-
|
892
|
+
const { preview } = await import('./chunks/dep-G-px366b.js').then(function (n) { return n.G; });
|
893
893
|
try {
|
894
894
|
const server = await preview({
|
895
895
|
root,
|
package/dist/node/constants.js
CHANGED
@@ -45,22 +45,6 @@ const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
45
45
|
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
46
46
|
*/
|
47
47
|
const FS_PREFIX = `/@fs/`;
|
48
|
-
/**
|
49
|
-
* Prefix for resolved Ids that are not valid browser import specifiers
|
50
|
-
*/
|
51
|
-
const VALID_ID_PREFIX = `/@id/`;
|
52
|
-
/**
|
53
|
-
* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
|
54
|
-
* module ID with `\0`, a convention from the rollup ecosystem.
|
55
|
-
* This prevents other plugins from trying to process the id (like node resolution),
|
56
|
-
* and core features like sourcemaps can use this info to differentiate between
|
57
|
-
* virtual modules and regular files.
|
58
|
-
* `\0` is not a permitted char in import URLs so we have to replace them during
|
59
|
-
* import analysis. The id will be decoded back before entering the plugins pipeline.
|
60
|
-
* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
|
61
|
-
* modules in the browser end up encoded as `/@id/__x00__{id}`
|
62
|
-
*/
|
63
|
-
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
64
48
|
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
65
49
|
const ENV_PUBLIC_PATH = `/@vite/env`;
|
66
50
|
const VITE_PACKAGE_DIR = resolve(
|
@@ -128,4 +112,4 @@ const DEFAULT_PREVIEW_PORT = 4173;
|
|
128
112
|
const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
|
129
113
|
const METADATA_FILENAME = '_metadata.json';
|
130
114
|
|
131
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME,
|
115
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|
package/dist/node/index.d.ts
CHANGED
@@ -15,8 +15,8 @@ import * as url from 'node:url';
|
|
15
15
|
import { URL } from 'node:url';
|
16
16
|
import * as stream from 'node:stream';
|
17
17
|
import { Duplex, DuplexOptions } from 'node:stream';
|
18
|
-
import { F as FetchResult,
|
19
|
-
export {
|
18
|
+
import { F as FetchResult, H as HMRLogger } from './types.d-AKzkD8vd.js';
|
19
|
+
export { a as FetchFunction } from './types.d-AKzkD8vd.js';
|
20
20
|
import { SecureContextOptions } from 'node:tls';
|
21
21
|
import { ZlibOptions } from 'node:zlib';
|
22
22
|
import { HMRPayload, CustomPayload } from '../../types/hmrPayload.js';
|
@@ -26,6 +26,7 @@ export { CustomEventMap, InferCustomEventPayload, InvalidatePayload } from '../.
|
|
26
26
|
import { TransformOptions as esbuild_TransformOptions, TransformResult as esbuild_TransformResult, BuildOptions as esbuild_BuildOptions } from 'esbuild';
|
27
27
|
export { TransformOptions as EsbuildTransformOptions, version as esbuildVersion } from 'esbuild';
|
28
28
|
import * as PostCSS from 'postcss';
|
29
|
+
import { ViteRuntimeOptions, ViteModuleRunner, ViteRuntime, HMRRuntimeConnection } from 'vite/runtime';
|
29
30
|
export { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from '../../types/importGlob.js';
|
30
31
|
export { ChunkMetadata } from '../../types/metadata.js';
|
31
32
|
import '../../types/hot.js';
|
package/dist/node/index.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules,
|
3
|
-
export {
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-G-px366b.js';
|
3
|
+
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-G-px366b.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import { existsSync, readFileSync } from 'node:fs';
|
7
|
-
import { ViteRuntime, ESModulesRunner } from '
|
7
|
+
import { ViteRuntime, ESModulesRunner } from 'vite/runtime';
|
8
8
|
import 'node:fs/promises';
|
9
9
|
import 'node:path';
|
10
10
|
import 'node:url';
|
package/dist/node/runtime.d.ts
CHANGED
@@ -1,12 +1,63 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
1
|
+
import { V as ViteRuntimeOptions, b as ViteModuleRunner, M as ModuleCacheMap, c as HMRClient, R as ResolvedResult, d as ViteRuntimeModuleContext } from './types.d-AKzkD8vd.js';
|
2
|
+
export { a as FetchFunction, F as FetchResult, e as HMRConnection, H as HMRLogger, g as HMRRuntimeConnection, f as ModuleCache, S as SSRImportMetadata, h as ViteRuntimeImportMeta, s as ssrDynamicImportKey, i as ssrExportAllKey, j as ssrImportKey, k as ssrImportMetaKey, l as ssrModuleExportsKey } from './types.d-AKzkD8vd.js';
|
3
3
|
import '../../types/hot.js';
|
4
4
|
import '../../types/hmrPayload.js';
|
5
5
|
import '../../types/customEvent.js';
|
6
6
|
|
7
|
+
interface ViteRuntimeDebugger {
|
8
|
+
(formatter: unknown, ...args: unknown[]): void;
|
9
|
+
}
|
10
|
+
declare class ViteRuntime {
|
11
|
+
options: ViteRuntimeOptions;
|
12
|
+
runner: ViteModuleRunner;
|
13
|
+
private debug?;
|
14
|
+
/**
|
15
|
+
* Holds the cache of modules
|
16
|
+
* Keys of the map are ids
|
17
|
+
*/
|
18
|
+
moduleCache: ModuleCacheMap;
|
19
|
+
hmrClient?: HMRClient;
|
20
|
+
entrypoints: Set<string>;
|
21
|
+
private idToUrlMap;
|
22
|
+
private fileToIdMap;
|
23
|
+
private envProxy;
|
24
|
+
private _destroyed;
|
25
|
+
private _resetSourceMapSupport?;
|
26
|
+
constructor(options: ViteRuntimeOptions, runner: ViteModuleRunner, debug?: ViteRuntimeDebugger | undefined);
|
27
|
+
/**
|
28
|
+
* URL to execute. Accepts file path, server path or id relative to the root.
|
29
|
+
*/
|
30
|
+
executeUrl<T = any>(url: string): Promise<T>;
|
31
|
+
/**
|
32
|
+
* Entrypoint URL to execute. Accepts file path, server path or id relative to the root.
|
33
|
+
* In the case of a full reload triggered by HMR, this is the module that will be reloaded.
|
34
|
+
* If this method is called multiple times, all entrypoints will be reloaded one at a time.
|
35
|
+
*/
|
36
|
+
executeEntrypoint<T = any>(url: string): Promise<T>;
|
37
|
+
/**
|
38
|
+
* Clear all caches including HMR listeners.
|
39
|
+
*/
|
40
|
+
clearCache(): void;
|
41
|
+
/**
|
42
|
+
* Clears all caches, removes all HMR listeners, and resets source map support.
|
43
|
+
* This method doesn't stop the HMR connection.
|
44
|
+
*/
|
45
|
+
destroy(): Promise<void>;
|
46
|
+
/**
|
47
|
+
* Returns `true` if the runtime has been destroyed by calling `destroy()` method.
|
48
|
+
*/
|
49
|
+
isDestroyed(): boolean;
|
50
|
+
private invalidateFiles;
|
51
|
+
private normalizeEntryUrl;
|
52
|
+
private processImport;
|
53
|
+
private cachedRequest;
|
54
|
+
private cachedModule;
|
55
|
+
protected directRequest(id: string, fetchResult: ResolvedResult, _callstack: string[]): Promise<any>;
|
56
|
+
}
|
57
|
+
|
7
58
|
declare class ESModulesRunner implements ViteModuleRunner {
|
8
59
|
runViteModule(context: ViteRuntimeModuleContext, code: string): Promise<any>;
|
9
60
|
runExternalModule(filepath: string): Promise<any>;
|
10
61
|
}
|
11
62
|
|
12
|
-
export { ESModulesRunner, ViteModuleRunner, ViteRuntimeModuleContext };
|
63
|
+
export { ESModulesRunner, ModuleCacheMap, ResolvedResult, ViteModuleRunner, ViteRuntime, ViteRuntimeModuleContext, ViteRuntimeOptions };
|