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