@lemon-fe/vite-plugin-micro-frontend 1.0.6 → 1.0.8
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/dist/index.d.ts +4 -17
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +7 -41
- package/dist/runtime.js +27837 -260
- package/dist/runtime.js.map +1 -1
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -129,8 +129,9 @@ interface MicroFrontendPluginOptions {
|
|
|
129
129
|
type VitePlugin = Plugin;
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* HTML 转换插件 -
|
|
133
|
-
*
|
|
132
|
+
* HTML 转换插件 - 开发环境下处理 React Refresh 脚本
|
|
133
|
+
* 在乾坤微前端场景下,需要替换默认的 refresh 脚本以支持沙箱环境
|
|
134
|
+
* 只在开发环境(vite dev)下生效,生产环境不做任何处理
|
|
134
135
|
*/
|
|
135
136
|
declare function htmlRemoveFreshPlugin(): VitePlugin;
|
|
136
137
|
|
|
@@ -156,26 +157,12 @@ interface DynamicOptions<P = Record<string, unknown>> {
|
|
|
156
157
|
loader: () => Promise<{
|
|
157
158
|
default: ComponentType<P>;
|
|
158
159
|
}>;
|
|
159
|
-
/**
|
|
160
|
+
/** 加载中/加载失败时显示的组件 */
|
|
160
161
|
loading?: ComponentType<any>;
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
163
164
|
* 封装动态导入函数,兼容 Umi 的 dynamic
|
|
164
165
|
*
|
|
165
|
-
* 特性:
|
|
166
|
-
* - 当 chunk 加载失败时(如部署后旧文件不存在),会通过 manifest.json 映射加载最新 chunk
|
|
167
|
-
* - 无需刷新整个页面,适合微前端场景
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```tsx
|
|
171
|
-
* import { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/runtime';
|
|
172
|
-
*
|
|
173
|
-
* // 使用 dynamic
|
|
174
|
-
* const MyComponent = dynamic({
|
|
175
|
-
* loader: () => import('./MyComponent'),
|
|
176
|
-
* loading: LoadingComponent,
|
|
177
|
-
* });
|
|
178
|
-
* ```
|
|
179
166
|
*/
|
|
180
167
|
declare function dynamic<P = Record<string, unknown>>(options: DynamicOptions<P>): ComponentType<P>;
|
|
181
168
|
|