@lingfan-engine/create 0.3.0 → 0.3.2
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 +1 -1
- package/template/__PROJECT__/package.json +5 -5
- package/template/__PROJECT__/vite.config.ts +1 -1
- package/template/overlays/miniprogram/package.patch.json +1 -1
- package/template/overlays/miniprogram/vite.config.ts +1 -1
- package/template/overlays/react/src/UiHost.tsx +10 -1
- package/template/overlays/react/src/main.tsx +14 -4
- package/template/overlays/react/vite.config.ts +1 -1
- package/template/overlays/ts/package.patch.json +1 -1
- package/template/overlays/vue/vite.config.ts +1 -1
- package/template/template-meta.json +2 -2
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@lingfan-engine/adapters": "^0.3.
|
|
14
|
-
"@lingfan-engine/core": "^0.3.
|
|
15
|
-
"@lingfan-engine/shell": "^0.3.
|
|
16
|
-
"@lingfan-engine/stories-build": "^0.3.
|
|
17
|
-
"@lingfan-engine/ui": "^0.3.
|
|
13
|
+
"@lingfan-engine/adapters": "^0.3.2",
|
|
14
|
+
"@lingfan-engine/core": "^0.3.2",
|
|
15
|
+
"@lingfan-engine/shell": "^0.3.2",
|
|
16
|
+
"@lingfan-engine/stories-build": "^0.3.2",
|
|
17
|
+
"@lingfan-engine/ui": "^0.3.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "^26.6.3",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"@dcloudio/uni-components": "3.0.0-4080720251210001",
|
|
5
5
|
"@dcloudio/uni-h5": "3.0.0-4080720251210001",
|
|
6
6
|
"@dcloudio/uni-mp-weixin": "3.0.0-4080720251210001",
|
|
7
|
-
"@lingfan-engine/shell": "^0.3.
|
|
7
|
+
"@lingfan-engine/shell": "^0.3.2",
|
|
8
8
|
"vue": "3.4.21"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
@@ -20,7 +20,7 @@ import uniModule, {
|
|
|
20
20
|
type VitePluginUniOptions,
|
|
21
21
|
} from "@dcloudio/vite-plugin-uni";
|
|
22
22
|
import { defineConfig, type Plugin } from "vite";
|
|
23
|
-
import { storyFontsVirtual, storyListVirtual } from "./vite.plugins";
|
|
23
|
+
import { storyFontsVirtual, storyListVirtual } from "./vite.plugins.ts";
|
|
24
24
|
|
|
25
25
|
type UniPluginFactory = (options?: VitePluginUniOptions) => Plugin[];
|
|
26
26
|
|
|
@@ -12,7 +12,13 @@
|
|
|
12
12
|
*
|
|
13
13
|
* 组件由 React 自己创建,所以挂载点的父子关系归 React——组合根不该再往这个容器里写节点。
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
createElement,
|
|
17
|
+
Fragment,
|
|
18
|
+
useEffect,
|
|
19
|
+
useMemo,
|
|
20
|
+
useSyncExternalStore,
|
|
21
|
+
} from "react";
|
|
16
22
|
import { missingMounts, selectMounts } from "@lingfan-engine/ui";
|
|
17
23
|
import { controlsStore } from "./controls";
|
|
18
24
|
import { mountStore, uis } from "./mounts";
|
|
@@ -49,7 +55,10 @@ export function UiHost() {
|
|
|
49
55
|
}
|
|
50
56
|
}, [raw]);
|
|
51
57
|
|
|
58
|
+
// 外层用 Fragment 而不是 null:`createElement(null, …)` 不是合法调用形态,
|
|
59
|
+
// 类型上也过不去(第一个参数只接受标签名或组件)。
|
|
52
60
|
return createElement(
|
|
61
|
+
Fragment,
|
|
53
62
|
null,
|
|
54
63
|
...items.map((item) =>
|
|
55
64
|
createElement(item.component as never, {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* 本层只替换入口与组合根)。
|
|
10
10
|
*/
|
|
11
11
|
import { createElement, StrictMode } from "react";
|
|
12
|
+
import { flushSync } from "react-dom";
|
|
12
13
|
import { createRoot } from "react-dom/client";
|
|
13
14
|
import { MANIFEST_FILE } from "@lingfan-engine/core";
|
|
14
15
|
import { DEFAULT_TEXT_CPS, DEFAULT_TOAST_MS } from "@lingfan-engine/ui";
|
|
@@ -63,10 +64,19 @@ function mountApp(): StageDom | undefined {
|
|
|
63
64
|
try {
|
|
64
65
|
const container = document.querySelector("#app");
|
|
65
66
|
if (container === null) throw new Error("宿主缺少节点:#app");
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/**
|
|
68
|
+
* 必须同步提交后再读节点。
|
|
69
|
+
*
|
|
70
|
+
* `createRoot().render()` 是并发渲染,只保证「稍后」提交——紧接着 `readDom()`
|
|
71
|
+
* 读到的还是空容器,取节点当场就抛,页面停在白屏。
|
|
72
|
+
* `flushSync` 把这次渲染强制同步落地,读节点时才拿得到 `App` 渲染出的结构。
|
|
73
|
+
* StrictMode 只影响开发期的重复渲染提示,不改变侧建行为:引擎在下面单独启动。
|
|
74
|
+
*/
|
|
75
|
+
flushSync(() => {
|
|
76
|
+
createRoot(container).render(
|
|
77
|
+
createElement(StrictMode, null, createElement(App)),
|
|
78
|
+
);
|
|
79
|
+
});
|
|
70
80
|
return readDom();
|
|
71
81
|
} catch (error) {
|
|
72
82
|
console.error(error);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import react from "@vitejs/plugin-react";
|
|
11
11
|
import { defineConfig } from "vite";
|
|
12
|
-
import { storyFontsVirtual, storyListVirtual } from "./vite.plugins";
|
|
12
|
+
import { storyFontsVirtual, storyListVirtual } from "./vite.plugins.ts";
|
|
13
13
|
|
|
14
14
|
/** 脚手架工程的 Vite 配置(React 形态) */
|
|
15
15
|
export default defineConfig({
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import vue from "@vitejs/plugin-vue";
|
|
11
11
|
import { defineConfig } from "vite";
|
|
12
|
-
import { storyFontsVirtual, storyListVirtual } from "./vite.plugins";
|
|
12
|
+
import { storyFontsVirtual, storyListVirtual } from "./vite.plugins.ts";
|
|
13
13
|
|
|
14
14
|
/** 脚手架工程的 Vite 配置(Vue 形态) */
|
|
15
15
|
export default defineConfig({
|