vite-plugin-preloader 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +340 -195
- package/dist/index.d.mts +36 -5
- package/dist/index.d.ts +36 -5
- package/dist/index.js +244 -258
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +234 -258
- package/dist/index.mjs.map +1 -1
- package/package.json +80 -81
package/dist/index.d.mts
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
|
|
3
3
|
interface PreloadRoute {
|
|
4
|
+
/** 路由路径,如 /dashboard。含 :param 的动态路由会被自动过滤 */
|
|
4
5
|
path: string;
|
|
6
|
+
/** 可选。组件文件路径,不填则自动推断为 @/views/{path}/index.vue */
|
|
5
7
|
component?: string;
|
|
8
|
+
/** 备注说明,仅用于日志显示 */
|
|
6
9
|
reason?: string;
|
|
10
|
+
/** 优先级,数字越小越优先加载,默认 2 */
|
|
7
11
|
priority?: number;
|
|
8
12
|
}
|
|
13
|
+
type StatusPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
9
14
|
interface PreloaderOptions {
|
|
10
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 要预加载的路由列表,支持字符串或对象格式
|
|
17
|
+
* 含 :param 的动态路由段会被自动过滤
|
|
18
|
+
* 默认 []
|
|
19
|
+
*/
|
|
20
|
+
routes?: (string | PreloadRoute)[];
|
|
21
|
+
/**
|
|
22
|
+
* 页面加载完成后延迟多少毫秒再触发状态显示
|
|
23
|
+
* 默认 2000ms
|
|
24
|
+
*/
|
|
11
25
|
delay?: number;
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
/**
|
|
27
|
+
* 是否开启调试日志与 window.__preloaderDebug 调试工具
|
|
28
|
+
* 默认:开发环境 true,生产环境 false
|
|
29
|
+
*/
|
|
14
30
|
debug?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 是否在页面角落显示预加载状态提示
|
|
33
|
+
* 默认 true
|
|
34
|
+
*/
|
|
35
|
+
showStatus?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 状态提示的显示位置
|
|
38
|
+
* 默认 'bottom-right'
|
|
39
|
+
*/
|
|
40
|
+
statusPosition?: StatusPosition;
|
|
41
|
+
/**
|
|
42
|
+
* 要排除预加载的路由路径列表(精确匹配或前缀匹配)
|
|
43
|
+
* 例:['/404', '/login', '/admin']
|
|
44
|
+
*/
|
|
45
|
+
exclude?: string[];
|
|
15
46
|
}
|
|
16
47
|
|
|
17
|
-
declare function preloaderPlugin(
|
|
48
|
+
declare function preloaderPlugin(userOptions?: PreloaderOptions): Plugin;
|
|
18
49
|
|
|
19
|
-
export { type PreloadRoute, type PreloaderOptions, preloaderPlugin as default };
|
|
50
|
+
export { type PreloadRoute, type PreloaderOptions, type StatusPosition, preloaderPlugin as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
|
|
3
3
|
interface PreloadRoute {
|
|
4
|
+
/** 路由路径,如 /dashboard。含 :param 的动态路由会被自动过滤 */
|
|
4
5
|
path: string;
|
|
6
|
+
/** 可选。组件文件路径,不填则自动推断为 @/views/{path}/index.vue */
|
|
5
7
|
component?: string;
|
|
8
|
+
/** 备注说明,仅用于日志显示 */
|
|
6
9
|
reason?: string;
|
|
10
|
+
/** 优先级,数字越小越优先加载,默认 2 */
|
|
7
11
|
priority?: number;
|
|
8
12
|
}
|
|
13
|
+
type StatusPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
9
14
|
interface PreloaderOptions {
|
|
10
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 要预加载的路由列表,支持字符串或对象格式
|
|
17
|
+
* 含 :param 的动态路由段会被自动过滤
|
|
18
|
+
* 默认 []
|
|
19
|
+
*/
|
|
20
|
+
routes?: (string | PreloadRoute)[];
|
|
21
|
+
/**
|
|
22
|
+
* 页面加载完成后延迟多少毫秒再触发状态显示
|
|
23
|
+
* 默认 2000ms
|
|
24
|
+
*/
|
|
11
25
|
delay?: number;
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
/**
|
|
27
|
+
* 是否开启调试日志与 window.__preloaderDebug 调试工具
|
|
28
|
+
* 默认:开发环境 true,生产环境 false
|
|
29
|
+
*/
|
|
14
30
|
debug?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 是否在页面角落显示预加载状态提示
|
|
33
|
+
* 默认 true
|
|
34
|
+
*/
|
|
35
|
+
showStatus?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 状态提示的显示位置
|
|
38
|
+
* 默认 'bottom-right'
|
|
39
|
+
*/
|
|
40
|
+
statusPosition?: StatusPosition;
|
|
41
|
+
/**
|
|
42
|
+
* 要排除预加载的路由路径列表(精确匹配或前缀匹配)
|
|
43
|
+
* 例:['/404', '/login', '/admin']
|
|
44
|
+
*/
|
|
45
|
+
exclude?: string[];
|
|
15
46
|
}
|
|
16
47
|
|
|
17
|
-
declare function preloaderPlugin(
|
|
48
|
+
declare function preloaderPlugin(userOptions?: PreloaderOptions): Plugin;
|
|
18
49
|
|
|
19
|
-
export { type PreloadRoute, type PreloaderOptions, preloaderPlugin as default };
|
|
50
|
+
export { type PreloadRoute, type PreloaderOptions, type StatusPosition, preloaderPlugin as default };
|