ndjjd-vite-plugin-federation 0.0.2 → 0.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ndjjd-vite-plugin-federation",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -15,6 +15,7 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "src/types/global.d.ts",
18
+ "src/types/vite.d.ts",
18
19
  "package.json",
19
20
  "README.md"
20
21
  ],
@@ -0,0 +1,31 @@
1
+ import type { Plugin } from 'vite';
2
+
3
+ export interface FederationPluginOptions {
4
+ /**
5
+ * 远程模块导入前缀,默认值:'vr:'
6
+ */
7
+ prefix?: string;
8
+ /**
9
+ * 自定义搜索函数,用于根据组件名称获取远程ZIP包地址
10
+ * @param name 组件名称
11
+ * @returns 远程ZIP包地址Promise
12
+ */
13
+ search?: (name: string) => Promise<string>;
14
+ /**
15
+ * 组件缓存目录,默认值:'./node_modules/.vr-cache'
16
+ */
17
+ cacheDir?: string;
18
+ /**
19
+ * 是否启用缓存,默认值:true
20
+ */
21
+ enableCache?: boolean;
22
+ }
23
+
24
+ /**
25
+ * Vite 远程组件联邦插件
26
+ * @param options 插件配置项
27
+ * @returns Vite Plugin 实例
28
+ */
29
+ export function FederationPlugin(options?: FederationPluginOptions): Plugin;
30
+
31
+ export default FederationPlugin;