vite 6.3.5 → 7.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/LICENSE.md +81 -314
- package/bin/openChrome.js +68 -0
- package/bin/vite.js +7 -7
- package/dist/client/client.mjs +886 -922
- package/dist/client/env.mjs +14 -19
- package/dist/node/chunks/dep-BuoK8Wda.js +377 -0
- package/dist/node/chunks/dep-BvyJBvVx.js +4 -0
- package/dist/node/chunks/dep-Cs9lwdKu.js +4 -0
- package/dist/node/chunks/dep-DCVhRpiz.js +5595 -0
- package/dist/node/chunks/dep-DDbTn5rw.js +482 -0
- package/dist/node/chunks/dep-D_YDhiNx.js +4 -0
- package/dist/node/chunks/dep-M_KD0XSK.js +36707 -0
- package/dist/node/chunks/dep-SmwnYDP9.js +320 -0
- package/dist/node/chunks/dep-cWFO4sv4.js +4 -0
- package/dist/node/chunks/dep-lCKrEJQm.js +31 -0
- package/dist/node/chunks/dep-sDKrrA4S.js +6814 -0
- package/dist/node/chunks/dep-yxQqhtZq.js +4 -0
- package/dist/node/cli.js +624 -865
- package/dist/node/index.d.ts +2723 -3277
- package/dist/node/index.js +24 -188
- package/dist/node/module-runner.d.ts +256 -234
- package/dist/node/module-runner.js +1000 -1178
- package/dist/node/moduleRunnerTransport-BWUZBVLX.d.ts +88 -0
- package/package.json +52 -55
- package/types/importGlob.d.ts +14 -0
- package/types/internal/cssPreprocessorOptions.d.ts +3 -22
- package/types/internal/terserOptions.d.ts +11 -0
- package/types/metadata.d.ts +0 -2
- package/bin/openChrome.applescript +0 -95
- package/dist/node/chunks/dep-3RmXg9uo.js +0 -553
- package/dist/node/chunks/dep-AiMcmC_f.js +0 -822
- package/dist/node/chunks/dep-CvfTChi5.js +0 -8218
- package/dist/node/chunks/dep-DBxKXgDP.js +0 -49496
- package/dist/node/chunks/dep-SgSik2vo.js +0 -7113
- package/dist/node/constants.js +0 -149
- package/dist/node/moduleRunnerTransport.d-DJ_mE5sf.d.ts +0 -87
- package/dist/node-cjs/publicUtils.cjs +0 -3986
- package/index.cjs +0 -96
- package/index.d.cts +0 -6
package/dist/node/constants.js
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
import path, { resolve } from 'node:path';
|
2
|
-
import { fileURLToPath } from 'node:url';
|
3
|
-
import { readFileSync } from 'node:fs';
|
4
|
-
|
5
|
-
const { version } = JSON.parse(
|
6
|
-
readFileSync(new URL("../../package.json", import.meta.url)).toString()
|
7
|
-
);
|
8
|
-
const ROLLUP_HOOKS = [
|
9
|
-
"options",
|
10
|
-
"buildStart",
|
11
|
-
"buildEnd",
|
12
|
-
"renderStart",
|
13
|
-
"renderError",
|
14
|
-
"renderChunk",
|
15
|
-
"writeBundle",
|
16
|
-
"generateBundle",
|
17
|
-
"banner",
|
18
|
-
"footer",
|
19
|
-
"augmentChunkHash",
|
20
|
-
"outputOptions",
|
21
|
-
"renderDynamicImport",
|
22
|
-
"resolveFileUrl",
|
23
|
-
"resolveImportMeta",
|
24
|
-
"intro",
|
25
|
-
"outro",
|
26
|
-
"closeBundle",
|
27
|
-
"closeWatcher",
|
28
|
-
"load",
|
29
|
-
"moduleParsed",
|
30
|
-
"watchChange",
|
31
|
-
"resolveDynamicImport",
|
32
|
-
"resolveId",
|
33
|
-
"shouldTransformCachedModule",
|
34
|
-
"transform",
|
35
|
-
"onLog"
|
36
|
-
];
|
37
|
-
const VERSION = version;
|
38
|
-
const DEFAULT_MAIN_FIELDS = [
|
39
|
-
"browser",
|
40
|
-
"module",
|
41
|
-
"jsnext:main",
|
42
|
-
// moment still uses this...
|
43
|
-
"jsnext"
|
44
|
-
];
|
45
|
-
const DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
|
46
|
-
const DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(
|
47
|
-
DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser")
|
48
|
-
);
|
49
|
-
const DEV_PROD_CONDITION = `development|production`;
|
50
|
-
const DEFAULT_CONDITIONS = ["module", "browser", "node", DEV_PROD_CONDITION];
|
51
|
-
const DEFAULT_CLIENT_CONDITIONS = Object.freeze(
|
52
|
-
DEFAULT_CONDITIONS.filter((c) => c !== "node")
|
53
|
-
);
|
54
|
-
const DEFAULT_SERVER_CONDITIONS = Object.freeze(
|
55
|
-
DEFAULT_CONDITIONS.filter((c) => c !== "browser")
|
56
|
-
);
|
57
|
-
const ESBUILD_MODULES_TARGET = [
|
58
|
-
"es2020",
|
59
|
-
"edge88",
|
60
|
-
"firefox78",
|
61
|
-
"chrome87",
|
62
|
-
"safari14"
|
63
|
-
];
|
64
|
-
const DEFAULT_CONFIG_FILES = [
|
65
|
-
"vite.config.js",
|
66
|
-
"vite.config.mjs",
|
67
|
-
"vite.config.ts",
|
68
|
-
"vite.config.cjs",
|
69
|
-
"vite.config.mts",
|
70
|
-
"vite.config.cts"
|
71
|
-
];
|
72
|
-
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
73
|
-
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
74
|
-
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
75
|
-
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
76
|
-
const FS_PREFIX = `/@fs/`;
|
77
|
-
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
78
|
-
const ENV_PUBLIC_PATH = `/@vite/env`;
|
79
|
-
const VITE_PACKAGE_DIR = resolve(
|
80
|
-
// import.meta.url is `dist/node/constants.js` after bundle
|
81
|
-
fileURLToPath(import.meta.url),
|
82
|
-
"../../.."
|
83
|
-
);
|
84
|
-
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
85
|
-
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
86
|
-
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
87
|
-
const KNOWN_ASSET_TYPES = [
|
88
|
-
// images
|
89
|
-
"apng",
|
90
|
-
"bmp",
|
91
|
-
"png",
|
92
|
-
"jpe?g",
|
93
|
-
"jfif",
|
94
|
-
"pjpeg",
|
95
|
-
"pjp",
|
96
|
-
"gif",
|
97
|
-
"svg",
|
98
|
-
"ico",
|
99
|
-
"webp",
|
100
|
-
"avif",
|
101
|
-
"cur",
|
102
|
-
"jxl",
|
103
|
-
// media
|
104
|
-
"mp4",
|
105
|
-
"webm",
|
106
|
-
"ogg",
|
107
|
-
"mp3",
|
108
|
-
"wav",
|
109
|
-
"flac",
|
110
|
-
"aac",
|
111
|
-
"opus",
|
112
|
-
"mov",
|
113
|
-
"m4a",
|
114
|
-
"vtt",
|
115
|
-
// fonts
|
116
|
-
"woff2?",
|
117
|
-
"eot",
|
118
|
-
"ttf",
|
119
|
-
"otf",
|
120
|
-
// other
|
121
|
-
"webmanifest",
|
122
|
-
"pdf",
|
123
|
-
"txt"
|
124
|
-
];
|
125
|
-
const DEFAULT_ASSETS_RE = new RegExp(
|
126
|
-
`\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`,
|
127
|
-
"i"
|
128
|
-
);
|
129
|
-
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
|
130
|
-
const loopbackHosts = /* @__PURE__ */ new Set([
|
131
|
-
"localhost",
|
132
|
-
"127.0.0.1",
|
133
|
-
"::1",
|
134
|
-
"0000:0000:0000:0000:0000:0000:0000:0001"
|
135
|
-
]);
|
136
|
-
const wildcardHosts = /* @__PURE__ */ new Set([
|
137
|
-
"0.0.0.0",
|
138
|
-
"::",
|
139
|
-
"0000:0000:0000:0000:0000:0000:0000:0000"
|
140
|
-
]);
|
141
|
-
const DEFAULT_DEV_PORT = 5173;
|
142
|
-
const DEFAULT_PREVIEW_PORT = 4173;
|
143
|
-
const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
|
144
|
-
const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
|
145
|
-
const METADATA_FILENAME = "_metadata.json";
|
146
|
-
const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
|
147
|
-
const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
|
148
|
-
|
149
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, defaultAllowedOrigins, loopbackHosts, wildcardHosts };
|
@@ -1,87 +0,0 @@
|
|
1
|
-
import { HotPayload } from '../../types/hmrPayload.js';
|
2
|
-
|
3
|
-
interface FetchFunctionOptions {
|
4
|
-
cached?: boolean;
|
5
|
-
startOffset?: number;
|
6
|
-
}
|
7
|
-
type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
|
8
|
-
interface CachedFetchResult {
|
9
|
-
/**
|
10
|
-
* If module cached in the runner, we can just confirm
|
11
|
-
* it wasn't invalidated on the server side.
|
12
|
-
*/
|
13
|
-
cache: true;
|
14
|
-
}
|
15
|
-
interface ExternalFetchResult {
|
16
|
-
/**
|
17
|
-
* The path to the externalized module starting with file://,
|
18
|
-
* by default this will be imported via a dynamic "import"
|
19
|
-
* instead of being transformed by vite and loaded with vite runner
|
20
|
-
*/
|
21
|
-
externalize: string;
|
22
|
-
/**
|
23
|
-
* Type of the module. Will be used to determine if import statement is correct.
|
24
|
-
* For example, if Vite needs to throw an error if variable is not actually exported
|
25
|
-
*/
|
26
|
-
type: 'module' | 'commonjs' | 'builtin' | 'network';
|
27
|
-
}
|
28
|
-
interface ViteFetchResult {
|
29
|
-
/**
|
30
|
-
* Code that will be evaluated by vite runner
|
31
|
-
* by default this will be wrapped in an async function
|
32
|
-
*/
|
33
|
-
code: string;
|
34
|
-
/**
|
35
|
-
* File path of the module on disk.
|
36
|
-
* This will be resolved as import.meta.url/filename
|
37
|
-
* Will be equal to `null` for virtual modules
|
38
|
-
*/
|
39
|
-
file: string | null;
|
40
|
-
/**
|
41
|
-
* Module ID in the server module graph.
|
42
|
-
*/
|
43
|
-
id: string;
|
44
|
-
/**
|
45
|
-
* Module URL used in the import.
|
46
|
-
*/
|
47
|
-
url: string;
|
48
|
-
/**
|
49
|
-
* Invalidate module on the client side.
|
50
|
-
*/
|
51
|
-
invalidate: boolean;
|
52
|
-
}
|
53
|
-
type InvokeMethods = {
|
54
|
-
fetchModule: (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
|
55
|
-
};
|
56
|
-
|
57
|
-
type ModuleRunnerTransportHandlers = {
|
58
|
-
onMessage: (data: HotPayload) => void;
|
59
|
-
onDisconnection: () => void;
|
60
|
-
};
|
61
|
-
/**
|
62
|
-
* "send and connect" or "invoke" must be implemented
|
63
|
-
*/
|
64
|
-
interface ModuleRunnerTransport {
|
65
|
-
connect?(handlers: ModuleRunnerTransportHandlers): Promise<void> | void;
|
66
|
-
disconnect?(): Promise<void> | void;
|
67
|
-
send?(data: HotPayload): Promise<void> | void;
|
68
|
-
invoke?(data: HotPayload): Promise<{
|
69
|
-
result: any;
|
70
|
-
} | {
|
71
|
-
error: any;
|
72
|
-
}>;
|
73
|
-
timeout?: number;
|
74
|
-
}
|
75
|
-
interface NormalizedModuleRunnerTransport {
|
76
|
-
connect?(onMessage?: (data: HotPayload) => void): Promise<void> | void;
|
77
|
-
disconnect?(): Promise<void> | void;
|
78
|
-
send(data: HotPayload): Promise<void>;
|
79
|
-
invoke<T extends keyof InvokeMethods>(name: T, data: Parameters<InvokeMethods[T]>): Promise<ReturnType<Awaited<InvokeMethods[T]>>>;
|
80
|
-
}
|
81
|
-
declare const createWebSocketModuleRunnerTransport: (options: {
|
82
|
-
createConnection: () => WebSocket;
|
83
|
-
pingInterval?: number;
|
84
|
-
}) => Required<Pick<ModuleRunnerTransport, "connect" | "disconnect" | "send">>;
|
85
|
-
|
86
|
-
export { createWebSocketModuleRunnerTransport as c };
|
87
|
-
export type { ExternalFetchResult as E, FetchFunctionOptions as F, ModuleRunnerTransport as M, NormalizedModuleRunnerTransport as N, ViteFetchResult as V, FetchResult as a, ModuleRunnerTransportHandlers as b };
|