Skip to content

Commit 4713319

Browse files
ZEJIA-LIUZakaryCodemayintao3heiazuxuanzebin
authored
merge: 合并鸿蒙分支 (#16740)
* fix: 支持关闭 jsx 样式注入,并提供 css map * chore(release): publish 4.0.0-alpha.24 --tag=alpha * fix(vite): 修复组件模式配置缺失问题 * chore(release): publish 4.0.0-alpha.25 --tag=alpha * feat: update from ets runtime * chore(release): publish 4.0.0-alpha.26 --tag=alpha * feat(harmony): add terser plugin * chore(release): publish 4.0.0-alpha.27 --tag=alpha * fix: 移除废弃插件 * feat(ets): 调整运行时导出 * feat: 更新 capi 版本 runtime * feat(harmony): add cpp style * fix: 修复导出路径 * chore(release): publish 4.0.0-alpha.36 --tag=alpha * fix(harmony): update runtime * fix: 修复cssmodules匹配不到的问题 * feat: comp.js 支持路由重命名 * feat: 去掉console * fix: uid types * fix(harmony): 修复常量替换问题 * fix(harmony): 调整 api 依赖引用 * chore(release): publish 4.0.0-alpha.44 --tag=alpha * fix(harmony): 移除 onpm 不能装载的类型 * fix: 修复 input 事件错误逻辑 * fix: 修复 form 元素移除属性错误 * fix(react): env shake * fix: 修复stickySection没有渲染list-item的问题 * chore(release): publish 4.0.0-beta.119 --tag=beta * fix: 修复list-view问题 * chore(release): publish 4.0.0-beta.120 --tag=beta * fix: 修复sticky-section没有被复用 * chore(release): publish 4.0.0-beta.121 --tag=beta * fix: 修复错误引入taro的问题 * chore(release): publish 4.0.0-beta.122 --tag=beta * chore(release): publish 4.0.0-beta.122 --tag=beta * fix: 修复cssmodule样式不生效 * chore(release): publish 4.0.0-beta.123 --tag=beta * fix: 临时修复 harmony 不能编译 ts 的问题 * chore(release): publish 4.0.0-beta.124 --tag=beta * fix: 兼容找不到页面情况 * fix(harmony): 优化 contextPromise 设置 * fix(harmony): 修复读取配置时缺少常量注入 * chore(release): publish 4.0.0-beta.125 --tag=beta * fix: code * feat(harmony): 修复图片等资源注入引用问题 * chore(release): publish 4.0.0-beta.126 --tag=beta * fix: 修复 readConfig 时引入 babel 导致的问题 * fix: 更新 lint 问题 * chore(release): publish 4.0.0-beta.127 --tag=beta * fix: 修复 readConfig 时引入 babel 导致问题 * chore(release): publish 4.0.0-beta.128 --tag=beta * fix: 修复scroll无法禁止滚动的bug * chore(release): publish 4.0.0-beta.129 --tag=beta * feat: 在style的opacity设置成空字符串里把他设置成1,避免harmony beta2把opacity的默认值设置成0的情况 * chore(release): publish 4.0.0-beta.130 --tag=beta * fix: 修复鸿蒙端的pagaName获取不到的问题和ets的类型问题 * fix: 修改readConfig方法 * chore(release): publish 4.0.0-beta.131 --tag=beta * fix: 修复beta2文本不更新的问题 * chore(release): publish 4.0.0-beta.132 --tag=beta * fix: 修复 overflow 是 scroll 和 auto 情况下 scrollview 不能滚动的问题 * chore(release): publish 4.0.0-beta.133 --tag=beta * fix(types): update picker region data * fix(runner): 整理 page entry 参数 * fix(runner): word spelling * feat(runner): add modifyEntryFile func * chore(release): publish 4.0.0-beta.134 --tag=beta * fix: update runner hooks * chore(release): publish 4.0.0-beta.135 --tag=beta * fix(harmony): 对齐 page 各生命周期中使用的对象实例 * chore(release): publish 4.0.0-beta.136 --tag=beta * fix(harmony): 对齐 custom 路由判断 * chore(release): publish 4.0.0-beta.137 --tag=beta * fix(runner): for wins path * chore(release): publish 4.0.0-beta.138 --tag=beta * chore: 升级 pnpm 版本 * feat(vite): 修复 wins 路径问题 * chore(release): publish 4.0.0-beta.139 --tag=beta * test: update snapshoot --------- Co-authored-by: ZakaryCode <zakarycode@gmail.com> Co-authored-by: mayintao3 <mayintao3@jd.com> Co-authored-by: zhuminghui2 <zhuminghui2@jd.com> Co-authored-by: xuanzebin <xuanzebin3@jd.com> Co-authored-by: liuzejia <liuzejia@SZMAC-FV0MR4G7.local>
1 parent a262dcb commit 4713319

28 files changed

Lines changed: 16927 additions & 12350 deletions

.github/workflows/build-rust-binding.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Setup pnpm
4949
uses: pnpm/action-setup@v3.0.0
5050
with:
51-
version: 8
51+
version: 9
5252
- name: Setup Node.js ${{ matrix.node-version }}
5353
uses: actions/setup-node@v4
5454
if: ${{ !matrix.settings.docker }}

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- name: Setup pnpm
6565
uses: pnpm/action-setup@v3.0.0
6666
with:
67-
version: 8
67+
version: 9
6868
- name: Setup Node.js ${{ matrix.node-version }}
6969
uses: actions/setup-node@v4
7070
with:

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
- name: Setup pnpm
8989
uses: pnpm/action-setup@v3.0.0
9090
with:
91-
version: 8
91+
version: 9
9292
- name: Setup Node 18
9393
uses: actions/setup-node@v4
9494
with:

.github/workflows/sync-components-types.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: install
3737
uses: pnpm/action-setup@v3.0.0
3838
with:
39-
version: 8
39+
version: 9
4040
run_install: |
4141
- recursive: true
4242
args: [--frozen-lockfile, --strict-peer-dependencies]

packages/taro-helper/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ export function readPageConfig(configPath: string) {
631631
}
632632

633633
interface IReadConfigOptions {
634-
defineConstants?: Record<string, any>
635634
alias?: Record<string, any>
635+
defineConstants?: Record<string, any>
636636
}
637637

638638
export function readConfig<T extends IReadConfigOptions> (configPath: string, options: T = {} as T) {

packages/taro-platform-harmony/src/components/components-harmony-ets/scrollView.ets

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ function getAttributes (node: TaroScrollViewElement): ScrollViewAttrs {
3636

3737
function getScrollable (node: TaroScrollViewElement) {
3838
const _attrs = node._attrs
39+
if (node?.hmStyle?.overflow === "scroll" || node?.hmStyle?.overflow === "auto") {
40+
return ScrollDirection.Vertical
41+
}
3942
if (_attrs.scrollX) {
4043
return ScrollDirection.Horizontal
4144
} else if (_attrs.scrollY) {
@@ -47,11 +50,11 @@ function getScrollable (node: TaroScrollViewElement) {
4750

4851
function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', xOffset?: number, yOffset?: number) {
4952
if (!node || !node.scroller) return
50-
53+
5154
const currentOffset = node.scroller.currentOffset() as ScrollViewCurrentOffset
52-
55+
5356
if (!currentOffset) return
54-
57+
5558
const currentXOffset = currentOffset.xOffset
5659
const currentYOffset = currentOffset.yOffset
5760
const value: ScrollViewEvent = {

packages/taro-platform-harmony/src/runtime-ets/dom/node.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ export class TaroNode extends TaroDataSourceElement {
190190
this.childNodes.push(child)
191191
this.notifyDataAdd(this.childNodes.length - 1)
192192

193+
if (this.nodeName === 'TEXT') {
194+
// 修复beta2版本文字从undefined -> 有值时的 不更新问题
195+
this.updateComponent()
196+
}
197+
193198
// @ts-ignore
194199
child.toggleLayer?.(true)
195200

packages/taro-vite-runner/src/harmony/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type { RollupInjectOptions } from '@rollup/plugin-inject'
2020
import type { ViteHarmonyCompilerContext } from '@tarojs/taro/types/compile/viteCompilerContext'
2121
import type { InputPluginOption, OutputOptions } from 'rollup'
2222
import type { Plugin, PluginOption } from 'vite'
23+
import type { TaroHarmonyPageMeta } from './template/page'
2324

2425
export default function (viteCompilerContext: ViteHarmonyCompilerContext): PluginOption {
2526
const { taroConfig, cwd: appPath } = viteCompilerContext
@@ -200,7 +201,9 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
200201
name = name.replace(/[\\/]+/g, '/')
201202

202203
const appId = viteCompilerContext.app.config.appId || 'app'
203-
const isTaroComp = appId === name || viteCompilerContext.pages.some(page => page.name === name) || viteCompilerContext.components?.some(comp => comp.name === name)
204+
const isTaroComp = appId === name ||
205+
viteCompilerContext.pages.some((page: TaroHarmonyPageMeta) => [page.name, page.originName].includes(name)) ||
206+
viteCompilerContext.components?.some((comp: TaroHarmonyPageMeta) => [comp.name, comp.originName].includes(name))
204207
// 如果同时存在app.ets和app.js,因为鸿蒙IDE编译会把app.ets编译成app.ts,会跟app.js冲突,识别都是/app,导致app.js被app.ts覆盖了,所以需要名字
205208
const suffix = isTaroComp ? virtualModulePrefixREG.test(chunkInfo.facadeModuleId || '') ? TARO_COMP_SUFFIX : '_comp' : ''
206209
name = stripMultiPlatformExt(`${name}${suffix}`) + taroConfig.fileType.script

packages/taro-vite-runner/src/harmony/emit.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { componentConfig } from '../utils/component'
99

1010
import type { ViteHarmonyCompilerContext } from '@tarojs/taro/types/compile/viteCompilerContext'
1111
import type { PluginOption } from 'vite'
12+
import type { TaroHarmonyPageMeta } from './template/page'
1213

1314
export default function (viteCompilerContext: ViteHarmonyCompilerContext): PluginOption {
1415
const { taroConfig } = viteCompilerContext
@@ -104,18 +105,21 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
104105
const comps = viteCompilerContext.getComponents() || []
105106

106107
const lines: string[] = []
107-
comps.forEach(comp => {
108-
const key = Object.keys(taroConfig.router?.customRoutes || {}).find(e => [comp.name, addLeadingSlash(comp.name)].includes(e))
108+
comps.forEach((comp: TaroHarmonyPageMeta) => {
109+
const key = Object.keys(taroConfig.router?.customRoutes || {}).find(e => {
110+
const name = comp.originName || comp.name
111+
return [name, addLeadingSlash(name)].includes(e)
112+
})
109113

110114
if (key) {
111115
const alias = taroConfig.router?.customRoutes![key]
112116
if (alias instanceof Array) {
113-
alias.forEach(item => lines.push(`export * from './${path.join('src/main', 'ets', item)}'`))
117+
alias.forEach(item => lines.push(`export * from './${path.posix.join('src/main', 'ets', item)}'`))
114118
} else if (typeof alias === 'string') {
115-
lines.push(`export * from './${path.join('src/main', 'ets', alias)}'`)
119+
lines.push(`export * from './${path.posix.join('src/main', 'ets', alias)}'`)
116120
}
117121
} else {
118-
lines.push(`export * from './${path.join('src/main', 'ets', comp.name)}'`)
122+
lines.push(`export * from './${path.posix.join('src/main', 'ets', comp.name)}'`)
119123
}
120124
})
121125
lines.push('')

packages/taro-vite-runner/src/harmony/page.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
9494
pageName = 'index'
9595
}
9696

97+
const page_ = page as TaroHarmonyPageMeta
98+
page_.id = id
99+
page_.originName = page.name
100+
page_.name = pageName
101+
97102
this.emitFile({
98103
type: 'prebuilt-chunk',
99104
fileName: viteCompilerContext.getTargetFilePath(pageName, '.ets'),
100-
code: parse.parse(path.resolve(appRoot, pageName), {
101-
...page,
102-
originName: page.name,
103-
name: pageName,
104-
id,
105-
} as TaroHarmonyPageMeta, name, this.resolve),
105+
code: parse.parse(path.resolve(appRoot, pageName), page_, name, this.resolve),
106106
exports: ['default'],
107107
})
108108
})

0 commit comments

Comments
 (0)