From d2f1accc480720c67ea007ac7b39e8bda65f6235 Mon Sep 17 00:00:00 2001 From: lilei946 Date: Tue, 22 Jul 2025 09:59:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E5=8D=87aiottoolkit=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=89=88=E6=9C=AC,=E4=BC=98=E5=8C=96marquee=E7=AD=89?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=89=93=E5=8C=85=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lilei946 --- .../hap-compiler/src/template/validator.js | 30 +++++++++++++------ .../src/loaders/ux-fragment-utils.js | 10 ++++--- packages/hap-dsl-xvm/src/loaders/ux-loader.js | 3 +- packages/hap-packager/package.json | 2 +- .../__snapshots__/compile.test.js.snap | 2 +- .../__snapshots__/splitChunks.test.js.snap | 10 +++---- packages/hap-toolkit/src/utils.js | 2 ++ yarn.lock | 8 ++--- 8 files changed, 42 insertions(+), 25 deletions(-) diff --git a/packages/hap-compiler/src/template/validator.js b/packages/hap-compiler/src/template/validator.js index 6cf30fe2..a7b27049 100644 --- a/packages/hap-compiler/src/template/validator.js +++ b/packages/hap-compiler/src/template/validator.js @@ -1118,15 +1118,27 @@ function checkTagName(node, output, options = {}) { ) { const locationAddr = location.line && location.column ? '@' + location.line + ':' + location.column : '' - colorconsole.throw( - 'ERROR: ' + - locationAddr + - ' 使用 `' + - tagName + - '` 组件,要求卡片配置 minCardPlatformVersion 或 minPlatformVersion 不低于 ' + - tagNatives[tagName].minRequiredRuntimeVersion + - ', 请修改' - ) + if (options.isTargetVivo) { + colorconsole.throw( + 'ERROR: ' + + locationAddr + + ' 使用 `' + + tagName + + '` 组件,要求卡片配置 minCardPlatformVersion 或 minPlatformVersion 不低于 ' + + tagNatives[tagName].minRequiredRuntimeVersion + + ', 请修改' + ) + } else { + colorconsole.warn( + 'ERROR: ' + + locationAddr + + ' 使用 `' + + tagName + + '` 组件,要求卡片配置 minCardPlatformVersion 或 minPlatformVersion 不低于 ' + + tagNatives[tagName].minRequiredRuntimeVersion + + ', 请修改' + ) + } } // 检测根组件合法性 diff --git a/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js b/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js index ae91e14f..e5265877 100644 --- a/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js +++ b/packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js @@ -269,7 +269,7 @@ function makeLoaderString(type, config, newJSCard, uxType) { * @returns {string} */ function processImportFrag($loader, imports, importNames, queryOptions = {}) { - const { newJSCard, lite, cardEntry, minCardRuntimeVersion } = queryOptions + const { newJSCard, lite, cardEntry, minCardRuntimeVersion, isTargetVivo } = queryOptions let retStr = '' if (imports.length) { const newJSCardParam = newJSCard ? `&newJSCard=${newJSCard}` : '' @@ -278,6 +278,7 @@ function processImportFrag($loader, imports, importNames, queryOptions = {}) { const minCardRuntimeVersionParam = minCardRuntimeVersion ? `&minCardRuntimeVersion=${minCardRuntimeVersion}` : '' + const isTargetVivoParam = isTargetVivo ? `&isTargetVivo=${isTargetVivo}` : '' for (let i = 0; i < imports.length; i++) { const imp = imports[i] let importSrc = imp.attrs.src @@ -314,7 +315,7 @@ function processImportFrag($loader, imports, importNames, queryOptions = {}) { let reqStr = makeRequireString( $loader, makeLoaderString(FRAG_TYPE.IMPORT, null, newJSCard), - `${importSrc}?uxType=${ENTRY_TYPE.COMP}&name=${importName}${newJSCardParam}${liteParam}${cardEntryParam}${minCardRuntimeVersionParam}` + `${importSrc}?uxType=${ENTRY_TYPE.COMP}&name=${importName}${newJSCardParam}${liteParam}${cardEntryParam}${minCardRuntimeVersionParam}${isTargetVivoParam}` ) if (compileOptionsObject.stats) { @@ -338,7 +339,7 @@ function processImportFrag($loader, imports, importNames, queryOptions = {}) { * @param {number} lite 轻卡 */ function processTemplateFrag($loader, templates, importNames, queryOptions = {}) { - const { uxType, newJSCard, lite, cardEntry, minCardRuntimeVersion } = queryOptions + const { uxType, newJSCard, lite, cardEntry, minCardRuntimeVersion, isTargetVivo } = queryOptions let retStr = '{}' if (!templates.length) { $loader.emitError(new Error('需要模板