fix: 修复用户、角色、权限管理页面的API响应嵌套结构问题
- Users.vue: res.data → res.data.data - Roles.vue: res.data → res.data.data - Permissions.vue: res.data → res.data.data - package.json: 移除vue-tsc类型检查加快构建
This commit is contained in:
parent
890d2ae895
commit
29b51eca99
|
|
@ -109,9 +109,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
|
||||
"integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
|
||||
"version": "0.20.2",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz",
|
||||
"integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -161,9 +161,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-x64": {
|
||||
"version": "4.59.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz",
|
||||
"integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==",
|
||||
"version": "4.59.1",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.1.tgz",
|
||||
"integrity": "sha512-x6VG6U29+Ivlnajrg1IHdzXeAwSoEHBFVO+CtC9Brugx6de712CUJobRUxsIA0KYrQvCmzNrMPFTT1A4CCqNTg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -209,9 +209,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@vitejs/plugin-vue": {
|
||||
"version": "5.2.4",
|
||||
"resolved": "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-5.2.4.tgz",
|
||||
"integrity": "sha512-7Yx/SXSOcQq5HiiV3orevHUFn+pmMB4cgbEkDYgnkUWb0WfeQ/wa2yFv6D5ICiCQOVpjA7vYDXrC7AGO8yjDHA==",
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-5.2.1.tgz",
|
||||
"integrity": "sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
|
@ -880,9 +880,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz",
|
||||
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
|
||||
"version": "0.20.2",
|
||||
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.20.2.tgz",
|
||||
"integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
|
|
@ -893,29 +893,29 @@
|
|||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.5",
|
||||
"@esbuild/android-arm": "0.21.5",
|
||||
"@esbuild/android-arm64": "0.21.5",
|
||||
"@esbuild/android-x64": "0.21.5",
|
||||
"@esbuild/darwin-arm64": "0.21.5",
|
||||
"@esbuild/darwin-x64": "0.21.5",
|
||||
"@esbuild/freebsd-arm64": "0.21.5",
|
||||
"@esbuild/freebsd-x64": "0.21.5",
|
||||
"@esbuild/linux-arm": "0.21.5",
|
||||
"@esbuild/linux-arm64": "0.21.5",
|
||||
"@esbuild/linux-ia32": "0.21.5",
|
||||
"@esbuild/linux-loong64": "0.21.5",
|
||||
"@esbuild/linux-mips64el": "0.21.5",
|
||||
"@esbuild/linux-ppc64": "0.21.5",
|
||||
"@esbuild/linux-riscv64": "0.21.5",
|
||||
"@esbuild/linux-s390x": "0.21.5",
|
||||
"@esbuild/linux-x64": "0.21.5",
|
||||
"@esbuild/netbsd-x64": "0.21.5",
|
||||
"@esbuild/openbsd-x64": "0.21.5",
|
||||
"@esbuild/sunos-x64": "0.21.5",
|
||||
"@esbuild/win32-arm64": "0.21.5",
|
||||
"@esbuild/win32-ia32": "0.21.5",
|
||||
"@esbuild/win32-x64": "0.21.5"
|
||||
"@esbuild/aix-ppc64": "0.20.2",
|
||||
"@esbuild/android-arm": "0.20.2",
|
||||
"@esbuild/android-arm64": "0.20.2",
|
||||
"@esbuild/android-x64": "0.20.2",
|
||||
"@esbuild/darwin-arm64": "0.20.2",
|
||||
"@esbuild/darwin-x64": "0.20.2",
|
||||
"@esbuild/freebsd-arm64": "0.20.2",
|
||||
"@esbuild/freebsd-x64": "0.20.2",
|
||||
"@esbuild/linux-arm": "0.20.2",
|
||||
"@esbuild/linux-arm64": "0.20.2",
|
||||
"@esbuild/linux-ia32": "0.20.2",
|
||||
"@esbuild/linux-loong64": "0.20.2",
|
||||
"@esbuild/linux-mips64el": "0.20.2",
|
||||
"@esbuild/linux-ppc64": "0.20.2",
|
||||
"@esbuild/linux-riscv64": "0.20.2",
|
||||
"@esbuild/linux-s390x": "0.20.2",
|
||||
"@esbuild/linux-x64": "0.20.2",
|
||||
"@esbuild/netbsd-x64": "0.20.2",
|
||||
"@esbuild/openbsd-x64": "0.20.2",
|
||||
"@esbuild/sunos-x64": "0.20.2",
|
||||
"@esbuild/win32-arm64": "0.20.2",
|
||||
"@esbuild/win32-ia32": "0.20.2",
|
||||
"@esbuild/win32-x64": "0.20.2"
|
||||
}
|
||||
},
|
||||
"node_modules/estree-walker": {
|
||||
|
|
@ -988,6 +988,21 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
|
||||
|
|
@ -1591,9 +1606,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.59.0",
|
||||
"resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.59.0.tgz",
|
||||
"integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==",
|
||||
"version": "4.59.1",
|
||||
"resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.59.1.tgz",
|
||||
"integrity": "sha512-iZKH8BeoCwTCBTZBZWQQMreekd4mdomwdjIQ40GC1oZm6o+8PnNMIxFOiCsGMWeS8iDJ7KZcl7KwmKk/0HOQpA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
@ -1607,31 +1622,31 @@
|
|||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.59.0",
|
||||
"@rollup/rollup-android-arm64": "4.59.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.59.0",
|
||||
"@rollup/rollup-darwin-x64": "4.59.0",
|
||||
"@rollup/rollup-freebsd-arm64": "4.59.0",
|
||||
"@rollup/rollup-freebsd-x64": "4.59.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.59.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.59.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-loong64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-loong64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-ppc64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-ppc64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.59.0",
|
||||
"@rollup/rollup-openbsd-x64": "4.59.0",
|
||||
"@rollup/rollup-openharmony-arm64": "4.59.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.59.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.59.0",
|
||||
"@rollup/rollup-win32-x64-gnu": "4.59.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.59.0",
|
||||
"@rollup/rollup-android-arm-eabi": "4.59.1",
|
||||
"@rollup/rollup-android-arm64": "4.59.1",
|
||||
"@rollup/rollup-darwin-arm64": "4.59.1",
|
||||
"@rollup/rollup-darwin-x64": "4.59.1",
|
||||
"@rollup/rollup-freebsd-arm64": "4.59.1",
|
||||
"@rollup/rollup-freebsd-x64": "4.59.1",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.59.1",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.59.1",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-loong64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-loong64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-ppc64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-ppc64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-x64-musl": "4.59.1",
|
||||
"@rollup/rollup-openbsd-x64": "4.59.1",
|
||||
"@rollup/rollup-openharmony-arm64": "4.59.1",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.59.1",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.59.1",
|
||||
"@rollup/rollup-win32-x64-gnu": "4.59.1",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.59.1",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
|
|
@ -1823,15 +1838,15 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.4.21",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.21.tgz",
|
||||
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
|
||||
"version": "5.2.14",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.2.14.tgz",
|
||||
"integrity": "sha512-TFQLuwWLPms+NBNlh0D9LZQ+HXW471COABxw/9TEUBrjuHMo9BrYBPrN/SYAwIuVL+rLerycxiLT41t4f5MZpA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.21.3",
|
||||
"postcss": "^8.4.43",
|
||||
"rollup": "^4.20.0"
|
||||
"esbuild": "^0.20.1",
|
||||
"postcss": "^8.4.38",
|
||||
"rollup": "^4.13.0"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
|
|
@ -1850,7 +1865,6 @@
|
|||
"less": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"sass": "*",
|
||||
"sass-embedded": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"terser": "^5.4.0"
|
||||
|
|
@ -1868,9 +1882,6 @@
|
|||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
|
|
@ -1905,6 +1916,21 @@
|
|||
"url": "https://opencollective.com/vitest"
|
||||
}
|
||||
},
|
||||
"node_modules/vite/node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vitest": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmmirror.com/vitest/-/vitest-1.6.1.tgz",
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@esbuild/darwin-x64",
|
||||
"version": "0.21.5",
|
||||
"version": "0.20.2",
|
||||
"description": "The macOS 64-bit binary for esbuild, a JavaScript bundler.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@rollup/rollup-darwin-x64",
|
||||
"version": "4.59.0",
|
||||
"version": "4.59.1",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -20,7 +20,7 @@ const crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
|
|||
const require$$0__default = /*#__PURE__*/_interopDefaultCompat(require$$0);
|
||||
const require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
|
||||
|
||||
const version = "5.2.4";
|
||||
const version = "5.2.1";
|
||||
|
||||
function resolveCompiler(root) {
|
||||
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
||||
|
|
@ -38,7 +38,7 @@ function tryResolveCompiler(root) {
|
|||
return tryRequire("vue/compiler-sfc", root);
|
||||
}
|
||||
}
|
||||
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
||||
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
||||
function tryRequire(id, from) {
|
||||
try {
|
||||
return from ? _require(_require.resolve(id, { paths: [from] })) : _require(id);
|
||||
|
|
@ -151,8 +151,7 @@ function getTempSrcDescriptor(filename, query) {
|
|||
start: { line: 0, column: 0 }
|
||||
}
|
||||
}
|
||||
],
|
||||
isTemp: true
|
||||
]
|
||||
};
|
||||
}
|
||||
function setSrcDescriptor(filename, entry, scoped) {
|
||||
|
|
@ -310,8 +309,6 @@ function resolveTemplateCompilerOptions(descriptor, options, ssr) {
|
|||
}
|
||||
return {
|
||||
...options.template,
|
||||
// @ts-expect-error TODO remove when 3.6 is out
|
||||
vapor: descriptor.vapor,
|
||||
id,
|
||||
ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
|
||||
filename,
|
||||
|
|
@ -375,7 +372,8 @@ function resolveScript(descriptor, options, ssr, customElement) {
|
|||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const resolved = options.compiler.compileScript(descriptor, {
|
||||
let resolved = null;
|
||||
resolved = options.compiler.compileScript(descriptor, {
|
||||
...options.script,
|
||||
id: descriptor.id,
|
||||
isProd: options.isProduction,
|
||||
|
|
@ -441,7 +439,7 @@ function decodeInteger(reader, relative) {
|
|||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -2147483648 | -value;
|
||||
value = -0x80000000 | -value;
|
||||
}
|
||||
return relative + value;
|
||||
}
|
||||
|
|
@ -1018,6 +1016,10 @@ function put(setarr, key) {
|
|||
}
|
||||
|
||||
const COLUMN = 0;
|
||||
const SOURCES_INDEX = 1;
|
||||
const SOURCE_LINE = 2;
|
||||
const SOURCE_COLUMN = 3;
|
||||
const NAMES_INDEX = 4;
|
||||
|
||||
const NO_NAME = -1;
|
||||
/**
|
||||
|
|
@ -1090,12 +1092,17 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|||
const line = getLine(mappings, genLine);
|
||||
const index = getColumnIndex(line, genColumn);
|
||||
if (!source) {
|
||||
if (skipable && skipSourceless(line, index))
|
||||
return;
|
||||
return insert(line, index, [genColumn]);
|
||||
}
|
||||
const sourcesIndex = put(sources, source);
|
||||
const namesIndex = name ? put(names, name) : NO_NAME;
|
||||
if (sourcesIndex === sourcesContent.length)
|
||||
sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
|
||||
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
|
||||
return;
|
||||
}
|
||||
return insert(line, index, name
|
||||
? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
|
||||
: [genColumn, sourcesIndex, sourceLine, sourceColumn]);
|
||||
|
|
@ -1135,6 +1142,32 @@ function putAll(setarr, array) {
|
|||
for (let i = 0; i < array.length; i++)
|
||||
put(setarr, array[i]);
|
||||
}
|
||||
function skipSourceless(line, index) {
|
||||
// The start of a line is already sourceless, so adding a sourceless segment to the beginning
|
||||
// doesn't generate any useful information.
|
||||
if (index === 0)
|
||||
return true;
|
||||
const prev = line[index - 1];
|
||||
// If the previous segment is also sourceless, then adding another sourceless segment doesn't
|
||||
// genrate any new information. Else, this segment will end the source/named segment and point to
|
||||
// a sourceless position, which is useful.
|
||||
return prev.length === 1;
|
||||
}
|
||||
function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
|
||||
// A source/named segment at the start of a line gives position at that genColumn
|
||||
if (index === 0)
|
||||
return false;
|
||||
const prev = line[index - 1];
|
||||
// If the previous segment is sourceless, then we're transitioning to a source.
|
||||
if (prev.length === 1)
|
||||
return false;
|
||||
// If the previous segment maps to the exact same source position, then this segment doesn't
|
||||
// provide any new position information.
|
||||
return (sourcesIndex === prev[SOURCES_INDEX] &&
|
||||
sourceLine === prev[SOURCE_LINE] &&
|
||||
sourceColumn === prev[SOURCE_COLUMN] &&
|
||||
namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
|
||||
}
|
||||
function addMappingInternal(skipable, map, mapping) {
|
||||
const { generated, source, original, name, content } = mapping;
|
||||
if (!source) {
|
||||
|
|
@ -1495,64 +1528,26 @@ function requireCommon () {
|
|||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '')
|
||||
.trim()
|
||||
.replace(' ', ',')
|
||||
.split(',')
|
||||
.filter(Boolean);
|
||||
let i;
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
const len = split.length;
|
||||
|
||||
for (const ns of split) {
|
||||
if (ns[0] === '-') {
|
||||
createDebug.skips.push(ns.slice(1));
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) {
|
||||
// ignore empty strings
|
||||
continue;
|
||||
}
|
||||
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
|
||||
if (namespaces[0] === '-') {
|
||||
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
||||
} else {
|
||||
createDebug.names.push(ns);
|
||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given string matches a namespace template, honoring
|
||||
* asterisks as wildcards.
|
||||
*
|
||||
* @param {String} search
|
||||
* @param {String} template
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function matchesTemplate(search, template) {
|
||||
let searchIndex = 0;
|
||||
let templateIndex = 0;
|
||||
let starIndex = -1;
|
||||
let matchIndex = 0;
|
||||
|
||||
while (searchIndex < search.length) {
|
||||
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
||||
// Match character or proceed with wildcard
|
||||
if (template[templateIndex] === '*') {
|
||||
starIndex = templateIndex;
|
||||
matchIndex = searchIndex;
|
||||
templateIndex++; // Skip the '*'
|
||||
} else {
|
||||
searchIndex++;
|
||||
templateIndex++;
|
||||
}
|
||||
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
||||
// Backtrack to the last '*' and try to match more characters
|
||||
templateIndex = starIndex + 1;
|
||||
matchIndex++;
|
||||
searchIndex = matchIndex;
|
||||
} else {
|
||||
return false; // No match
|
||||
}
|
||||
}
|
||||
|
||||
// Handle trailing '*' in template
|
||||
while (templateIndex < template.length && template[templateIndex] === '*') {
|
||||
templateIndex++;
|
||||
}
|
||||
|
||||
return templateIndex === template.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
|
|
@ -1561,8 +1556,8 @@ function requireCommon () {
|
|||
*/
|
||||
function disable() {
|
||||
const namespaces = [
|
||||
...createDebug.names,
|
||||
...createDebug.skips.map(namespace => '-' + namespace)
|
||||
...createDebug.names.map(toNamespace),
|
||||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||||
].join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
|
|
@ -1576,14 +1571,21 @@ function requireCommon () {
|
|||
* @api public
|
||||
*/
|
||||
function enabled(name) {
|
||||
for (const skip of createDebug.skips) {
|
||||
if (matchesTemplate(name, skip)) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
||||
let i;
|
||||
let len;
|
||||
|
||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||||
if (createDebug.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const ns of createDebug.names) {
|
||||
if (matchesTemplate(name, ns)) {
|
||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||||
if (createDebug.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1591,6 +1593,19 @@ function requireCommon () {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert regexp to namespace
|
||||
*
|
||||
* @param {RegExp} regxep
|
||||
* @return {String} namespace
|
||||
* @api private
|
||||
*/
|
||||
function toNamespace(regexp) {
|
||||
return regexp.toString()
|
||||
.substring(2, regexp.toString().length - 2)
|
||||
.replace(/\.\*\?$/, '*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
|
|
@ -1759,7 +1774,6 @@ function requireBrowser () {
|
|||
|
||||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
// eslint-disable-next-line no-return-assign
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
|
|
@ -2184,25 +2198,18 @@ function requireNode () {
|
|||
* treat as a browser.
|
||||
*/
|
||||
|
||||
var hasRequiredSrc;
|
||||
|
||||
function requireSrc () {
|
||||
if (hasRequiredSrc) return src.exports;
|
||||
hasRequiredSrc = 1;
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
src.exports = requireBrowser();
|
||||
} else {
|
||||
} else {
|
||||
src.exports = requireNode();
|
||||
}
|
||||
return src.exports;
|
||||
}
|
||||
|
||||
var srcExports = requireSrc();
|
||||
var srcExports = src.exports;
|
||||
const _debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
||||
|
||||
const debug = _debug("vite:hmr");
|
||||
const directRequestRE = /(?:\?|&)direct\b/;
|
||||
async function handleHotUpdate({ file, modules, read }, options, customElement, typeDepModules) {
|
||||
async function handleHotUpdate({ file, modules, read }, options, customElement) {
|
||||
const prevDescriptor = getDescriptor(file, options, false, true);
|
||||
if (!prevDescriptor) {
|
||||
return;
|
||||
|
|
@ -2303,15 +2310,17 @@ async function handleHotUpdate({ file, modules, read }, options, customElement,
|
|||
}
|
||||
debug(`[vue:update(${updateType.join("&")})] ${file}`);
|
||||
}
|
||||
return [...affectedModules, ...typeDepModules || []].filter(
|
||||
Boolean
|
||||
);
|
||||
return [...affectedModules].filter(Boolean);
|
||||
}
|
||||
function isEqualBlock(a, b) {
|
||||
if (!a && !b) return true;
|
||||
if (!a || !b) return false;
|
||||
if (a.src && b.src && a.src === b.src) return true;
|
||||
if (a.content !== b.content) return false;
|
||||
if (!a && !b)
|
||||
return true;
|
||||
if (!a || !b)
|
||||
return false;
|
||||
if (a.src && b.src && a.src === b.src)
|
||||
return true;
|
||||
if (a.content !== b.content)
|
||||
return false;
|
||||
const keysA = Object.keys(a.attrs);
|
||||
const keysB = Object.keys(b.attrs);
|
||||
if (keysA.length !== keysB.length) {
|
||||
|
|
@ -2550,20 +2559,11 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
}
|
||||
let resolvedMap = void 0;
|
||||
if (options.sourceMap) {
|
||||
if (templateMap) {
|
||||
const from = scriptMap ?? {
|
||||
file: filename,
|
||||
sourceRoot: "",
|
||||
version: 3,
|
||||
sources: [],
|
||||
sourcesContent: [],
|
||||
names: [],
|
||||
mappings: ""
|
||||
};
|
||||
if (scriptMap && templateMap) {
|
||||
const gen = fromMap(
|
||||
// version property of result.map is declared as string
|
||||
// but actually it is `3`
|
||||
from
|
||||
scriptMap
|
||||
);
|
||||
const tracer = new TraceMap(
|
||||
// same above
|
||||
|
|
@ -2571,7 +2571,8 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
);
|
||||
const offset = (scriptCode.match(/\r?\n/g)?.length ?? 0) + 1;
|
||||
eachMapping(tracer, (m) => {
|
||||
if (m.source == null) return;
|
||||
if (m.source == null)
|
||||
return;
|
||||
addMapping(gen, {
|
||||
source: m.source,
|
||||
original: { line: m.originalLine, column: m.originalColumn },
|
||||
|
|
@ -2584,7 +2585,7 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
resolvedMap = toEncodedMap(gen);
|
||||
resolvedMap.sourcesContent = templateMap.sourcesContent;
|
||||
} else {
|
||||
resolvedMap = scriptMap;
|
||||
resolvedMap = scriptMap ?? templateMap;
|
||||
}
|
||||
}
|
||||
if (!attachedProps.length) {
|
||||
|
|
@ -2598,30 +2599,11 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
let resolvedCode = output.join("\n");
|
||||
const lang = descriptor.scriptSetup?.lang || descriptor.script?.lang;
|
||||
if (lang && /tsx?$/.test(lang) && !descriptor.script?.src) {
|
||||
const { transformWithOxc } = await import('vite');
|
||||
if (transformWithOxc) {
|
||||
const { code: code2, map } = await transformWithOxc(
|
||||
resolvedCode,
|
||||
filename,
|
||||
{
|
||||
// #430 support decorators in .vue file
|
||||
// target can be overridden by oxc config target
|
||||
// @ts-ignore Rolldown-specific
|
||||
...options.devServer?.config.oxc,
|
||||
lang: "ts",
|
||||
sourcemap: options.sourceMap
|
||||
},
|
||||
resolvedMap
|
||||
);
|
||||
resolvedCode = code2;
|
||||
resolvedMap = resolvedMap ? map : resolvedMap;
|
||||
} else {
|
||||
const { code: code2, map } = await vite.transformWithEsbuild(
|
||||
resolvedCode,
|
||||
filename,
|
||||
{
|
||||
target: "esnext",
|
||||
charset: "utf8",
|
||||
// #430 support decorators in .vue file
|
||||
// target can be overridden by esbuild config target
|
||||
...options.devServer?.config.esbuild,
|
||||
|
|
@ -2633,7 +2615,6 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
resolvedCode = code2;
|
||||
resolvedMap = resolvedMap ? map : resolvedMap;
|
||||
}
|
||||
}
|
||||
return {
|
||||
code: resolvedCode,
|
||||
map: resolvedMap || {
|
||||
|
|
@ -2681,8 +2662,7 @@ async function genTemplateCode(descriptor, options, pluginContext, ssr, customEl
|
|||
}
|
||||
}
|
||||
async function genScriptCode(descriptor, options, pluginContext, ssr, customElement) {
|
||||
const vaporFlag = descriptor.vapor ? "__vapor: true" : "";
|
||||
let scriptCode = `const ${scriptIdentifier} = { ${vaporFlag} }`;
|
||||
let scriptCode = `const ${scriptIdentifier} = {}`;
|
||||
let map;
|
||||
const script = resolveScript(descriptor, options, ssr, customElement);
|
||||
if (script) {
|
||||
|
|
@ -2751,7 +2731,7 @@ async function genStyleCode(descriptor, pluginContext, customElement, attachedPr
|
|||
style.module
|
||||
);
|
||||
stylesCode += importCode;
|
||||
Object.assign(cssModulesMap ||= {}, nameMap);
|
||||
Object.assign(cssModulesMap || (cssModulesMap = {}), nameMap);
|
||||
} else {
|
||||
if (customElement) {
|
||||
stylesCode += `
|
||||
|
|
@ -2880,12 +2860,7 @@ async function transformStyle(code, descriptor, index, options, pluginContext, f
|
|||
) : { mappings: "" };
|
||||
return {
|
||||
code: result.code,
|
||||
map,
|
||||
meta: block.scoped && !descriptor.isTemp ? {
|
||||
vite: {
|
||||
cssScopeTo: [descriptor.filename, "default"]
|
||||
}
|
||||
} : void 0
|
||||
map
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2909,7 +2884,6 @@ function vuePlugin(rawOptions = {}) {
|
|||
const customElement = options.value.features?.customElement || options.value.customElement;
|
||||
return typeof customElement === "boolean" ? () => customElement : vite.createFilter(customElement);
|
||||
});
|
||||
let transformCachedModule = false;
|
||||
return {
|
||||
name: "vite:vue",
|
||||
api: {
|
||||
|
|
@ -2930,42 +2904,26 @@ function vuePlugin(rawOptions = {}) {
|
|||
if (options.value.compiler.invalidateTypeCache) {
|
||||
options.value.compiler.invalidateTypeCache(ctx.file);
|
||||
}
|
||||
let typeDepModules;
|
||||
const matchesFilter = filter.value(ctx.file);
|
||||
if (typeDepToSFCMap.has(ctx.file)) {
|
||||
typeDepModules = handleTypeDepChange(
|
||||
typeDepToSFCMap.get(ctx.file),
|
||||
ctx
|
||||
);
|
||||
if (!matchesFilter) return typeDepModules;
|
||||
return handleTypeDepChange(typeDepToSFCMap.get(ctx.file), ctx);
|
||||
}
|
||||
if (matchesFilter) {
|
||||
if (filter.value(ctx.file)) {
|
||||
return handleHotUpdate(
|
||||
ctx,
|
||||
options.value,
|
||||
customElementFilter.value(ctx.file),
|
||||
typeDepModules
|
||||
customElementFilter.value(ctx.file)
|
||||
);
|
||||
}
|
||||
},
|
||||
config(config) {
|
||||
const parseDefine = (v) => {
|
||||
try {
|
||||
return typeof v === "string" ? JSON.parse(v) : v;
|
||||
} catch (err) {
|
||||
return v;
|
||||
}
|
||||
};
|
||||
return {
|
||||
resolve: {
|
||||
dedupe: config.build?.ssr ? [] : ["vue"]
|
||||
},
|
||||
define: {
|
||||
__VUE_OPTIONS_API__: options.value.features?.optionsAPI ?? parseDefine(config.define?.__VUE_OPTIONS_API__) ?? true,
|
||||
__VUE_PROD_DEVTOOLS__: (options.value.features?.prodDevtools || parseDefine(config.define?.__VUE_PROD_DEVTOOLS__)) ?? false,
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: (options.value.features?.prodHydrationMismatchDetails || parseDefine(
|
||||
config.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
|
||||
)) ?? false
|
||||
__VUE_OPTIONS_API__: !!((options.value.features?.optionsAPI ?? true) || config.define?.__VUE_OPTIONS_API__),
|
||||
__VUE_PROD_DEVTOOLS__: !!(options.value.features?.prodDevtools || config.define?.__VUE_PROD_DEVTOOLS__),
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: !!(options.value.features?.prodHydrationMismatchDetails || config.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__)
|
||||
},
|
||||
ssr: {
|
||||
// @ts-ignore -- config.legacy.buildSsrCjsExternalHeuristics will be removed in Vite 5
|
||||
|
|
@ -2982,23 +2940,6 @@ function vuePlugin(rawOptions = {}) {
|
|||
isProduction: config.isProduction,
|
||||
devToolsEnabled: !!(options.value.features?.prodDevtools || config.define.__VUE_PROD_DEVTOOLS__ || !config.isProduction)
|
||||
};
|
||||
const _warn = config.logger.warn;
|
||||
config.logger.warn = (...args) => {
|
||||
const msg = args[0];
|
||||
if (msg.match(
|
||||
/\[lightningcss\] '(deep|slotted|global)' is not recognized as a valid pseudo-/
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
_warn(...args);
|
||||
};
|
||||
transformCachedModule = config.command === "build" && options.value.sourceMap && config.build.watch != null;
|
||||
},
|
||||
shouldTransformCachedModule({ id }) {
|
||||
if (transformCachedModule && parseVueRequest(id).query.vue) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
configureServer(server) {
|
||||
options.value.devServer = server;
|
||||
|
|
@ -3020,10 +2961,10 @@ function vuePlugin(rawOptions = {}) {
|
|||
}
|
||||
},
|
||||
load(id, opt) {
|
||||
const ssr = opt?.ssr === true;
|
||||
if (id === EXPORT_HELPER_ID) {
|
||||
return helperCode;
|
||||
}
|
||||
const ssr = opt?.ssr === true;
|
||||
const { filename, query } = parseVueRequest(id);
|
||||
if (query.vue) {
|
||||
if (query.src) {
|
||||
|
|
@ -3073,9 +3014,6 @@ function vuePlugin(rawOptions = {}) {
|
|||
);
|
||||
} else {
|
||||
const descriptor = query.src ? getSrcDescriptor(filename, query) || getTempSrcDescriptor(filename, query) : getDescriptor(filename, options.value);
|
||||
if (query.src) {
|
||||
this.addWatchFile(filename);
|
||||
}
|
||||
if (query.type === "template") {
|
||||
return transformTemplateAsModule(
|
||||
code,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Plugin, ViteDevServer } from 'vite';
|
||||
import { ViteDevServer, Plugin } from 'vite';
|
||||
import * as _compiler from 'vue/compiler-sfc';
|
||||
import { SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
|
||||
|
||||
|
|
@ -108,6 +108,4 @@ interface Api {
|
|||
}
|
||||
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
|
||||
|
||||
// @ts-ignore
|
||||
export = vuePlugin;
|
||||
export { type Api, type Options, type ResolvedOptions, type VueQuery, parseVueRequest };
|
||||
export { type Api, type Options, type ResolvedOptions, type VueQuery, vuePlugin as default, parseVueRequest };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Plugin, ViteDevServer } from 'vite';
|
||||
import { ViteDevServer, Plugin } from 'vite';
|
||||
import * as _compiler from 'vue/compiler-sfc';
|
||||
import { SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Plugin, ViteDevServer } from 'vite';
|
||||
import { ViteDevServer, Plugin } from 'vite';
|
||||
import * as _compiler from 'vue/compiler-sfc';
|
||||
import { SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
|
||||
|
||||
|
|
@ -108,6 +108,4 @@ interface Api {
|
|||
}
|
||||
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
|
||||
|
||||
// @ts-ignore
|
||||
export = vuePlugin;
|
||||
export { type Api, type Options, type ResolvedOptions, type VueQuery, parseVueRequest };
|
||||
export { type Api, type Options, type ResolvedOptions, type VueQuery, vuePlugin as default, parseVueRequest };
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import crypto from 'node:crypto';
|
|||
import require$$0 from 'tty';
|
||||
import require$$1 from 'util';
|
||||
|
||||
const version = "5.2.4";
|
||||
const version = "5.2.1";
|
||||
|
||||
function resolveCompiler(root) {
|
||||
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
||||
|
|
@ -138,8 +138,7 @@ function getTempSrcDescriptor(filename, query) {
|
|||
start: { line: 0, column: 0 }
|
||||
}
|
||||
}
|
||||
],
|
||||
isTemp: true
|
||||
]
|
||||
};
|
||||
}
|
||||
function setSrcDescriptor(filename, entry, scoped) {
|
||||
|
|
@ -297,8 +296,6 @@ function resolveTemplateCompilerOptions(descriptor, options, ssr) {
|
|||
}
|
||||
return {
|
||||
...options.template,
|
||||
// @ts-expect-error TODO remove when 3.6 is out
|
||||
vapor: descriptor.vapor,
|
||||
id,
|
||||
ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
|
||||
filename,
|
||||
|
|
@ -362,7 +359,8 @@ function resolveScript(descriptor, options, ssr, customElement) {
|
|||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const resolved = options.compiler.compileScript(descriptor, {
|
||||
let resolved = null;
|
||||
resolved = options.compiler.compileScript(descriptor, {
|
||||
...options.script,
|
||||
id: descriptor.id,
|
||||
isProd: options.isProduction,
|
||||
|
|
@ -428,7 +426,7 @@ function decodeInteger(reader, relative) {
|
|||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -2147483648 | -value;
|
||||
value = -0x80000000 | -value;
|
||||
}
|
||||
return relative + value;
|
||||
}
|
||||
|
|
@ -1005,6 +1003,10 @@ function put(setarr, key) {
|
|||
}
|
||||
|
||||
const COLUMN = 0;
|
||||
const SOURCES_INDEX = 1;
|
||||
const SOURCE_LINE = 2;
|
||||
const SOURCE_COLUMN = 3;
|
||||
const NAMES_INDEX = 4;
|
||||
|
||||
const NO_NAME = -1;
|
||||
/**
|
||||
|
|
@ -1077,12 +1079,17 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|||
const line = getLine(mappings, genLine);
|
||||
const index = getColumnIndex(line, genColumn);
|
||||
if (!source) {
|
||||
if (skipable && skipSourceless(line, index))
|
||||
return;
|
||||
return insert(line, index, [genColumn]);
|
||||
}
|
||||
const sourcesIndex = put(sources, source);
|
||||
const namesIndex = name ? put(names, name) : NO_NAME;
|
||||
if (sourcesIndex === sourcesContent.length)
|
||||
sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
|
||||
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
|
||||
return;
|
||||
}
|
||||
return insert(line, index, name
|
||||
? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
|
||||
: [genColumn, sourcesIndex, sourceLine, sourceColumn]);
|
||||
|
|
@ -1122,6 +1129,32 @@ function putAll(setarr, array) {
|
|||
for (let i = 0; i < array.length; i++)
|
||||
put(setarr, array[i]);
|
||||
}
|
||||
function skipSourceless(line, index) {
|
||||
// The start of a line is already sourceless, so adding a sourceless segment to the beginning
|
||||
// doesn't generate any useful information.
|
||||
if (index === 0)
|
||||
return true;
|
||||
const prev = line[index - 1];
|
||||
// If the previous segment is also sourceless, then adding another sourceless segment doesn't
|
||||
// genrate any new information. Else, this segment will end the source/named segment and point to
|
||||
// a sourceless position, which is useful.
|
||||
return prev.length === 1;
|
||||
}
|
||||
function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
|
||||
// A source/named segment at the start of a line gives position at that genColumn
|
||||
if (index === 0)
|
||||
return false;
|
||||
const prev = line[index - 1];
|
||||
// If the previous segment is sourceless, then we're transitioning to a source.
|
||||
if (prev.length === 1)
|
||||
return false;
|
||||
// If the previous segment maps to the exact same source position, then this segment doesn't
|
||||
// provide any new position information.
|
||||
return (sourcesIndex === prev[SOURCES_INDEX] &&
|
||||
sourceLine === prev[SOURCE_LINE] &&
|
||||
sourceColumn === prev[SOURCE_COLUMN] &&
|
||||
namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
|
||||
}
|
||||
function addMappingInternal(skipable, map, mapping) {
|
||||
const { generated, source, original, name, content } = mapping;
|
||||
if (!source) {
|
||||
|
|
@ -1482,64 +1515,26 @@ function requireCommon () {
|
|||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '')
|
||||
.trim()
|
||||
.replace(' ', ',')
|
||||
.split(',')
|
||||
.filter(Boolean);
|
||||
let i;
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
const len = split.length;
|
||||
|
||||
for (const ns of split) {
|
||||
if (ns[0] === '-') {
|
||||
createDebug.skips.push(ns.slice(1));
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) {
|
||||
// ignore empty strings
|
||||
continue;
|
||||
}
|
||||
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
|
||||
if (namespaces[0] === '-') {
|
||||
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
||||
} else {
|
||||
createDebug.names.push(ns);
|
||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given string matches a namespace template, honoring
|
||||
* asterisks as wildcards.
|
||||
*
|
||||
* @param {String} search
|
||||
* @param {String} template
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function matchesTemplate(search, template) {
|
||||
let searchIndex = 0;
|
||||
let templateIndex = 0;
|
||||
let starIndex = -1;
|
||||
let matchIndex = 0;
|
||||
|
||||
while (searchIndex < search.length) {
|
||||
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
||||
// Match character or proceed with wildcard
|
||||
if (template[templateIndex] === '*') {
|
||||
starIndex = templateIndex;
|
||||
matchIndex = searchIndex;
|
||||
templateIndex++; // Skip the '*'
|
||||
} else {
|
||||
searchIndex++;
|
||||
templateIndex++;
|
||||
}
|
||||
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
||||
// Backtrack to the last '*' and try to match more characters
|
||||
templateIndex = starIndex + 1;
|
||||
matchIndex++;
|
||||
searchIndex = matchIndex;
|
||||
} else {
|
||||
return false; // No match
|
||||
}
|
||||
}
|
||||
|
||||
// Handle trailing '*' in template
|
||||
while (templateIndex < template.length && template[templateIndex] === '*') {
|
||||
templateIndex++;
|
||||
}
|
||||
|
||||
return templateIndex === template.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
|
|
@ -1548,8 +1543,8 @@ function requireCommon () {
|
|||
*/
|
||||
function disable() {
|
||||
const namespaces = [
|
||||
...createDebug.names,
|
||||
...createDebug.skips.map(namespace => '-' + namespace)
|
||||
...createDebug.names.map(toNamespace),
|
||||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||||
].join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
|
|
@ -1563,14 +1558,21 @@ function requireCommon () {
|
|||
* @api public
|
||||
*/
|
||||
function enabled(name) {
|
||||
for (const skip of createDebug.skips) {
|
||||
if (matchesTemplate(name, skip)) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
||||
let i;
|
||||
let len;
|
||||
|
||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||||
if (createDebug.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const ns of createDebug.names) {
|
||||
if (matchesTemplate(name, ns)) {
|
||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||||
if (createDebug.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1578,6 +1580,19 @@ function requireCommon () {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert regexp to namespace
|
||||
*
|
||||
* @param {RegExp} regxep
|
||||
* @return {String} namespace
|
||||
* @api private
|
||||
*/
|
||||
function toNamespace(regexp) {
|
||||
return regexp.toString()
|
||||
.substring(2, regexp.toString().length - 2)
|
||||
.replace(/\.\*\?$/, '*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
|
|
@ -1746,7 +1761,6 @@ function requireBrowser () {
|
|||
|
||||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
// eslint-disable-next-line no-return-assign
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
|
|
@ -2171,25 +2185,18 @@ function requireNode () {
|
|||
* treat as a browser.
|
||||
*/
|
||||
|
||||
var hasRequiredSrc;
|
||||
|
||||
function requireSrc () {
|
||||
if (hasRequiredSrc) return src.exports;
|
||||
hasRequiredSrc = 1;
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
src.exports = requireBrowser();
|
||||
} else {
|
||||
} else {
|
||||
src.exports = requireNode();
|
||||
}
|
||||
return src.exports;
|
||||
}
|
||||
|
||||
var srcExports = requireSrc();
|
||||
var srcExports = src.exports;
|
||||
const _debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
||||
|
||||
const debug = _debug("vite:hmr");
|
||||
const directRequestRE = /(?:\?|&)direct\b/;
|
||||
async function handleHotUpdate({ file, modules, read }, options, customElement, typeDepModules) {
|
||||
async function handleHotUpdate({ file, modules, read }, options, customElement) {
|
||||
const prevDescriptor = getDescriptor(file, options, false, true);
|
||||
if (!prevDescriptor) {
|
||||
return;
|
||||
|
|
@ -2290,15 +2297,17 @@ async function handleHotUpdate({ file, modules, read }, options, customElement,
|
|||
}
|
||||
debug(`[vue:update(${updateType.join("&")})] ${file}`);
|
||||
}
|
||||
return [...affectedModules, ...typeDepModules || []].filter(
|
||||
Boolean
|
||||
);
|
||||
return [...affectedModules].filter(Boolean);
|
||||
}
|
||||
function isEqualBlock(a, b) {
|
||||
if (!a && !b) return true;
|
||||
if (!a || !b) return false;
|
||||
if (a.src && b.src && a.src === b.src) return true;
|
||||
if (a.content !== b.content) return false;
|
||||
if (!a && !b)
|
||||
return true;
|
||||
if (!a || !b)
|
||||
return false;
|
||||
if (a.src && b.src && a.src === b.src)
|
||||
return true;
|
||||
if (a.content !== b.content)
|
||||
return false;
|
||||
const keysA = Object.keys(a.attrs);
|
||||
const keysB = Object.keys(b.attrs);
|
||||
if (keysA.length !== keysB.length) {
|
||||
|
|
@ -2537,20 +2546,11 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
}
|
||||
let resolvedMap = void 0;
|
||||
if (options.sourceMap) {
|
||||
if (templateMap) {
|
||||
const from = scriptMap ?? {
|
||||
file: filename,
|
||||
sourceRoot: "",
|
||||
version: 3,
|
||||
sources: [],
|
||||
sourcesContent: [],
|
||||
names: [],
|
||||
mappings: ""
|
||||
};
|
||||
if (scriptMap && templateMap) {
|
||||
const gen = fromMap(
|
||||
// version property of result.map is declared as string
|
||||
// but actually it is `3`
|
||||
from
|
||||
scriptMap
|
||||
);
|
||||
const tracer = new TraceMap(
|
||||
// same above
|
||||
|
|
@ -2558,7 +2558,8 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
);
|
||||
const offset = (scriptCode.match(/\r?\n/g)?.length ?? 0) + 1;
|
||||
eachMapping(tracer, (m) => {
|
||||
if (m.source == null) return;
|
||||
if (m.source == null)
|
||||
return;
|
||||
addMapping(gen, {
|
||||
source: m.source,
|
||||
original: { line: m.originalLine, column: m.originalColumn },
|
||||
|
|
@ -2571,7 +2572,7 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
resolvedMap = toEncodedMap(gen);
|
||||
resolvedMap.sourcesContent = templateMap.sourcesContent;
|
||||
} else {
|
||||
resolvedMap = scriptMap;
|
||||
resolvedMap = scriptMap ?? templateMap;
|
||||
}
|
||||
}
|
||||
if (!attachedProps.length) {
|
||||
|
|
@ -2585,30 +2586,11 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
let resolvedCode = output.join("\n");
|
||||
const lang = descriptor.scriptSetup?.lang || descriptor.script?.lang;
|
||||
if (lang && /tsx?$/.test(lang) && !descriptor.script?.src) {
|
||||
const { transformWithOxc } = await import('vite');
|
||||
if (transformWithOxc) {
|
||||
const { code: code2, map } = await transformWithOxc(
|
||||
resolvedCode,
|
||||
filename,
|
||||
{
|
||||
// #430 support decorators in .vue file
|
||||
// target can be overridden by oxc config target
|
||||
// @ts-ignore Rolldown-specific
|
||||
...options.devServer?.config.oxc,
|
||||
lang: "ts",
|
||||
sourcemap: options.sourceMap
|
||||
},
|
||||
resolvedMap
|
||||
);
|
||||
resolvedCode = code2;
|
||||
resolvedMap = resolvedMap ? map : resolvedMap;
|
||||
} else {
|
||||
const { code: code2, map } = await transformWithEsbuild(
|
||||
resolvedCode,
|
||||
filename,
|
||||
{
|
||||
target: "esnext",
|
||||
charset: "utf8",
|
||||
// #430 support decorators in .vue file
|
||||
// target can be overridden by esbuild config target
|
||||
...options.devServer?.config.esbuild,
|
||||
|
|
@ -2620,7 +2602,6 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|||
resolvedCode = code2;
|
||||
resolvedMap = resolvedMap ? map : resolvedMap;
|
||||
}
|
||||
}
|
||||
return {
|
||||
code: resolvedCode,
|
||||
map: resolvedMap || {
|
||||
|
|
@ -2668,8 +2649,7 @@ async function genTemplateCode(descriptor, options, pluginContext, ssr, customEl
|
|||
}
|
||||
}
|
||||
async function genScriptCode(descriptor, options, pluginContext, ssr, customElement) {
|
||||
const vaporFlag = descriptor.vapor ? "__vapor: true" : "";
|
||||
let scriptCode = `const ${scriptIdentifier} = { ${vaporFlag} }`;
|
||||
let scriptCode = `const ${scriptIdentifier} = {}`;
|
||||
let map;
|
||||
const script = resolveScript(descriptor, options, ssr, customElement);
|
||||
if (script) {
|
||||
|
|
@ -2738,7 +2718,7 @@ async function genStyleCode(descriptor, pluginContext, customElement, attachedPr
|
|||
style.module
|
||||
);
|
||||
stylesCode += importCode;
|
||||
Object.assign(cssModulesMap ||= {}, nameMap);
|
||||
Object.assign(cssModulesMap || (cssModulesMap = {}), nameMap);
|
||||
} else {
|
||||
if (customElement) {
|
||||
stylesCode += `
|
||||
|
|
@ -2867,12 +2847,7 @@ async function transformStyle(code, descriptor, index, options, pluginContext, f
|
|||
) : { mappings: "" };
|
||||
return {
|
||||
code: result.code,
|
||||
map,
|
||||
meta: block.scoped && !descriptor.isTemp ? {
|
||||
vite: {
|
||||
cssScopeTo: [descriptor.filename, "default"]
|
||||
}
|
||||
} : void 0
|
||||
map
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2896,7 +2871,6 @@ function vuePlugin(rawOptions = {}) {
|
|||
const customElement = options.value.features?.customElement || options.value.customElement;
|
||||
return typeof customElement === "boolean" ? () => customElement : createFilter(customElement);
|
||||
});
|
||||
let transformCachedModule = false;
|
||||
return {
|
||||
name: "vite:vue",
|
||||
api: {
|
||||
|
|
@ -2917,42 +2891,26 @@ function vuePlugin(rawOptions = {}) {
|
|||
if (options.value.compiler.invalidateTypeCache) {
|
||||
options.value.compiler.invalidateTypeCache(ctx.file);
|
||||
}
|
||||
let typeDepModules;
|
||||
const matchesFilter = filter.value(ctx.file);
|
||||
if (typeDepToSFCMap.has(ctx.file)) {
|
||||
typeDepModules = handleTypeDepChange(
|
||||
typeDepToSFCMap.get(ctx.file),
|
||||
ctx
|
||||
);
|
||||
if (!matchesFilter) return typeDepModules;
|
||||
return handleTypeDepChange(typeDepToSFCMap.get(ctx.file), ctx);
|
||||
}
|
||||
if (matchesFilter) {
|
||||
if (filter.value(ctx.file)) {
|
||||
return handleHotUpdate(
|
||||
ctx,
|
||||
options.value,
|
||||
customElementFilter.value(ctx.file),
|
||||
typeDepModules
|
||||
customElementFilter.value(ctx.file)
|
||||
);
|
||||
}
|
||||
},
|
||||
config(config) {
|
||||
const parseDefine = (v) => {
|
||||
try {
|
||||
return typeof v === "string" ? JSON.parse(v) : v;
|
||||
} catch (err) {
|
||||
return v;
|
||||
}
|
||||
};
|
||||
return {
|
||||
resolve: {
|
||||
dedupe: config.build?.ssr ? [] : ["vue"]
|
||||
},
|
||||
define: {
|
||||
__VUE_OPTIONS_API__: options.value.features?.optionsAPI ?? parseDefine(config.define?.__VUE_OPTIONS_API__) ?? true,
|
||||
__VUE_PROD_DEVTOOLS__: (options.value.features?.prodDevtools || parseDefine(config.define?.__VUE_PROD_DEVTOOLS__)) ?? false,
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: (options.value.features?.prodHydrationMismatchDetails || parseDefine(
|
||||
config.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__
|
||||
)) ?? false
|
||||
__VUE_OPTIONS_API__: !!((options.value.features?.optionsAPI ?? true) || config.define?.__VUE_OPTIONS_API__),
|
||||
__VUE_PROD_DEVTOOLS__: !!(options.value.features?.prodDevtools || config.define?.__VUE_PROD_DEVTOOLS__),
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: !!(options.value.features?.prodHydrationMismatchDetails || config.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__)
|
||||
},
|
||||
ssr: {
|
||||
// @ts-ignore -- config.legacy.buildSsrCjsExternalHeuristics will be removed in Vite 5
|
||||
|
|
@ -2969,23 +2927,6 @@ function vuePlugin(rawOptions = {}) {
|
|||
isProduction: config.isProduction,
|
||||
devToolsEnabled: !!(options.value.features?.prodDevtools || config.define.__VUE_PROD_DEVTOOLS__ || !config.isProduction)
|
||||
};
|
||||
const _warn = config.logger.warn;
|
||||
config.logger.warn = (...args) => {
|
||||
const msg = args[0];
|
||||
if (msg.match(
|
||||
/\[lightningcss\] '(deep|slotted|global)' is not recognized as a valid pseudo-/
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
_warn(...args);
|
||||
};
|
||||
transformCachedModule = config.command === "build" && options.value.sourceMap && config.build.watch != null;
|
||||
},
|
||||
shouldTransformCachedModule({ id }) {
|
||||
if (transformCachedModule && parseVueRequest(id).query.vue) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
configureServer(server) {
|
||||
options.value.devServer = server;
|
||||
|
|
@ -3007,10 +2948,10 @@ function vuePlugin(rawOptions = {}) {
|
|||
}
|
||||
},
|
||||
load(id, opt) {
|
||||
const ssr = opt?.ssr === true;
|
||||
if (id === EXPORT_HELPER_ID) {
|
||||
return helperCode;
|
||||
}
|
||||
const ssr = opt?.ssr === true;
|
||||
const { filename, query } = parseVueRequest(id);
|
||||
if (query.vue) {
|
||||
if (query.src) {
|
||||
|
|
@ -3060,9 +3001,6 @@ function vuePlugin(rawOptions = {}) {
|
|||
);
|
||||
} else {
|
||||
const descriptor = query.src ? getSrcDescriptor(filename, query) || getTempSrcDescriptor(filename, query) : getDescriptor(filename, options.value);
|
||||
if (query.src) {
|
||||
this.addWatchFile(filename);
|
||||
}
|
||||
if (query.type === "template") {
|
||||
return transformTemplateAsModule(
|
||||
code,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vitejs/plugin-vue",
|
||||
"version": "5.2.4",
|
||||
"version": "5.2.1",
|
||||
"type": "commonjs",
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
|
|
@ -33,14 +33,14 @@
|
|||
"vue": "^3.2.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.8",
|
||||
"@jridgewell/gen-mapping": "^0.3.5",
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"debug": "^4.4.0",
|
||||
"rollup": "^4.40.2",
|
||||
"debug": "^4.3.7",
|
||||
"rollup": "^4.27.2",
|
||||
"slash": "^5.1.0",
|
||||
"source-map-js": "^1.2.1",
|
||||
"vite": "^6.3.5",
|
||||
"vue": "^3.5.13"
|
||||
"vite": "^6.0.0",
|
||||
"vue": "^3.5.12"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "unbuild --stub",
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -167,7 +167,8 @@ function extractFileFromTarGzip(buffer, subpath) {
|
|||
let size = parseInt(str(offset + 124, 12), 8);
|
||||
offset += 512;
|
||||
if (!isNaN(size)) {
|
||||
if (name === subpath) return buffer.subarray(offset, offset + size);
|
||||
if (name === subpath)
|
||||
return buffer.subarray(offset, offset + size);
|
||||
offset += size + 511 & ~511;
|
||||
}
|
||||
}
|
||||
|
|
@ -202,8 +203,10 @@ function removeRecursive(dir) {
|
|||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (stats.isDirectory()) removeRecursive(entryPath);
|
||||
else fs2.unlinkSync(entryPath);
|
||||
if (stats.isDirectory())
|
||||
removeRecursive(entryPath);
|
||||
else
|
||||
fs2.unlinkSync(entryPath);
|
||||
}
|
||||
fs2.rmdirSync(dir);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,6 @@ export interface ResolveOptions {
|
|||
resolveDir?: string
|
||||
kind?: ImportKind
|
||||
pluginData?: any
|
||||
with?: Record<string, string>
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||
|
|
@ -380,7 +379,6 @@ export interface OnResolveArgs {
|
|||
resolveDir: string
|
||||
kind: ImportKind
|
||||
pluginData: any
|
||||
with: Record<string, string>
|
||||
}
|
||||
|
||||
export type ImportKind =
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "esbuild",
|
||||
"version": "0.21.5",
|
||||
"version": "0.20.2",
|
||||
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
@ -18,29 +18,29 @@
|
|||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.5",
|
||||
"@esbuild/android-arm": "0.21.5",
|
||||
"@esbuild/android-arm64": "0.21.5",
|
||||
"@esbuild/android-x64": "0.21.5",
|
||||
"@esbuild/darwin-arm64": "0.21.5",
|
||||
"@esbuild/darwin-x64": "0.21.5",
|
||||
"@esbuild/freebsd-arm64": "0.21.5",
|
||||
"@esbuild/freebsd-x64": "0.21.5",
|
||||
"@esbuild/linux-arm": "0.21.5",
|
||||
"@esbuild/linux-arm64": "0.21.5",
|
||||
"@esbuild/linux-ia32": "0.21.5",
|
||||
"@esbuild/linux-loong64": "0.21.5",
|
||||
"@esbuild/linux-mips64el": "0.21.5",
|
||||
"@esbuild/linux-ppc64": "0.21.5",
|
||||
"@esbuild/linux-riscv64": "0.21.5",
|
||||
"@esbuild/linux-s390x": "0.21.5",
|
||||
"@esbuild/linux-x64": "0.21.5",
|
||||
"@esbuild/netbsd-x64": "0.21.5",
|
||||
"@esbuild/openbsd-x64": "0.21.5",
|
||||
"@esbuild/sunos-x64": "0.21.5",
|
||||
"@esbuild/win32-arm64": "0.21.5",
|
||||
"@esbuild/win32-ia32": "0.21.5",
|
||||
"@esbuild/win32-x64": "0.21.5"
|
||||
"@esbuild/aix-ppc64": "0.20.2",
|
||||
"@esbuild/android-arm": "0.20.2",
|
||||
"@esbuild/android-arm64": "0.20.2",
|
||||
"@esbuild/android-x64": "0.20.2",
|
||||
"@esbuild/darwin-arm64": "0.20.2",
|
||||
"@esbuild/darwin-x64": "0.20.2",
|
||||
"@esbuild/freebsd-arm64": "0.20.2",
|
||||
"@esbuild/freebsd-x64": "0.20.2",
|
||||
"@esbuild/linux-arm": "0.20.2",
|
||||
"@esbuild/linux-arm64": "0.20.2",
|
||||
"@esbuild/linux-ia32": "0.20.2",
|
||||
"@esbuild/linux-loong64": "0.20.2",
|
||||
"@esbuild/linux-mips64el": "0.20.2",
|
||||
"@esbuild/linux-ppc64": "0.20.2",
|
||||
"@esbuild/linux-riscv64": "0.20.2",
|
||||
"@esbuild/linux-s390x": "0.20.2",
|
||||
"@esbuild/linux-x64": "0.20.2",
|
||||
"@esbuild/netbsd-x64": "0.20.2",
|
||||
"@esbuild/openbsd-x64": "0.20.2",
|
||||
"@esbuild/sunos-x64": "0.20.2",
|
||||
"@esbuild/win32-arm64": "0.20.2",
|
||||
"@esbuild/win32-ia32": "0.20.2",
|
||||
"@esbuild/win32-x64": "0.20.2"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
<a href="https://nodejs.org/en/about/previous-releases">
|
||||
<img src="https://img.shields.io/node/v/rollup.svg" alt="node compatibility">
|
||||
</a>
|
||||
<a href="https://packagephobia.now.sh/result?p=rollup">
|
||||
<img src="https://packagephobia.now.sh/badge?p=rollup" alt="install size" >
|
||||
<a href="https://packagephobia.com/result?p=rollup">
|
||||
<img src="https://packagephobia.com/badge?p=rollup" alt="install size" >
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/rollup/rollup">
|
||||
<img src="https://codecov.io/gh/rollup/rollup/graph/badge.svg" alt="code coverage" >
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ function _mergeNamespaces(n, m) {
|
|||
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
||||
}
|
||||
|
||||
var version = "4.59.0";
|
||||
var version = "4.59.1";
|
||||
|
||||
// src/vlq.ts
|
||||
var comma = ",".charCodeAt(0);
|
||||
|
|
@ -19594,7 +19594,11 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
|
|||
getDynamicImporters(dynamicEntry),
|
||||
dynamicEntry.implicitlyLoadedAfter
|
||||
])) {
|
||||
for (const entry of dependentEntriesByModule.get(importer)) {
|
||||
const importerEntries = dependentEntriesByModule.get(importer);
|
||||
if (!importerEntries) {
|
||||
continue;
|
||||
}
|
||||
for (const entry of importerEntries) {
|
||||
dynamicallyDependentEntries.add(entry);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ function _mergeNamespaces(n, m) {
|
|||
|
||||
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
||||
|
||||
var version = "4.59.0";
|
||||
var version = "4.59.1";
|
||||
|
||||
function ensureArray$1(items) {
|
||||
if (Array.isArray(items)) {
|
||||
|
|
@ -21088,7 +21088,11 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
|
|||
getDynamicImporters(dynamicEntry),
|
||||
dynamicEntry.implicitlyLoadedAfter
|
||||
])) {
|
||||
for (const entry of dependentEntriesByModule.get(importer)) {
|
||||
const importerEntries = dependentEntriesByModule.get(importer);
|
||||
if (!importerEntries) {
|
||||
continue;
|
||||
}
|
||||
for (const entry of importerEntries) {
|
||||
dynamicallyDependentEntries.add(entry);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
@license
|
||||
Rollup.js v4.59.0
|
||||
Sun, 22 Feb 2026 07:31:53 GMT - commit ae846957f109690a866cc3e4c073613c338d3476
|
||||
Rollup.js v4.59.1
|
||||
Sat, 21 Mar 2026 06:45:31 GMT - commit 0cba9e079e1d6e56882558827b37557f36c52966
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "rollup",
|
||||
"version": "4.59.0",
|
||||
"version": "4.59.1",
|
||||
"description": "Next-generation ES module bundler",
|
||||
"main": "dist/rollup.js",
|
||||
"module": "dist/es/rollup.js",
|
||||
|
|
@ -114,31 +114,31 @@
|
|||
"homepage": "https://rollupjs.org/",
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2",
|
||||
"@rollup/rollup-darwin-arm64": "4.59.0",
|
||||
"@rollup/rollup-android-arm64": "4.59.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.59.0",
|
||||
"@rollup/rollup-freebsd-arm64": "4.59.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.59.0",
|
||||
"@rollup/rollup-android-arm-eabi": "4.59.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.59.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.59.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.59.0",
|
||||
"@rollup/rollup-linux-loong64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-loong64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-ppc64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-ppc64-musl": "4.59.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.59.0",
|
||||
"@rollup/rollup-darwin-x64": "4.59.0",
|
||||
"@rollup/rollup-win32-x64-gnu": "4.59.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.59.0",
|
||||
"@rollup/rollup-freebsd-x64": "4.59.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.59.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.59.0",
|
||||
"@rollup/rollup-openbsd-x64": "4.59.0",
|
||||
"@rollup/rollup-openharmony-arm64": "4.59.0"
|
||||
"@rollup/rollup-darwin-arm64": "4.59.1",
|
||||
"@rollup/rollup-android-arm64": "4.59.1",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.59.1",
|
||||
"@rollup/rollup-freebsd-arm64": "4.59.1",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.59.1",
|
||||
"@rollup/rollup-android-arm-eabi": "4.59.1",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.59.1",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.59.1",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.59.1",
|
||||
"@rollup/rollup-linux-loong64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-loong64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-ppc64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-ppc64-musl": "4.59.1",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.59.1",
|
||||
"@rollup/rollup-darwin-x64": "4.59.1",
|
||||
"@rollup/rollup-win32-x64-gnu": "4.59.1",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.59.1",
|
||||
"@rollup/rollup-freebsd-x64": "4.59.1",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.59.1",
|
||||
"@rollup/rollup-linux-x64-musl": "4.59.1",
|
||||
"@rollup/rollup-openbsd-x64": "4.59.1",
|
||||
"@rollup/rollup-openharmony-arm64": "4.59.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.8"
|
||||
|
|
@ -147,12 +147,12 @@
|
|||
"core-js": "We only update manually as every update requires a snapshot update"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@codemirror/commands": "^6.10.2",
|
||||
"@codemirror/lang-javascript": "^6.2.4",
|
||||
"@codemirror/language": "^6.12.1",
|
||||
"@codemirror/commands": "^6.10.3",
|
||||
"@codemirror/lang-javascript": "^6.2.5",
|
||||
"@codemirror/language": "^6.12.2",
|
||||
"@codemirror/search": "^6.6.0",
|
||||
"@codemirror/state": "^6.5.4",
|
||||
"@codemirror/view": "^6.39.14",
|
||||
"@codemirror/state": "^6.6.0",
|
||||
"@codemirror/view": "^6.40.0",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@inquirer/prompts": "^7.10.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.5.5",
|
||||
|
|
@ -160,21 +160,21 @@
|
|||
"@napi-rs/cli": "3.4.1",
|
||||
"@rollup/plugin-alias": "^6.0.0",
|
||||
"@rollup/plugin-buble": "^1.0.3",
|
||||
"@rollup/plugin-commonjs": "^29.0.0",
|
||||
"@rollup/plugin-commonjs": "^29.0.2",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.3",
|
||||
"@rollup/plugin-replace": "^6.0.3",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.3.0",
|
||||
"@rollup/pluginutils": "^5.3.0",
|
||||
"@shikijs/vitepress-twoslash": "^3.22.0",
|
||||
"@shikijs/vitepress-twoslash": "^4.0.2",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "^20.19.33",
|
||||
"@types/node": "^20.19.37",
|
||||
"@types/picomatch": "^4.0.2",
|
||||
"@types/semver": "^7.7.1",
|
||||
"@types/yargs-parser": "^21.0.3",
|
||||
"@vue/language-server": "^3.2.4",
|
||||
"acorn": "^8.15.0",
|
||||
"@vue/language-server": "^3.2.5",
|
||||
"acorn": "^8.16.0",
|
||||
"acorn-import-assertions": "^1.9.0",
|
||||
"acorn-jsx": "^5.3.2",
|
||||
"buble": "^0.20.0",
|
||||
|
|
@ -186,26 +186,26 @@
|
|||
"date-time": "^4.0.0",
|
||||
"es5-shim": "^4.6.7",
|
||||
"es6-shim": "^0.35.8",
|
||||
"eslint": "^10.0.0",
|
||||
"eslint": "^10.0.3",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-unicorn": "^63.0.0",
|
||||
"eslint-plugin-vue": "^10.8.0",
|
||||
"fixturify": "^3.0.0",
|
||||
"flru": "^1.0.2",
|
||||
"fs-extra": "^11.3.3",
|
||||
"fs-extra": "^11.3.4",
|
||||
"github-api": "^3.4.0",
|
||||
"globals": "^17.3.0",
|
||||
"globals": "^17.4.0",
|
||||
"husky": "^9.1.7",
|
||||
"is-reference": "^3.0.3",
|
||||
"lint-staged": "^16.2.7",
|
||||
"lint-staged": "^16.4.0",
|
||||
"locate-character": "^3.0.0",
|
||||
"magic-string": "^0.30.21",
|
||||
"memfs": "^4.56.10",
|
||||
"mocha": "11.3.0",
|
||||
"nodemon": "^3.1.11",
|
||||
"memfs": "^4.56.11",
|
||||
"mocha": "11.7.5",
|
||||
"nodemon": "^3.1.14",
|
||||
"npm-audit-resolver": "^3.0.0-RC.0",
|
||||
"nyc": "^17.1.0",
|
||||
"nyc": "^18.0.0",
|
||||
"patch-package": "^8.0.1",
|
||||
"picocolors": "^1.1.1",
|
||||
"picomatch": "^4.0.3",
|
||||
|
|
@ -215,7 +215,7 @@
|
|||
"pretty-bytes": "^7.1.0",
|
||||
"pretty-ms": "^9.3.0",
|
||||
"requirejs": "^2.3.8",
|
||||
"rollup": "^4.57.1",
|
||||
"rollup": "^4.59.0",
|
||||
"rollup-plugin-license": "^3.7.0",
|
||||
"semver": "^7.7.4",
|
||||
"shx": "^0.4.0",
|
||||
|
|
@ -223,24 +223,24 @@
|
|||
"source-map": "^0.7.6",
|
||||
"source-map-support": "^0.5.21",
|
||||
"systemjs": "^6.15.1",
|
||||
"terser": "^5.46.0",
|
||||
"terser": "^5.46.1",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.56.0",
|
||||
"typescript-eslint": "^8.57.1",
|
||||
"vite": "^7.3.1",
|
||||
"vitepress": "^1.6.4",
|
||||
"vue": "^3.5.28",
|
||||
"vue": "^3.5.30",
|
||||
"vue-eslint-parser": "^10.4.0",
|
||||
"vue-tsc": "^3.2.4",
|
||||
"vue-tsc": "^3.2.5",
|
||||
"wasm-pack": "^0.14.0",
|
||||
"yargs-parser": "^21.1.1"
|
||||
},
|
||||
"overrides": {
|
||||
"axios": "^1.13.5",
|
||||
"axios": "^1.13.6",
|
||||
"esbuild": ">0.24.2",
|
||||
"lodash-es": ">4.17.22",
|
||||
"path-scurry": {
|
||||
"lru-cache": "^11.2.6"
|
||||
"lru-cache": "^11.2.7"
|
||||
},
|
||||
"readable-stream": "npm:@built-in/readable-stream@1",
|
||||
"semver": "^7.7.4",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Vite is released under the MIT license:
|
|||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-present, VoidZero Inc. and Vite contributors
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
@ -25,7 +25,7 @@ SOFTWARE.
|
|||
|
||||
# Licenses of bundled dependencies
|
||||
The published Vite artifact additionally contains code with the following licenses:
|
||||
Apache-2.0, BSD-2-Clause, BlueOak-1.0.0, CC0-1.0, ISC, MIT
|
||||
Apache-2.0, BSD-2-Clause, CC0-1.0, ISC, MIT
|
||||
|
||||
# Bundled dependencies:
|
||||
## @ampproject/remapping
|
||||
|
|
@ -587,6 +587,64 @@ Repository: rollup/plugins
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## acorn
|
||||
License: MIT
|
||||
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
|
||||
Repository: https://github.com/acornjs/acorn.git
|
||||
|
||||
> MIT License
|
||||
>
|
||||
> Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
> THE SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## acorn-walk
|
||||
License: MIT
|
||||
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
|
||||
Repository: https://github.com/acornjs/acorn.git
|
||||
|
||||
> MIT License
|
||||
>
|
||||
> Copyright (C) 2012-2020 by various contributors (see AUTHORS)
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
> THE SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## ansi-regex
|
||||
License: MIT
|
||||
By: Sindre Sorhus
|
||||
|
|
@ -1470,6 +1528,57 @@ Repository: git@github.com:follow-redirects/follow-redirects.git
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## fs.realpath
|
||||
License: ISC
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: git+https://github.com/isaacs/fs.realpath.git
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
>
|
||||
> ----
|
||||
>
|
||||
> This library bundles a version of the `fs.realpath` and `fs.realpathSync`
|
||||
> methods from Node.js v0.10 under the terms of the Node.js MIT license.
|
||||
>
|
||||
> Node's license follows, also included at the header of `old.js` which contains
|
||||
> the licensed code:
|
||||
>
|
||||
> Copyright Joyent, Inc. and other Node contributors.
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a
|
||||
> copy of this software and associated documentation files (the "Software"),
|
||||
> to deal in the Software without restriction, including without limitation
|
||||
> the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
> and/or sell copies of the Software, and to permit persons to whom the
|
||||
> Software is furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
> DEALINGS IN THE SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## generic-names
|
||||
License: MIT
|
||||
By: Alexey Litvinov
|
||||
|
|
@ -1506,7 +1615,7 @@ Repository: git://github.com/isaacs/node-glob.git
|
|||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) 2009-2023 Isaac Z. Schlueter and Contributors
|
||||
> Copyright (c) 2009-2022 Isaac Z. Schlueter and Contributors
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -1589,6 +1698,51 @@ Repository: git+https://github.com/css-modules/icss-utils.git
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## inflight
|
||||
License: ISC
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: https://github.com/npm/inflight.git
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) Isaac Z. Schlueter
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## inherits
|
||||
License: ISC
|
||||
Repository: git://github.com/isaacs/inherits
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) Isaac Z. Schlueter
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
> PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## is-binary-path
|
||||
License: MIT
|
||||
By: Sindre Sorhus
|
||||
|
|
@ -1956,29 +2110,6 @@ Repository: lodash/lodash
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## lru-cache
|
||||
License: ISC
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: git://github.com/isaacs/node-lru-cache.git
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## magic-string
|
||||
License: MIT
|
||||
By: Rich Harris
|
||||
|
|
@ -2074,29 +2205,6 @@ Repository: git://github.com/isaacs/minimatch.git
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## minipass
|
||||
License: ISC
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: https://github.com/isaacs/minipass
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) 2017-2023 npm, Inc., Isaac Z. Schlueter, and Contributors
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## mlly
|
||||
License: MIT
|
||||
Repository: unjs/mlly
|
||||
|
|
@ -2271,6 +2379,29 @@ Repository: jshttp/on-finished
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## once
|
||||
License: ISC
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: git://github.com/isaacs/once
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## open
|
||||
License: MIT
|
||||
By: Sindre Sorhus
|
||||
|
|
@ -2363,69 +2494,6 @@ Repository: sindresorhus/path-key
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## path-scurry
|
||||
License: BlueOak-1.0.0
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: git+https://github.com/isaacs/path-scurry
|
||||
|
||||
> # Blue Oak Model License
|
||||
>
|
||||
> Version 1.0.0
|
||||
>
|
||||
> ## Purpose
|
||||
>
|
||||
> This license gives everyone as much permission to work with
|
||||
> this software as possible, while protecting contributors
|
||||
> from liability.
|
||||
>
|
||||
> ## Acceptance
|
||||
>
|
||||
> In order to receive this license, you must agree to its
|
||||
> rules. The rules of this license are both obligations
|
||||
> under that agreement and conditions to your license.
|
||||
> You must not do anything with this software that triggers
|
||||
> a rule that you cannot or will not follow.
|
||||
>
|
||||
> ## Copyright
|
||||
>
|
||||
> Each contributor licenses you to do everything with this
|
||||
> software that would otherwise infringe that contributor's
|
||||
> copyright in it.
|
||||
>
|
||||
> ## Notices
|
||||
>
|
||||
> You must ensure that everyone who gets a copy of
|
||||
> any part of this software from you, with or without
|
||||
> changes, also gets the text of this license or a link to
|
||||
> <https://blueoakcouncil.org/license/1.0.0>.
|
||||
>
|
||||
> ## Excuse
|
||||
>
|
||||
> If anyone notifies you in writing that you have not
|
||||
> complied with [Notices](#notices), you can keep your
|
||||
> license by taking all practical steps to comply within 30
|
||||
> days after the notice. If you do not do so, your license
|
||||
> ends immediately.
|
||||
>
|
||||
> ## Patent
|
||||
>
|
||||
> Each contributor licenses you to do everything with this
|
||||
> software that would otherwise infringe any patent claims
|
||||
> they can license or become able to license.
|
||||
>
|
||||
> ## Reliability
|
||||
>
|
||||
> No contributor can revoke this license.
|
||||
>
|
||||
> ## No Liability
|
||||
>
|
||||
> ***As far as the law allows, this software comes as is,
|
||||
> without any warranty or condition, and no contributor
|
||||
> will be liable to anyone for any damages related to this
|
||||
> software or this license, under any kind of legal claim.***
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## periscopic
|
||||
License: MIT
|
||||
Repository: Rich-Harris/periscopic
|
||||
|
|
@ -3375,6 +3443,29 @@ Repository: git://github.com/isaacs/node-which.git
|
|||
|
||||
---------------------------------------
|
||||
|
||||
## wrappy
|
||||
License: ISC
|
||||
By: Isaac Z. Schlueter
|
||||
Repository: https://github.com/npm/wrappy
|
||||
|
||||
> The ISC License
|
||||
>
|
||||
> Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
>
|
||||
> Permission to use, copy, modify, and/or distribute this software for any
|
||||
> purpose with or without fee is hereby granted, provided that the above
|
||||
> copyright notice and this permission notice appear in all copies.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## ws
|
||||
License: MIT
|
||||
By: Einar Otto Stangvik
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
Vite (French word for "fast", pronounced `/vit/`) is a new breed of frontend build tool that significantly improves the frontend development experience. It consists of two major parts:
|
||||
|
||||
- A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vite.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vite.dev/guide/features.html#hot-module-replacement).
|
||||
- A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vitejs.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vitejs.dev/guide/features.html#hot-module-replacement).
|
||||
|
||||
- A [build command](https://vite.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production.
|
||||
- A [build command](https://vitejs.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production.
|
||||
|
||||
In addition, Vite is highly extensible via its [Plugin API](https://vite.dev/guide/api-plugin.html) and [JavaScript API](https://vite.dev/guide/api-javascript.html) with full typing support.
|
||||
In addition, Vite is highly extensible via its [Plugin API](https://vitejs.dev/guide/api-plugin.html) and [JavaScript API](https://vitejs.dev/guide/api-javascript.html) with full typing support.
|
||||
|
||||
[Read the Docs to Learn More](https://vite.dev).
|
||||
[Read the Docs to Learn More](https://vitejs.dev).
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ declare module '*.apng' {
|
|||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.bmp' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.png' {
|
||||
const src: string
|
||||
export default src
|
||||
|
|
@ -246,11 +242,3 @@ declare module '*?inline' {
|
|||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare interface VitePreloadErrorEvent extends Event {
|
||||
payload: Error
|
||||
}
|
||||
|
||||
declare interface WindowEventMap {
|
||||
'vite:preloadError': VitePreloadErrorEvent
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,43 +7,48 @@ class HMRContext {
|
|||
if (!hmrClient.dataMap.has(ownerPath)) {
|
||||
hmrClient.dataMap.set(ownerPath, {});
|
||||
}
|
||||
// when a file is hot updated, a new context is created
|
||||
// clear its stale callbacks
|
||||
const mod = hmrClient.hotModulesMap.get(ownerPath);
|
||||
if (mod) {
|
||||
mod.callbacks = [];
|
||||
}
|
||||
// clear stale custom event listeners
|
||||
const staleListeners = hmrClient.ctxToListenersMap.get(ownerPath);
|
||||
if (staleListeners) {
|
||||
for (const [event, staleFns] of staleListeners) {
|
||||
const listeners = hmrClient.customListenersMap.get(event);
|
||||
if (listeners) {
|
||||
hmrClient.customListenersMap.set(
|
||||
event,
|
||||
listeners.filter((l) => !staleFns.includes(l))
|
||||
);
|
||||
hmrClient.customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.newListeners = /* @__PURE__ */ new Map();
|
||||
this.newListeners = new Map();
|
||||
hmrClient.ctxToListenersMap.set(ownerPath, this.newListeners);
|
||||
}
|
||||
get data() {
|
||||
return this.hmrClient.dataMap.get(this.ownerPath);
|
||||
}
|
||||
accept(deps, callback) {
|
||||
if (typeof deps === "function" || !deps) {
|
||||
this.acceptDeps([this.ownerPath], ([mod]) => deps?.(mod));
|
||||
} else if (typeof deps === "string") {
|
||||
this.acceptDeps([deps], ([mod]) => callback?.(mod));
|
||||
} else if (Array.isArray(deps)) {
|
||||
if (typeof deps === 'function' || !deps) {
|
||||
// self-accept: hot.accept(() => {})
|
||||
this.acceptDeps([this.ownerPath], ([mod]) => deps === null || deps === void 0 ? void 0 : deps(mod));
|
||||
}
|
||||
else if (typeof deps === 'string') {
|
||||
// explicit deps
|
||||
this.acceptDeps([deps], ([mod]) => callback === null || callback === void 0 ? void 0 : callback(mod));
|
||||
}
|
||||
else if (Array.isArray(deps)) {
|
||||
this.acceptDeps(deps, callback);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new Error(`invalid hot.accept() usage.`);
|
||||
}
|
||||
}
|
||||
// export names (first arg) are irrelevant on the client side, they're
|
||||
// extracted in the server for propagation
|
||||
acceptExports(_, callback) {
|
||||
this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod));
|
||||
this.acceptDeps([this.ownerPath], ([mod]) => callback === null || callback === void 0 ? void 0 : callback(mod));
|
||||
}
|
||||
dispose(cb) {
|
||||
this.hmrClient.disposeMap.set(this.ownerPath, cb);
|
||||
|
|
@ -53,17 +58,14 @@ class HMRContext {
|
|||
}
|
||||
// Kept for backward compatibility (#11036)
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
decline() {
|
||||
}
|
||||
decline() { }
|
||||
invalidate(message) {
|
||||
this.hmrClient.notifyListeners("vite:invalidate", {
|
||||
this.hmrClient.notifyListeners('vite:invalidate', {
|
||||
path: this.ownerPath,
|
||||
message
|
||||
message,
|
||||
});
|
||||
this.send("vite:invalidate", { path: this.ownerPath, message });
|
||||
this.hmrClient.logger.debug(
|
||||
`[vite] invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`
|
||||
);
|
||||
this.send('vite:invalidate', { path: this.ownerPath, message });
|
||||
this.hmrClient.logger.debug(`[vite] invalidate ${this.ownerPath}${message ? `: ${message}` : ''}`);
|
||||
}
|
||||
on(event, cb) {
|
||||
const addToMap = (map) => {
|
||||
|
|
@ -77,7 +79,7 @@ class HMRContext {
|
|||
off(event, cb) {
|
||||
const removeFromMap = (map) => {
|
||||
const existing = map.get(event);
|
||||
if (existing === void 0) {
|
||||
if (existing === undefined) {
|
||||
return;
|
||||
}
|
||||
const pruned = existing.filter((l) => l !== cb);
|
||||
|
|
@ -91,19 +93,16 @@ class HMRContext {
|
|||
removeFromMap(this.newListeners);
|
||||
}
|
||||
send(event, data) {
|
||||
this.hmrClient.messenger.send(
|
||||
JSON.stringify({ type: "custom", event, data })
|
||||
);
|
||||
this.hmrClient.messenger.send(JSON.stringify({ type: 'custom', event, data }));
|
||||
}
|
||||
acceptDeps(deps, callback = () => {
|
||||
}) {
|
||||
acceptDeps(deps, callback = () => { }) {
|
||||
const mod = this.hmrClient.hotModulesMap.get(this.ownerPath) || {
|
||||
id: this.ownerPath,
|
||||
callbacks: []
|
||||
callbacks: [],
|
||||
};
|
||||
mod.callbacks.push({
|
||||
deps,
|
||||
fn: callback
|
||||
fn: callback,
|
||||
});
|
||||
this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
|
||||
}
|
||||
|
|
@ -125,15 +124,17 @@ class HMRMessenger {
|
|||
}
|
||||
}
|
||||
class HMRClient {
|
||||
constructor(logger, connection, importUpdatedModule) {
|
||||
constructor(logger, connection,
|
||||
// This allows implementing reloading via different methods depending on the environment
|
||||
importUpdatedModule) {
|
||||
this.logger = logger;
|
||||
this.importUpdatedModule = importUpdatedModule;
|
||||
this.hotModulesMap = /* @__PURE__ */ new Map();
|
||||
this.disposeMap = /* @__PURE__ */ new Map();
|
||||
this.pruneMap = /* @__PURE__ */ new Map();
|
||||
this.dataMap = /* @__PURE__ */ new Map();
|
||||
this.customListenersMap = /* @__PURE__ */ new Map();
|
||||
this.ctxToListenersMap = /* @__PURE__ */ new Map();
|
||||
this.hotModulesMap = new Map();
|
||||
this.disposeMap = new Map();
|
||||
this.pruneMap = new Map();
|
||||
this.dataMap = new Map();
|
||||
this.customListenersMap = new Map();
|
||||
this.ctxToListenersMap = new Map();
|
||||
this.updateQueue = [];
|
||||
this.pendingUpdateQueue = false;
|
||||
this.messenger = new HMRMessenger(connection);
|
||||
|
|
@ -156,12 +157,11 @@ class HMRClient {
|
|||
// but they may have left behind side effects that need to be cleaned up
|
||||
// (.e.g style injections)
|
||||
async prunePaths(paths) {
|
||||
await Promise.all(
|
||||
paths.map((path) => {
|
||||
await Promise.all(paths.map((path) => {
|
||||
const disposer = this.disposeMap.get(path);
|
||||
if (disposer) return disposer(this.dataMap.get(path));
|
||||
})
|
||||
);
|
||||
if (disposer)
|
||||
return disposer(this.dataMap.get(path));
|
||||
}));
|
||||
paths.forEach((path) => {
|
||||
const fn = this.pruneMap.get(path);
|
||||
if (fn) {
|
||||
|
|
@ -170,12 +170,12 @@ class HMRClient {
|
|||
});
|
||||
}
|
||||
warnFailedUpdate(err, path) {
|
||||
if (!err.message.includes("fetch")) {
|
||||
if (!err.message.includes('fetch')) {
|
||||
this.logger.error(err);
|
||||
}
|
||||
this.logger.error(
|
||||
`[hmr] Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`
|
||||
);
|
||||
this.logger.error(`[hmr] Failed to reload ${path}. ` +
|
||||
`This could be due to syntax errors or importing non-existent ` +
|
||||
`modules. (see errors above)`);
|
||||
}
|
||||
/**
|
||||
* buffer multiple hot updates triggered by the same src change
|
||||
|
|
@ -197,27 +197,29 @@ class HMRClient {
|
|||
const { path, acceptedPath } = update;
|
||||
const mod = this.hotModulesMap.get(path);
|
||||
if (!mod) {
|
||||
// In a code-splitting project,
|
||||
// it is common that the hot-updating module is not loaded yet.
|
||||
// https://github.com/vitejs/vite/issues/721
|
||||
return;
|
||||
}
|
||||
let fetchedModule;
|
||||
const isSelfUpdate = path === acceptedPath;
|
||||
const qualifiedCallbacks = mod.callbacks.filter(
|
||||
({ deps }) => deps.includes(acceptedPath)
|
||||
);
|
||||
// determine the qualified callbacks before we re-import the modules
|
||||
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
|
||||
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
||||
const disposer = this.disposeMap.get(acceptedPath);
|
||||
if (disposer) await disposer(this.dataMap.get(acceptedPath));
|
||||
if (disposer)
|
||||
await disposer(this.dataMap.get(acceptedPath));
|
||||
try {
|
||||
fetchedModule = await this.importUpdatedModule(update);
|
||||
} catch (e) {
|
||||
}
|
||||
catch (e) {
|
||||
this.warnFailedUpdate(e, acceptedPath);
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
for (const { deps, fn } of qualifiedCallbacks) {
|
||||
fn(
|
||||
deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0)
|
||||
);
|
||||
fn(deps.map((dep) => (dep === acceptedPath ? fetchedModule : undefined)));
|
||||
}
|
||||
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
||||
this.logger.debug(`[vite] hot updated: ${loggedPath}`);
|
||||
|
|
@ -226,7 +228,8 @@ class HMRClient {
|
|||
}
|
||||
|
||||
const hmrConfigName = __HMR_CONFIG_NAME__;
|
||||
const base$1 = __BASE__ || "/";
|
||||
const base$1 = __BASE__ || '/';
|
||||
// Create an element with provided attributes and optional children
|
||||
function h(e, attrs = {}, ...children) {
|
||||
const elem = document.createElement(e);
|
||||
for (const [k, v] of Object.entries(attrs)) {
|
||||
|
|
@ -235,9 +238,8 @@ function h(e, attrs = {}, ...children) {
|
|||
elem.append(...children);
|
||||
return elem;
|
||||
}
|
||||
const templateStyle = (
|
||||
/*css*/
|
||||
`
|
||||
// set :host styles to make playwright detect the element as visible
|
||||
const templateStyle = /*css*/ `
|
||||
:host {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
|
@ -377,103 +379,73 @@ kbd {
|
|||
border-color: rgb(54, 57, 64);
|
||||
border-image: initial;
|
||||
}
|
||||
`
|
||||
);
|
||||
const createTemplate = () => h(
|
||||
"div",
|
||||
{ class: "backdrop", part: "backdrop" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "window", part: "window" },
|
||||
h(
|
||||
"pre",
|
||||
{ class: "message", part: "message" },
|
||||
h("span", { class: "plugin", part: "plugin" }),
|
||||
h("span", { class: "message-body", part: "message-body" })
|
||||
),
|
||||
h("pre", { class: "file", part: "file" }),
|
||||
h("pre", { class: "frame", part: "frame" }),
|
||||
h("pre", { class: "stack", part: "stack" }),
|
||||
h(
|
||||
"div",
|
||||
{ class: "tip", part: "tip" },
|
||||
"Click outside, press ",
|
||||
h("kbd", {}, "Esc"),
|
||||
" key, or fix the code to dismiss.",
|
||||
h("br"),
|
||||
"You can also disable this overlay by setting ",
|
||||
h("code", { part: "config-option-name" }, "server.hmr.overlay"),
|
||||
" to ",
|
||||
h("code", { part: "config-option-value" }, "false"),
|
||||
" in ",
|
||||
h("code", { part: "config-file-name" }, hmrConfigName),
|
||||
"."
|
||||
)
|
||||
),
|
||||
h("style", {}, templateStyle)
|
||||
);
|
||||
`;
|
||||
// Error Template
|
||||
const createTemplate = () => h('div', { class: 'backdrop', part: 'backdrop' }, h('div', { class: 'window', part: 'window' }, h('pre', { class: 'message', part: 'message' }, h('span', { class: 'plugin', part: 'plugin' }), h('span', { class: 'message-body', part: 'message-body' })), h('pre', { class: 'file', part: 'file' }), h('pre', { class: 'frame', part: 'frame' }), h('pre', { class: 'stack', part: 'stack' }), h('div', { class: 'tip', part: 'tip' }, 'Click outside, press ', h('kbd', {}, 'Esc'), ' key, or fix the code to dismiss.', h('br'), 'You can also disable this overlay by setting ', h('code', { part: 'config-option-name' }, 'server.hmr.overlay'), ' to ', h('code', { part: 'config-option-value' }, 'false'), ' in ', h('code', { part: 'config-file-name' }, hmrConfigName), '.')), h('style', {}, templateStyle));
|
||||
const fileRE = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
|
||||
const codeframeRE = /^(?:>?\s*\d+\s+\|.*|\s+\|\s*\^.*)\r?\n/gm;
|
||||
// Allow `ErrorOverlay` to extend `HTMLElement` even in environments where
|
||||
// `HTMLElement` was not originally defined.
|
||||
const { HTMLElement = class {
|
||||
} } = globalThis;
|
||||
class ErrorOverlay extends HTMLElement {
|
||||
constructor(err, links = true) {
|
||||
var _a;
|
||||
super();
|
||||
this.root = this.attachShadow({ mode: "open" });
|
||||
this.root = this.attachShadow({ mode: 'open' });
|
||||
this.root.appendChild(createTemplate());
|
||||
codeframeRE.lastIndex = 0;
|
||||
const hasFrame = err.frame && codeframeRE.test(err.frame);
|
||||
const message = hasFrame ? err.message.replace(codeframeRE, "") : err.message;
|
||||
const message = hasFrame
|
||||
? err.message.replace(codeframeRE, '')
|
||||
: err.message;
|
||||
if (err.plugin) {
|
||||
this.text(".plugin", `[plugin:${err.plugin}] `);
|
||||
this.text('.plugin', `[plugin:${err.plugin}] `);
|
||||
}
|
||||
this.text(".message-body", message.trim());
|
||||
const [file] = (err.loc?.file || err.id || "unknown file").split(`?`);
|
||||
this.text('.message-body', message.trim());
|
||||
const [file] = (((_a = err.loc) === null || _a === void 0 ? void 0 : _a.file) || err.id || 'unknown file').split(`?`);
|
||||
if (err.loc) {
|
||||
this.text(".file", `${file}:${err.loc.line}:${err.loc.column}`, links);
|
||||
} else if (err.id) {
|
||||
this.text(".file", file);
|
||||
this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, links);
|
||||
}
|
||||
else if (err.id) {
|
||||
this.text('.file', file);
|
||||
}
|
||||
if (hasFrame) {
|
||||
this.text(".frame", err.frame.trim());
|
||||
this.text('.frame', err.frame.trim());
|
||||
}
|
||||
this.text(".stack", err.stack, links);
|
||||
this.root.querySelector(".window").addEventListener("click", (e) => {
|
||||
this.text('.stack', err.stack, links);
|
||||
this.root.querySelector('.window').addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
});
|
||||
this.addEventListener("click", () => {
|
||||
this.addEventListener('click', () => {
|
||||
this.close();
|
||||
});
|
||||
this.closeOnEsc = (e) => {
|
||||
if (e.key === "Escape" || e.code === "Escape") {
|
||||
if (e.key === 'Escape' || e.code === 'Escape') {
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
document.addEventListener("keydown", this.closeOnEsc);
|
||||
document.addEventListener('keydown', this.closeOnEsc);
|
||||
}
|
||||
text(selector, text, linkFiles = false) {
|
||||
const el = this.root.querySelector(selector);
|
||||
if (!linkFiles) {
|
||||
el.textContent = text;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
let curIndex = 0;
|
||||
let match;
|
||||
fileRE.lastIndex = 0;
|
||||
while (match = fileRE.exec(text)) {
|
||||
while ((match = fileRE.exec(text))) {
|
||||
const { 0: file, index } = match;
|
||||
if (index != null) {
|
||||
const frag = text.slice(curIndex, index);
|
||||
el.appendChild(document.createTextNode(frag));
|
||||
const link = document.createElement("a");
|
||||
const link = document.createElement('a');
|
||||
link.textContent = file;
|
||||
link.className = "file-link";
|
||||
link.className = 'file-link';
|
||||
link.onclick = () => {
|
||||
fetch(
|
||||
new URL(
|
||||
`${base$1}__open-in-editor?file=${encodeURIComponent(file)}`,
|
||||
import.meta.url
|
||||
)
|
||||
);
|
||||
fetch(new URL(`${base$1}__open-in-editor?file=${encodeURIComponent(file)}`, import.meta.url));
|
||||
};
|
||||
el.appendChild(link);
|
||||
curIndex += frag.length + file.length;
|
||||
|
|
@ -482,95 +454,90 @@ class ErrorOverlay extends HTMLElement {
|
|||
}
|
||||
}
|
||||
close() {
|
||||
this.parentNode?.removeChild(this);
|
||||
document.removeEventListener("keydown", this.closeOnEsc);
|
||||
var _a;
|
||||
(_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this);
|
||||
document.removeEventListener('keydown', this.closeOnEsc);
|
||||
}
|
||||
}
|
||||
const overlayId = "vite-error-overlay";
|
||||
const { customElements } = globalThis;
|
||||
const overlayId = 'vite-error-overlay';
|
||||
const { customElements } = globalThis; // Ensure `customElements` is defined before the next line.
|
||||
if (customElements && !customElements.get(overlayId)) {
|
||||
customElements.define(overlayId, ErrorOverlay);
|
||||
}
|
||||
|
||||
console.debug("[vite] connecting...");
|
||||
var _a;
|
||||
console.debug('[vite] connecting...');
|
||||
const importMetaUrl = new URL(import.meta.url);
|
||||
// use server configuration, then fallback to inference
|
||||
const serverHost = __SERVER_HOST__;
|
||||
const socketProtocol = __HMR_PROTOCOL__ || (importMetaUrl.protocol === "https:" ? "wss" : "ws");
|
||||
const socketProtocol = __HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws');
|
||||
const hmrPort = __HMR_PORT__;
|
||||
const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${__HMR_BASE__}`;
|
||||
const directSocketHost = __HMR_DIRECT_TARGET__;
|
||||
const base = __BASE__ || "/";
|
||||
const wsToken = __WS_TOKEN__;
|
||||
const base = __BASE__ || '/';
|
||||
let socket;
|
||||
try {
|
||||
let fallback;
|
||||
// only use fallback when port is inferred to prevent confusion
|
||||
if (!hmrPort) {
|
||||
fallback = () => {
|
||||
// fallback to connecting directly to the hmr server
|
||||
// for servers which does not support proxying websocket
|
||||
socket = setupWebSocket(socketProtocol, directSocketHost, () => {
|
||||
const currentScriptHostURL = new URL(import.meta.url);
|
||||
const currentScriptHost = currentScriptHostURL.host + currentScriptHostURL.pathname.replace(/@vite\/client$/, "");
|
||||
console.error(
|
||||
`[vite] failed to connect to websocket.
|
||||
your current setup:
|
||||
(browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)
|
||||
(browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)
|
||||
Check out your Vite / network configuration and https://vite.dev/config/server-options.html#server-hmr .`
|
||||
);
|
||||
const currentScriptHost = currentScriptHostURL.host +
|
||||
currentScriptHostURL.pathname.replace(/@vite\/client$/, '');
|
||||
console.error('[vite] failed to connect to websocket.\n' +
|
||||
'your current setup:\n' +
|
||||
` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\n` +
|
||||
` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\n` +
|
||||
'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .');
|
||||
});
|
||||
socket.addEventListener(
|
||||
"open",
|
||||
() => {
|
||||
console.info(
|
||||
"[vite] Direct websocket connection fallback. Check out https://vite.dev/config/server-options.html#server-hmr to remove the previous connection error."
|
||||
);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
socket.addEventListener('open', () => {
|
||||
console.info('[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.');
|
||||
}, { once: true });
|
||||
};
|
||||
}
|
||||
socket = setupWebSocket(socketProtocol, socketHost, fallback);
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`[vite] failed to connect to websocket (${error}). `);
|
||||
}
|
||||
function setupWebSocket(protocol, hostAndPath, onCloseWithoutOpen) {
|
||||
const socket2 = new WebSocket(
|
||||
`${protocol}://${hostAndPath}?token=${wsToken}`,
|
||||
"vite-hmr"
|
||||
);
|
||||
const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr');
|
||||
let isOpened = false;
|
||||
socket2.addEventListener(
|
||||
"open",
|
||||
() => {
|
||||
socket.addEventListener('open', () => {
|
||||
isOpened = true;
|
||||
notifyListeners("vite:ws:connect", { webSocket: socket2 });
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
socket2.addEventListener("message", async ({ data }) => {
|
||||
notifyListeners('vite:ws:connect', { webSocket: socket });
|
||||
}, { once: true });
|
||||
// Listen for messages
|
||||
socket.addEventListener('message', async ({ data }) => {
|
||||
handleMessage(JSON.parse(data));
|
||||
});
|
||||
socket2.addEventListener("close", async ({ wasClean }) => {
|
||||
if (wasClean) return;
|
||||
// ping server
|
||||
socket.addEventListener('close', async ({ wasClean }) => {
|
||||
if (wasClean)
|
||||
return;
|
||||
if (!isOpened && onCloseWithoutOpen) {
|
||||
onCloseWithoutOpen();
|
||||
return;
|
||||
}
|
||||
notifyListeners("vite:ws:disconnect", { webSocket: socket2 });
|
||||
notifyListeners('vite:ws:disconnect', { webSocket: socket });
|
||||
if (hasDocument) {
|
||||
console.log(`[vite] server connection lost. Polling for restart...`);
|
||||
console.log(`[vite] server connection lost. polling for restart...`);
|
||||
await waitForSuccessfulPing(protocol, hostAndPath);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
return socket2;
|
||||
return socket;
|
||||
}
|
||||
function cleanUrl(pathname) {
|
||||
const url = new URL(pathname, "http://vite.dev");
|
||||
url.searchParams.delete("direct");
|
||||
const url = new URL(pathname, 'http://vitejs.dev');
|
||||
url.searchParams.delete('direct');
|
||||
return url.pathname + url.search;
|
||||
}
|
||||
let isFirstUpdate = true;
|
||||
const outdatedLinkTags = /* @__PURE__ */ new WeakSet();
|
||||
const outdatedLinkTags = new WeakSet();
|
||||
const debounceReload = (time) => {
|
||||
let timer;
|
||||
return () => {
|
||||
|
|
@ -584,74 +551,77 @@ const debounceReload = (time) => {
|
|||
};
|
||||
};
|
||||
const pageReload = debounceReload(50);
|
||||
const hmrClient = new HMRClient(
|
||||
console,
|
||||
{
|
||||
const hmrClient = new HMRClient(console, {
|
||||
isReady: () => socket && socket.readyState === 1,
|
||||
send: (message) => socket.send(message)
|
||||
},
|
||||
async function importUpdatedModule({
|
||||
acceptedPath,
|
||||
timestamp,
|
||||
explicitImportRequired,
|
||||
isWithinCircularImport
|
||||
}) {
|
||||
send: (message) => socket.send(message),
|
||||
}, async function importUpdatedModule({ acceptedPath, timestamp, explicitImportRequired, isWithinCircularImport, }) {
|
||||
const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`);
|
||||
const importPromise = import(
|
||||
/* @vite-ignore */
|
||||
base + acceptedPathWithoutQuery.slice(1) + `?${explicitImportRequired ? "import&" : ""}t=${timestamp}${query ? `&${query}` : ""}`
|
||||
);
|
||||
base +
|
||||
acceptedPathWithoutQuery.slice(1) +
|
||||
`?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${query ? `&${query}` : ''}`);
|
||||
if (isWithinCircularImport) {
|
||||
importPromise.catch(() => {
|
||||
console.info(
|
||||
`[hmr] ${acceptedPath} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order. To debug and break the circular import, you can run \`vite --debug hmr\` to log the circular dependency path if a file change triggered it.`
|
||||
);
|
||||
console.info(`[hmr] ${acceptedPath} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order. ` +
|
||||
`To debug and break the circular import, you can run \`vite --debug hmr\` to log the circular dependency path if a file change triggered it.`);
|
||||
pageReload();
|
||||
});
|
||||
}
|
||||
return await importPromise;
|
||||
}
|
||||
);
|
||||
});
|
||||
async function handleMessage(payload) {
|
||||
switch (payload.type) {
|
||||
case "connected":
|
||||
case 'connected':
|
||||
console.debug(`[vite] connected.`);
|
||||
hmrClient.messenger.flush();
|
||||
// proxy(nginx, docker) hmr ws maybe caused timeout,
|
||||
// so send ping package let ws keep alive.
|
||||
setInterval(() => {
|
||||
if (socket.readyState === socket.OPEN) {
|
||||
socket.send('{"type":"ping"}');
|
||||
}
|
||||
}, __HMR_TIMEOUT__);
|
||||
break;
|
||||
case "update":
|
||||
notifyListeners("vite:beforeUpdate", payload);
|
||||
case 'update':
|
||||
notifyListeners('vite:beforeUpdate', payload);
|
||||
if (hasDocument) {
|
||||
// if this is the first update and there's already an error overlay, it
|
||||
// means the page opened with existing server compile error and the whole
|
||||
// module script failed to load (since one of the nested imports is 500).
|
||||
// in this case a normal update won't work and a full reload is needed.
|
||||
if (isFirstUpdate && hasErrorOverlay()) {
|
||||
location.reload();
|
||||
window.location.reload();
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (enableOverlay) {
|
||||
clearErrorOverlay();
|
||||
}
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
payload.updates.map(async (update) => {
|
||||
if (update.type === "js-update") {
|
||||
await Promise.all(payload.updates.map(async (update) => {
|
||||
if (update.type === 'js-update') {
|
||||
return hmrClient.queueUpdate(update);
|
||||
}
|
||||
// css-update
|
||||
// this is only sent when a css file referenced with <link> is updated
|
||||
const { path, timestamp } = update;
|
||||
const searchUrl = cleanUrl(path);
|
||||
const el = Array.from(
|
||||
document.querySelectorAll("link")
|
||||
).find(
|
||||
(e) => !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl)
|
||||
);
|
||||
// can't use querySelector with `[href*=]` here since the link may be
|
||||
// using relative paths so we need to use link.href to grab the full
|
||||
// URL for the include check.
|
||||
const el = Array.from(document.querySelectorAll('link')).find((e) => !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl));
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const newPath = `${base}${searchUrl.slice(1)}${searchUrl.includes("?") ? "&" : "?"}t=${timestamp}`;
|
||||
const newPath = `${base}${searchUrl.slice(1)}${searchUrl.includes('?') ? '&' : '?'}t=${timestamp}`;
|
||||
// rather than swapping the href on the existing tag, we will
|
||||
// create a new link tag. Once the new stylesheet has loaded we
|
||||
// will remove the existing link tag. This removes a Flash Of
|
||||
// Unstyled Content that can occur when swapping out the tag href
|
||||
// directly, as the new stylesheet has not yet been loaded.
|
||||
return new Promise((resolve) => {
|
||||
const newLinkTag = el.cloneNode();
|
||||
newLinkTag.href = new URL(newPath, el.href).href;
|
||||
|
|
@ -660,50 +630,51 @@ async function handleMessage(payload) {
|
|||
console.debug(`[vite] css hot updated: ${searchUrl}`);
|
||||
resolve();
|
||||
};
|
||||
newLinkTag.addEventListener("load", removeOldEl);
|
||||
newLinkTag.addEventListener("error", removeOldEl);
|
||||
newLinkTag.addEventListener('load', removeOldEl);
|
||||
newLinkTag.addEventListener('error', removeOldEl);
|
||||
outdatedLinkTags.add(el);
|
||||
el.after(newLinkTag);
|
||||
});
|
||||
})
|
||||
);
|
||||
notifyListeners("vite:afterUpdate", payload);
|
||||
}));
|
||||
notifyListeners('vite:afterUpdate', payload);
|
||||
break;
|
||||
case "custom": {
|
||||
case 'custom': {
|
||||
notifyListeners(payload.event, payload.data);
|
||||
break;
|
||||
}
|
||||
case "full-reload":
|
||||
notifyListeners("vite:beforeFullReload", payload);
|
||||
case 'full-reload':
|
||||
notifyListeners('vite:beforeFullReload', payload);
|
||||
if (hasDocument) {
|
||||
if (payload.path && payload.path.endsWith(".html")) {
|
||||
if (payload.path && payload.path.endsWith('.html')) {
|
||||
// if html file is edited, only reload the page if the browser is
|
||||
// currently on that page.
|
||||
const pagePath = decodeURI(location.pathname);
|
||||
const payloadPath = base + payload.path.slice(1);
|
||||
if (pagePath === payloadPath || payload.path === "/index.html" || pagePath.endsWith("/") && pagePath + "index.html" === payloadPath) {
|
||||
if (pagePath === payloadPath ||
|
||||
payload.path === '/index.html' ||
|
||||
(pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)) {
|
||||
pageReload();
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pageReload();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "prune":
|
||||
notifyListeners("vite:beforePrune", payload);
|
||||
case 'prune':
|
||||
notifyListeners('vite:beforePrune', payload);
|
||||
await hmrClient.prunePaths(payload.paths);
|
||||
break;
|
||||
case "error": {
|
||||
notifyListeners("vite:error", payload);
|
||||
case 'error': {
|
||||
notifyListeners('vite:error', payload);
|
||||
if (hasDocument) {
|
||||
const err = payload.err;
|
||||
if (enableOverlay) {
|
||||
createErrorOverlay(err);
|
||||
} else {
|
||||
console.error(
|
||||
`[vite] Internal Server Error
|
||||
${err.message}
|
||||
${err.stack}`
|
||||
);
|
||||
}
|
||||
else {
|
||||
console.error(`[vite] Internal Server Error\n${err.message}\n${err.stack}`);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -718,7 +689,7 @@ function notifyListeners(event, data) {
|
|||
hmrClient.notifyListeners(event, data);
|
||||
}
|
||||
const enableOverlay = __HMR_ENABLE_OVERLAY__;
|
||||
const hasDocument = "document" in globalThis;
|
||||
const hasDocument = 'document' in globalThis;
|
||||
function createErrorOverlay(err) {
|
||||
clearErrorOverlay();
|
||||
document.body.appendChild(new ErrorOverlay(err));
|
||||
|
|
@ -729,34 +700,39 @@ function clearErrorOverlay() {
|
|||
function hasErrorOverlay() {
|
||||
return document.querySelectorAll(overlayId).length;
|
||||
}
|
||||
async function waitForSuccessfulPing(socketProtocol2, hostAndPath, ms = 1e3) {
|
||||
const pingHostProtocol = socketProtocol2 === "wss" ? "https" : "http";
|
||||
async function waitForSuccessfulPing(socketProtocol, hostAndPath, ms = 1000) {
|
||||
const pingHostProtocol = socketProtocol === 'wss' ? 'https' : 'http';
|
||||
const ping = async () => {
|
||||
// A fetch on a websocket URL will return a successful promise with status 400,
|
||||
// but will reject a networking error.
|
||||
// When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors
|
||||
try {
|
||||
await fetch(`${pingHostProtocol}://${hostAndPath}`, {
|
||||
mode: "no-cors",
|
||||
mode: 'no-cors',
|
||||
headers: {
|
||||
// Custom headers won't be included in a request with no-cors so (ab)use one of the
|
||||
// safelisted headers to identify the ping request
|
||||
Accept: "text/x-vite-ping"
|
||||
}
|
||||
Accept: 'text/x-vite-ping',
|
||||
},
|
||||
});
|
||||
return true;
|
||||
} catch {
|
||||
}
|
||||
catch { }
|
||||
return false;
|
||||
};
|
||||
if (await ping()) {
|
||||
return;
|
||||
}
|
||||
await wait(ms);
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
if (document.visibilityState === "visible") {
|
||||
if (document.visibilityState === 'visible') {
|
||||
if (await ping()) {
|
||||
break;
|
||||
}
|
||||
await wait(ms);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
await waitForWindowShow();
|
||||
}
|
||||
}
|
||||
|
|
@ -767,42 +743,54 @@ function wait(ms) {
|
|||
function waitForWindowShow() {
|
||||
return new Promise((resolve) => {
|
||||
const onChange = async () => {
|
||||
if (document.visibilityState === "visible") {
|
||||
if (document.visibilityState === 'visible') {
|
||||
resolve();
|
||||
document.removeEventListener("visibilitychange", onChange);
|
||||
document.removeEventListener('visibilitychange', onChange);
|
||||
}
|
||||
};
|
||||
document.addEventListener("visibilitychange", onChange);
|
||||
document.addEventListener('visibilitychange', onChange);
|
||||
});
|
||||
}
|
||||
const sheetsMap = /* @__PURE__ */ new Map();
|
||||
if ("document" in globalThis) {
|
||||
document.querySelectorAll("style[data-vite-dev-id]").forEach((el) => {
|
||||
sheetsMap.set(el.getAttribute("data-vite-dev-id"), el);
|
||||
const sheetsMap = new Map();
|
||||
// collect existing style elements that may have been inserted during SSR
|
||||
// to avoid FOUC or duplicate styles
|
||||
if ('document' in globalThis) {
|
||||
document
|
||||
.querySelectorAll('style[data-vite-dev-id]')
|
||||
.forEach((el) => {
|
||||
sheetsMap.set(el.getAttribute('data-vite-dev-id'), el);
|
||||
});
|
||||
}
|
||||
const cspNonce = "document" in globalThis ? document.querySelector("meta[property=csp-nonce]")?.nonce : void 0;
|
||||
const cspNonce = 'document' in globalThis
|
||||
? (_a = document.querySelector('meta[property=csp-nonce]')) === null || _a === void 0 ? void 0 : _a.nonce
|
||||
: undefined;
|
||||
// all css imports should be inserted at the same position
|
||||
// because after build it will be a single css file
|
||||
let lastInsertedStyle;
|
||||
function updateStyle(id, content) {
|
||||
let style = sheetsMap.get(id);
|
||||
if (!style) {
|
||||
style = document.createElement("style");
|
||||
style.setAttribute("type", "text/css");
|
||||
style.setAttribute("data-vite-dev-id", id);
|
||||
style = document.createElement('style');
|
||||
style.setAttribute('type', 'text/css');
|
||||
style.setAttribute('data-vite-dev-id', id);
|
||||
style.textContent = content;
|
||||
if (cspNonce) {
|
||||
style.setAttribute("nonce", cspNonce);
|
||||
style.setAttribute('nonce', cspNonce);
|
||||
}
|
||||
if (!lastInsertedStyle) {
|
||||
document.head.appendChild(style);
|
||||
// reset lastInsertedStyle after async
|
||||
// because dynamically imported css will be splitted into a different file
|
||||
setTimeout(() => {
|
||||
lastInsertedStyle = void 0;
|
||||
lastInsertedStyle = undefined;
|
||||
}, 0);
|
||||
} else {
|
||||
lastInsertedStyle.insertAdjacentElement("afterend", style);
|
||||
}
|
||||
else {
|
||||
lastInsertedStyle.insertAdjacentElement('afterend', style);
|
||||
}
|
||||
lastInsertedStyle = style;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
style.textContent = content;
|
||||
}
|
||||
sheetsMap.set(id, style);
|
||||
|
|
@ -817,13 +805,19 @@ function removeStyle(id) {
|
|||
function createHotContext(ownerPath) {
|
||||
return new HMRContext(hmrClient, ownerPath);
|
||||
}
|
||||
/**
|
||||
* urls here are dynamic import() urls that couldn't be statically analyzed
|
||||
*/
|
||||
function injectQuery(url, queryToInject) {
|
||||
if (url[0] !== "." && url[0] !== "/") {
|
||||
// skip urls that won't be handled by vite
|
||||
if (url[0] !== '.' && url[0] !== '/') {
|
||||
return url;
|
||||
}
|
||||
const pathname = url.replace(/[?#].*$/, "");
|
||||
const { search, hash } = new URL(url, "http://vite.dev");
|
||||
return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ""}${hash || ""}`;
|
||||
// can't use pathname from URL since it may be relative like ../
|
||||
const pathname = url.replace(/[?#].*$/, '');
|
||||
const { search, hash } = new URL(url, 'http://vitejs.dev');
|
||||
return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${hash || ''}`;
|
||||
}
|
||||
|
||||
export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
|
||||
//# sourceMappingURL=client.mjs.map
|
||||
|
|
|
|||
|
|
@ -1,24 +1,30 @@
|
|||
const context = (() => {
|
||||
if (typeof globalThis !== "undefined") {
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
return globalThis;
|
||||
} else if (typeof self !== "undefined") {
|
||||
}
|
||||
else if (typeof self !== 'undefined') {
|
||||
return self;
|
||||
} else if (typeof window !== "undefined") {
|
||||
}
|
||||
else if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
} else {
|
||||
return Function("return this")();
|
||||
}
|
||||
else {
|
||||
return Function('return this')();
|
||||
}
|
||||
})();
|
||||
// assign defines
|
||||
const defines = __DEFINES__;
|
||||
Object.keys(defines).forEach((key) => {
|
||||
const segments = key.split(".");
|
||||
const segments = key.split('.');
|
||||
let target = context;
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
const segment = segments[i];
|
||||
if (i === segments.length - 1) {
|
||||
target[segment] = defines[key];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
target = target[segment] || (target[segment] = {});
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=env.mjs.map
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,993 +0,0 @@
|
|||
import { C as getDefaultExportFromCjs } from './dep-BK3b2jBa.js';
|
||||
import require$$0 from 'path';
|
||||
import require$$0__default from 'fs';
|
||||
import { l as lib } from './dep-IQS-Za7F.js';
|
||||
|
||||
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
||||
import { dirname as __cjs_dirname } from 'node:path';
|
||||
import { createRequire as __cjs_createRequire } from 'node:module';
|
||||
|
||||
const __filename = __cjs_fileURLToPath(import.meta.url);
|
||||
const __dirname = __cjs_dirname(__filename);
|
||||
const require = __cjs_createRequire(import.meta.url);
|
||||
const __require = require;
|
||||
function _mergeNamespaces(n, m) {
|
||||
for (var i = 0; i < m.length; i++) {
|
||||
var e = m[i];
|
||||
if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
|
||||
if (k !== 'default' && !(k in n)) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
} }
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
var formatImportPrelude$2 = function formatImportPrelude(layer, media, supports) {
|
||||
const parts = [];
|
||||
|
||||
if (typeof layer !== "undefined") {
|
||||
let layerParams = "layer";
|
||||
if (layer) {
|
||||
layerParams = `layer(${layer})`;
|
||||
}
|
||||
|
||||
parts.push(layerParams);
|
||||
}
|
||||
|
||||
if (typeof supports !== "undefined") {
|
||||
parts.push(`supports(${supports})`);
|
||||
}
|
||||
|
||||
if (typeof media !== "undefined") {
|
||||
parts.push(media);
|
||||
}
|
||||
|
||||
return parts.join(" ")
|
||||
};
|
||||
|
||||
const formatImportPrelude$1 = formatImportPrelude$2;
|
||||
|
||||
// Base64 encode an import with conditions
|
||||
// The order of conditions is important and is interleaved with cascade layer declarations
|
||||
// Each group of conditions and cascade layers needs to be interpreted in order
|
||||
// To achieve this we create a list of base64 encoded imports, where each import contains a stylesheet with another import.
|
||||
// Each import can define a single group of conditions and a single cascade layer.
|
||||
var base64EncodedImport = function base64EncodedConditionalImport(prelude, conditions) {
|
||||
conditions.reverse();
|
||||
const first = conditions.pop();
|
||||
let params = `${prelude} ${formatImportPrelude$1(
|
||||
first.layer,
|
||||
first.media,
|
||||
first.supports,
|
||||
)}`;
|
||||
|
||||
for (const condition of conditions) {
|
||||
params = `'data:text/css;base64,${Buffer.from(`@import ${params}`).toString(
|
||||
"base64",
|
||||
)}' ${formatImportPrelude$1(
|
||||
condition.layer,
|
||||
condition.media,
|
||||
condition.supports,
|
||||
)}`;
|
||||
}
|
||||
|
||||
return params
|
||||
};
|
||||
|
||||
const base64EncodedConditionalImport = base64EncodedImport;
|
||||
|
||||
var applyConditions$1 = function applyConditions(bundle, atRule) {
|
||||
bundle.forEach(stmt => {
|
||||
if (
|
||||
stmt.type === "charset" ||
|
||||
stmt.type === "warning" ||
|
||||
!stmt.conditions?.length
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
if (stmt.type === "import") {
|
||||
stmt.node.params = base64EncodedConditionalImport(
|
||||
stmt.fullUri,
|
||||
stmt.conditions,
|
||||
);
|
||||
return
|
||||
}
|
||||
|
||||
const { nodes } = stmt;
|
||||
const { parent } = nodes[0];
|
||||
|
||||
const atRules = [];
|
||||
|
||||
// Convert conditions to at-rules
|
||||
for (const condition of stmt.conditions) {
|
||||
if (typeof condition.media !== "undefined") {
|
||||
const mediaNode = atRule({
|
||||
name: "media",
|
||||
params: condition.media,
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
atRules.push(mediaNode);
|
||||
}
|
||||
|
||||
if (typeof condition.supports !== "undefined") {
|
||||
const supportsNode = atRule({
|
||||
name: "supports",
|
||||
params: `(${condition.supports})`,
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
atRules.push(supportsNode);
|
||||
}
|
||||
|
||||
if (typeof condition.layer !== "undefined") {
|
||||
const layerNode = atRule({
|
||||
name: "layer",
|
||||
params: condition.layer,
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
atRules.push(layerNode);
|
||||
}
|
||||
}
|
||||
|
||||
// Add nodes to AST
|
||||
const outerAtRule = atRules.shift();
|
||||
const innerAtRule = atRules.reduce((previous, next) => {
|
||||
previous.append(next);
|
||||
return next
|
||||
}, outerAtRule);
|
||||
|
||||
parent.insertBefore(nodes[0], outerAtRule);
|
||||
|
||||
// remove nodes
|
||||
nodes.forEach(node => {
|
||||
node.parent = undefined;
|
||||
});
|
||||
|
||||
// better output
|
||||
nodes[0].raws.before = nodes[0].raws.before || "\n";
|
||||
|
||||
// wrap new rules with media query and/or layer at rule
|
||||
innerAtRule.append(nodes);
|
||||
|
||||
stmt.type = "nodes";
|
||||
stmt.nodes = [outerAtRule];
|
||||
delete stmt.node;
|
||||
});
|
||||
};
|
||||
|
||||
var applyRaws$1 = function applyRaws(bundle) {
|
||||
bundle.forEach((stmt, index) => {
|
||||
if (index === 0) return
|
||||
|
||||
if (stmt.parent) {
|
||||
const { before } = stmt.parent.node.raws;
|
||||
if (stmt.type === "nodes") stmt.nodes[0].raws.before = before;
|
||||
else stmt.node.raws.before = before;
|
||||
} else if (stmt.type === "nodes") {
|
||||
stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n";
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var applyStyles$1 = function applyStyles(bundle, styles) {
|
||||
styles.nodes = [];
|
||||
|
||||
// Strip additional statements.
|
||||
bundle.forEach(stmt => {
|
||||
if (["charset", "import"].includes(stmt.type)) {
|
||||
stmt.node.parent = undefined;
|
||||
styles.append(stmt.node);
|
||||
} else if (stmt.type === "nodes") {
|
||||
stmt.nodes.forEach(node => {
|
||||
node.parent = undefined;
|
||||
styles.append(node);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var readCache$1 = {exports: {}};
|
||||
|
||||
var pify$2 = {exports: {}};
|
||||
|
||||
var processFn = function (fn, P, opts) {
|
||||
return function () {
|
||||
var that = this;
|
||||
var args = new Array(arguments.length);
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
return new P(function (resolve, reject) {
|
||||
args.push(function (err, result) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else if (opts.multiArgs) {
|
||||
var results = new Array(arguments.length - 1);
|
||||
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
results[i - 1] = arguments[i];
|
||||
}
|
||||
|
||||
resolve(results);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
|
||||
fn.apply(that, args);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var pify$1 = pify$2.exports = function (obj, P, opts) {
|
||||
if (typeof P !== 'function') {
|
||||
opts = P;
|
||||
P = Promise;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
opts.exclude = opts.exclude || [/.+Sync$/];
|
||||
|
||||
var filter = function (key) {
|
||||
var match = function (pattern) {
|
||||
return typeof pattern === 'string' ? key === pattern : pattern.test(key);
|
||||
};
|
||||
|
||||
return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
|
||||
};
|
||||
|
||||
var ret = typeof obj === 'function' ? function () {
|
||||
if (opts.excludeMain) {
|
||||
return obj.apply(this, arguments);
|
||||
}
|
||||
|
||||
return processFn(obj, P, opts).apply(this, arguments);
|
||||
} : {};
|
||||
|
||||
return Object.keys(obj).reduce(function (ret, key) {
|
||||
var x = obj[key];
|
||||
|
||||
ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
|
||||
|
||||
return ret;
|
||||
}, ret);
|
||||
};
|
||||
|
||||
pify$1.all = pify$1;
|
||||
|
||||
var pifyExports = pify$2.exports;
|
||||
|
||||
var fs = require$$0__default;
|
||||
var path$3 = require$$0;
|
||||
var pify = pifyExports;
|
||||
|
||||
var stat = pify(fs.stat);
|
||||
var readFile = pify(fs.readFile);
|
||||
var resolve = path$3.resolve;
|
||||
|
||||
var cache = Object.create(null);
|
||||
|
||||
function convert(content, encoding) {
|
||||
if (Buffer.isEncoding(encoding)) {
|
||||
return content.toString(encoding);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
readCache$1.exports = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
return stat(path).then(function (stats) {
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
return readFile(path).then(function (data) {
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
});
|
||||
}).catch(function (err) {
|
||||
cache[path] = null;
|
||||
return Promise.reject(err);
|
||||
});
|
||||
};
|
||||
|
||||
readCache$1.exports.sync = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
try {
|
||||
var stats = fs.statSync(path);
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
var data = fs.readFileSync(path);
|
||||
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
} catch (err) {
|
||||
cache[path] = null;
|
||||
throw err;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
readCache$1.exports.get = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
if (cache[path]) {
|
||||
return convert(cache[path].content, encoding);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
readCache$1.exports.clear = function () {
|
||||
cache = Object.create(null);
|
||||
};
|
||||
|
||||
var readCacheExports = readCache$1.exports;
|
||||
|
||||
const anyDataURLRegexp = /^data:text\/css(?:;(base64|plain))?,/i;
|
||||
const base64DataURLRegexp = /^data:text\/css;base64,/i;
|
||||
const plainDataURLRegexp = /^data:text\/css;plain,/i;
|
||||
|
||||
function isValid(url) {
|
||||
return anyDataURLRegexp.test(url)
|
||||
}
|
||||
|
||||
function contents(url) {
|
||||
if (base64DataURLRegexp.test(url)) {
|
||||
// "data:text/css;base64,".length === 21
|
||||
return Buffer.from(url.slice(21), "base64").toString()
|
||||
}
|
||||
|
||||
if (plainDataURLRegexp.test(url)) {
|
||||
// "data:text/css;plain,".length === 20
|
||||
return decodeURIComponent(url.slice(20))
|
||||
}
|
||||
|
||||
// "data:text/css,".length === 14
|
||||
return decodeURIComponent(url.slice(14))
|
||||
}
|
||||
|
||||
var dataUrl = {
|
||||
isValid,
|
||||
contents,
|
||||
};
|
||||
|
||||
const readCache = readCacheExports;
|
||||
const dataURL$1 = dataUrl;
|
||||
|
||||
var loadContent$1 = function loadContent(filename) {
|
||||
if (dataURL$1.isValid(filename)) {
|
||||
return dataURL$1.contents(filename)
|
||||
}
|
||||
|
||||
return readCache(filename, "utf-8")
|
||||
};
|
||||
|
||||
// external tooling
|
||||
const valueParser = lib;
|
||||
|
||||
// extended tooling
|
||||
const { stringify } = valueParser;
|
||||
|
||||
var parseStatements$1 = function parseStatements(result, styles, conditions, from) {
|
||||
const statements = [];
|
||||
let nodes = [];
|
||||
|
||||
styles.each(node => {
|
||||
let stmt;
|
||||
if (node.type === "atrule") {
|
||||
if (node.name === "import")
|
||||
stmt = parseImport(result, node, conditions, from);
|
||||
else if (node.name === "charset")
|
||||
stmt = parseCharset(result, node, conditions, from);
|
||||
}
|
||||
|
||||
if (stmt) {
|
||||
if (nodes.length) {
|
||||
statements.push({
|
||||
type: "nodes",
|
||||
nodes,
|
||||
conditions: [...conditions],
|
||||
from,
|
||||
});
|
||||
nodes = [];
|
||||
}
|
||||
statements.push(stmt);
|
||||
} else nodes.push(node);
|
||||
});
|
||||
|
||||
if (nodes.length) {
|
||||
statements.push({
|
||||
type: "nodes",
|
||||
nodes,
|
||||
conditions: [...conditions],
|
||||
from,
|
||||
});
|
||||
}
|
||||
|
||||
return statements
|
||||
};
|
||||
|
||||
function parseCharset(result, atRule, conditions, from) {
|
||||
if (atRule.prev()) {
|
||||
return result.warn("@charset must precede all other statements", {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
return {
|
||||
type: "charset",
|
||||
node: atRule,
|
||||
conditions: [...conditions],
|
||||
from,
|
||||
}
|
||||
}
|
||||
|
||||
function parseImport(result, atRule, conditions, from) {
|
||||
let prev = atRule.prev();
|
||||
|
||||
// `@import` statements may follow other `@import` statements.
|
||||
if (prev) {
|
||||
do {
|
||||
if (
|
||||
prev.type === "comment" ||
|
||||
(prev.type === "atrule" && prev.name === "import")
|
||||
) {
|
||||
prev = prev.prev();
|
||||
continue
|
||||
}
|
||||
|
||||
break
|
||||
} while (prev)
|
||||
}
|
||||
|
||||
// All `@import` statements may be preceded by `@charset` or `@layer` statements.
|
||||
// But the `@import` statements must be consecutive.
|
||||
if (prev) {
|
||||
do {
|
||||
if (
|
||||
prev.type === "comment" ||
|
||||
(prev.type === "atrule" &&
|
||||
(prev.name === "charset" || (prev.name === "layer" && !prev.nodes)))
|
||||
) {
|
||||
prev = prev.prev();
|
||||
continue
|
||||
}
|
||||
|
||||
return result.warn(
|
||||
"@import must precede all other statements (besides @charset or empty @layer)",
|
||||
{ node: atRule },
|
||||
)
|
||||
} while (prev)
|
||||
}
|
||||
|
||||
if (atRule.nodes) {
|
||||
return result.warn(
|
||||
"It looks like you didn't end your @import statement correctly. " +
|
||||
"Child nodes are attached to it.",
|
||||
{ node: atRule },
|
||||
)
|
||||
}
|
||||
|
||||
const params = valueParser(atRule.params).nodes;
|
||||
const stmt = {
|
||||
type: "import",
|
||||
uri: "",
|
||||
fullUri: "",
|
||||
node: atRule,
|
||||
conditions: [...conditions],
|
||||
from,
|
||||
};
|
||||
|
||||
let layer;
|
||||
let media;
|
||||
let supports;
|
||||
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const node = params[i];
|
||||
|
||||
if (node.type === "space" || node.type === "comment") continue
|
||||
|
||||
if (node.type === "string") {
|
||||
if (stmt.uri) {
|
||||
return result.warn(`Multiple url's in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (!node.value) {
|
||||
return result.warn(`Unable to find uri in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
stmt.uri = node.value;
|
||||
stmt.fullUri = stringify(node);
|
||||
continue
|
||||
}
|
||||
|
||||
if (node.type === "function" && /^url$/i.test(node.value)) {
|
||||
if (stmt.uri) {
|
||||
return result.warn(`Multiple url's in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (!node.nodes?.[0]?.value) {
|
||||
return result.warn(`Unable to find uri in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
stmt.uri = node.nodes[0].value;
|
||||
stmt.fullUri = stringify(node);
|
||||
continue
|
||||
}
|
||||
|
||||
if (!stmt.uri) {
|
||||
return result.warn(`Unable to find uri in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
(node.type === "word" || node.type === "function") &&
|
||||
/^layer$/i.test(node.value)
|
||||
) {
|
||||
if (typeof layer !== "undefined") {
|
||||
return result.warn(`Multiple layers in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof supports !== "undefined") {
|
||||
return result.warn(
|
||||
`layers must be defined before support conditions in '${atRule.toString()}'`,
|
||||
{
|
||||
node: atRule,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
if (node.nodes) {
|
||||
layer = stringify(node.nodes);
|
||||
} else {
|
||||
layer = "";
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if (node.type === "function" && /^supports$/i.test(node.value)) {
|
||||
if (typeof supports !== "undefined") {
|
||||
return result.warn(
|
||||
`Multiple support conditions in '${atRule.toString()}'`,
|
||||
{
|
||||
node: atRule,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
supports = stringify(node.nodes);
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
media = stringify(params.slice(i));
|
||||
break
|
||||
}
|
||||
|
||||
if (!stmt.uri) {
|
||||
return result.warn(`Unable to find uri in '${atRule.toString()}'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
typeof media !== "undefined" ||
|
||||
typeof layer !== "undefined" ||
|
||||
typeof supports !== "undefined"
|
||||
) {
|
||||
stmt.conditions.push({
|
||||
layer,
|
||||
media,
|
||||
supports,
|
||||
});
|
||||
}
|
||||
|
||||
return stmt
|
||||
}
|
||||
|
||||
// builtin tooling
|
||||
const path$2 = require$$0;
|
||||
|
||||
// placeholder tooling
|
||||
let sugarss;
|
||||
|
||||
var processContent$1 = function processContent(
|
||||
result,
|
||||
content,
|
||||
filename,
|
||||
options,
|
||||
postcss,
|
||||
) {
|
||||
const { plugins } = options;
|
||||
const ext = path$2.extname(filename);
|
||||
|
||||
const parserList = [];
|
||||
|
||||
// SugarSS support:
|
||||
if (ext === ".sss") {
|
||||
if (!sugarss) {
|
||||
/* c8 ignore next 3 */
|
||||
try {
|
||||
sugarss = __require('sugarss');
|
||||
} catch {} // Ignore
|
||||
}
|
||||
if (sugarss)
|
||||
return runPostcss(postcss, content, filename, plugins, [sugarss])
|
||||
}
|
||||
|
||||
// Syntax support:
|
||||
if (result.opts.syntax?.parse) {
|
||||
parserList.push(result.opts.syntax.parse);
|
||||
}
|
||||
|
||||
// Parser support:
|
||||
if (result.opts.parser) parserList.push(result.opts.parser);
|
||||
// Try the default as a last resort:
|
||||
parserList.push(null);
|
||||
|
||||
return runPostcss(postcss, content, filename, plugins, parserList)
|
||||
};
|
||||
|
||||
function runPostcss(postcss, content, filename, plugins, parsers, index) {
|
||||
if (!index) index = 0;
|
||||
return postcss(plugins)
|
||||
.process(content, {
|
||||
from: filename,
|
||||
parser: parsers[index],
|
||||
})
|
||||
.catch(err => {
|
||||
// If there's an error, try the next parser
|
||||
index++;
|
||||
// If there are no parsers left, throw it
|
||||
if (index === parsers.length) throw err
|
||||
return runPostcss(postcss, content, filename, plugins, parsers, index)
|
||||
})
|
||||
}
|
||||
|
||||
const path$1 = require$$0;
|
||||
|
||||
const dataURL = dataUrl;
|
||||
const parseStatements = parseStatements$1;
|
||||
const processContent = processContent$1;
|
||||
const resolveId$1 = (id) => id;
|
||||
const formatImportPrelude = formatImportPrelude$2;
|
||||
|
||||
async function parseStyles$1(
|
||||
result,
|
||||
styles,
|
||||
options,
|
||||
state,
|
||||
conditions,
|
||||
from,
|
||||
postcss,
|
||||
) {
|
||||
const statements = parseStatements(result, styles, conditions, from);
|
||||
|
||||
for (const stmt of statements) {
|
||||
if (stmt.type !== "import" || !isProcessableURL(stmt.uri)) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (options.filter && !options.filter(stmt.uri)) {
|
||||
// rejected by filter
|
||||
continue
|
||||
}
|
||||
|
||||
await resolveImportId(result, stmt, options, state, postcss);
|
||||
}
|
||||
|
||||
let charset;
|
||||
const imports = [];
|
||||
const bundle = [];
|
||||
|
||||
function handleCharset(stmt) {
|
||||
if (!charset) charset = stmt;
|
||||
// charsets aren't case-sensitive, so convert to lower case to compare
|
||||
else if (
|
||||
stmt.node.params.toLowerCase() !== charset.node.params.toLowerCase()
|
||||
) {
|
||||
throw stmt.node.error(
|
||||
`Incompatible @charset statements:
|
||||
${stmt.node.params} specified in ${stmt.node.source.input.file}
|
||||
${charset.node.params} specified in ${charset.node.source.input.file}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// squash statements and their children
|
||||
statements.forEach(stmt => {
|
||||
if (stmt.type === "charset") handleCharset(stmt);
|
||||
else if (stmt.type === "import") {
|
||||
if (stmt.children) {
|
||||
stmt.children.forEach((child, index) => {
|
||||
if (child.type === "import") imports.push(child);
|
||||
else if (child.type === "charset") handleCharset(child);
|
||||
else bundle.push(child);
|
||||
// For better output
|
||||
if (index === 0) child.parent = stmt;
|
||||
});
|
||||
} else imports.push(stmt);
|
||||
} else if (stmt.type === "nodes") {
|
||||
bundle.push(stmt);
|
||||
}
|
||||
});
|
||||
|
||||
return charset ? [charset, ...imports.concat(bundle)] : imports.concat(bundle)
|
||||
}
|
||||
|
||||
async function resolveImportId(result, stmt, options, state, postcss) {
|
||||
if (dataURL.isValid(stmt.uri)) {
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
stmt.children = await loadImportContent(
|
||||
result,
|
||||
stmt,
|
||||
stmt.uri,
|
||||
options,
|
||||
state,
|
||||
postcss,
|
||||
);
|
||||
|
||||
return
|
||||
} else if (dataURL.isValid(stmt.from.slice(-1))) {
|
||||
// Data urls can't be used as a base url to resolve imports.
|
||||
throw stmt.node.error(
|
||||
`Unable to import '${stmt.uri}' from a stylesheet that is embedded in a data url`,
|
||||
)
|
||||
}
|
||||
|
||||
const atRule = stmt.node;
|
||||
let sourceFile;
|
||||
if (atRule.source?.input?.file) {
|
||||
sourceFile = atRule.source.input.file;
|
||||
}
|
||||
const base = sourceFile
|
||||
? path$1.dirname(atRule.source.input.file)
|
||||
: options.root;
|
||||
|
||||
const paths = [await options.resolve(stmt.uri, base, options, atRule)].flat();
|
||||
|
||||
// Ensure that each path is absolute:
|
||||
const resolved = await Promise.all(
|
||||
paths.map(file => {
|
||||
return !path$1.isAbsolute(file)
|
||||
? resolveId$1(file)
|
||||
: file
|
||||
}),
|
||||
);
|
||||
|
||||
// Add dependency messages:
|
||||
resolved.forEach(file => {
|
||||
result.messages.push({
|
||||
type: "dependency",
|
||||
plugin: "postcss-import",
|
||||
file,
|
||||
parent: sourceFile,
|
||||
});
|
||||
});
|
||||
|
||||
const importedContent = await Promise.all(
|
||||
resolved.map(file => {
|
||||
return loadImportContent(result, stmt, file, options, state, postcss)
|
||||
}),
|
||||
);
|
||||
|
||||
// Merge loaded statements
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
stmt.children = importedContent.flat().filter(x => !!x);
|
||||
}
|
||||
|
||||
async function loadImportContent(
|
||||
result,
|
||||
stmt,
|
||||
filename,
|
||||
options,
|
||||
state,
|
||||
postcss,
|
||||
) {
|
||||
const atRule = stmt.node;
|
||||
const { conditions, from } = stmt;
|
||||
const stmtDuplicateCheckKey = conditions
|
||||
.map(condition =>
|
||||
formatImportPrelude(condition.layer, condition.media, condition.supports),
|
||||
)
|
||||
.join(":");
|
||||
|
||||
if (options.skipDuplicates) {
|
||||
// skip files already imported at the same scope
|
||||
if (state.importedFiles[filename]?.[stmtDuplicateCheckKey]) {
|
||||
return
|
||||
}
|
||||
|
||||
// save imported files to skip them next time
|
||||
if (!state.importedFiles[filename]) {
|
||||
state.importedFiles[filename] = {};
|
||||
}
|
||||
state.importedFiles[filename][stmtDuplicateCheckKey] = true;
|
||||
}
|
||||
|
||||
if (from.includes(filename)) {
|
||||
return
|
||||
}
|
||||
|
||||
const content = await options.load(filename, options);
|
||||
|
||||
if (content.trim() === "" && options.warnOnEmpty) {
|
||||
result.warn(`${filename} is empty`, { node: atRule });
|
||||
return
|
||||
}
|
||||
|
||||
// skip previous imported files not containing @import rules
|
||||
if (
|
||||
options.skipDuplicates &&
|
||||
state.hashFiles[content]?.[stmtDuplicateCheckKey]
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const importedResult = await processContent(
|
||||
result,
|
||||
content,
|
||||
filename,
|
||||
options,
|
||||
postcss,
|
||||
);
|
||||
|
||||
const styles = importedResult.root;
|
||||
result.messages = result.messages.concat(importedResult.messages);
|
||||
|
||||
if (options.skipDuplicates) {
|
||||
const hasImport = styles.some(child => {
|
||||
return child.type === "atrule" && child.name === "import"
|
||||
});
|
||||
if (!hasImport) {
|
||||
// save hash files to skip them next time
|
||||
if (!state.hashFiles[content]) {
|
||||
state.hashFiles[content] = {};
|
||||
}
|
||||
|
||||
state.hashFiles[content][stmtDuplicateCheckKey] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// recursion: import @import from imported file
|
||||
return parseStyles$1(
|
||||
result,
|
||||
styles,
|
||||
options,
|
||||
state,
|
||||
conditions,
|
||||
[...from, filename],
|
||||
postcss,
|
||||
)
|
||||
}
|
||||
|
||||
function isProcessableURL(uri) {
|
||||
// skip protocol base uri (protocol://url) or protocol-relative
|
||||
if (/^(?:[a-z]+:)?\/\//i.test(uri)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// check for fragment or query
|
||||
try {
|
||||
// needs a base to parse properly
|
||||
const url = new URL(uri, "https://example.com");
|
||||
if (url.search) {
|
||||
return false
|
||||
}
|
||||
} catch {} // Ignore
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
var parseStyles_1 = parseStyles$1;
|
||||
|
||||
// builtin tooling
|
||||
const path = require$$0;
|
||||
|
||||
// internal tooling
|
||||
const applyConditions = applyConditions$1;
|
||||
const applyRaws = applyRaws$1;
|
||||
const applyStyles = applyStyles$1;
|
||||
const loadContent = loadContent$1;
|
||||
const parseStyles = parseStyles_1;
|
||||
const resolveId = (id) => id;
|
||||
|
||||
function AtImport(options) {
|
||||
options = {
|
||||
root: process.cwd(),
|
||||
path: [],
|
||||
skipDuplicates: true,
|
||||
resolve: resolveId,
|
||||
load: loadContent,
|
||||
plugins: [],
|
||||
addModulesDirectories: [],
|
||||
warnOnEmpty: true,
|
||||
...options,
|
||||
};
|
||||
|
||||
options.root = path.resolve(options.root);
|
||||
|
||||
// convert string to an array of a single element
|
||||
if (typeof options.path === "string") options.path = [options.path];
|
||||
|
||||
if (!Array.isArray(options.path)) options.path = [];
|
||||
|
||||
options.path = options.path.map(p => path.resolve(options.root, p));
|
||||
|
||||
return {
|
||||
postcssPlugin: "postcss-import",
|
||||
async Once(styles, { result, atRule, postcss }) {
|
||||
const state = {
|
||||
importedFiles: {},
|
||||
hashFiles: {},
|
||||
};
|
||||
|
||||
if (styles.source?.input?.file) {
|
||||
state.importedFiles[styles.source.input.file] = {};
|
||||
}
|
||||
|
||||
if (options.plugins && !Array.isArray(options.plugins)) {
|
||||
throw new Error("plugins option must be an array")
|
||||
}
|
||||
|
||||
const bundle = await parseStyles(
|
||||
result,
|
||||
styles,
|
||||
options,
|
||||
state,
|
||||
[],
|
||||
[],
|
||||
postcss,
|
||||
);
|
||||
|
||||
applyRaws(bundle);
|
||||
applyConditions(bundle, atRule);
|
||||
applyStyles(bundle, styles);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
AtImport.postcss = true;
|
||||
|
||||
var postcssImport = AtImport;
|
||||
|
||||
var index = /*@__PURE__*/getDefaultExportFromCjs(postcssImport);
|
||||
|
||||
var index$1 = /*#__PURE__*/_mergeNamespaces({
|
||||
__proto__: null,
|
||||
default: index
|
||||
}, [postcssImport]);
|
||||
|
||||
export { index$1 as i };
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
|
@ -1,21 +1,18 @@
|
|||
import path from 'node:path';
|
||||
import fs__default from 'node:fs';
|
||||
import fs from 'node:fs';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import { EventEmitter } from 'events';
|
||||
import { B as colors, v as createLogger, r as resolveConfig } from './chunks/dep-BK3b2jBa.js';
|
||||
import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-p3C6MpSJ.js';
|
||||
import { VERSION } from './constants.js';
|
||||
import 'node:fs/promises';
|
||||
import 'node:url';
|
||||
import 'node:util';
|
||||
import 'node:module';
|
||||
import 'node:crypto';
|
||||
import 'tty';
|
||||
import 'path';
|
||||
import 'esbuild';
|
||||
import 'fs';
|
||||
import 'node:events';
|
||||
import 'node:stream';
|
||||
import 'node:string_decoder';
|
||||
import 'assert';
|
||||
import 'node:child_process';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
|
|
@ -27,6 +24,7 @@ import 'stream';
|
|||
import 'os';
|
||||
import 'child_process';
|
||||
import 'node:os';
|
||||
import 'node:crypto';
|
||||
import 'node:dns';
|
||||
import 'crypto';
|
||||
import 'module';
|
||||
|
|
@ -34,6 +32,7 @@ import 'node:assert';
|
|||
import 'node:v8';
|
||||
import 'node:worker_threads';
|
||||
import 'node:buffer';
|
||||
import 'node:events';
|
||||
import 'rollup/parseAst';
|
||||
import 'querystring';
|
||||
import 'node:readline';
|
||||
|
|
@ -41,8 +40,6 @@ import 'zlib';
|
|||
import 'buffer';
|
||||
import 'https';
|
||||
import 'tls';
|
||||
import 'node:net';
|
||||
import 'assert';
|
||||
import 'node:zlib';
|
||||
|
||||
function toArr(any) {
|
||||
|
|
@ -658,26 +655,23 @@ class CAC extends EventEmitter {
|
|||
|
||||
const cac = (name = "") => new CAC(name);
|
||||
|
||||
const cli = cac("vite");
|
||||
const cli = cac('vite');
|
||||
let profileSession = global.__vite_profile_session;
|
||||
let profileCount = 0;
|
||||
const stopProfiler = (log) => {
|
||||
if (!profileSession) return;
|
||||
if (!profileSession)
|
||||
return;
|
||||
return new Promise((res, rej) => {
|
||||
profileSession.post("Profiler.stop", (err, { profile }) => {
|
||||
profileSession.post('Profiler.stop', (err, { profile }) => {
|
||||
// Write profile to disk, upload, etc.
|
||||
if (!err) {
|
||||
const outPath = path.resolve(
|
||||
`./vite-profile-${profileCount++}.cpuprofile`
|
||||
);
|
||||
fs__default.writeFileSync(outPath, JSON.stringify(profile));
|
||||
log(
|
||||
colors.yellow(
|
||||
`CPU profile written to ${colors.white(colors.dim(outPath))}`
|
||||
)
|
||||
);
|
||||
profileSession = void 0;
|
||||
const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`);
|
||||
fs.writeFileSync(outPath, JSON.stringify(profile));
|
||||
log(colors.yellow(`CPU profile written to ${colors.white(colors.dim(outPath))}`));
|
||||
profileSession = undefined;
|
||||
res();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rej(err);
|
||||
}
|
||||
});
|
||||
|
|
@ -690,9 +684,12 @@ const filterDuplicateOptions = (options) => {
|
|||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* removing global flags before passing as command specific sub-configs
|
||||
*/
|
||||
function cleanOptions(options) {
|
||||
const ret = { ...options };
|
||||
delete ret["--"];
|
||||
delete ret['--'];
|
||||
delete ret.c;
|
||||
delete ret.config;
|
||||
delete ret.base;
|
||||
|
|
@ -705,33 +702,62 @@ function cleanOptions(options) {
|
|||
delete ret.filter;
|
||||
delete ret.m;
|
||||
delete ret.mode;
|
||||
if ("sourcemap" in ret) {
|
||||
// convert the sourcemap option to a boolean if necessary
|
||||
if ('sourcemap' in ret) {
|
||||
const sourcemap = ret.sourcemap;
|
||||
ret.sourcemap = sourcemap === "true" ? true : sourcemap === "false" ? false : ret.sourcemap;
|
||||
ret.sourcemap =
|
||||
sourcemap === 'true'
|
||||
? true
|
||||
: sourcemap === 'false'
|
||||
? false
|
||||
: ret.sourcemap;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* host may be a number (like 0), should convert to string
|
||||
*/
|
||||
const convertHost = (v) => {
|
||||
if (typeof v === "number") {
|
||||
if (typeof v === 'number') {
|
||||
return String(v);
|
||||
}
|
||||
return v;
|
||||
};
|
||||
/**
|
||||
* base may be a number (like 0), should convert to empty string
|
||||
*/
|
||||
const convertBase = (v) => {
|
||||
if (v === 0) {
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
return v;
|
||||
};
|
||||
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("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
||||
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`
|
||||
).action(async (root, options) => {
|
||||
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('-d, --debug [feat]', `[string | boolean] show debug logs`)
|
||||
.option('-f, --filter <filter>', `[string] filter debug logs`)
|
||||
.option('-m, --mode <mode>', `[string] set env mode`);
|
||||
// dev
|
||||
cli
|
||||
.command('[root]', 'start dev server') // default command
|
||||
.alias('serve') // the command is called 'serve' in Vite's API
|
||||
.alias('dev') // alias to align with the script name
|
||||
.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`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { createServer } = await import('./chunks/dep-BK3b2jBa.js').then(function (n) { return n.F; });
|
||||
// output structure is preserved even after bundling so require()
|
||||
// is ok here
|
||||
const { createServer } = await import('./chunks/dep-p3C6MpSJ.js').then(function (n) { return n.E; });
|
||||
try {
|
||||
const server = await createServer({
|
||||
root,
|
||||
|
|
@ -741,89 +767,76 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|||
logLevel: options.logLevel,
|
||||
clearScreen: options.clearScreen,
|
||||
optimizeDeps: { force: options.force },
|
||||
server: cleanOptions(options)
|
||||
server: cleanOptions(options),
|
||||
});
|
||||
if (!server.httpServer) {
|
||||
throw new Error("HTTP server not available");
|
||||
throw new Error('HTTP server not available');
|
||||
}
|
||||
await server.listen();
|
||||
const info = server.config.logger.info;
|
||||
const viteStartTime = global.__vite_start_time ?? false;
|
||||
const startupDurationString = viteStartTime ? colors.dim(
|
||||
`ready in ${colors.reset(
|
||||
colors.bold(Math.ceil(performance.now() - viteStartTime))
|
||||
)} ms`
|
||||
) : "";
|
||||
const startupDurationString = viteStartTime
|
||||
? colors.dim(`ready in ${colors.reset(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
|
||||
: '';
|
||||
const hasExistingLogs = process.stdout.bytesWritten > 0 || process.stderr.bytesWritten > 0;
|
||||
info(
|
||||
`
|
||||
${colors.green(
|
||||
`${colors.bold("VITE")} v${VERSION}`
|
||||
)} ${startupDurationString}
|
||||
`,
|
||||
{
|
||||
clear: !hasExistingLogs
|
||||
}
|
||||
);
|
||||
info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, {
|
||||
clear: !hasExistingLogs,
|
||||
});
|
||||
server.printUrls();
|
||||
const customShortcuts = [];
|
||||
if (profileSession) {
|
||||
customShortcuts.push({
|
||||
key: "p",
|
||||
description: "start/stop the profiler",
|
||||
async action(server2) {
|
||||
key: 'p',
|
||||
description: 'start/stop the profiler',
|
||||
async action(server) {
|
||||
if (profileSession) {
|
||||
await stopProfiler(server2.config.logger.info);
|
||||
} else {
|
||||
const inspector = await import('node:inspector').then(
|
||||
(r) => r.default
|
||||
);
|
||||
await stopProfiler(server.config.logger.info);
|
||||
}
|
||||
else {
|
||||
const inspector = await import('node:inspector').then((r) => r.default);
|
||||
await new Promise((res) => {
|
||||
profileSession = new inspector.Session();
|
||||
profileSession.connect();
|
||||
profileSession.post("Profiler.enable", () => {
|
||||
profileSession.post("Profiler.start", () => {
|
||||
server2.config.logger.info("Profiler started");
|
||||
profileSession.post('Profiler.enable', () => {
|
||||
profileSession.post('Profiler.start', () => {
|
||||
server.config.logger.info('Profiler started');
|
||||
res();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
server.bindCLIShortcuts({ print: true, customShortcuts });
|
||||
} catch (e) {
|
||||
}
|
||||
catch (e) {
|
||||
const logger = createLogger(options.logLevel);
|
||||
logger.error(colors.red(`error when starting dev server:
|
||||
${e.stack}`), {
|
||||
error: e
|
||||
logger.error(colors.red(`error when starting dev server:\n${e.stack}`), {
|
||||
error: e,
|
||||
});
|
||||
stopProfiler(logger.info);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).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 | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)`
|
||||
).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`).action(async (root, options) => {
|
||||
// build
|
||||
cli
|
||||
.command('build [root]', 'build for production')
|
||||
.option('--target <target>', `[string] transpile target (default: 'modules')`)
|
||||
.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 | "terser" | "esbuild"] enable/disable minification, ` +
|
||||
`or specify minifier to use (default: esbuild)`)
|
||||
.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`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { build } = await import('./chunks/dep-BK3b2jBa.js').then(function (n) { return n.G; });
|
||||
const { build } = await import('./chunks/dep-p3C6MpSJ.js').then(function (n) { return n.F; });
|
||||
const buildOptions = cleanOptions(options);
|
||||
try {
|
||||
await build({
|
||||
|
|
@ -833,52 +846,50 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|||
configFile: options.config,
|
||||
logLevel: options.logLevel,
|
||||
clearScreen: options.clearScreen,
|
||||
build: buildOptions
|
||||
build: buildOptions,
|
||||
});
|
||||
} catch (e) {
|
||||
createLogger(options.logLevel).error(
|
||||
colors.red(`error during build:
|
||||
${e.stack}`),
|
||||
{ error: e }
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
|
||||
process.exit(1);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
stopProfiler((message) => createLogger(options.logLevel).info(message));
|
||||
}
|
||||
});
|
||||
cli.command("optimize [root]", "pre-bundle dependencies").option(
|
||||
"--force",
|
||||
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
||||
).action(
|
||||
async (root, options) => {
|
||||
// optimize
|
||||
cli
|
||||
.command('optimize [root]', 'pre-bundle dependencies')
|
||||
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { optimizeDeps } = await import('./chunks/dep-BK3b2jBa.js').then(function (n) { return n.E; });
|
||||
const { optimizeDeps } = await import('./chunks/dep-p3C6MpSJ.js').then(function (n) { return n.D; });
|
||||
try {
|
||||
const config = await resolveConfig(
|
||||
{
|
||||
const config = await resolveConfig({
|
||||
root,
|
||||
base: options.base,
|
||||
configFile: options.config,
|
||||
logLevel: options.logLevel,
|
||||
mode: options.mode
|
||||
},
|
||||
"serve"
|
||||
);
|
||||
mode: options.mode,
|
||||
}, 'serve');
|
||||
await optimizeDeps(config, options.force, true);
|
||||
} catch (e) {
|
||||
createLogger(options.logLevel).error(
|
||||
colors.red(`error when optimizing deps:
|
||||
${e.stack}`),
|
||||
{ error: e }
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
);
|
||||
cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
|
||||
async (root, options) => {
|
||||
});
|
||||
// preview
|
||||
cli
|
||||
.command('preview [root]', 'locally preview production build')
|
||||
.option('--host [host]', `[string] specify hostname`, { type: [convertHost] })
|
||||
.option('--port <port>', `[number] specify port`)
|
||||
.option('--strictPort', `[boolean] exit if specified port is already in use`)
|
||||
.option('--open [path]', `[boolean | string] open browser on startup`)
|
||||
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { preview } = await import('./chunks/dep-BK3b2jBa.js').then(function (n) { return n.H; });
|
||||
const { preview } = await import('./chunks/dep-p3C6MpSJ.js').then(function (n) { return n.G; });
|
||||
try {
|
||||
const server = await preview({
|
||||
root,
|
||||
|
|
@ -887,29 +898,26 @@ cli.command("preview [root]", "locally preview production build").option("--host
|
|||
logLevel: options.logLevel,
|
||||
mode: options.mode,
|
||||
build: {
|
||||
outDir: options.outDir
|
||||
outDir: options.outDir,
|
||||
},
|
||||
preview: {
|
||||
port: options.port,
|
||||
strictPort: options.strictPort,
|
||||
host: options.host,
|
||||
open: options.open
|
||||
}
|
||||
open: options.open,
|
||||
},
|
||||
});
|
||||
server.printUrls();
|
||||
server.bindCLIShortcuts({ print: true });
|
||||
} catch (e) {
|
||||
createLogger(options.logLevel).error(
|
||||
colors.red(`error when starting preview server:
|
||||
${e.stack}`),
|
||||
{ error: e }
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), { error: e });
|
||||
process.exit(1);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
stopProfiler((message) => createLogger(options.logLevel).info(message));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
cli.help();
|
||||
cli.version(VERSION);
|
||||
cli.parse();
|
||||
|
|
|
|||
|
|
@ -2,112 +2,114 @@ import path, { resolve } from 'node:path';
|
|||
import { fileURLToPath } from 'node:url';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const { version } = JSON.parse(
|
||||
readFileSync(new URL("../../package.json", import.meta.url)).toString()
|
||||
);
|
||||
const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
|
||||
const VERSION = version;
|
||||
const DEFAULT_MAIN_FIELDS = [
|
||||
"browser",
|
||||
"module",
|
||||
"jsnext:main",
|
||||
// moment still uses this...
|
||||
"jsnext"
|
||||
'browser',
|
||||
'module',
|
||||
'jsnext:main',
|
||||
'jsnext',
|
||||
];
|
||||
// Baseline support browserslist
|
||||
// "defaults and supports es6-module and supports es6-module-dynamic-import"
|
||||
// Higher browser versions may be needed for extra features.
|
||||
const ESBUILD_MODULES_TARGET = [
|
||||
"es2020",
|
||||
// support import.meta.url
|
||||
"edge88",
|
||||
"firefox78",
|
||||
"chrome87",
|
||||
"safari14"
|
||||
'es2020',
|
||||
'edge88',
|
||||
'firefox78',
|
||||
'chrome87',
|
||||
'safari14',
|
||||
];
|
||||
const DEFAULT_EXTENSIONS = [
|
||||
".mjs",
|
||||
".js",
|
||||
".mts",
|
||||
".ts",
|
||||
".jsx",
|
||||
".tsx",
|
||||
".json"
|
||||
'.mjs',
|
||||
'.js',
|
||||
'.mts',
|
||||
'.ts',
|
||||
'.jsx',
|
||||
'.tsx',
|
||||
'.json',
|
||||
];
|
||||
const DEFAULT_CONFIG_FILES = [
|
||||
"vite.config.js",
|
||||
"vite.config.mjs",
|
||||
"vite.config.ts",
|
||||
"vite.config.cjs",
|
||||
"vite.config.mts",
|
||||
"vite.config.cts"
|
||||
'vite.config.js',
|
||||
'vite.config.mjs',
|
||||
'vite.config.ts',
|
||||
'vite.config.cjs',
|
||||
'vite.config.mts',
|
||||
'vite.config.cts',
|
||||
];
|
||||
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
||||
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
||||
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
||||
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
||||
/**
|
||||
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
||||
*/
|
||||
const FS_PREFIX = `/@fs/`;
|
||||
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
||||
const ENV_PUBLIC_PATH = `/@vite/env`;
|
||||
const VITE_PACKAGE_DIR = resolve(
|
||||
// import.meta.url is `dist/node/constants.js` after bundle
|
||||
fileURLToPath(import.meta.url),
|
||||
"../../.."
|
||||
);
|
||||
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
||||
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
||||
// import.meta.url is `dist/node/constants.js` after bundle
|
||||
fileURLToPath(import.meta.url), '../../..');
|
||||
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
||||
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
||||
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
||||
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
||||
// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
|
||||
// to the TypeScript declaration file `packages/vite/client.d.ts` and
|
||||
// add a mime type to the `registerCustomMime` in
|
||||
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
|
||||
// looked up by mrmime.
|
||||
const KNOWN_ASSET_TYPES = [
|
||||
// images
|
||||
"apng",
|
||||
"bmp",
|
||||
"png",
|
||||
"jpe?g",
|
||||
"jfif",
|
||||
"pjpeg",
|
||||
"pjp",
|
||||
"gif",
|
||||
"svg",
|
||||
"ico",
|
||||
"webp",
|
||||
"avif",
|
||||
'apng',
|
||||
'png',
|
||||
'jpe?g',
|
||||
'jfif',
|
||||
'pjpeg',
|
||||
'pjp',
|
||||
'gif',
|
||||
'svg',
|
||||
'ico',
|
||||
'webp',
|
||||
'avif',
|
||||
// media
|
||||
"mp4",
|
||||
"webm",
|
||||
"ogg",
|
||||
"mp3",
|
||||
"wav",
|
||||
"flac",
|
||||
"aac",
|
||||
"opus",
|
||||
"mov",
|
||||
"m4a",
|
||||
"vtt",
|
||||
'mp4',
|
||||
'webm',
|
||||
'ogg',
|
||||
'mp3',
|
||||
'wav',
|
||||
'flac',
|
||||
'aac',
|
||||
'opus',
|
||||
'mov',
|
||||
'm4a',
|
||||
'vtt',
|
||||
// fonts
|
||||
"woff2?",
|
||||
"eot",
|
||||
"ttf",
|
||||
"otf",
|
||||
'woff2?',
|
||||
'eot',
|
||||
'ttf',
|
||||
'otf',
|
||||
// other
|
||||
"webmanifest",
|
||||
"pdf",
|
||||
"txt"
|
||||
'webmanifest',
|
||||
'pdf',
|
||||
'txt',
|
||||
];
|
||||
const DEFAULT_ASSETS_RE = new RegExp(
|
||||
`\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`
|
||||
);
|
||||
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
||||
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
|
||||
const loopbackHosts = /* @__PURE__ */ new Set([
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"::1",
|
||||
"0000:0000:0000:0000:0000:0000:0000:0001"
|
||||
const loopbackHosts = new Set([
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
'::1',
|
||||
'0000:0000:0000:0000:0000:0000:0000:0001',
|
||||
]);
|
||||
const wildcardHosts = /* @__PURE__ */ new Set([
|
||||
"0.0.0.0",
|
||||
"::",
|
||||
"0000:0000:0000:0000:0000:0000:0000:0000"
|
||||
const wildcardHosts = new Set([
|
||||
'0.0.0.0',
|
||||
'::',
|
||||
'0000:0000:0000:0000:0000:0000:0000:0000',
|
||||
]);
|
||||
const DEFAULT_DEV_PORT = 5173;
|
||||
const DEFAULT_PREVIEW_PORT = 4173;
|
||||
const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
|
||||
const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
|
||||
const METADATA_FILENAME = "_metadata.json";
|
||||
const METADATA_FILENAME = '_metadata.json';
|
||||
|
||||
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, defaultAllowedOrigins, loopbackHosts, wildcardHosts };
|
||||
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 };
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="node" />
|
||||
import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, MinimalPluginContext, InputOptions, CustomPluginOptions, LoadResult, SourceDescription, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, PluginContext, ResolveIdResult, TransformPluginContext, GetManualChunk } from 'rollup';
|
||||
import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, InputOptions, CustomPluginOptions, SourceDescription, LoadResult, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, PluginContext, ResolveIdResult, TransformPluginContext, GetManualChunk } from 'rollup';
|
||||
import * as rollup from 'rollup';
|
||||
export { rollup as Rollup };
|
||||
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
||||
|
|
@ -414,7 +414,6 @@ declare namespace HttpProxy {
|
|||
* @param req - Client request.
|
||||
* @param res - Client response.
|
||||
* @param options - Additional options.
|
||||
* @param callback - Error callback.
|
||||
*/
|
||||
web(
|
||||
req: http.IncomingMessage,
|
||||
|
|
@ -429,7 +428,6 @@ declare namespace HttpProxy {
|
|||
* @param socket - Client socket.
|
||||
* @param head - Client head.
|
||||
* @param options - Additional options.
|
||||
* @param callback - Error callback.
|
||||
*/
|
||||
ws(
|
||||
req: http.IncomingMessage,
|
||||
|
|
@ -620,12 +618,6 @@ interface ProxyOptions extends HttpProxy.ServerOptions {
|
|||
* webpack-dev-server style bypass function
|
||||
*/
|
||||
bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
|
||||
/**
|
||||
* rewrite the Origin header of a WebSocket request to match the the target
|
||||
*
|
||||
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
|
||||
*/
|
||||
rewriteWsOrigin?: boolean | undefined;
|
||||
}
|
||||
|
||||
type LogType = 'error' | 'warn' | 'info';
|
||||
|
|
@ -669,18 +661,6 @@ interface CommonServerOptions {
|
|||
* Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
|
||||
*/
|
||||
host?: string | boolean;
|
||||
/**
|
||||
* The hostnames that Vite is allowed to respond to.
|
||||
* `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
|
||||
* When using HTTPS, this check is skipped.
|
||||
*
|
||||
* If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
|
||||
* For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
|
||||
*
|
||||
* If set to `true`, the server is allowed to respond to requests for any hosts.
|
||||
* This is not recommended as it will be vulnerable to DNS rebinding attacks.
|
||||
*/
|
||||
allowedHosts?: string[] | true;
|
||||
/**
|
||||
* Enable TLS + HTTP/2.
|
||||
* Note: this downgrades to TLS only when the proxy option is also used.
|
||||
|
|
@ -716,14 +696,8 @@ interface CommonServerOptions {
|
|||
/**
|
||||
* Configure CORS for the dev server.
|
||||
* Uses https://github.com/expressjs/cors.
|
||||
*
|
||||
* When enabling this option, **we recommend setting a specific value
|
||||
* rather than `true`** to avoid exposing the source code to untrusted origins.
|
||||
*
|
||||
* Set to `true` to allow all methods from any origin, or configure separately
|
||||
* using an object.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
cors?: CorsOptions | boolean;
|
||||
/**
|
||||
|
|
@ -735,13 +709,7 @@ interface CommonServerOptions {
|
|||
* https://github.com/expressjs/cors#configuration-options
|
||||
*/
|
||||
interface CorsOptions {
|
||||
/**
|
||||
* Configures the Access-Control-Allow-Origin CORS header.
|
||||
*
|
||||
* **We recommend setting a specific value rather than
|
||||
* `true`** to avoid exposing the source code to untrusted origins.
|
||||
*/
|
||||
origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
||||
origin?: CorsOrigin | ((origin: string, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
||||
methods?: string | string[];
|
||||
allowedHeaders?: string | string[];
|
||||
exposedHeaders?: string | string[];
|
||||
|
|
@ -905,50 +873,29 @@ declare class ModuleGraph {
|
|||
* https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
|
||||
*/
|
||||
|
||||
declare class PluginContainer {
|
||||
config: ResolvedConfig;
|
||||
moduleGraph?: ModuleGraph | undefined;
|
||||
watcher?: FSWatcher | undefined;
|
||||
plugins: readonly Plugin<any>[];
|
||||
private _pluginContextMap;
|
||||
private _pluginContextMapSsr;
|
||||
private _resolvedRollupOptions?;
|
||||
private _processesing;
|
||||
private _seenResolves;
|
||||
private _closed;
|
||||
private _moduleNodeToLoadAddedImports;
|
||||
getSortedPluginHooks: PluginHookUtils['getSortedPluginHooks'];
|
||||
getSortedPlugins: PluginHookUtils['getSortedPlugins'];
|
||||
watchFiles: Set<string>;
|
||||
minimalContext: MinimalPluginContext;
|
||||
private _updateModuleLoadAddedImports;
|
||||
private _getAddedImports;
|
||||
interface PluginContainer {
|
||||
options: InputOptions;
|
||||
getModuleInfo(id: string): ModuleInfo | null;
|
||||
private handleHookPromise;
|
||||
get options(): InputOptions;
|
||||
resolveRollupOptions(): Promise<InputOptions>;
|
||||
private _getPluginContext;
|
||||
private hookParallel;
|
||||
buildStart(_options?: InputOptions): Promise<void>;
|
||||
resolveId(rawId: string, importer?: string | undefined, options?: {
|
||||
buildStart(options: InputOptions): Promise<void>;
|
||||
resolveId(id: string, importer?: string, options?: {
|
||||
attributes?: Record<string, string>;
|
||||
custom?: CustomPluginOptions;
|
||||
skip?: Set<Plugin>;
|
||||
ssr?: boolean;
|
||||
isEntry?: boolean;
|
||||
}): Promise<PartialResolvedId | null>;
|
||||
load(id: string, options?: {
|
||||
ssr?: boolean;
|
||||
}): Promise<LoadResult | null>;
|
||||
transform(code: string, id: string, options?: {
|
||||
ssr?: boolean;
|
||||
inMap?: SourceDescription['map'];
|
||||
ssr?: boolean;
|
||||
}): Promise<{
|
||||
code: string;
|
||||
map: SourceMap | {
|
||||
mappings: '';
|
||||
} | null;
|
||||
}>;
|
||||
load(id: string, options?: {
|
||||
ssr?: boolean;
|
||||
}): Promise<LoadResult | null>;
|
||||
watchChange(id: string, change: {
|
||||
event: 'create' | 'update' | 'delete';
|
||||
}): Promise<void>;
|
||||
|
|
@ -960,7 +907,6 @@ declare class PluginContainer {
|
|||
|
||||
declare const WebSocketAlias: typeof WebSocket
|
||||
interface WebSocketAlias extends WebSocket {}
|
||||
|
||||
// WebSocket socket.
|
||||
declare class WebSocket extends EventEmitter {
|
||||
/** The connection is not yet open. */
|
||||
|
|
@ -1229,6 +1175,7 @@ declare class WebSocket extends EventEmitter {
|
|||
listener: (...args: any[]) => void,
|
||||
): this
|
||||
}
|
||||
// tslint:disable-line no-empty-interface
|
||||
|
||||
declare namespace WebSocket {
|
||||
/**
|
||||
|
|
@ -1478,9 +1425,9 @@ declare namespace WebSocket {
|
|||
}
|
||||
|
||||
const WebSocketServer: typeof Server
|
||||
interface WebSocketServer extends Server {}
|
||||
interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
|
||||
const WebSocket: typeof WebSocketAlias
|
||||
interface WebSocket extends WebSocketAlias {}
|
||||
interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
|
||||
|
||||
// WebSocket stream
|
||||
function createWebSocketStream(
|
||||
|
|
@ -1497,7 +1444,7 @@ interface HmrOptions {
|
|||
path?: string;
|
||||
timeout?: number;
|
||||
overlay?: boolean;
|
||||
server?: HttpServer;
|
||||
server?: Server;
|
||||
}
|
||||
interface HmrContext {
|
||||
file: string;
|
||||
|
|
@ -1613,11 +1560,6 @@ interface ServerOptions extends CommonServerOptions {
|
|||
* Configure HMR-specific options (port, host, path & protocol)
|
||||
*/
|
||||
hmr?: HmrOptions | boolean;
|
||||
/**
|
||||
* Do not start the websocket connection.
|
||||
* @experimental
|
||||
*/
|
||||
ws?: false;
|
||||
/**
|
||||
* Warm-up files to transform and cache the results in advance. This improves the
|
||||
* initial page load during server starts and prevents transform waterfalls.
|
||||
|
|
@ -1647,7 +1589,7 @@ interface ServerOptions extends CommonServerOptions {
|
|||
*
|
||||
* This is needed to proxy WebSocket connections to the parent server.
|
||||
*/
|
||||
server: HttpServer;
|
||||
server: http.Server;
|
||||
};
|
||||
/**
|
||||
* Options for files served via '/\@fs/'.
|
||||
|
|
@ -2122,9 +2064,6 @@ interface RollupDynamicImportVarsOptions {
|
|||
declare namespace Terser {
|
||||
export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
||||
|
||||
export type ConsoleProperty = keyof typeof console
|
||||
type DropConsoleOption = boolean | ConsoleProperty[]
|
||||
|
||||
export interface ParseOptions {
|
||||
bare_returns?: boolean
|
||||
/** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
|
||||
|
|
@ -2145,7 +2084,7 @@ declare namespace Terser {
|
|||
dead_code?: boolean
|
||||
defaults?: boolean
|
||||
directives?: boolean
|
||||
drop_console?: DropConsoleOption
|
||||
drop_console?: boolean
|
||||
drop_debugger?: boolean
|
||||
ecma?: ECMA
|
||||
evaluate?: boolean
|
||||
|
|
@ -2168,7 +2107,6 @@ declare namespace Terser {
|
|||
passes?: number
|
||||
properties?: boolean
|
||||
pure_funcs?: string[]
|
||||
pure_new?: boolean
|
||||
pure_getters?: boolean | 'strict'
|
||||
reduce_funcs?: boolean
|
||||
reduce_vars?: boolean
|
||||
|
|
@ -2218,7 +2156,7 @@ declare namespace Terser {
|
|||
* Obtains the nth most favored (usually shortest) identifier to rename a variable to.
|
||||
* The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
|
||||
* This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
|
||||
* @param n The ordinal of the identifier.
|
||||
* @param n - The ordinal of the identifier.
|
||||
*/
|
||||
get(n: number): string
|
||||
}
|
||||
|
|
@ -2230,8 +2168,8 @@ declare namespace Terser {
|
|||
/**
|
||||
* Modifies the internal weighting of the input characters by the specified delta.
|
||||
* Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
|
||||
* @param chars The characters to modify the weighting of.
|
||||
* @param delta The numeric weight to add to the characters.
|
||||
* @param chars - The characters to modify the weighting of.
|
||||
* @param delta - The numeric weight to add to the characters.
|
||||
*/
|
||||
consider(chars: string, delta: number): number
|
||||
/**
|
||||
|
|
@ -2314,7 +2252,7 @@ declare namespace Terser {
|
|||
module?: boolean
|
||||
nameCache?: object
|
||||
format?: FormatOptions
|
||||
/** @deprecated */
|
||||
/** @deprecated deprecated */
|
||||
output?: FormatOptions
|
||||
parse?: ParseOptions
|
||||
safari10?: boolean
|
||||
|
|
@ -2334,7 +2272,6 @@ declare namespace Terser {
|
|||
includeSources?: boolean
|
||||
filename?: string
|
||||
root?: string
|
||||
asObject?: boolean
|
||||
url?: string | 'inline'
|
||||
}
|
||||
}
|
||||
|
|
@ -2556,7 +2493,7 @@ interface LibraryOptions {
|
|||
*/
|
||||
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
||||
}
|
||||
type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife' | 'system';
|
||||
type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
||||
interface ModulePreloadOptions {
|
||||
/**
|
||||
* Whether to inject a module preload polyfill.
|
||||
|
|
@ -2687,7 +2624,7 @@ interface DepOptimizationConfig {
|
|||
* When enabled, it will hold the first optimized deps results until all static
|
||||
* imports are crawled on cold start. This avoids the need for full-page reloads
|
||||
* when new dependencies are discovered and they trigger the generation of new
|
||||
* common chunks. If all dependencies are found by the scanner plus the explicitly
|
||||
* common chunks. If all dependencies are found by the scanner plus the explicitely
|
||||
* defined ones in `include`, it is better to disable this option to let the
|
||||
* browser process more requests in parallel.
|
||||
* @default true
|
||||
|
|
@ -2923,7 +2860,6 @@ type LightningCSSOptions = {
|
|||
pseudoClasses?: PseudoClasses
|
||||
unusedSymbols?: string[]
|
||||
cssModules?: CSSModulesConfig
|
||||
errorRecovery?: boolean
|
||||
}
|
||||
|
||||
interface CSSOptions {
|
||||
|
|
@ -3426,18 +3362,6 @@ interface LegacyOptions {
|
|||
* https://github.com/vitejs/vite/discussions/14697.
|
||||
*/
|
||||
proxySsrExternalModules?: boolean;
|
||||
/**
|
||||
* In Vite 6.0.8 / 5.4.11 and below, WebSocket server was able to connect from any web pages. However,
|
||||
* that could be exploited by a malicious web page.
|
||||
*
|
||||
* In Vite 6.0.9+ / 5.4.12+, the WebSocket server now requires a token to connect from a web page.
|
||||
* But this may break some plugins and frameworks that connects to the WebSocket server
|
||||
* on their own. Enabling this option will make Vite skip the token check.
|
||||
*
|
||||
* **We do not recommend enabling this option unless you are sure that you are fine with
|
||||
* that security weakness.**
|
||||
*/
|
||||
skipWebSocketTokenCheck?: boolean;
|
||||
}
|
||||
interface ResolvedWorkerOptions {
|
||||
format: 'es' | 'iife';
|
||||
|
|
@ -3479,17 +3403,6 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
|
|||
worker: ResolvedWorkerOptions;
|
||||
appType: AppType;
|
||||
experimental: ExperimentalOptions;
|
||||
/**
|
||||
* The token to connect to the WebSocket server from browsers.
|
||||
*
|
||||
* We recommend using `import.meta.hot` rather than connecting
|
||||
* to the WebSocket server directly.
|
||||
* If you have a usecase that requires connecting to the WebSocket
|
||||
* server, please create an issue so that we can discuss.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
webSocketToken: string;
|
||||
} & PluginHookUtils>;
|
||||
interface PluginHookUtils {
|
||||
getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
|
||||
|
|
@ -3567,10 +3480,8 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|||
|
||||
/**
|
||||
* Check if the url is allowed to be served, via the `server.fs` config.
|
||||
* @deprecated Use the `isFileLoadingAllowed` function instead.
|
||||
*/
|
||||
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
||||
declare function isFileLoadingAllowed(server: ViteDevServer, filePath: string): boolean;
|
||||
|
||||
declare function loadEnv(mode: string, envDir: string, prefixes?: string | string[]): Record<string, string>;
|
||||
declare function resolveEnvPrefix({ envPrefix, }: UserConfig): string[];
|
||||
|
|
@ -3624,4 +3535,4 @@ declare class ServerHMRConnector implements HMRRuntimeConnection {
|
|||
onUpdate(handler: (payload: HMRPayload) => void): void;
|
||||
}
|
||||
|
||||
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
||||
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
||||
import { i as isInNodeModules, a as arraify } from './chunks/dep-BK3b2jBa.js';
|
||||
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, y as isFileLoadingAllowed, x as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-BK3b2jBa.js';
|
||||
import { i as isInNodeModules, a as arraify } from './chunks/dep-p3C6MpSJ.js';
|
||||
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-p3C6MpSJ.js';
|
||||
export { VERSION as version } from './constants.js';
|
||||
export { version as esbuildVersion } from 'esbuild';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
|
|
@ -11,25 +11,23 @@ import 'node:url';
|
|||
import 'node:util';
|
||||
import 'node:perf_hooks';
|
||||
import 'node:module';
|
||||
import 'node:crypto';
|
||||
import 'tty';
|
||||
import 'path';
|
||||
import 'fs';
|
||||
import 'node:events';
|
||||
import 'node:stream';
|
||||
import 'node:string_decoder';
|
||||
import 'events';
|
||||
import 'assert';
|
||||
import 'node:child_process';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'util';
|
||||
import 'net';
|
||||
import 'events';
|
||||
import 'url';
|
||||
import 'http';
|
||||
import 'stream';
|
||||
import 'os';
|
||||
import 'child_process';
|
||||
import 'node:os';
|
||||
import 'node:crypto';
|
||||
import 'node:dns';
|
||||
import 'crypto';
|
||||
import 'module';
|
||||
|
|
@ -37,35 +35,50 @@ import 'node:assert';
|
|||
import 'node:v8';
|
||||
import 'node:worker_threads';
|
||||
import 'node:buffer';
|
||||
import 'node:events';
|
||||
import 'querystring';
|
||||
import 'node:readline';
|
||||
import 'zlib';
|
||||
import 'buffer';
|
||||
import 'https';
|
||||
import 'tls';
|
||||
import 'node:net';
|
||||
import 'assert';
|
||||
import 'node:zlib';
|
||||
|
||||
const CSS_LANGS_RE = (
|
||||
// eslint-disable-next-line regexp/no-unused-capturing-group
|
||||
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/
|
||||
);
|
||||
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
||||
// copy from constants.ts
|
||||
const CSS_LANGS_RE =
|
||||
// eslint-disable-next-line regexp/no-unused-capturing-group
|
||||
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
||||
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
||||
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
|
||||
// We don't recommend using this strategy as a general solution moving forward
|
||||
// splitVendorChunk is a simple index/vendor strategy that was used in Vite
|
||||
// until v2.8. It is exposed to let people continue to use it in case it was
|
||||
// working well for their setups.
|
||||
// The cache needs to be reset on buildStart for watch mode to work correctly
|
||||
// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
|
||||
/**
|
||||
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
||||
*/
|
||||
class SplitVendorChunkCache {
|
||||
cache;
|
||||
constructor() {
|
||||
this.cache = /* @__PURE__ */ new Map();
|
||||
this.cache = new Map();
|
||||
}
|
||||
reset() {
|
||||
this.cache = /* @__PURE__ */ new Map();
|
||||
this.cache = new Map();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
||||
*/
|
||||
function splitVendorChunk(options = {}) {
|
||||
const cache = options.cache ?? new SplitVendorChunkCache();
|
||||
return (id, { getModuleInfo }) => {
|
||||
if (isInNodeModules(id) && !isCSSRequest(id) && staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
||||
return "vendor";
|
||||
if (isInNodeModules(id) &&
|
||||
!isCSSRequest(id) &&
|
||||
staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
||||
return 'vendor';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -74,6 +87,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|||
return cache.get(id);
|
||||
}
|
||||
if (importStack.includes(id)) {
|
||||
// circular deps!
|
||||
cache.set(id, false);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -86,17 +100,13 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|||
cache.set(id, true);
|
||||
return true;
|
||||
}
|
||||
const someImporterIs = mod.importers.some(
|
||||
(importer) => staticImportedByEntry(
|
||||
importer,
|
||||
getModuleInfo,
|
||||
cache,
|
||||
importStack.concat(id)
|
||||
)
|
||||
);
|
||||
const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
|
||||
cache.set(id, someImporterIs);
|
||||
return someImporterIs;
|
||||
}
|
||||
/**
|
||||
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
||||
*/
|
||||
function splitVendorChunkPlugin() {
|
||||
const caches = [];
|
||||
function createSplitVendorChunk(output, config) {
|
||||
|
|
@ -104,12 +114,12 @@ function splitVendorChunkPlugin() {
|
|||
caches.push(cache);
|
||||
const build = config.build ?? {};
|
||||
const format = output?.format;
|
||||
if (!build.ssr && !build.lib && format !== "umd" && format !== "iife") {
|
||||
if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
|
||||
return splitVendorChunk({ cache });
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: "vite:split-vendor-chunk",
|
||||
name: 'vite:split-vendor-chunk',
|
||||
config(config) {
|
||||
let outputs = config?.build?.rollupOptions?.output;
|
||||
if (outputs) {
|
||||
|
|
@ -118,78 +128,82 @@ function splitVendorChunkPlugin() {
|
|||
const viteManualChunks = createSplitVendorChunk(output, config);
|
||||
if (viteManualChunks) {
|
||||
if (output.manualChunks) {
|
||||
if (typeof output.manualChunks === "function") {
|
||||
if (typeof output.manualChunks === 'function') {
|
||||
const userManualChunks = output.manualChunks;
|
||||
output.manualChunks = (id, api) => {
|
||||
return userManualChunks(id, api) ?? viteManualChunks(id, api);
|
||||
};
|
||||
} else {
|
||||
console.warn(
|
||||
"(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead."
|
||||
);
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
// else, leave the object form of manualChunks untouched, as
|
||||
// we can't safely replicate rollup handling.
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
output.manualChunks = viteManualChunks;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return {
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: createSplitVendorChunk({}, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
manualChunks: createSplitVendorChunk({}, config),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
buildStart() {
|
||||
caches.forEach((cache) => cache.reset());
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
class ServerHMRBroadcasterClient {
|
||||
hmrChannel;
|
||||
constructor(hmrChannel) {
|
||||
this.hmrChannel = hmrChannel;
|
||||
}
|
||||
send(...args) {
|
||||
let payload;
|
||||
if (typeof args[0] === "string") {
|
||||
if (typeof args[0] === 'string') {
|
||||
payload = {
|
||||
type: "custom",
|
||||
type: 'custom',
|
||||
event: args[0],
|
||||
data: args[1]
|
||||
data: args[1],
|
||||
};
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
payload = args[0];
|
||||
}
|
||||
if (payload.type !== "custom") {
|
||||
throw new Error(
|
||||
"Cannot send non-custom events from the client to the server."
|
||||
);
|
||||
if (payload.type !== 'custom') {
|
||||
throw new Error('Cannot send non-custom events from the client to the server.');
|
||||
}
|
||||
this.hmrChannel.send(payload);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The connector class to establish HMR communication between the server and the Vite runtime.
|
||||
* @experimental
|
||||
*/
|
||||
class ServerHMRConnector {
|
||||
handlers = [];
|
||||
hmrChannel;
|
||||
hmrClient;
|
||||
connected = false;
|
||||
constructor(server) {
|
||||
const hmrChannel = server.hot?.channels.find(
|
||||
(c) => c.name === "ssr"
|
||||
);
|
||||
const hmrChannel = server.hot?.channels.find((c) => c.name === 'ssr');
|
||||
if (!hmrChannel) {
|
||||
throw new Error(
|
||||
"Your version of Vite doesn't support HMR during SSR. Please, use Vite 5.1 or higher."
|
||||
);
|
||||
throw new Error("Your version of Vite doesn't support HMR during SSR. Please, use Vite 5.1 or higher.");
|
||||
}
|
||||
this.hmrClient = new ServerHMRBroadcasterClient(hmrChannel);
|
||||
hmrChannel.api.outsideEmitter.on("send", (payload) => {
|
||||
hmrChannel.api.outsideEmitter.on('send', (payload) => {
|
||||
this.handlers.forEach((listener) => listener(payload));
|
||||
});
|
||||
this.hmrChannel = hmrChannel;
|
||||
|
|
@ -199,15 +213,11 @@ class ServerHMRConnector {
|
|||
}
|
||||
send(message) {
|
||||
const payload = JSON.parse(message);
|
||||
this.hmrChannel.api.innerEmitter.emit(
|
||||
payload.event,
|
||||
payload.data,
|
||||
this.hmrClient
|
||||
);
|
||||
this.hmrChannel.api.innerEmitter.emit(payload.event, payload.data, this.hmrClient);
|
||||
}
|
||||
onUpdate(handler) {
|
||||
this.handlers.push(handler);
|
||||
handler({ type: "connected" });
|
||||
handler({ type: 'connected' });
|
||||
this.connected = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -219,43 +229,44 @@ function createHMROptions(server, options) {
|
|||
const connection = new ServerHMRConnector(server);
|
||||
return {
|
||||
connection,
|
||||
logger: options.hmr?.logger
|
||||
logger: options.hmr?.logger,
|
||||
};
|
||||
}
|
||||
const prepareStackTrace = {
|
||||
retrieveFile(id) {
|
||||
if (existsSync(id)) {
|
||||
return readFileSync(id, "utf-8");
|
||||
}
|
||||
return readFileSync(id, 'utf-8');
|
||||
}
|
||||
},
|
||||
};
|
||||
function resolveSourceMapOptions(options) {
|
||||
if (options.sourcemapInterceptor != null) {
|
||||
if (options.sourcemapInterceptor === "prepareStackTrace") {
|
||||
if (options.sourcemapInterceptor === 'prepareStackTrace') {
|
||||
return prepareStackTrace;
|
||||
}
|
||||
if (typeof options.sourcemapInterceptor === "object") {
|
||||
if (typeof options.sourcemapInterceptor === 'object') {
|
||||
return { ...prepareStackTrace, ...options.sourcemapInterceptor };
|
||||
}
|
||||
return options.sourcemapInterceptor;
|
||||
}
|
||||
if (typeof process !== "undefined" && "setSourceMapsEnabled" in process) {
|
||||
return "node";
|
||||
if (typeof process !== 'undefined' && 'setSourceMapsEnabled' in process) {
|
||||
return 'node';
|
||||
}
|
||||
return prepareStackTrace;
|
||||
}
|
||||
/**
|
||||
* Create an instance of the Vite SSR runtime that support HMR.
|
||||
* @experimental
|
||||
*/
|
||||
async function createViteRuntime(server, options = {}) {
|
||||
const hmr = createHMROptions(server, options);
|
||||
return new ViteRuntime(
|
||||
{
|
||||
return new ViteRuntime({
|
||||
...options,
|
||||
root: server.config.root,
|
||||
fetchModule: server.ssrFetchModule,
|
||||
hmr,
|
||||
sourcemapInterceptor: resolveSourceMapOptions(options)
|
||||
},
|
||||
options.runner || new ESModulesRunner()
|
||||
);
|
||||
sourcemapInterceptor: resolveSourceMapOptions(options),
|
||||
}, options.runner || new ESModulesRunner());
|
||||
}
|
||||
|
||||
export { ServerHMRConnector, createViteRuntime, isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ function normalizeString(path, allowAboveRoot) {
|
|||
char = "/";
|
||||
}
|
||||
if (char === "/") {
|
||||
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
||||
if (!(lastSlash === index - 1 || dots === 1))
|
||||
if (dots === 2) {
|
||||
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
||||
if (res.length > 2) {
|
||||
const lastSlashIndex = res.lastIndexOf("/");
|
||||
|
|
@ -66,7 +67,8 @@ function normalizeString(path, allowAboveRoot) {
|
|||
} else
|
||||
res.length > 0 ? res += `/${path.slice(lastSlash + 1, index)}` : res = path.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
||||
lastSlash = index, dots = 0;
|
||||
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
||||
} else
|
||||
char === "." && dots !== -1 ? ++dots : dots = -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -94,46 +96,38 @@ for (let i = 0; i < chars.length; i++) {
|
|||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c, charToInt[c] = i;
|
||||
}
|
||||
function decodeInteger(reader, relative) {
|
||||
function decode(mappings) {
|
||||
const state = new Int32Array(5), decoded = [];
|
||||
let index = 0;
|
||||
do {
|
||||
const semi = indexOf(mappings, index), line = [];
|
||||
let sorted = !0, lastCol = 0;
|
||||
state[0] = 0;
|
||||
for (let i = index; i < semi; i++) {
|
||||
let seg;
|
||||
i = decodeInteger(mappings, i, state, 0);
|
||||
const col = state[0];
|
||||
col < lastCol && (sorted = !1), lastCol = col, hasMoreVlq(mappings, i, semi) ? (i = decodeInteger(mappings, i, state, 1), i = decodeInteger(mappings, i, state, 2), i = decodeInteger(mappings, i, state, 3), hasMoreVlq(mappings, i, semi) ? (i = decodeInteger(mappings, i, state, 4), seg = [col, state[1], state[2], state[3], state[4]]) : seg = [col, state[1], state[2], state[3]]) : seg = [col], line.push(seg);
|
||||
}
|
||||
sorted || sort(line), decoded.push(line), index = semi + 1;
|
||||
} while (index <= mappings.length);
|
||||
return decoded;
|
||||
}
|
||||
function indexOf(mappings, index) {
|
||||
const idx = mappings.indexOf(";", index);
|
||||
return idx === -1 ? mappings.length : idx;
|
||||
}
|
||||
function decodeInteger(mappings, pos, state, j) {
|
||||
let value = 0, shift = 0, integer = 0;
|
||||
do {
|
||||
const c = reader.next();
|
||||
const c = mappings.charCodeAt(pos++);
|
||||
integer = charToInt[c], value |= (integer & 31) << shift, shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
return value >>>= 1, shouldNegate && (value = -2147483648 | -value), relative + value;
|
||||
return value >>>= 1, shouldNegate && (value = -2147483648 | -value), state[j] += value, pos;
|
||||
}
|
||||
function hasMoreVlq(reader, max) {
|
||||
return reader.pos >= max ? !1 : reader.peek() !== comma;
|
||||
}
|
||||
class StringReader {
|
||||
constructor(buffer) {
|
||||
this.pos = 0, this.buffer = buffer;
|
||||
}
|
||||
next() {
|
||||
return this.buffer.charCodeAt(this.pos++);
|
||||
}
|
||||
peek() {
|
||||
return this.buffer.charCodeAt(this.pos);
|
||||
}
|
||||
indexOf(char) {
|
||||
const { buffer, pos } = this, idx = buffer.indexOf(char, pos);
|
||||
return idx === -1 ? buffer.length : idx;
|
||||
}
|
||||
}
|
||||
function decode(mappings) {
|
||||
const { length } = mappings, reader = new StringReader(mappings), decoded = [];
|
||||
let genColumn = 0, sourcesIndex = 0, sourceLine = 0, sourceColumn = 0, namesIndex = 0;
|
||||
do {
|
||||
const semi = reader.indexOf(";"), line = [];
|
||||
let sorted = !0, lastCol = 0;
|
||||
for (genColumn = 0; reader.pos < semi; ) {
|
||||
let seg;
|
||||
genColumn = decodeInteger(reader, genColumn), genColumn < lastCol && (sorted = !1), lastCol = genColumn, hasMoreVlq(reader, semi) ? (sourcesIndex = decodeInteger(reader, sourcesIndex), sourceLine = decodeInteger(reader, sourceLine), sourceColumn = decodeInteger(reader, sourceColumn), hasMoreVlq(reader, semi) ? (namesIndex = decodeInteger(reader, namesIndex), seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]) : seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]) : seg = [genColumn], line.push(seg), reader.pos++;
|
||||
}
|
||||
sorted || sort(line), decoded.push(line), reader.pos = semi + 1;
|
||||
} while (reader.pos <= length);
|
||||
return decoded;
|
||||
function hasMoreVlq(mappings, i, length) {
|
||||
return i >= length ? !1 : mappings.charCodeAt(i) !== comma;
|
||||
}
|
||||
function sort(line) {
|
||||
line.sort(sortComparator);
|
||||
|
|
@ -206,13 +200,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|||
return found ? index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index) : bias === LEAST_UPPER_BOUND && index++, index === -1 || index === segments.length ? -1 : index;
|
||||
}
|
||||
class DecodedMap {
|
||||
constructor(map, from) {
|
||||
this.map = map;
|
||||
const { mappings, names, sources } = map;
|
||||
this.version = map.version, this.names = names || [], this._encoded = mappings || "", this._decodedMemo = memoizedState(), this.url = from, this.resolvedSources = (sources || []).map(
|
||||
(s) => posixResolve(s || "", from)
|
||||
);
|
||||
}
|
||||
map;
|
||||
_encoded;
|
||||
_decoded;
|
||||
_decodedMemo;
|
||||
|
|
@ -220,6 +208,11 @@ class DecodedMap {
|
|||
version;
|
||||
names = [];
|
||||
resolvedSources;
|
||||
constructor(map, from) {
|
||||
this.map = map;
|
||||
const { mappings, names, sources } = map;
|
||||
this.version = map.version, this.names = names || [], this._encoded = mappings || "", this._decodedMemo = memoizedState(), this.url = from, this.resolvedSources = (sources || []).map((s) => posixResolve(s || "", from));
|
||||
}
|
||||
}
|
||||
function memoizedState() {
|
||||
return {
|
||||
|
|
@ -232,9 +225,7 @@ function getOriginalPosition(map, needle) {
|
|||
const result = originalPositionFor(map, needle);
|
||||
return result.column == null ? null : result;
|
||||
}
|
||||
const VITE_RUNTIME_SOURCEMAPPING_REGEXP = new RegExp(
|
||||
`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`
|
||||
);
|
||||
const VITE_RUNTIME_SOURCEMAPPING_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
|
||||
class ModuleCacheMap extends Map {
|
||||
root;
|
||||
constructor(root, entries) {
|
||||
|
|
@ -276,16 +267,17 @@ class ModuleCacheMap extends Map {
|
|||
const module = this.get(id);
|
||||
module.evaluated = !1, module.meta = void 0, module.map = void 0, module.promise = void 0, module.exports = void 0, module.imports?.clear();
|
||||
}
|
||||
isImported({
|
||||
importedId,
|
||||
importedBy
|
||||
}, seen = /* @__PURE__ */ new Set()) {
|
||||
if (importedId = this.normalize(importedId), importedBy = this.normalize(importedBy), importedBy === importedId) return !0;
|
||||
if (seen.has(importedId)) return !1;
|
||||
isImported({ importedId, importedBy }, seen = /* @__PURE__ */ new Set()) {
|
||||
if (importedId = this.normalize(importedId), importedBy = this.normalize(importedBy), importedBy === importedId)
|
||||
return !0;
|
||||
if (seen.has(importedId))
|
||||
return !1;
|
||||
seen.add(importedId);
|
||||
const importers = this.getByModuleId(importedId)?.importers;
|
||||
if (!importers) return !1;
|
||||
if (importers.has(importedBy)) return !0;
|
||||
if (!importers)
|
||||
return !1;
|
||||
if (importers.has(importedBy))
|
||||
return !0;
|
||||
for (const importer of importers)
|
||||
if (this.isImported({
|
||||
importedBy,
|
||||
|
|
@ -300,7 +292,8 @@ class ModuleCacheMap extends Map {
|
|||
invalidateDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
|
||||
for (const _id of ids) {
|
||||
const id = this.normalize(_id);
|
||||
if (invalidated.has(id)) continue;
|
||||
if (invalidated.has(id))
|
||||
continue;
|
||||
invalidated.add(id);
|
||||
const mod = super.get(id);
|
||||
mod?.importers && this.invalidateDepTree(mod.importers, invalidated), super.delete(id);
|
||||
|
|
@ -313,7 +306,8 @@ class ModuleCacheMap extends Map {
|
|||
invalidateSubDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
|
||||
for (const _id of ids) {
|
||||
const id = this.normalize(_id);
|
||||
if (invalidated.has(id)) continue;
|
||||
if (invalidated.has(id))
|
||||
continue;
|
||||
invalidated.add(id);
|
||||
const subIds = Array.from(super.entries()).filter(([, mod]) => mod.importers?.has(id)).map(([key]) => key);
|
||||
subIds.length && this.invalidateSubDepTree(subIds, invalidated), super.delete(id);
|
||||
|
|
@ -322,21 +316,28 @@ class ModuleCacheMap extends Map {
|
|||
}
|
||||
getSourceMap(moduleId) {
|
||||
const mod = this.get(moduleId);
|
||||
if (mod.map) return mod.map;
|
||||
if (!mod.meta || !("code" in mod.meta)) return null;
|
||||
const mapString = VITE_RUNTIME_SOURCEMAPPING_REGEXP.exec(mod.meta.code)?.[1];
|
||||
if (!mapString) return null;
|
||||
if (mod.map)
|
||||
return mod.map;
|
||||
if (!mod.meta || !("code" in mod.meta))
|
||||
return null;
|
||||
const mapString = mod.meta.code.match(VITE_RUNTIME_SOURCEMAPPING_REGEXP)?.[1];
|
||||
if (!mapString)
|
||||
return null;
|
||||
const baseFile = mod.meta.file || moduleId.split("?")[0];
|
||||
return mod.map = new DecodedMap(JSON.parse(decodeBase64(mapString)), baseFile), mod.map;
|
||||
}
|
||||
}
|
||||
const prefixedBuiltins = /* @__PURE__ */ new Set(["node:test"]);
|
||||
function normalizeModuleId(file, root) {
|
||||
if (prefixedBuiltins.has(file)) return file;
|
||||
if (prefixedBuiltins.has(file))
|
||||
return file;
|
||||
let unixFile = slash(file).replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
|
||||
return unixFile.startsWith(root) && (unixFile = unixFile.slice(root.length - 1)), unixFile.replace(/^file:\//, "/");
|
||||
}
|
||||
class HMRContext {
|
||||
hmrClient;
|
||||
ownerPath;
|
||||
newListeners;
|
||||
constructor(hmrClient, ownerPath) {
|
||||
this.hmrClient = hmrClient, this.ownerPath = ownerPath, hmrClient.dataMap.has(ownerPath) || hmrClient.dataMap.set(ownerPath, {});
|
||||
const mod = hmrClient.hotModulesMap.get(ownerPath);
|
||||
|
|
@ -345,14 +346,10 @@ class HMRContext {
|
|||
if (staleListeners)
|
||||
for (const [event, staleFns] of staleListeners) {
|
||||
const listeners = hmrClient.customListenersMap.get(event);
|
||||
listeners && hmrClient.customListenersMap.set(
|
||||
event,
|
||||
listeners.filter((l) => !staleFns.includes(l))
|
||||
);
|
||||
listeners && hmrClient.customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
|
||||
}
|
||||
this.newListeners = /* @__PURE__ */ new Map(), hmrClient.ctxToListenersMap.set(ownerPath, this.newListeners);
|
||||
}
|
||||
newListeners;
|
||||
get data() {
|
||||
return this.hmrClient.dataMap.get(this.ownerPath);
|
||||
}
|
||||
|
|
@ -385,9 +382,7 @@ class HMRContext {
|
|||
this.hmrClient.notifyListeners("vite:invalidate", {
|
||||
path: this.ownerPath,
|
||||
message
|
||||
}), this.send("vite:invalidate", { path: this.ownerPath, message }), this.hmrClient.logger.debug(
|
||||
`[vite] invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`
|
||||
);
|
||||
}), this.send("vite:invalidate", { path: this.ownerPath, message }), this.hmrClient.logger.debug(`[vite] invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`);
|
||||
}
|
||||
on(event, cb) {
|
||||
const addToMap = (map) => {
|
||||
|
|
@ -411,9 +406,7 @@ class HMRContext {
|
|||
removeFromMap(this.hmrClient.customListenersMap), removeFromMap(this.newListeners);
|
||||
}
|
||||
send(event, data) {
|
||||
this.hmrClient.messenger.send(
|
||||
JSON.stringify({ type: "custom", event, data })
|
||||
);
|
||||
this.hmrClient.messenger.send(JSON.stringify({ type: "custom", event, data }));
|
||||
}
|
||||
acceptDeps(deps, callback = () => {
|
||||
}) {
|
||||
|
|
@ -428,6 +421,7 @@ class HMRContext {
|
|||
}
|
||||
}
|
||||
class HMRMessenger {
|
||||
connection;
|
||||
constructor(connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
|
@ -440,9 +434,8 @@ class HMRMessenger {
|
|||
}
|
||||
}
|
||||
class HMRClient {
|
||||
constructor(logger, connection, importUpdatedModule) {
|
||||
this.logger = logger, this.importUpdatedModule = importUpdatedModule, this.messenger = new HMRMessenger(connection);
|
||||
}
|
||||
logger;
|
||||
importUpdatedModule;
|
||||
hotModulesMap = /* @__PURE__ */ new Map();
|
||||
disposeMap = /* @__PURE__ */ new Map();
|
||||
pruneMap = /* @__PURE__ */ new Map();
|
||||
|
|
@ -450,6 +443,9 @@ class HMRClient {
|
|||
customListenersMap = /* @__PURE__ */ new Map();
|
||||
ctxToListenersMap = /* @__PURE__ */ new Map();
|
||||
messenger;
|
||||
constructor(logger, connection, importUpdatedModule) {
|
||||
this.logger = logger, this.importUpdatedModule = importUpdatedModule, this.messenger = new HMRMessenger(connection);
|
||||
}
|
||||
async notifyListeners(event, data) {
|
||||
const cbs = this.customListenersMap.get(event);
|
||||
cbs && await Promise.allSettled(cbs.map((cb) => cb(data)));
|
||||
|
|
@ -461,20 +457,17 @@ class HMRClient {
|
|||
// but they may have left behind side effects that need to be cleaned up
|
||||
// (.e.g style injections)
|
||||
async prunePaths(paths) {
|
||||
await Promise.all(
|
||||
paths.map((path) => {
|
||||
await Promise.all(paths.map((path) => {
|
||||
const disposer = this.disposeMap.get(path);
|
||||
if (disposer) return disposer(this.dataMap.get(path));
|
||||
})
|
||||
), paths.forEach((path) => {
|
||||
if (disposer)
|
||||
return disposer(this.dataMap.get(path));
|
||||
})), paths.forEach((path) => {
|
||||
const fn = this.pruneMap.get(path);
|
||||
fn && fn(this.dataMap.get(path));
|
||||
});
|
||||
}
|
||||
warnFailedUpdate(err, path) {
|
||||
err.message.includes("fetch") || this.logger.error(err), this.logger.error(
|
||||
`[hmr] Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`
|
||||
);
|
||||
err.message.includes("fetch") || this.logger.error(err), this.logger.error(`[hmr] Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`);
|
||||
}
|
||||
updateQueue = [];
|
||||
pendingUpdateQueue = !1;
|
||||
|
|
@ -495,9 +488,7 @@ class HMRClient {
|
|||
if (!mod)
|
||||
return;
|
||||
let fetchedModule;
|
||||
const isSelfUpdate = path === acceptedPath, qualifiedCallbacks = mod.callbacks.filter(
|
||||
({ deps }) => deps.includes(acceptedPath)
|
||||
);
|
||||
const isSelfUpdate = path === acceptedPath, qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
|
||||
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
||||
const disposer = this.disposeMap.get(acceptedPath);
|
||||
disposer && await disposer(this.dataMap.get(acceptedPath));
|
||||
|
|
@ -509,22 +500,18 @@ class HMRClient {
|
|||
}
|
||||
return () => {
|
||||
for (const { deps, fn } of qualifiedCallbacks)
|
||||
fn(
|
||||
deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0)
|
||||
);
|
||||
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
|
||||
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
||||
this.logger.debug(`[vite] hot updated: ${loggedPath}`);
|
||||
};
|
||||
}
|
||||
}
|
||||
function analyzeImportedModDifference(mod, rawId, moduleType, metadata) {
|
||||
if (!metadata?.isDynamicImport && metadata?.importedNames?.length) {
|
||||
if (!metadata?.isDynamicImport && moduleType !== "module" && metadata?.importedNames?.length) {
|
||||
const missingBindings = metadata.importedNames.filter((s) => !(s in mod));
|
||||
if (missingBindings.length) {
|
||||
const lastBinding = missingBindings[missingBindings.length - 1];
|
||||
throw moduleType === "module" ? new SyntaxError(
|
||||
`[vite] The requested module '${rawId}' does not provide an export named '${lastBinding}'`
|
||||
) : new SyntaxError(`[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
|
||||
throw new SyntaxError(`[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
|
||||
CommonJS modules can always be imported via the default export, for example using:
|
||||
|
||||
import pkg from '${rawId}';
|
||||
|
|
@ -533,6 +520,15 @@ const {${missingBindings.join(", ")}} = pkg;
|
|||
}
|
||||
}
|
||||
}
|
||||
function proxyGuardOnlyEsm(mod, rawId, metadata) {
|
||||
return metadata?.importedNames?.length ? new Proxy(mod, {
|
||||
get(mod2, prop) {
|
||||
if (prop !== "then" && !(prop in mod2))
|
||||
throw new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${prop.toString()}'`);
|
||||
return mod2[prop];
|
||||
}
|
||||
}) : mod;
|
||||
}
|
||||
const ssrModuleExportsKey = "__vite_ssr_exports__", ssrImportKey = "__vite_ssr_import__", ssrDynamicImportKey = "__vite_ssr_dynamic_import__", ssrExportAllKey = "__vite_ssr_exportAll__", ssrImportMetaKey = "__vite_ssr_import_meta__", noop = () => {
|
||||
}, silentConsole = {
|
||||
debug: noop,
|
||||
|
|
@ -550,28 +546,23 @@ async function handleHMRPayload(runtime, payload) {
|
|||
hmrClient.logger.debug("[vite] connected."), hmrClient.messenger.flush();
|
||||
break;
|
||||
case "update":
|
||||
await hmrClient.notifyListeners("vite:beforeUpdate", payload), await Promise.all(
|
||||
payload.updates.map(async (update) => {
|
||||
await hmrClient.notifyListeners("vite:beforeUpdate", payload), await Promise.all(payload.updates.map(async (update) => {
|
||||
if (update.type === "js-update")
|
||||
return update.acceptedPath = unwrapId(update.acceptedPath), update.path = unwrapId(update.path), hmrClient.queueUpdate(update);
|
||||
hmrClient.logger.error(
|
||||
"[vite] css hmr is not supported in runtime mode."
|
||||
);
|
||||
})
|
||||
), await hmrClient.notifyListeners("vite:afterUpdate", payload);
|
||||
hmrClient.logger.error("[vite] css hmr is not supported in runtime mode.");
|
||||
})), await hmrClient.notifyListeners("vite:afterUpdate", payload);
|
||||
break;
|
||||
case "custom": {
|
||||
await hmrClient.notifyListeners(payload.event, payload.data);
|
||||
break;
|
||||
}
|
||||
case "full-reload": {
|
||||
const { triggeredBy } = payload, clearEntrypoints = triggeredBy ? [...runtime.entrypoints].filter(
|
||||
(entrypoint) => runtime.moduleCache.isImported({
|
||||
const { triggeredBy } = payload, clearEntrypoints = triggeredBy ? [...runtime.entrypoints].filter((entrypoint) => runtime.moduleCache.isImported({
|
||||
importedId: triggeredBy,
|
||||
importedBy: entrypoint
|
||||
})
|
||||
) : [...runtime.entrypoints];
|
||||
if (!clearEntrypoints.length) break;
|
||||
})) : [...runtime.entrypoints];
|
||||
if (!clearEntrypoints.length)
|
||||
break;
|
||||
hmrClient.logger.debug("[vite] program reload"), await hmrClient.notifyListeners("vite:beforeFullReload", payload), runtime.moduleCache.clear();
|
||||
for (const id of clearEntrypoints)
|
||||
await runtime.executeUrl(id);
|
||||
|
|
@ -583,11 +574,9 @@ async function handleHMRPayload(runtime, payload) {
|
|||
case "error": {
|
||||
await hmrClient.notifyListeners("vite:error", payload);
|
||||
const err = payload.err;
|
||||
hmrClient.logger.error(
|
||||
`[vite] Internal Server Error
|
||||
hmrClient.logger.error(`[vite] Internal Server Error
|
||||
${err.message}
|
||||
${err.stack}`
|
||||
);
|
||||
${err.stack}`);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -618,12 +607,11 @@ class Queue {
|
|||
const sourceMapCache = {}, fileContentsCache = {}, moduleGraphs = /* @__PURE__ */ new Set(), retrieveFileHandlers = /* @__PURE__ */ new Set(), retrieveSourceMapHandlers = /* @__PURE__ */ new Set(), createExecHandlers = (handlers) => (...args) => {
|
||||
for (const handler of handlers) {
|
||||
const result = handler(...args);
|
||||
if (result) return result;
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}, retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers), retrieveSourceMapFromHandlers = createExecHandlers(
|
||||
retrieveSourceMapHandlers
|
||||
);
|
||||
}, retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers), retrieveSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
|
||||
let overridden = !1;
|
||||
const originalPrepare = Error.prepareStackTrace;
|
||||
function resetInterceptor(runtime, options) {
|
||||
|
|
@ -633,7 +621,8 @@ function interceptStackTrace(runtime, options = {}) {
|
|||
return overridden || (Error.prepareStackTrace = prepareStackTrace, overridden = !0), moduleGraphs.add(runtime.moduleCache), options.retrieveFile && retrieveFileHandlers.add(options.retrieveFile), options.retrieveSourceMap && retrieveSourceMapHandlers.add(options.retrieveSourceMap), () => resetInterceptor(runtime, options);
|
||||
}
|
||||
function supportRelativeURL(file, url) {
|
||||
if (!file) return url;
|
||||
if (!file)
|
||||
return url;
|
||||
const dir = posixDirname(slash(file)), match = /^\w+:\/\/[^/]*/.exec(dir);
|
||||
let protocol = match ? match[0] : "";
|
||||
const startPath = dir.slice(protocol.length);
|
||||
|
|
@ -652,24 +641,29 @@ function getRuntimeSourceMap(position) {
|
|||
return null;
|
||||
}
|
||||
function retrieveFile(path) {
|
||||
if (path in fileContentsCache) return fileContentsCache[path];
|
||||
if (path in fileContentsCache)
|
||||
return fileContentsCache[path];
|
||||
const content = retrieveFileFromHandlers(path);
|
||||
return typeof content == "string" ? (fileContentsCache[path] = content, content) : null;
|
||||
}
|
||||
function retrieveSourceMapURL(source) {
|
||||
const fileData = retrieveFile(source);
|
||||
if (!fileData) return null;
|
||||
if (!fileData)
|
||||
return null;
|
||||
const re = /\/\/[@#]\s*sourceMappingURL=([^\s'"]+)\s*$|\/\*[@#]\s*sourceMappingURL=[^\s*'"]+\s*\*\/\s*$/gm;
|
||||
let lastMatch, match;
|
||||
for (; match = re.exec(fileData); ) lastMatch = match;
|
||||
for (; match = re.exec(fileData); )
|
||||
lastMatch = match;
|
||||
return lastMatch ? lastMatch[1] : null;
|
||||
}
|
||||
const reSourceMap = /^data:application\/json[^,]+base64,/;
|
||||
function retrieveSourceMap(source) {
|
||||
const urlAndMap = retrieveSourceMapFromHandlers(source);
|
||||
if (urlAndMap) return urlAndMap;
|
||||
if (urlAndMap)
|
||||
return urlAndMap;
|
||||
let sourceMappingURL = retrieveSourceMapURL(source);
|
||||
if (!sourceMappingURL) return null;
|
||||
if (!sourceMappingURL)
|
||||
return null;
|
||||
let sourceMapData;
|
||||
if (reSourceMap.test(sourceMappingURL)) {
|
||||
const rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1);
|
||||
|
|
@ -682,7 +676,8 @@ function retrieveSourceMap(source) {
|
|||
} : null;
|
||||
}
|
||||
function mapSourcePosition(position) {
|
||||
if (!position.source) return position;
|
||||
if (!position.source)
|
||||
return position;
|
||||
let sourceMap = getRuntimeSourceMap(position);
|
||||
if (sourceMap || (sourceMap = sourceMapCache[position.source]), !sourceMap) {
|
||||
const urlAndMap = retrieveSourceMap(position.source);
|
||||
|
|
@ -690,10 +685,7 @@ function mapSourcePosition(position) {
|
|||
const url = urlAndMap.url;
|
||||
sourceMap = sourceMapCache[position.source] = {
|
||||
url,
|
||||
map: new DecodedMap(
|
||||
typeof urlAndMap.map == "string" ? JSON.parse(urlAndMap.map) : urlAndMap.map,
|
||||
url
|
||||
)
|
||||
map: new DecodedMap(typeof urlAndMap.map == "string" ? JSON.parse(urlAndMap.map) : urlAndMap.map, url)
|
||||
};
|
||||
const contents = sourceMap.map?.map.sourcesContent;
|
||||
sourceMap.map && contents && sourceMap.map.resolvedSources.forEach((source, i) => {
|
||||
|
|
@ -712,10 +704,7 @@ function mapSourcePosition(position) {
|
|||
if (sourceMap && sourceMap.map && sourceMap.url) {
|
||||
const originalPosition = getOriginalPosition(sourceMap.map, position);
|
||||
if (originalPosition && originalPosition.source != null)
|
||||
return originalPosition.source = supportRelativeURL(
|
||||
sourceMap.url,
|
||||
originalPosition.source
|
||||
), sourceMap.vite && (originalPosition._vite = !0), originalPosition;
|
||||
return originalPosition.source = supportRelativeURL(sourceMap.url, originalPosition.source), sourceMap.vite && (originalPosition._vite = !0), originalPosition;
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
|
@ -749,14 +738,13 @@ function CallSiteToString() {
|
|||
const functionName = this.getFunctionName();
|
||||
let addSuffix = !0;
|
||||
const isConstructor = this.isConstructor();
|
||||
if (this.isToplevel() || isConstructor)
|
||||
isConstructor ? line += `new ${functionName || "<anonymous>"}` : functionName ? line += functionName : (line += fileLocation, addSuffix = !1);
|
||||
else {
|
||||
if (!(this.isToplevel() || isConstructor)) {
|
||||
let typeName = this.getTypeName();
|
||||
typeName === "[object Object]" && (typeName = "null");
|
||||
const methodName = this.getMethodName();
|
||||
functionName ? (typeName && functionName.indexOf(typeName) !== 0 && (line += `${typeName}.`), line += functionName, methodName && functionName.indexOf(`.${methodName}`) !== functionName.length - methodName.length - 1 && (line += ` [as ${methodName}]`)) : line += `${typeName}.${methodName || "<anonymous>"}`;
|
||||
}
|
||||
} else
|
||||
isConstructor ? line += `new ${functionName || "<anonymous>"}` : functionName ? line += functionName : (line += fileLocation, addSuffix = !1);
|
||||
return addSuffix && (line += ` (${fileLocation})`), line;
|
||||
}
|
||||
function cloneCallSite(frame) {
|
||||
|
|
@ -813,29 +801,18 @@ function prepareStackTrace(error, stack) {
|
|||
function enableSourceMapSupport(runtime) {
|
||||
if (runtime.options.sourcemapInterceptor === "node") {
|
||||
if (typeof process > "u")
|
||||
throw new TypeError(
|
||||
`Cannot use "sourcemapInterceptor: 'node'" because global "process" variable is not available.`
|
||||
);
|
||||
throw new TypeError(`Cannot use "sourcemapInterceptor: 'node'" because global "process" variable is not available.`);
|
||||
if (typeof process.setSourceMapsEnabled != "function")
|
||||
throw new TypeError(
|
||||
`Cannot use "sourcemapInterceptor: 'node'" because "process.setSourceMapsEnabled" function is not available. Please use Node >= 16.6.0.`
|
||||
);
|
||||
throw new TypeError(`Cannot use "sourcemapInterceptor: 'node'" because "process.setSourceMapsEnabled" function is not available. Please use Node >= 16.6.0.`);
|
||||
const isEnabledAlready = process.sourceMapsEnabled ?? !1;
|
||||
return process.setSourceMapsEnabled(!0), () => !isEnabledAlready && process.setSourceMapsEnabled(!1);
|
||||
}
|
||||
return interceptStackTrace(
|
||||
runtime,
|
||||
typeof runtime.options.sourcemapInterceptor == "object" ? runtime.options.sourcemapInterceptor : void 0
|
||||
);
|
||||
return interceptStackTrace(runtime, typeof runtime.options.sourcemapInterceptor == "object" ? runtime.options.sourcemapInterceptor : void 0);
|
||||
}
|
||||
class ViteRuntime {
|
||||
constructor(options, runner, debug) {
|
||||
this.options = options, this.runner = runner, this.debug = debug, this.moduleCache = options.moduleCache ?? new ModuleCacheMap(options.root), typeof options.hmr == "object" && (this.hmrClient = new HMRClient(
|
||||
options.hmr.logger === !1 ? silentConsole : options.hmr.logger || console,
|
||||
options.hmr.connection,
|
||||
({ acceptedPath, ssrInvalidates }) => (this.moduleCache.invalidate(acceptedPath), ssrInvalidates && this.invalidateFiles(ssrInvalidates), this.executeUrl(acceptedPath))
|
||||
), options.hmr.connection.onUpdate(createHMRHandler(this))), options.sourcemapInterceptor !== !1 && (this._resetSourceMapSupport = enableSourceMapSupport(this));
|
||||
}
|
||||
options;
|
||||
runner;
|
||||
debug;
|
||||
/**
|
||||
* Holds the cache of modules
|
||||
* Keys of the map are ids
|
||||
|
|
@ -847,13 +824,14 @@ class ViteRuntime {
|
|||
fileToIdMap = /* @__PURE__ */ new Map();
|
||||
envProxy = new Proxy({}, {
|
||||
get(_, p) {
|
||||
throw new Error(
|
||||
`[vite-runtime] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`
|
||||
);
|
||||
throw new Error(`[vite-runtime] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
||||
}
|
||||
});
|
||||
_destroyed = !1;
|
||||
_resetSourceMapSupport;
|
||||
constructor(options, runner, debug) {
|
||||
this.options = options, this.runner = runner, this.debug = debug, this.moduleCache = options.moduleCache ?? new ModuleCacheMap(options.root), typeof options.hmr == "object" && (this.hmrClient = new HMRClient(options.hmr.logger === !1 ? silentConsole : options.hmr.logger || console, options.hmr.connection, ({ acceptedPath, ssrInvalidates }) => (this.moduleCache.invalidate(acceptedPath), ssrInvalidates && this.invalidateFiles(ssrInvalidates), this.executeUrl(acceptedPath))), options.hmr.connection.onUpdate(createHMRHandler(this))), options.sourcemapInterceptor !== !1 && (this._resetSourceMapSupport = enableSourceMapSupport(this));
|
||||
}
|
||||
/**
|
||||
* URL to execute. Accepts file path, server path or id relative to the root.
|
||||
*/
|
||||
|
|
@ -913,7 +891,7 @@ class ViteRuntime {
|
|||
if (!("externalize" in fetchResult))
|
||||
return exports;
|
||||
const { id, type } = fetchResult;
|
||||
return type !== "module" && type !== "commonjs" || analyzeImportedModDifference(exports, id, type, metadata), exports;
|
||||
return type !== "module" && type !== "commonjs" ? exports : (analyzeImportedModDifference(exports, id, type, metadata), proxyGuardOnlyEsm(exports, id, metadata));
|
||||
}
|
||||
async cachedRequest(id, fetchedModule, callstack = [], metadata) {
|
||||
const moduleId = fetchedModule.id;
|
||||
|
|
@ -926,10 +904,8 @@ class ViteRuntime {
|
|||
const getStack = () => `stack:
|
||||
${[...callstack, moduleId].reverse().map((p) => ` - ${p}`).join(`
|
||||
`)}`;
|
||||
this.debug(
|
||||
`[vite-runtime] module ${moduleId} takes over 2s to load.
|
||||
${getStack()}`
|
||||
);
|
||||
this.debug(`[vite-runtime] module ${moduleId} takes over 2s to load.
|
||||
${getStack()}`);
|
||||
}, 2e3));
|
||||
try {
|
||||
if (mod.promise)
|
||||
|
|
@ -972,9 +948,7 @@ ${getStack()}`
|
|||
const { code, file } = fetchResult;
|
||||
if (code == null) {
|
||||
const importer = callstack[callstack.length - 2];
|
||||
throw new Error(
|
||||
`[vite-runtime] Failed to load "${id}"${importer ? ` imported from ${importer}` : ""}`
|
||||
);
|
||||
throw new Error(`[vite-runtime] Failed to load "${id}"${importer ? ` imported from ${importer}` : ""}`);
|
||||
}
|
||||
const modulePath = cleanUrl(file || moduleId), href = posixPathToFileHref(modulePath), filename = modulePath, dirname2 = posixDirname(modulePath), meta = {
|
||||
filename: isWindows ? toWindowsPath(filename) : filename,
|
||||
|
|
@ -982,9 +956,7 @@ ${getStack()}`
|
|||
url: href,
|
||||
env: this.envProxy,
|
||||
resolve(id2, parent) {
|
||||
throw new Error(
|
||||
'[vite-runtime] "import.meta.resolve" is not supported.'
|
||||
);
|
||||
throw new Error('[vite-runtime] "import.meta.resolve" is not supported.');
|
||||
},
|
||||
// should be replaced during transformation
|
||||
glob() {
|
||||
|
|
@ -1042,13 +1014,7 @@ class ESModulesRunner {
|
|||
ssrExportAllKey,
|
||||
// source map should already be inlined by Vite
|
||||
'"use strict";' + code
|
||||
)(
|
||||
context[ssrModuleExportsKey],
|
||||
context[ssrImportMetaKey],
|
||||
context[ssrImportKey],
|
||||
context[ssrDynamicImportKey],
|
||||
context[ssrExportAllKey]
|
||||
), Object.seal(context[ssrModuleExportsKey]);
|
||||
)(context[ssrModuleExportsKey], context[ssrImportMetaKey], context[ssrImportKey], context[ssrDynamicImportKey], context[ssrExportAllKey]), Object.seal(context[ssrModuleExportsKey]);
|
||||
}
|
||||
runExternalModule(filepath) {
|
||||
return import(filepath);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
warnCjsUsage()
|
||||
|
||||
// type utils
|
||||
module.exports.defineConfig = (config) => config
|
||||
|
||||
// proxy cjs utils (sync functions)
|
||||
// eslint-disable-next-line n/no-missing-require -- will be generated by build
|
||||
Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs'))
|
||||
|
||||
// async functions, can be redirect from ESM build
|
||||
|
|
@ -25,36 +28,11 @@ asyncFunctions.forEach((name) => {
|
|||
|
||||
function warnCjsUsage() {
|
||||
if (process.env.VITE_CJS_IGNORE_WARNING) return
|
||||
const logLevelIndex = process.argv.findIndex((arg) =>
|
||||
/^(?:-l|--logLevel)/.test(arg),
|
||||
)
|
||||
if (logLevelIndex > 0) {
|
||||
const logLevelValue = process.argv[logLevelIndex + 1]
|
||||
if (logLevelValue === 'silent' || logLevelValue === 'error') {
|
||||
return
|
||||
}
|
||||
if (/silent|error/.test(process.argv[logLevelIndex])) {
|
||||
return
|
||||
}
|
||||
}
|
||||
const yellow = (str) => `\u001b[33m${str}\u001b[39m`
|
||||
console.warn(
|
||||
const log = process.env.VITE_CJS_TRACE ? console.trace : console.warn
|
||||
log(
|
||||
yellow(
|
||||
`The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
|
||||
`The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
|
||||
),
|
||||
)
|
||||
if (process.env.VITE_CJS_TRACE) {
|
||||
const e = {}
|
||||
const stackTraceLimit = Error.stackTraceLimit
|
||||
Error.stackTraceLimit = 100
|
||||
Error.captureStackTrace(e)
|
||||
Error.stackTraceLimit = stackTraceLimit
|
||||
console.log(
|
||||
e.stack
|
||||
.split('\n')
|
||||
.slice(1)
|
||||
.filter((line) => !line.includes('(node:'))
|
||||
.join('\n'),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @deprecated The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
|
||||
* @deprecated The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
|
||||
*/
|
||||
declare const module: any
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vite",
|
||||
"version": "5.4.21",
|
||||
"version": "5.2.14",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
|
|
@ -68,30 +68,33 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/vitejs/vite/issues"
|
||||
},
|
||||
"homepage": "https://vite.dev",
|
||||
"homepage": "https://vitejs.dev",
|
||||
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
||||
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.21.3",
|
||||
"postcss": "^8.4.43",
|
||||
"rollup": "^4.20.0"
|
||||
"esbuild": "^0.20.1",
|
||||
"postcss": "^8.4.38",
|
||||
"rollup": "^4.13.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ampproject/remapping": "^2.3.0",
|
||||
"@babel/parser": "^7.25.6",
|
||||
"@babel/parser": "^7.24.6",
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"@polka/compression": "^1.0.0-next.25",
|
||||
"@rollup/plugin-alias": "^5.1.0",
|
||||
"@rollup/plugin-commonjs": "^26.0.1",
|
||||
"@rollup/plugin-commonjs": "^25.0.8",
|
||||
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "15.2.3",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@rollup/pluginutils": "^5.1.0",
|
||||
"@types/escape-html": "^1.0.4",
|
||||
"@types/pnpapi": "^0.0.5",
|
||||
"acorn": "^8.11.3",
|
||||
"acorn-walk": "^8.3.2",
|
||||
"artichokie": "^0.2.1",
|
||||
"cac": "^6.7.14",
|
||||
"chokidar": "^3.6.0",
|
||||
|
|
@ -99,21 +102,21 @@
|
|||
"convert-source-map": "^2.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"debug": "^4.3.6",
|
||||
"debug": "^4.3.4",
|
||||
"dep-types": "link:./src/types",
|
||||
"dotenv": "^16.4.5",
|
||||
"dotenv-expand": "^11.0.6",
|
||||
"es-module-lexer": "^1.5.4",
|
||||
"es-module-lexer": "^1.5.3",
|
||||
"escape-html": "^1.0.3",
|
||||
"estree-walker": "^3.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fast-glob": "^3.3.2",
|
||||
"http-proxy": "^1.18.1",
|
||||
"launch-editor-middleware": "^2.9.1",
|
||||
"lightningcss": "^1.26.0",
|
||||
"magic-string": "^0.30.11",
|
||||
"micromatch": "^4.0.8",
|
||||
"mlly": "^1.7.1",
|
||||
"launch-editor-middleware": "^2.6.1",
|
||||
"lightningcss": "^1.25.1",
|
||||
"magic-string": "^0.30.10",
|
||||
"micromatch": "^4.0.7",
|
||||
"mlly": "^1.7.0",
|
||||
"mrmime": "^2.0.0",
|
||||
"open": "^8.4.2",
|
||||
"parse5": "^7.1.2",
|
||||
|
|
@ -127,25 +130,23 @@
|
|||
"resolve.exports": "^2.0.2",
|
||||
"rollup-plugin-dts": "^6.1.1",
|
||||
"rollup-plugin-esbuild": "^6.1.1",
|
||||
"rollup-plugin-license": "^3.5.2",
|
||||
"sass": "^1.77.8",
|
||||
"sass-embedded": "^1.77.8",
|
||||
"rollup-plugin-license": "^3.4.0",
|
||||
"sass": "^1.77.2",
|
||||
"sirv": "^2.0.4",
|
||||
"source-map-support": "^0.5.21",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"strip-literal": "^2.1.0",
|
||||
"tsconfck": "^3.1.4",
|
||||
"tslib": "^2.7.0",
|
||||
"tsconfck": "^3.0.3",
|
||||
"tslib": "^2.6.2",
|
||||
"types": "link:./types",
|
||||
"ufo": "^1.5.4",
|
||||
"ws": "^8.18.0"
|
||||
"ufo": "^1.5.3",
|
||||
"ws": "^8.17.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^18.0.0 || >=20.0.0",
|
||||
"less": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"sass": "*",
|
||||
"sass-embedded": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"terser": "^5.4.0"
|
||||
|
|
@ -157,9 +158,6 @@
|
|||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
|
|
@ -177,12 +175,12 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "tsx scripts/dev.ts",
|
||||
"dev": "rimraf dist && pnpm run build-bundle -w",
|
||||
"build": "rimraf dist && run-s build-bundle build-types",
|
||||
"build-bundle": "rollup --config rollup.config.ts --configPlugin esbuild",
|
||||
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
|
||||
"build-types": "run-s build-types-temp build-types-roll build-types-check",
|
||||
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
|
||||
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && rimraf temp",
|
||||
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
|
||||
"build-types-check": "tsc --project tsconfig.check.json",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint --cache --ext .ts src/**",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev:simple": "node dev-server.mjs",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest",
|
||||
"test:e2e": "playwright test"
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ const fetchPermissions = async () => {
|
|||
loading.value = true
|
||||
try {
|
||||
const res = await getPermissions()
|
||||
permissions.value = res.data || []
|
||||
permissions.value = res.data.data || []
|
||||
pagination.total = permissions.value.length
|
||||
} catch {
|
||||
message.error('获取权限列表失败')
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const fetchRoles = async () => {
|
|||
loading.value = true
|
||||
try {
|
||||
const res = await getRoles()
|
||||
roles.value = res.data
|
||||
roles.value = res.data.data || []
|
||||
} catch {
|
||||
message.error('获取角色列表失败')
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ const fetchUsers = async () => {
|
|||
if (searchKeyword.value) params.keyword = searchKeyword.value
|
||||
if (searchStatus.value) params.status = searchStatus.value
|
||||
const res = await getUsers(params)
|
||||
users.value = res.data
|
||||
users.value = res.data.data || []
|
||||
} catch {
|
||||
message.error('获取用户列表失败')
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in New Issue