From 3f715e3ec1d53e9c5dce67a7e341dde8fae5589b Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Thu, 25 Apr 2024 14:40:57 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtabbar=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/harmony/template/page.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/taro-vite-runner/src/harmony/template/page.ts b/packages/taro-vite-runner/src/harmony/template/page.ts index 6606cd115f60..c420205f3190 100644 --- a/packages/taro-vite-runner/src/harmony/template/page.ts +++ b/packages/taro-vite-runner/src/harmony/template/page.ts @@ -184,16 +184,16 @@ export default class Parser extends BaseParser { }, this.isTabbarPage), this.renderState({ decorator: 'StorageLink("__TARO_PAGE_STACK")', name: 'pageStack', type: 'router.RouterState[]', foreach: () => '[]', disabled: this.buildConfig.isBuildNativeComp - }, this.isTabbarPage), + }, false), this.renderState({ decorator: 'StorageProp("__TARO_ENTRY_PAGE_PATH")', name: 'entryPagePath', type: 'string', foreach: () => '""', disabled: this.buildConfig.isBuildNativeComp - }, this.isTabbarPage), + }, false), this.renderState({ decorator: 'State', name: 'appConfig', type: 'Taro.AppConfig', foreach: () => 'window.__taroAppConfig || {}', disabled: this.buildConfig.isBuildNativeComp - }, this.isTabbarPage), + }, false), this.renderState({ decorator: 'State', name: 'tabBarList', type: `${this.isTabbarPage ? 'ITabBarItem' : 'Taro.TabBarItem'}[]`, foreach: () => 'this.appConfig.tabBar?.list || []', disabled: this.buildConfig.isBuildNativeComp - }, this.isTabbarPage), + }, false), ].filter(item => item !== '').flat() if (this.isTabbarPage) { @@ -373,10 +373,10 @@ this.removeTabBarEvent()` : 'callFn(this.page?.onUnload, this)', .fontColor((this.navigationBarTextStyle${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''} || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black) if (this.navigationBarLoading${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''}) { LoadingProgress() - .margin({ left: convertNumber2VP(10 / 7.5, 'vw') }) - .height(convertNumber2VP(40 / 7.5, 'vw')) - .width(convertNumber2VP(40 / 7.5, 'vw')) - .color((this.navigationBarTextStyle${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''} || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black) + .margin({ left: convertNumber2VP(10 / 7.5, 'vw') }) + .height(convertNumber2VP(40 / 7.5, 'vw')) + .width(convertNumber2VP(40 / 7.5, 'vw')) + .color((this.navigationBarTextStyle${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''} || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black) } } .height('100%') From d3a394119f2eecbfd1f272be8ea44fe6bbf9026e Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Thu, 25 Apr 2024 14:56:44 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E4=B8=BAswiper=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0touch=E5=92=8Ctransition=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components-harmony-ets/swiper.ets | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/taro-platform-harmony/src/components/components-harmony-ets/swiper.ets b/packages/taro-platform-harmony/src/components/components-harmony-ets/swiper.ets index b6d77242608c..5ea5bf92fd71 100644 --- a/packages/taro-platform-harmony/src/components/components-harmony-ets/swiper.ets +++ b/packages/taro-platform-harmony/src/components/components-harmony-ets/swiper.ets @@ -77,5 +77,28 @@ export default struct TaroSwiper { this.node._nodeInfo.areaInfo = res[1] })) .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME)) + .onGestureSwipe(shouldBindEvent((index: number, extraInfo: SwiperAnimationEvent) => { + const currentOffset = extraInfo.currentOffset || 0 + // 判断设置的滚动方向 + const isVertical = this.node._attrs.vertical || false + let event: TaroEvent + if (isVertical) { + event = createTaroEvent('transition', { detail: { dx: 0, dy: currentOffset } }, this.node) + } else { + event = createTaroEvent('transition', { detail: { dx: currentOffset, dy: 0 } }, this.node) + } + eventHandler(event, 'transition', this.node) + }, this.node, ['transition'])) + .onTouch(shouldBindEvent((event: TouchEvent) => { + if (event.type === TouchType.Down) { + eventHandler(event, 'touchStart', this.node) + } + if (event.type === TouchType.Up) { + eventHandler(event, 'touchEnd', this.node) + } + if (event.type === TouchType.Move) { + eventHandler(event, 'touchMove', this.node) + } + }, this.node, ['touchstart', 'touchmove', 'touchend'])) } } From d69b9cb57fd67133aea76dc3a74d4b8c14ac251e Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Thu, 25 Apr 2024 21:35:50 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AF=B9usingCom?= =?UTF-8?q?ponents=E7=AC=AC=E4=B8=89=E6=96=B9=E5=8C=85=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../taro-vite-runner/src/harmony/entry.ts | 15 ++-- packages/taro-vite-runner/src/harmony/ets.ts | 2 +- .../src/harmony/template/render.ts | 9 ++- .../src/utils/compiler/harmony.ts | 78 ++++++++++++------- .../types/compile/viteCompilerContext.d.ts | 1 + 5 files changed, 69 insertions(+), 36 deletions(-) diff --git a/packages/taro-vite-runner/src/harmony/entry.ts b/packages/taro-vite-runner/src/harmony/entry.ts index 2d9ab311fc38..6d3b2d24b319 100644 --- a/packages/taro-vite-runner/src/harmony/entry.ts +++ b/packages/taro-vite-runner/src/harmony/entry.ts @@ -68,12 +68,15 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi // native components for (const comp of viteCompilerContext.nativeComponents.values()) { - this.emitFile({ - type: 'chunk', - id: comp.templatePath + QUERY_IS_NATIVE_SCRIPT, - fileName: path.relative(viteCompilerContext.sourceDir, comp.templatePath) + QUERY_IS_NATIVE_SCRIPT, - implicitlyLoadedAfterOneOf: [rawId] - }) + if (!comp.isPackage) { + this.emitFile({ + type: 'chunk', + id: comp.templatePath + QUERY_IS_NATIVE_SCRIPT, + fileName: path.relative(viteCompilerContext.sourceDir, comp.templatePath) + QUERY_IS_NATIVE_SCRIPT, + implicitlyLoadedAfterOneOf: [rawId] + }) + } + } // emit tabbar diff --git a/packages/taro-vite-runner/src/harmony/ets.ts b/packages/taro-vite-runner/src/harmony/ets.ts index d56c5c2f7d9b..8493c49c461f 100644 --- a/packages/taro-vite-runner/src/harmony/ets.ts +++ b/packages/taro-vite-runner/src/harmony/ets.ts @@ -75,7 +75,7 @@ export default async function (viteCompilerContext: ViteHarmonyCompilerContext): const moduleRelativePath = match[1] const modulePath = resolveSync(moduleRelativePath, { basedir: path.dirname(realId), extensions: ['.js', '.ts', '.ets'] }) - if (modulePath) { + if (modulePath && !modulePath.includes('node_modules')) { const isETS = modulePath.endsWith('.ets') const fileName = path.relative(viteCompilerContext.sourceDir, modulePath) diff --git a/packages/taro-vite-runner/src/harmony/template/render.ts b/packages/taro-vite-runner/src/harmony/template/render.ts index 6e5dd374d03f..65850f15275f 100644 --- a/packages/taro-vite-runner/src/harmony/template/render.ts +++ b/packages/taro-vite-runner/src/harmony/template/render.ts @@ -220,8 +220,13 @@ export { createChildItem, createLazyChildren } let result = '' this.context.nativeComponents.forEach((nativeMeta, _) => { - const nativePath = path.relative(this.context.sourceDir, nativeMeta.scriptPath) - result = `${result}import ${nativeMeta.name} from '../../../${nativePath}'\n` + if (nativeMeta.isPackage) { + result += `import ${nativeMeta.name} from '${nativeMeta.scriptPath}'\n` + } else { + const nativePath = path.relative(this.context.sourceDir, nativeMeta.scriptPath) + result = `${result}import ${nativeMeta.name} from '../../../${nativePath}'\n` + } + }) return result diff --git a/packages/taro-vite-runner/src/utils/compiler/harmony.ts b/packages/taro-vite-runner/src/utils/compiler/harmony.ts index 22d93a27b9b3..efe620c1c36c 100644 --- a/packages/taro-vite-runner/src/utils/compiler/harmony.ts +++ b/packages/taro-vite-runner/src/utils/compiler/harmony.ts @@ -15,7 +15,7 @@ import { ViteHarmonyBuildConfig, ViteHarmonyCompilerContext, ViteNativeCompMeta, - VitePageMeta + VitePageMeta, } from '@tarojs/taro/types/compile/viteCompilerContext' import JSON5 from 'json5' import path from 'path' @@ -28,7 +28,7 @@ import { CompilerContext } from './base' import type { AppConfig, PageConfig } from '@tarojs/taro' -function readJsonSync (file: string) { +function readJsonSync(file: string) { const ext = path.extname(file) if (ext === '.json5') { const raw = fs.readFileSync(file, 'utf-8') @@ -46,10 +46,16 @@ export class TaroCompilerContext extends CompilerContext extraComponents: string[] = [] nativeExt = ['.ets'] nativeComponents = new Map() + ohpmPackageList: string[] = [] - constructor (appPath: string, taroConfig: ViteHarmonyBuildConfig) { + constructor(appPath: string, taroConfig: ViteHarmonyBuildConfig) { super(appPath, taroConfig) + // 收集所有配置定义的鸿蒙 + this.ohpmPackageList = Object.values(this.taroConfig?.harmony?.ohPackage ?? {}).reduce((acc, cur) => { + return [...acc, ...Object.keys(cur)] + }, []) + this.fileType = this.taroConfig.fileType this.useETS = taroConfig.useETS !== false this.useJSON5 = taroConfig.useJSON5 !== false @@ -60,17 +66,18 @@ export class TaroCompilerContext extends CompilerContext if (this.taroConfig.isBuildNativeComp) { this.components = this.getComponents() - this.components?.length > 0 && this.components.forEach(component => { - this.collectNativeComponents(component) - }) + this.components?.length > 0 && + this.components.forEach((component) => { + this.collectNativeComponents(component) + }) } } - processConfig () { + processConfig() { this.taroConfig = recursiveMerge({}, defaultConfig, this.rawTaroConfig) } - getCommonChunks () { + getCommonChunks() { const { commonChunks } = this.taroConfig const defaultCommonChunks = ['runtime', 'vendors', 'taro', 'common'] let customCommonChunks: string[] = defaultCommonChunks @@ -100,7 +107,7 @@ export class TaroCompilerContext extends CompilerContext this.filesConfig[this.getConfigFilePath(pageMeta.name)] = { path: configPath, - content: config + content: config, } // 编译原生组件的时候,不要把 pages 里引用的自定义组件带上 @@ -112,7 +119,7 @@ export class TaroCompilerContext extends CompilerContext return pageMeta } - collectNativeComponents (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) { + collectNativeComponents(meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) { const { name, scriptPath, config } = meta const { usingComponents } = config @@ -126,6 +133,21 @@ export class TaroCompilerContext extends CompilerContext usingComponents[compName] = compPath } + // 如果是鸿蒙的包 + if (new RegExp(`^(${this.ohpmPackageList.join('|')})`).test(compPath)) { + const nativeCompMeta: ViteNativeCompMeta = { + name: compName, + scriptPath: compPath, + config: {}, + configPath: '', + isNative: true, + templatePath: compPath, + isPackage: true, + } + this.nativeComponents.set(compPath, nativeCompMeta) + return + } + const compScriptPath = resolveMainFilePath(path.resolve(path.dirname(scriptPath), compPath)) if (this.nativeComponents.has(compScriptPath)) return @@ -169,7 +191,7 @@ export class TaroCompilerContext extends CompilerContext Object.assign(config, data) } else { const list = config[key] || [] - const idx = list.findIndex(item => item.name === value) + const idx = list.findIndex((item) => item.name === value) if (idx >= 0) { list[idx].value = data } else { @@ -183,14 +205,17 @@ export class TaroCompilerContext extends CompilerContext } // Note: 修改 harmony Hap 的配置文件,当前仅支持注入路由配置 - modifyHarmonyConfig (config: Partial = {}) { + modifyHarmonyConfig(config: Partial = {}) { const { tabBar } = config - const pages = (this.pages || []).map(item => item.name) + const pages = (this.pages || []).map((item) => item.name) const { projectPath, hapName = 'entry', outputRoot = 'dist', name = 'default' } = this.taroConfig const designWidth = this.taroConfig.designWidth || this.taroConfig.postcss?.pxtransform?.config?.designWidth || 750 const buildProfilePath = path.join(projectPath, `build-profile.${this.useJSON5 !== false ? 'json5' : 'json'}`) const srcPath = `./${hapName}` - const hapConfigPath = path.join(path.resolve(outputRoot, '..'), `${this.useJSON5 !== false ? 'module.json5' : 'config.json'}`) + const hapConfigPath = path.join( + path.resolve(outputRoot, '..'), + `${this.useJSON5 !== false ? 'module.json5' : 'config.json'}` + ) try { const profile = readJsonSync(buildProfilePath) profile.modules ||= [] @@ -205,11 +230,9 @@ export class TaroCompilerContext extends CompilerContext targets: [ { name: 'default', - applyToProducts: [ - 'default' - ] - } - ] + applyToProducts: ['default'], + }, + ], }) } fs.writeJsonSync(buildProfilePath, profile, { spaces: 2 }) @@ -261,7 +284,7 @@ export class TaroCompilerContext extends CompilerContext const tabBarLength = tabBarList.length || 0 if (tabBarLength > 1) { etsPage.push(TARO_TABBAR_PAGE_PATH) - etsPage.push(...pages.filter(item => tabBarList.every(tab => tab.pagePath !== item))) + etsPage.push(...pages.filter((item) => tabBarList.every((tab) => tab.pagePath !== item))) } else { etsPage.push(...pages) } @@ -279,9 +302,9 @@ export class TaroCompilerContext extends CompilerContext // FA 模型 hapConfig.module.js ||= [] const jsFAs = hapConfig.module.js - const target = jsFAs.find(item => item.name === name) + const target = jsFAs.find((item) => item.name === name) const mode = { - syntax: this.useETS ? 'ets': 'hml', + syntax: this.useETS ? 'ets' : 'hml', type: 'pageAbility', } if (target) { @@ -305,12 +328,13 @@ export class TaroCompilerContext extends CompilerContext } // Note: 更新 oh-package 中项目依赖声明 - modifyHostPackage ( - hmsDeps: Record = {}, - hmsDevDeps: Record = {}, - ) { + modifyHostPackage(hmsDeps: Record = {}, hmsDevDeps: Record = {}) { const { projectPath, hapName = 'entry', ohPackage = {} } = this.taroConfig - const packageJsonFile = path.join(projectPath, hapName, `${this.useJSON5 !== false ? 'oh-package.json5' : 'package.json'}`) + const packageJsonFile = path.join( + projectPath, + hapName, + `${this.useJSON5 !== false ? 'oh-package.json5' : 'package.json'}` + ) const isExists = fs.pathExistsSync(packageJsonFile) if (!isExists) return diff --git a/packages/taro/types/compile/viteCompilerContext.d.ts b/packages/taro/types/compile/viteCompilerContext.d.ts index f4785cb567ce..46301d467e10 100644 --- a/packages/taro/types/compile/viteCompilerContext.d.ts +++ b/packages/taro/types/compile/viteCompilerContext.d.ts @@ -14,6 +14,7 @@ export interface ViteNativeCompMeta { isNative: true templatePath: string cssPath?: string + isPackage?: boolean } export interface ViteFileType { From f6ba98868ea56112ccaf8e7f584380f45b656a3a Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Fri, 26 Apr 2024 11:28:03 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20blended=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=99=9A=E6=8B=9F=E6=A8=A1=E5=9D=97=E7=9A=84?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-vite-runner/src/harmony/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-vite-runner/src/harmony/config.ts b/packages/taro-vite-runner/src/harmony/config.ts index b4b169d87601..9c0c6ebab0f3 100644 --- a/packages/taro-vite-runner/src/harmony/config.ts +++ b/packages/taro-vite-runner/src/harmony/config.ts @@ -224,7 +224,7 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi }, } - if (taroConfig.isWatch) { + if (taroConfig.isWatch && !taroConfig.blended) { delete output.manualChunks output.preserveModules = true output.preserveModulesRoot = 'src' From bf5b103e174bce3326345385b3e5a6f1d6a3ccd1 Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Sun, 28 Apr 2024 14:38:51 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E5=9C=A8cli=E9=87=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0pure-native-component=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/cli.ts | 3 ++- packages/taro-cli/src/presets/commands/build.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/taro-cli/src/cli.ts b/packages/taro-cli/src/cli.ts index 80e3d12354c6..3d3da3e100c0 100644 --- a/packages/taro-cli/src/cli.ts +++ b/packages/taro-cli/src/cli.ts @@ -170,7 +170,8 @@ export default class CLI { plugin, isWatch: Boolean(args.watch), // Note: 是否把 Taro 组件编译为原生自定义组件 - isBuildNativeComp: _[1] === 'native-components', + isBuildNativeComp: _[1] === 'native-components' || _[1] === 'pure-native-components', + isBuildPureNativeComp: _[1] === 'native-components-pure', // Note: 新的混合编译模式,支持把组件单独编译为原生组件 newBlended: Boolean(args['new-blended']), // Note: 是否禁用编译 diff --git a/packages/taro-cli/src/presets/commands/build.ts b/packages/taro-cli/src/presets/commands/build.ts index 043c2ff8a9db..937fc53c4431 100644 --- a/packages/taro-cli/src/presets/commands/build.ts +++ b/packages/taro-cli/src/presets/commands/build.ts @@ -100,7 +100,7 @@ export default (ctx: IPluginContext) => { fs.ensureDirSync(outputPath) // is build native components mode? - const isBuildNativeComp = _[1] === 'native-components' + const isBuildNativeComp = _[1] === 'native-components' || _[1] === 'pure-native-components' await ctx.applyPlugins(hooks.ON_BUILD_START) await ctx.applyPlugins({ From 869267c6229bbe99d11eb4459531756821e55fe2 Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Sun, 28 Apr 2024 14:39:22 +0800 Subject: [PATCH 6/9] =?UTF-8?q?feat:=20=E5=9C=A8=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=8C=85=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E5=85=B3?= =?UTF-8?q?=E6=8E=89=E6=96=87=E4=BB=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-vite-runner/src/harmony/config.ts | 1 + packages/taro-vite-runner/src/mini/emit.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/taro-vite-runner/src/harmony/config.ts b/packages/taro-vite-runner/src/harmony/config.ts index 9c0c6ebab0f3..0054b929495a 100644 --- a/packages/taro-vite-runner/src/harmony/config.ts +++ b/packages/taro-vite-runner/src/harmony/config.ts @@ -57,6 +57,7 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi const nativeCompPathList: string[] = [] for (const comp of viteCompilerContext.nativeComponents.values()) { + if (comp.isPackage) continue nativeCompPathList.push(comp.templatePath + QUERY_IS_NATIVE_SCRIPT) } diff --git a/packages/taro-vite-runner/src/mini/emit.ts b/packages/taro-vite-runner/src/mini/emit.ts index 5d99f89222cf..a354f3507394 100644 --- a/packages/taro-vite-runner/src/mini/emit.ts +++ b/packages/taro-vite-runner/src/mini/emit.ts @@ -89,6 +89,7 @@ export default function (viteCompilerContext: ViteMiniCompilerContext): PluginOp // emit native components' json for (const comp of viteCompilerContext.nativeComponents.values()) { + if (comp.isPackage) continue generateConfigFile(this, viteCompilerContext, { filePath: comp.name, config: comp.config From b73c3afa50b726baa5ee588e758d298f0c84552d Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Sun, 28 Apr 2024 16:02:29 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/cli.ts | 2 +- packages/taro-cli/src/presets/commands/build.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/taro-cli/src/cli.ts b/packages/taro-cli/src/cli.ts index 3d3da3e100c0..671685e36985 100644 --- a/packages/taro-cli/src/cli.ts +++ b/packages/taro-cli/src/cli.ts @@ -171,7 +171,7 @@ export default class CLI { isWatch: Boolean(args.watch), // Note: 是否把 Taro 组件编译为原生自定义组件 isBuildNativeComp: _[1] === 'native-components' || _[1] === 'pure-native-components', - isBuildPureNativeComp: _[1] === 'native-components-pure', + isBuildPureNativeComp: _[1] === 'pure-native-components', // Note: 新的混合编译模式,支持把组件单独编译为原生组件 newBlended: Boolean(args['new-blended']), // Note: 是否禁用编译 diff --git a/packages/taro-cli/src/presets/commands/build.ts b/packages/taro-cli/src/presets/commands/build.ts index 937fc53c4431..20485e0b89e7 100644 --- a/packages/taro-cli/src/presets/commands/build.ts +++ b/packages/taro-cli/src/presets/commands/build.ts @@ -101,6 +101,8 @@ export default (ctx: IPluginContext) => { // is build native components mode? const isBuildNativeComp = _[1] === 'native-components' || _[1] === 'pure-native-components' + // 是否构造一个纯净的,不包含环境功能适配的原生组件 + const isBuildPureNativeComp = _[1] === 'pure-native-components' await ctx.applyPlugins(hooks.ON_BUILD_START) await ctx.applyPlugins({ @@ -112,6 +114,7 @@ export default (ctx: IPluginContext) => { mode: isProduction ? 'production' : 'development', blended, isBuildNativeComp, + isBuildPureNativeComp, withoutBuild, newBlended, async modifyWebpackChain(chain, webpack, data) { From a5c37b03a84e85baa3318cb759ec43472cc149ca Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Sun, 28 Apr 2024 16:33:21 +0800 Subject: [PATCH 8/9] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/cli.ts | 6 +++--- packages/taro-cli/src/presets/commands/build.ts | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/taro-cli/src/cli.ts b/packages/taro-cli/src/cli.ts index 671685e36985..689e40ba4896 100644 --- a/packages/taro-cli/src/cli.ts +++ b/packages/taro-cli/src/cli.ts @@ -163,15 +163,15 @@ export default class CLI { customCommand(command, kernel, args) break } - + console.log('args+++', args) customCommand(command, kernel, { + args, _, platform, plugin, isWatch: Boolean(args.watch), // Note: 是否把 Taro 组件编译为原生自定义组件 - isBuildNativeComp: _[1] === 'native-components' || _[1] === 'pure-native-components', - isBuildPureNativeComp: _[1] === 'pure-native-components', + isBuildNativeComp: _[1] === 'native-components', // Note: 新的混合编译模式,支持把组件单独编译为原生组件 newBlended: Boolean(args['new-blended']), // Note: 是否禁用编译 diff --git a/packages/taro-cli/src/presets/commands/build.ts b/packages/taro-cli/src/presets/commands/build.ts index 20485e0b89e7..043c2ff8a9db 100644 --- a/packages/taro-cli/src/presets/commands/build.ts +++ b/packages/taro-cli/src/presets/commands/build.ts @@ -100,9 +100,7 @@ export default (ctx: IPluginContext) => { fs.ensureDirSync(outputPath) // is build native components mode? - const isBuildNativeComp = _[1] === 'native-components' || _[1] === 'pure-native-components' - // 是否构造一个纯净的,不包含环境功能适配的原生组件 - const isBuildPureNativeComp = _[1] === 'pure-native-components' + const isBuildNativeComp = _[1] === 'native-components' await ctx.applyPlugins(hooks.ON_BUILD_START) await ctx.applyPlugins({ @@ -114,7 +112,6 @@ export default (ctx: IPluginContext) => { mode: isProduction ? 'production' : 'development', blended, isBuildNativeComp, - isBuildPureNativeComp, withoutBuild, newBlended, async modifyWebpackChain(chain, webpack, data) { From ad6ef90e8249999cad33c1c84c6900f0bae51dd6 Mon Sep 17 00:00:00 2001 From: mayintao3 Date: Sun, 28 Apr 2024 16:35:19 +0800 Subject: [PATCH 9/9] =?UTF-8?q?feat:=20=E5=8E=BB=E6=8E=89console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/cli.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/taro-cli/src/cli.ts b/packages/taro-cli/src/cli.ts index 689e40ba4896..8bd1bd51a64c 100644 --- a/packages/taro-cli/src/cli.ts +++ b/packages/taro-cli/src/cli.ts @@ -163,7 +163,6 @@ export default class CLI { customCommand(command, kernel, args) break } - console.log('args+++', args) customCommand(command, kernel, { args, _,