1 | import path, { resolve } from 'node:path';
|
2 | import { fileURLToPath } from 'node:url';
|
3 |
|
4 | var version = "3.2.6";
|
5 |
|
6 | const VERSION = version;
|
7 | const DEFAULT_MAIN_FIELDS = [
|
8 | 'module',
|
9 | 'jsnext:main',
|
10 | 'jsnext'
|
11 | ];
|
12 |
|
13 |
|
14 |
|
15 | const ESBUILD_MODULES_TARGET = [
|
16 | 'es2020',
|
17 | 'edge88',
|
18 | 'firefox78',
|
19 | 'chrome87',
|
20 | 'safari13'
|
21 | ];
|
22 | const DEFAULT_EXTENSIONS = [
|
23 | '.mjs',
|
24 | '.js',
|
25 | '.mts',
|
26 | '.ts',
|
27 | '.jsx',
|
28 | '.tsx',
|
29 | '.json'
|
30 | ];
|
31 | const DEFAULT_CONFIG_FILES = [
|
32 | 'vite.config.js',
|
33 | 'vite.config.mjs',
|
34 | 'vite.config.ts',
|
35 | 'vite.config.cjs',
|
36 | 'vite.config.mts',
|
37 | 'vite.config.cts'
|
38 | ];
|
39 | const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
40 | const OPTIMIZABLE_ENTRY_RE = /\.(?:[cm]?[jt]s)$/;
|
41 | const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
|
42 |
|
43 |
|
44 |
|
45 | const FS_PREFIX = `/@fs/`;
|
46 |
|
47 |
|
48 |
|
49 | const VALID_ID_PREFIX = `/@id/`;
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
62 | const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
63 | const ENV_PUBLIC_PATH = `/@vite/env`;
|
64 | const VITE_PACKAGE_DIR = resolve(
|
65 |
|
66 | fileURLToPath(import.meta.url), '../../..');
|
67 | const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
68 | const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
69 | const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | const KNOWN_ASSET_TYPES = [
|
77 |
|
78 | 'png',
|
79 | 'jpe?g',
|
80 | 'jfif',
|
81 | 'pjpeg',
|
82 | 'pjp',
|
83 | 'gif',
|
84 | 'svg',
|
85 | 'ico',
|
86 | 'webp',
|
87 | 'avif',
|
88 |
|
89 | 'mp4',
|
90 | 'webm',
|
91 | 'ogg',
|
92 | 'mp3',
|
93 | 'wav',
|
94 | 'flac',
|
95 | 'aac',
|
96 |
|
97 | 'woff2?',
|
98 | 'eot',
|
99 | 'ttf',
|
100 | 'otf',
|
101 |
|
102 | 'webmanifest',
|
103 | 'pdf',
|
104 | 'txt'
|
105 | ];
|
106 | const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
107 | const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/;
|
108 | const loopbackHosts = new Set([
|
109 | 'localhost',
|
110 | '127.0.0.1',
|
111 | '::1',
|
112 | '0000:0000:0000:0000:0000:0000:0000:0001'
|
113 | ]);
|
114 | const wildcardHosts = new Set([
|
115 | '0.0.0.0',
|
116 | '::',
|
117 | '0000:0000:0000:0000:0000:0000:0000:0000'
|
118 | ]);
|
119 |
|
120 | export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|