source: imaps-frontend/node_modules/vite/dist/node/constants.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[d565449]1import path, { resolve } from 'node:path';
2import { fileURLToPath } from 'node:url';
3import { readFileSync } from 'node:fs';
4
5const { version } = JSON.parse(
6 readFileSync(new URL("../../package.json", import.meta.url)).toString()
7);
8const VERSION = version;
9const DEFAULT_MAIN_FIELDS = [
10 "browser",
11 "module",
12 "jsnext:main",
13 // moment still uses this...
14 "jsnext"
15];
16const ESBUILD_MODULES_TARGET = [
17 "es2020",
18 // support import.meta.url
19 "edge88",
20 "firefox78",
21 "chrome87",
22 "safari14"
23];
24const DEFAULT_EXTENSIONS = [
25 ".mjs",
26 ".js",
27 ".mts",
28 ".ts",
29 ".jsx",
30 ".tsx",
31 ".json"
32];
33const DEFAULT_CONFIG_FILES = [
34 "vite.config.js",
35 "vite.config.mjs",
36 "vite.config.ts",
37 "vite.config.cjs",
38 "vite.config.mts",
39 "vite.config.cts"
40];
41const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
42const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
43const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
44const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
45const FS_PREFIX = `/@fs/`;
46const CLIENT_PUBLIC_PATH = `/@vite/client`;
47const ENV_PUBLIC_PATH = `/@vite/env`;
48const VITE_PACKAGE_DIR = resolve(
49 // import.meta.url is `dist/node/constants.js` after bundle
50 fileURLToPath(import.meta.url),
51 "../../.."
52);
53const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
54const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
55const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
56const KNOWN_ASSET_TYPES = [
57 // images
58 "apng",
59 "bmp",
60 "png",
61 "jpe?g",
62 "jfif",
63 "pjpeg",
64 "pjp",
65 "gif",
66 "svg",
67 "ico",
68 "webp",
69 "avif",
70 // media
71 "mp4",
72 "webm",
73 "ogg",
74 "mp3",
75 "wav",
76 "flac",
77 "aac",
78 "opus",
79 "mov",
80 "m4a",
81 "vtt",
82 // fonts
83 "woff2?",
84 "eot",
85 "ttf",
86 "otf",
87 // other
88 "webmanifest",
89 "pdf",
90 "txt"
91];
92const DEFAULT_ASSETS_RE = new RegExp(
93 `\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`
94);
95const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
96const loopbackHosts = /* @__PURE__ */ new Set([
97 "localhost",
98 "127.0.0.1",
99 "::1",
100 "0000:0000:0000:0000:0000:0000:0000:0001"
101]);
102const wildcardHosts = /* @__PURE__ */ new Set([
103 "0.0.0.0",
104 "::",
105 "0000:0000:0000:0000:0000:0000:0000:0000"
106]);
107const DEFAULT_DEV_PORT = 5173;
108const DEFAULT_PREVIEW_PORT = 4173;
109const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
110const METADATA_FILENAME = "_metadata.json";
111
112export { 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 };
Note: See TracBrowser for help on using the repository browser.