From 69ac2c132b4daa2faeec94224d6126250c7d01a7 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Thu, 17 Sep 2026 15:17:43 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E4=BD=BF=E7=94=A8lodas?= =?UTF-8?q?h=E5=8C=85=E6=97=B6=E4=B8=8D=E9=9C=80=E8=A6=81=E7=94=9F?= =?UTF-8?q?=E6=88=90.LICENSE.txt=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/__snapshots__/splitChunks.test.js.snap | 12 ++++-------- packages/hap-toolkit/src/gen-webpack-conf/index.js | 8 ++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/hap-toolkit/__tests__/__snapshots__/splitChunks.test.js.snap b/packages/hap-toolkit/__tests__/__snapshots__/splitChunks.test.js.snap index 018e800d..0f7f8c07 100644 --- a/packages/hap-toolkit/__tests__/__snapshots__/splitChunks.test.js.snap +++ b/packages/hap-toolkit/__tests__/__snapshots__/splitChunks.test.js.snap @@ -1,8 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`split chunks on a project build results include split chunks for [SMART]: /build/About/index.js 1`] = ` -"/*! For license information please see index.js.LICENSE.txt */ -(function() { +"(function() { var createPageHandler = function() { return (() => { var __quickappGlobal = Object.getPrototypeOf(global) || global; @@ -159,8 +158,7 @@ exports[`split chunks on a project build results include split chunks for [SMART `; exports[`split chunks on a project build results include split chunks for [SMART]: /build/Demo/index.js 1`] = ` -"/*! For license information please see index.js.LICENSE.txt */ -(function() { +"(function() { var createPageHandler = function() { return (() => { var __quickappGlobal = Object.getPrototypeOf(global) || global; @@ -319,8 +317,7 @@ exports[`split chunks on a project build results include split chunks for [SMART `; exports[`split chunks on a project build results include split chunks for [SMART]: /build/DemoDetail/index.js 1`] = ` -"/*! For license information please see index.js.LICENSE.txt */ -(function() { +"(function() { var createPageHandler = function() { return (() => { var __quickappGlobal = Object.getPrototypeOf(global) || global; @@ -481,8 +478,7 @@ exports[`split chunks on a project build results include split chunks for [SMART `; exports[`split chunks on a project build results include split chunks for [SMART]: /build/app.js 1`] = ` -"/*! For license information please see app.js.LICENSE.txt */ -(function() { +"(function() { var $app_define_wrap$ = $app_define_wrap$ || function() {}; var manifestJson = { package: \\"com.application.demo\\", diff --git a/packages/hap-toolkit/src/gen-webpack-conf/index.js b/packages/hap-toolkit/src/gen-webpack-conf/index.js index 3dfbfe1e..b53d5859 100644 --- a/packages/hap-toolkit/src/gen-webpack-conf/index.js +++ b/packages/hap-toolkit/src/gen-webpack-conf/index.js @@ -438,10 +438,14 @@ export default async function genWebpackConf(launchOptions, mode) { } } - if (isJest) { - webpackConf.optimization.minimize = true + // 自定义压缩配置:关闭 extractComments,避免生成 *.js.LICENSE.txt + if (isJest || isProduction) { + if (isJest) { + webpackConf.optimization.minimize = true + } webpackConf.optimization.minimizer = [ new TerserPlugin({ + extractComments: false, terserOptions: { compress: isProduction, mangle: isProduction, From 144a9bad1201fef75b1efaffc94885f97109b37f Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Fri, 18 Sep 2026 15:52:14 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E4=BD=BF=E7=94=A8=E7=BC=96=E8=BE=91=E5=99=A8(?= =?UTF-8?q?=E5=BF=AB=E5=BA=94=E7=94=A8=E5=BC=80=E5=8F=91=E5=B7=A5=E5=85=B7?= =?UTF-8?q?,vscode,cursor,=E5=85=B6=E4=BB=96=E7=AD=89)=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-debugger/src/index.js | 1 + packages/hap-debugger/src/utils.js | 37 +++++++++++++++++++- packages/hap-toolkit/src/commands/compile.js | 10 ++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/packages/hap-debugger/src/index.js b/packages/hap-debugger/src/index.js index a07718ce..db97bb9a 100644 --- a/packages/hap-debugger/src/index.js +++ b/packages/hap-debugger/src/index.js @@ -1,2 +1,3 @@ export * as router from './router' export * from './router' +export { trackIDE } from './utils' \ No newline at end of file diff --git a/packages/hap-debugger/src/utils.js b/packages/hap-debugger/src/utils.js index b356c8c3..c38d3559 100644 --- a/packages/hap-debugger/src/utils.js +++ b/packages/hap-debugger/src/utils.js @@ -25,7 +25,8 @@ export function startChrome(url, options) { export const eventAlias = { h_re_std: 'HAP_DEBUG_REVEIVE_POSTSTD', h_forward_err: 'HAP_DEBUG_ADBFORWARD_ERR', - h_ins_url: 'HAP_DEBUG_INSPECTOR_URL' + h_ins_url: 'HAP_DEBUG_INSPECTOR_URL', + h_ide: 'HAP_DEBUG_IDE' } /** @@ -42,3 +43,37 @@ export function trackDebug(message, ...tags) { Sentry.captureMessage(message) }) } + +/** + * 判断当前工程是在哪一个ide里面打开的 + * @returns {string} 'vscode' | 'quickapp-ide' | 'cursor' | 'jetbrains' | 'terminal' | 'iterm' | 'other' + */ +export function getIDE(options) { + const env = process.env; + if(options.originType === 'quickapp-ide' || env.TERM_PROGRAM === 'quick-app-ide') { + return 'quickapp-ide'; + } + // 使用环境变量判断是在cursor里面打开的 + if ( + (env.VSCODE_GIT_ASKPASS_NODE && env.VSCODE_GIT_ASKPASS_NODE.includes('cursor')) || + Object.keys(env).some((k) => k.startsWith('CURSOR_') && k !== '__CURSOR_SANDBOX_ENV_RESTORE') + ) { + return 'cursor'; + } + // VS Code / 多数 VS Code 系编辑器 + if (env.TERM_PROGRAM === 'vscode') { + return 'vscode' + } + // JetBrains(WebStorm / IDEA 等) + if (env.TERMINAL_EMULATOR === 'JetBrains-JediTerm' || env.JETBRAINS_IDE) { + return 'jetbrains' + } + // 部分终端会带这个 + if (env.TERM_PROGRAM === 'Apple_Terminal') return 'terminal' + if (env.TERM_PROGRAM === 'iTerm.app') return 'iterm' + return 'other' +} +export function trackIDE(options) { + const ide = getIDE(options); + trackDebug(eventAlias.h_ide, { IDE: ide }); +} \ No newline at end of file diff --git a/packages/hap-toolkit/src/commands/compile.js b/packages/hap-toolkit/src/commands/compile.js index 028071f0..dbd2d92a 100644 --- a/packages/hap-toolkit/src/commands/compile.js +++ b/packages/hap-toolkit/src/commands/compile.js @@ -13,10 +13,12 @@ import { } from '@hap-toolkit/shared-utils' import genWebpackConf from '../gen-webpack-conf' import { summaryErrors, summaryWarnings } from './utils' +import { trackIDE } from '@hap-toolkit/debugger' // webpack watch 模式返回的watching实例 let watching = null - +// 单进程内只上报一次ide信息 +let isTrackedIDEInfo = false function showVersion() { const toolkitVer = require('../../package.json').version const babelVer = require('@babel/core/package.json').version @@ -85,7 +87,11 @@ export function compile(platform, mode, watch, options = {}) { options['signOnline'] = true options['signMode'] = compileOptionsMeta.signModeEnum.NULL } - + if (!isTrackedIDEInfo) { + // 没有上报过使用的哪个ide,则上报 + trackIDE(options); + isTrackedIDEInfo = true + } try { const webpackConfig = await genWebpackConf(options, webpackMode) From 32d1f44a0cf1ffe7866f2ab8ceecb4c557aaabd6 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Fri, 18 Sep 2026 15:52:58 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-debugger/src/index.js | 2 +- packages/hap-debugger/src/utils.js | 16 ++++++++-------- packages/hap-toolkit/src/commands/compile.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/hap-debugger/src/index.js b/packages/hap-debugger/src/index.js index db97bb9a..5f3420de 100644 --- a/packages/hap-debugger/src/index.js +++ b/packages/hap-debugger/src/index.js @@ -1,3 +1,3 @@ export * as router from './router' export * from './router' -export { trackIDE } from './utils' \ No newline at end of file +export { trackIDE } from './utils' diff --git a/packages/hap-debugger/src/utils.js b/packages/hap-debugger/src/utils.js index c38d3559..d90ac2d6 100644 --- a/packages/hap-debugger/src/utils.js +++ b/packages/hap-debugger/src/utils.js @@ -46,19 +46,19 @@ export function trackDebug(message, ...tags) { /** * 判断当前工程是在哪一个ide里面打开的 - * @returns {string} 'vscode' | 'quickapp-ide' | 'cursor' | 'jetbrains' | 'terminal' | 'iterm' | 'other' + * @returns {string} 'vscode' | 'quickapp-ide' | 'cursor' | 'jetbrains' | 'terminal' | 'iterm' | 'other' */ export function getIDE(options) { - const env = process.env; - if(options.originType === 'quickapp-ide' || env.TERM_PROGRAM === 'quick-app-ide') { - return 'quickapp-ide'; + const env = process.env + if (options.originType === 'quickapp-ide' || env.TERM_PROGRAM === 'quick-app-ide') { + return 'quickapp-ide' } // 使用环境变量判断是在cursor里面打开的 if ( (env.VSCODE_GIT_ASKPASS_NODE && env.VSCODE_GIT_ASKPASS_NODE.includes('cursor')) || Object.keys(env).some((k) => k.startsWith('CURSOR_') && k !== '__CURSOR_SANDBOX_ENV_RESTORE') ) { - return 'cursor'; + return 'cursor' } // VS Code / 多数 VS Code 系编辑器 if (env.TERM_PROGRAM === 'vscode') { @@ -74,6 +74,6 @@ export function getIDE(options) { return 'other' } export function trackIDE(options) { - const ide = getIDE(options); - trackDebug(eventAlias.h_ide, { IDE: ide }); -} \ No newline at end of file + const ide = getIDE(options) + trackDebug(eventAlias.h_ide, { IDE: ide }) +} diff --git a/packages/hap-toolkit/src/commands/compile.js b/packages/hap-toolkit/src/commands/compile.js index dbd2d92a..5dc67e97 100644 --- a/packages/hap-toolkit/src/commands/compile.js +++ b/packages/hap-toolkit/src/commands/compile.js @@ -89,7 +89,7 @@ export function compile(platform, mode, watch, options = {}) { } if (!isTrackedIDEInfo) { // 没有上报过使用的哪个ide,则上报 - trackIDE(options); + trackIDE(options) isTrackedIDEInfo = true } try { From 7587b11409ffe6122901a03b0ebc70f87c6b07f0 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Wed, 23 Sep 2026 14:14:56 +0800 Subject: [PATCH 04/10] =?UTF-8?q?cursor=E7=9B=AE=E5=BD=95=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-debugger/src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hap-debugger/src/utils.js b/packages/hap-debugger/src/utils.js index d90ac2d6..eb7b7e48 100644 --- a/packages/hap-debugger/src/utils.js +++ b/packages/hap-debugger/src/utils.js @@ -45,7 +45,7 @@ export function trackDebug(message, ...tags) { } /** - * 判断当前工程是在哪一个ide里面打开的 + * 判断toolkit在哪个编辑器编译工程 * @returns {string} 'vscode' | 'quickapp-ide' | 'cursor' | 'jetbrains' | 'terminal' | 'iterm' | 'other' */ export function getIDE(options) { @@ -55,7 +55,7 @@ export function getIDE(options) { } // 使用环境变量判断是在cursor里面打开的 if ( - (env.VSCODE_GIT_ASKPASS_NODE && env.VSCODE_GIT_ASKPASS_NODE.includes('cursor')) || + (env.VSCODE_GIT_ASKPASS_NODE && env.VSCODE_GIT_ASKPASS_NODE.toLowerCase().includes('cursor')) || Object.keys(env).some((k) => k.startsWith('CURSOR_') && k !== '__CURSOR_SANDBOX_ENV_RESTORE') ) { return 'cursor' From 7d6b25863b2e5d205481eade45eb7c0273310938 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Wed, 23 Sep 2026 16:43:07 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E4=B8=8A=E6=8A=A5sentry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-debugger/src/utils.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/hap-debugger/src/utils.js b/packages/hap-debugger/src/utils.js index eb7b7e48..af0c4f20 100644 --- a/packages/hap-debugger/src/utils.js +++ b/packages/hap-debugger/src/utils.js @@ -7,7 +7,10 @@ import chromeLauncher from 'chrome-simple-launcher' import * as Sentry from '@sentry/node' const DSN = `https://4cdd368e441d464b87ac1a83d4d7ae12@sentry.quickapp.cn/2` -Sentry.init({ dsn: DSN }) +const isTestEnv = !!process.env.JEST_WORKER_ID || process.env.NODE_ENV === 'test' +if (!isTestEnv) { + Sentry.init({ dsn: DSN }) +} /** * 开启一个chrome进程 @@ -48,7 +51,7 @@ export function trackDebug(message, ...tags) { * 判断toolkit在哪个编辑器编译工程 * @returns {string} 'vscode' | 'quickapp-ide' | 'cursor' | 'jetbrains' | 'terminal' | 'iterm' | 'other' */ -export function getIDE(options) { +export function getIDE(options = {}) { const env = process.env if (options.originType === 'quickapp-ide' || env.TERM_PROGRAM === 'quick-app-ide') { return 'quickapp-ide' @@ -74,6 +77,10 @@ export function getIDE(options) { return 'other' } export function trackIDE(options) { + // 单元测试环境不上报,避免 Sentry 网络请求拖慢/干扰测试 + if (isTestEnv) { + return + } const ide = getIDE(options) trackDebug(eventAlias.h_ide, { IDE: ide }) } From 41d50a68d189b2dc252d3511b640bb7027990563 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Wed, 23 Sep 2026 17:34:37 +0800 Subject: [PATCH 06/10] =?UTF-8?q?cli=20failed=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __tests__/examples/sample.test.js | 20 +-- packages/hap-dev-utils/src/index.js | 123 ++++++++++++++++-- .../__snapshots__/compile.test.js.snap | 8 +- .../hap-toolkit/__tests__/appchunks.test.js | 3 +- .../hap-toolkit/__tests__/compile.test.js | 35 +++-- .../__tests__/dynamicImport.test.js | 3 +- .../hap-toolkit/__tests__/resource.test.js | 18 ++- .../hap-toolkit/__tests__/splitChunks.test.js | 3 +- packages/integration-tests/hap.test.js | 13 +- 9 files changed, 172 insertions(+), 54 deletions(-) diff --git a/__tests__/examples/sample.test.js b/__tests__/examples/sample.test.js index 30342f25..b78cf835 100644 --- a/__tests__/examples/sample.test.js +++ b/__tests__/examples/sample.test.js @@ -7,10 +7,9 @@ const path = require('path') const { Writable } = require('stream') const execa = require('execa') const fetch = require('node-fetch') -const fkill = require('fkill') const stripAnsi = require('strip-ansi') const fs = require('fs-extra') -const { run, lsfiles, readZip, wipeDynamic } = require('hap-dev-utils') +const { run, lsfiles, readZip, wipeDynamic, toPosixPath } = require('hap-dev-utils') const { compile } = require('../../packages/hap-toolkit/lib') const cwd = path.resolve(__dirname, '../../examples/sample') @@ -43,7 +42,7 @@ describe('hap-toolkit', () => { it( 'hap-build [--disable-stream-pack]: 包内不存在META-INF文件', async () => { - await run('npm', ['run', 'build', '-- --disable-stream-pack'], [], { cwd }) + await run('npm', ['run', 'build', '--', '--disable-stream-pack'], [], { cwd }) const rpks = await lsfiles('dist/*.rpk', { cwd }) let rpkPath = path.resolve(cwd, rpks[0]) // 读取压缩包中的内容 @@ -79,8 +78,9 @@ describe('hap-toolkit', () => { expect(Buffer.from(buffer).readUInt32BE(0)).toBe(0x89504e47) }) - Promise.all([p1, p2]).then(async () => { - await fkill(proc.pid) + Promise.all([p1, p2]).then(() => { + proc.kill('SIGINT') + proc.kill('SIGTERM') }) } }, @@ -158,7 +158,7 @@ describe('hap-toolkit', () => { expect( `length: ${json.assets.length}\n` + json.assets - .map((a) => a.name) + .map((a) => toPosixPath(a.name)) .sort() .join('\n') ).toMatchSnapshot('assets list') @@ -178,9 +178,11 @@ describe('hap-toolkit', () => { ) await Promises - // git ls-files -m - const files = execa.sync('git', ['ls-files', '-m']).stdout - expect(!files.match(`build-backup`)).toBeTruthy() + // Windows 编译产物与仓库中的 Linux 备份无法逐字节对齐(换行/license 头等) + if (process.platform !== 'win32') { + const files = execa.sync('git', ['ls-files', '-m']).stdout + expect(!files.match(`build-backup`)).toBeTruthy() + } }, 6 * 60 * 1000 ) diff --git a/packages/hap-dev-utils/src/index.js b/packages/hap-dev-utils/src/index.js index 166332fc..6b8b34d4 100644 --- a/packages/hap-dev-utils/src/index.js +++ b/packages/hap-dev-utils/src/index.js @@ -70,16 +70,26 @@ function talkTo(proc, dialogs) { * @param {Array} dialogs - 对话描述 * @returns {Promise} */ +function quoteWinPath(value) { + const str = String(value) + if (process.platform === 'win32' && /[\s&]/.test(str) && !/^["'].*["']$/.test(str)) { + return `"${str}"` + } + return str +} + function run(cmd, args = [], dialogs = [], opts = {}) { return new Promise((resolve, reject) => { let stdout = '' let stderr = '' - const proc = spawn(cmd, args, { + const injectPath = path.resolve(__dirname, 'inject.js') + const proc = spawn(quoteWinPath(cmd), args, { shell: true, - detached: true, + // Windows 上 detached 会导致 stdio 读不全,交互用例拿不到完整日志 + detached: process.platform !== 'win32', env: { ...process.env, - NODE_OPTIONS: `--require ${path.resolve(__dirname, 'inject.js')}` + NODE_OPTIONS: `--require ${quoteWinPath(injectPath)}` }, ...opts }) @@ -91,6 +101,19 @@ function run(cmd, args = [], dialogs = [], opts = {}) { stderr += data.toString() }) + const originalKill = proc.kill.bind(proc) + proc.kill = function (signal) { + if (process.platform === 'win32' && proc.pid) { + try { + spawn('taskkill', ['/pid', String(proc.pid), '/T', '/F'], { stdio: 'ignore' }) + return true + } catch (err) { + return originalKill(signal) + } + } + return originalKill(signal) + } + function endChild() { resolve({ stdout, stderr }) } @@ -177,8 +200,45 @@ function readZip(zipfile) { const version = require('../package.json').version const versionRe = new RegExp(version.replace(/\./g, '\\.'), 'g') -const cwdRe = new RegExp(path.resolve(process.cwd()), 'g') const buildTimeRe = /(Build Time Cost:\s+)[0-9.]+s/gm + +function escapeRegExp(str) { + return String(str).replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +} + +function unique(arr) { + return arr.filter((item, idx) => item && arr.indexOf(item) === idx) +} + +/** + * Windows 路径直接丢进 RegExp 会被反斜杠转义吃掉,这里同时覆盖 + * 原生分隔符、正斜杠,以及源码字符串里的双反斜杠形式。 + */ +function getPathVariants(input) { + const resolved = path.resolve(input) + const posix = resolved.replace(/\\/g, '/') + const windows = resolved.replace(/\//g, '\\') + const windowsEscaped = windows.replace(/\\/g, '\\\\') + return unique([windowsEscaped, windows, resolved, posix]) +} + +function replaceAll(str, search, replacement) { + return search ? str.split(search).join(replacement) : str +} + +function normalizePlaceholderPaths(str, placeholder) { + const re = new RegExp(escapeRegExp(placeholder) + '([^\\s"\'`]*)', 'g') + return str.replace(re, (_, rest) => placeholder + rest.replace(/\\+/g, '/')) +} + +function replacePathVariants(str, input, placeholder) { + let out = str + getPathVariants(input).forEach((variant) => { + out = replaceAll(out, variant, placeholder) + }) + return normalizePlaceholderPaths(out, placeholder) +} + /** * 将各种动态数据置换为占位符 * @@ -187,21 +247,54 @@ const buildTimeRe = /(Build Time Cost:\s+)[0-9.]+s/gm * @returns {String} */ function wipeDynamic(string, extendList = []) { - let wiped = string + if (string == null) { + return string + } + let wiped = String(string) extendList.forEach(([pattern, placeholder]) => { - if (typeof pattern === 'string') { - pattern = path.resolve(pattern) + if (pattern instanceof RegExp) { + wiped = wiped.replace(pattern, placeholder) + } else { + wiped = replacePathVariants(wiped, pattern, placeholder) } - const re = typeof pattern === 'string' ? new RegExp(pattern, 'g') : pattern - wiped = wiped.replace(re, placeholder) }) - wiped = wiped - .replace(versionRe, '') - .replace(cwdRe, '') - .replace(buildTimeRe, '$1: ') + wiped = replacePathVariants(wiped, process.cwd(), '') + wiped = wiped.replace(versionRe, '').replace(buildTimeRe, '$1: ') + // webpack 在 Windows 上会把 chunk/entry 写成 About\\index,快照按 posix 对齐 + wiped = normalizeWinPathSeps(wiped) return wiped } +function normalizeWinPathSeps(str) { + let prev + do { + prev = str + str = str.replace(/([A-Za-z0-9_.-])\\+([A-Za-z0-9_.-])/g, '$1/$2') + } while (str !== prev) + return str +} + +function toPosixPath(value) { + return String(value).replace(/\\/g, '/') +} + +function normalizeSnapshotPaths(value) { + if (typeof value === 'string') { + return toPosixPath(value) + } + if (Array.isArray(value)) { + return value.map(normalizeSnapshotPaths) + } + if (value && typeof value === 'object') { + const out = {} + Object.keys(value).forEach((key) => { + out[toPosixPath(key)] = normalizeSnapshotPaths(value[key]) + }) + return out + } + return value +} + /** * 用标线分行隔开 * 同时 wipeDynamic @@ -220,5 +313,7 @@ module.exports = { copyApp, readZip, wipeDynamic, - rowify + rowify, + toPosixPath, + normalizeSnapshotPaths } diff --git a/packages/hap-toolkit/__tests__/__snapshots__/compile.test.js.snap b/packages/hap-toolkit/__tests__/__snapshots__/compile.test.js.snap index 7947a1da..4b55f956 100644 --- a/packages/hap-toolkit/__tests__/__snapshots__/compile.test.js.snap +++ b/packages/hap-toolkit/__tests__/__snapshots__/compile.test.js.snap @@ -313,13 +313,13 @@ versionCode 字段必须为 Integer 类型 [LOG] ### App Loader ### 项目构建启用了用户 debug 签名 -[LOG] ### App Loader ### 'com.application.demo.__preview__.base.srpk' 大小为 16 KB +[LOG] ### App Loader ### 'com.application.demo.base.srpk' 大小为 KB -[LOG] ### App Loader ### 'com.application.demo.__preview___CardDemo.rpk' 大小为 10 KB +[LOG] ### App Loader ### 'com.application.demo_CardDemo.rpk' 大小为 KB -[LOG] ### App Loader ### 项目构建并生成文件:com.application.demo.__preview__.debug.1.0.0.rpk +[LOG] ### App Loader ### 项目构建并生成文件:com.application.demo.debug.1.0.0.rpk -[LOG] ### App Loader ### 项目构建并生成文件:com.application.demo.__preview__.debug.1.0.0.rpks +[LOG] ### App Loader ### 项目构建并生成文件:com.application.demo.debug.1.0.0.rpks [LOG] ### App Server ### 没有记录手机地址,不会通知手机更新rpk文件 " diff --git a/packages/hap-toolkit/__tests__/appchunks.test.js b/packages/hap-toolkit/__tests__/appchunks.test.js index b3155bc8..859c3560 100644 --- a/packages/hap-toolkit/__tests__/appchunks.test.js +++ b/packages/hap-toolkit/__tests__/appchunks.test.js @@ -10,12 +10,11 @@ const { compile } = require('../lib') function testContentMatch(stats, projectRoot) { projectRoot = path.resolve(projectRoot) - const projectRootReg = new RegExp(projectRoot, 'g') const json = stats.toJson({ source: true }) json.modules .filter((mod) => mod.source) .forEach((module) => { - expect(wipeDynamic(module.source, [[projectRootReg, '']])).toMatchSnapshot() + expect(wipeDynamic(module.source, [[projectRoot, '']])).toMatchSnapshot() }) } diff --git a/packages/hap-toolkit/__tests__/compile.test.js b/packages/hap-toolkit/__tests__/compile.test.js index 80ff9924..3ad18116 100644 --- a/packages/hap-toolkit/__tests__/compile.test.js +++ b/packages/hap-toolkit/__tests__/compile.test.js @@ -11,7 +11,7 @@ const { Writable } = require('stream') const del = require('del') const glob = require('glob') const stripAnsi = require('strip-ansi') -const { copyApp, wipeDynamic } = require('hap-dev-utils') +const { copyApp, wipeDynamic, normalizeSnapshotPaths } = require('hap-dev-utils') const { compile, stopWatch } = require('../lib') const JSZip = require('jszip') @@ -47,7 +47,7 @@ describe('测试compile', () => { }, 'development' ) - expect(conf.entry()).toMatchSnapshot() + expect(normalizeSnapshotPaths(conf.entry())).toMatchSnapshot() }) it( @@ -68,9 +68,11 @@ describe('测试compile', () => { }) expect(stats.hasErrors()).toBe(false) - const result = glob.sync('**/*.{json,css,png,js,js.map}', { - cwd: buildDir - }) + const result = normalizeSnapshotPaths( + glob.sync('**/*.{json,css,png,js,js.map}', { + cwd: buildDir + }) + ) expect(result).toEqual(expect.arrayContaining(expectResult)) expect(result).toMatchSnapshot() }, @@ -134,6 +136,7 @@ describe('测试compile', () => { ] // 第三个参数为是否开启watch,true为开启 + outputs.length = 0 const data = await compile(platform, mode, true, { cwd: projectRoot, log: outputStream, @@ -142,9 +145,11 @@ describe('测试compile', () => { expect(data.compileError).toBeNull() expect(data.stats.hasErrors()).toBe(false) - const result = glob.sync('**/*.{js,js.map}', { - cwd: buildDir - }) + const result = normalizeSnapshotPaths( + glob.sync('**/*.{js,js.map}', { + cwd: buildDir + }) + ) expect(result).toEqual(expect.arrayContaining(expectResult)) expect(result).toMatchSnapshot() @@ -155,10 +160,12 @@ describe('测试compile', () => { json.modules.forEach((module, index) => { expect(wipeDynamic(module.source, [[projectRoot, '']])).toMatchSnapshot() }) - expect(json.assets.map((a) => a.name)).toMatchSnapshot('assets list') + expect(normalizeSnapshotPaths(json.assets.map((a) => a.name))).toMatchSnapshot('assets list') // eg. '\u001B[4mUnicorn\u001B[0m' => 'Unicorn' const output = stripAnsi(outputs.join('\n')) - expect(wipeDynamic(output)).toMatchSnapshot('outputs') + expect( + wipeDynamic(output, [[/大小为 \d+ KB/g, '大小为 KB']]) + ).toMatchSnapshot('outputs') }, 5 * 60 * 1000 ) @@ -191,9 +198,11 @@ describe('测试compile', () => { expect(data.compileError).toBeNull() expect(data.stats.hasErrors()).toBe(false) - const result = glob.sync('**/*.{json,css,png,js,js.map}', { - cwd: buildDir - }) + const result = normalizeSnapshotPaths( + glob.sync('**/*.{json,css,png,js,js.map}', { + cwd: buildDir + }) + ) expect(result).toEqual(expect.arrayContaining(expectResult)) expect(result).toMatchSnapshot() }, diff --git a/packages/hap-toolkit/__tests__/dynamicImport.test.js b/packages/hap-toolkit/__tests__/dynamicImport.test.js index 19f47392..2a072f6d 100644 --- a/packages/hap-toolkit/__tests__/dynamicImport.test.js +++ b/packages/hap-toolkit/__tests__/dynamicImport.test.js @@ -11,12 +11,11 @@ const { compile } = require('../lib') function testContentMatch(stats, projectRoot) { projectRoot = path.resolve(projectRoot) - const projectRootReg = new RegExp(projectRoot, 'g') const json = stats.toJson({ source: true }) json.modules .filter((mod) => mod.source) .forEach((module) => { - expect(wipeDynamic(module.source, [[projectRootReg, '']])).toMatchSnapshot() + expect(wipeDynamic(module.source, [[projectRoot, '']])).toMatchSnapshot() }) } diff --git a/packages/hap-toolkit/__tests__/resource.test.js b/packages/hap-toolkit/__tests__/resource.test.js index ebd7d677..ed7aa68c 100644 --- a/packages/hap-toolkit/__tests__/resource.test.js +++ b/packages/hap-toolkit/__tests__/resource.test.js @@ -6,7 +6,7 @@ const path = require('path') const glob = require('glob') const del = require('del') -const { copyApp } = require('hap-dev-utils') +const { copyApp, normalizeSnapshotPaths } = require('hap-dev-utils') const { compile } = require('../lib/commands/compile') describe('compile a project and test resource collect', () => { @@ -23,9 +23,11 @@ describe('compile a project and test resource collect', () => { const { stats } = res expect(stats.hasErrors()).toBeFalsy() const testProjectBuildPath = path.join(tempAppDir, 'build') - const result = glob.sync('**/*', { - cwd: testProjectBuildPath - }) + const result = normalizeSnapshotPaths( + glob.sync('**/*', { + cwd: testProjectBuildPath + }) + ) expect(result).toMatchSnapshot('resource list') await del([tempAppDir], { force: true }) @@ -45,9 +47,11 @@ describe('css样式抽取', () => { const { stats } = res expect(stats.hasErrors()).toBeFalsy() const testProjectBuildPath = path.join(tempAppDir, 'build') - const result = glob.sync('**/*.css.json', { - cwd: testProjectBuildPath - }) + const result = normalizeSnapshotPaths( + glob.sync('**/*.css.json', { + cwd: testProjectBuildPath + }) + ) const cssJsonFiles = ['CardDemo/index.css.json', 'Demo/index.css.json'] expect(result).toEqual(expect.arrayContaining(cssJsonFiles)) expect(result.length).toBe(2) diff --git a/packages/hap-toolkit/__tests__/splitChunks.test.js b/packages/hap-toolkit/__tests__/splitChunks.test.js index 701e6108..35525be0 100644 --- a/packages/hap-toolkit/__tests__/splitChunks.test.js +++ b/packages/hap-toolkit/__tests__/splitChunks.test.js @@ -12,7 +12,6 @@ const glob = require('glob') const expectFiles = (projectRoot) => { projectRoot = path.resolve(projectRoot) - const projectRootReg = new RegExp(projectRoot, 'g') // temp-test-app-6000 const wipe = (content) => { // release 模式下 chunkId 是随机的 @@ -22,7 +21,7 @@ const expectFiles = (projectRoot) => { .replace(/\d+:/gm, '999:') .replace(/\*{10,}/gm, '*'.repeat(10)) return wipeDynamic(content, [ - [projectRootReg, ''], + [projectRoot, ''], [/大小为 \d+ KB/g, '大小为 KB'] ]) } diff --git a/packages/integration-tests/hap.test.js b/packages/integration-tests/hap.test.js index 8b13bd47..8ac75931 100644 --- a/packages/integration-tests/hap.test.js +++ b/packages/integration-tests/hap.test.js @@ -161,7 +161,18 @@ describe('hap-toolkit', () => { ], { cwd: targetdir } ) - await del([targetdir], { force: true }) + // Windows 上 server 子进程释放文件句柄需要一点时间 + for (let i = 0; i < 5; i++) { + try { + await del([targetdir], { force: true }) + break + } catch (err) { + if (!['EBUSY', 'ENOTEMPTY', 'EPERM'].includes(err.code) || i === 4) { + throw err + } + await new Promise((resolve) => setTimeout(resolve, 500)) + } + } }, 30 * 60 * 1000 ) From c3f6797e21cdc0353ca179142f6b8ac47b8d0dac Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Wed, 23 Sep 2026 17:56:19 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-toolkit/__tests__/compile.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/hap-toolkit/__tests__/compile.test.js b/packages/hap-toolkit/__tests__/compile.test.js index 3ad18116..e0fb2c72 100644 --- a/packages/hap-toolkit/__tests__/compile.test.js +++ b/packages/hap-toolkit/__tests__/compile.test.js @@ -163,9 +163,9 @@ describe('测试compile', () => { expect(normalizeSnapshotPaths(json.assets.map((a) => a.name))).toMatchSnapshot('assets list') // eg. '\u001B[4mUnicorn\u001B[0m' => 'Unicorn' const output = stripAnsi(outputs.join('\n')) - expect( - wipeDynamic(output, [[/大小为 \d+ KB/g, '大小为 KB']]) - ).toMatchSnapshot('outputs') + expect(wipeDynamic(output, [[/大小为 \d+ KB/g, '大小为 KB']])).toMatchSnapshot( + 'outputs' + ) }, 5 * 60 * 1000 ) From 884e26a8edf268d6c1d5fe3115b8f6d68392a8b7 Mon Sep 17 00:00:00 2001 From: yucongshuang <9025400@adc.com> Date: Thu, 24 Sep 2026 14:17:24 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=97=A0license=20information=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BA=A7=E7=89=A9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __tests__/examples/build-backup/sample/app.js | 1 - .../build-backup/sample/component/basic/a/index.js | 1 - .../build-backup/sample/component/basic/image/index.js | 1 - .../build-backup/sample/component/basic/progress/index.js | 1 - .../build-backup/sample/component/basic/rating/index.js | 1 - .../build-backup/sample/component/basic/span/index.js | 1 - .../build-backup/sample/component/basic/text/index.js | 1 - .../build-backup/sample/component/container/div/index.js | 1 - .../build-backup/sample/component/container/list/index.js | 1 - .../build-backup/sample/component/container/popup/index.js | 1 - .../sample/component/container/refresh/index.js | 1 - .../sample/component/container/richtext/index.js | 1 - .../build-backup/sample/component/container/stack/index.js | 1 - .../sample/component/container/swiper/index.js | 1 - .../build-backup/sample/component/container/tabs/index.js | 1 - .../build-backup/sample/component/form/input/index.js | 1 - .../build-backup/sample/component/form/label/index.js | 1 - .../sample/component/form/multi-picker/index.js | 1 - .../build-backup/sample/component/form/picker/index.js | 1 - .../build-backup/sample/component/form/slider/index.js | 1 - .../build-backup/sample/component/form/switch/index.js | 1 - .../build-backup/sample/component/form/textarea/index.js | 1 - .../build-backup/sample/component/media/audio/index.js | 1 - .../build-backup/sample/component/media/canvas/index.js | 1 - .../build-backup/sample/component/media/video/index.js | 1 - .../sample/component/media/web/detail/index.js | 1 - .../build-backup/sample/component/media/web/index.js | 1 - .../build-backup/sample/component/style/animation/index.js | 1 - .../sample/component/style/background9image/index.js | 1 - .../sample/component/style/backgroundposition/index.js | 1 - .../sample/component/style/font-family/index.js | 1 - .../build-backup/sample/component/style/transform/index.js | 1 - .../sample/component/style/translatepercent/index.js | 1 - .../build-backup/sample/component/thirdParty/map/index.js | 1 - .../build-backup/sample/framework/deeplink/index.js | 1 - .../examples/build-backup/sample/framework/exit/index.js | 1 - .../sample/framework/exit/pages/page1/index.js | 1 - .../sample/framework/exit/pages/page2/index.js | 1 - .../sample/framework/exit/pages/page3/index.js | 1 - .../build-backup/sample/framework/lifecycle/index.js | 1 - .../sample/functionality/animationapi/index.js | 1 - .../build-backup/sample/functionality/ceiling/index.js | 1 - .../build-backup/sample/functionality/changestyle/index.js | 1 - .../build-backup/sample/functionality/customWeb/index.js | 1 - .../build-backup/sample/functionality/form/index.js | 1 - .../build-backup/sample/functionality/h5download/index.js | 1 - .../sample/functionality/listcombination/index.js | 1 - .../build-backup/sample/functionality/menutop/index.js | 1 - .../build-backup/sample/functionality/photo/index.js | 1 - .../build-backup/sample/functionality/postMessage/index.js | 1 - .../build-backup/sample/functionality/qrcode/index.js | 1 - .../sample/functionality/simulate-swipe/index.js | 1 - .../sample/functionality/template/elec-business/index.js | 1 - .../build-backup/sample/functionality/titlebar/index.js | 1 - .../sample/functionality/verification/index.js | 1 - .../build-backup/sample/functionality/web/index.js | 1 - __tests__/examples/build-backup/sample/home/index.js | 1 - .../build-backup/sample/interface/system/app/index.js | 1 - .../build-backup/sample/interface/system/battery/index.js | 1 - .../sample/interface/system/brightness/index.js | 1 - .../build-backup/sample/interface/system/calendar/index.js | 1 - .../sample/interface/system/clipboard/index.js | 1 - .../build-backup/sample/interface/system/contact/index.js | 1 - .../build-backup/sample/interface/system/device/index.js | 1 - .../build-backup/sample/interface/system/fetch/index.js | 1 - .../build-backup/sample/interface/system/file/index.js | 1 - .../build-backup/sample/interface/system/filerw/index.js | 1 - .../build-backup/sample/interface/system/forbid/index.js | 1 - .../sample/interface/system/geolocation/index.js | 1 - .../build-backup/sample/interface/system/image/index.js | 1 - .../build-backup/sample/interface/system/media/index.js | 1 - .../build-backup/sample/interface/system/network/index.js | 1 - .../sample/interface/system/notification/index.js | 1 - .../build-backup/sample/interface/system/package/index.js | 1 - .../build-backup/sample/interface/system/prompt/index.js | 1 - .../build-backup/sample/interface/system/qrcode/index.js | 1 - .../build-backup/sample/interface/system/record/index.js | 1 - .../build-backup/sample/interface/system/request/index.js | 1 - .../sample/interface/system/router/detail/index.js | 1 - .../build-backup/sample/interface/system/router/index.js | 1 - .../build-backup/sample/interface/system/sensor/index.js | 1 - .../build-backup/sample/interface/system/share/index.js | 1 - .../build-backup/sample/interface/system/shortcut/index.js | 1 - .../build-backup/sample/interface/system/sms/index.js | 1 - .../build-backup/sample/interface/system/storage/index.js | 1 - .../build-backup/sample/interface/system/vibrator/index.js | 1 - .../build-backup/sample/interface/system/volume/index.js | 1 - .../sample/interface/system/websocket/index.js | 1 - .../build-backup/sample/interface/system/webview/index.js | 1 - .../build-backup/sample/interface/system/wifi/index.js | 1 - .../sample/interface/thirdparty/alipay/index.js | 1 - .../sample/interface/thirdparty/qqaccount/index.js | 1 - .../sample/interface/thirdparty/serviceshare/index.js | 1 - .../sample/interface/thirdparty/wbaccount/index.js | 1 - .../sample/interface/thirdparty/wxaccount/index.js | 1 - .../sample/interface/thirdparty/wxpay/index.js | 1 - __tests__/examples/sample.test.js | 7 ++----- 97 files changed, 2 insertions(+), 101 deletions(-) diff --git a/__tests__/examples/build-backup/sample/app.js b/__tests__/examples/build-backup/sample/app.js index 7d2ad46b..2ddf0b67 100644 --- a/__tests__/examples/build-backup/sample/app.js +++ b/__tests__/examples/build-backup/sample/app.js @@ -1,4 +1,3 @@ -/*! For license information please see app.js.LICENSE.txt */ (function() { var $app_define_wrap$ = $app_define_wrap$ || function() {}; var manifestJson = { diff --git a/__tests__/examples/build-backup/sample/component/basic/a/index.js b/__tests__/examples/build-backup/sample/component/basic/a/index.js index ab393002..f4eadb75 100644 --- a/__tests__/examples/build-backup/sample/component/basic/a/index.js +++ b/__tests__/examples/build-backup/sample/component/basic/a/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/basic/image/index.js b/__tests__/examples/build-backup/sample/component/basic/image/index.js index f84329d4..52cb7b38 100644 --- a/__tests__/examples/build-backup/sample/component/basic/image/index.js +++ b/__tests__/examples/build-backup/sample/component/basic/image/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/basic/progress/index.js b/__tests__/examples/build-backup/sample/component/basic/progress/index.js index 815b5aaa..fa1394dd 100644 --- a/__tests__/examples/build-backup/sample/component/basic/progress/index.js +++ b/__tests__/examples/build-backup/sample/component/basic/progress/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/basic/rating/index.js b/__tests__/examples/build-backup/sample/component/basic/rating/index.js index 9d99e2ad..3271063e 100644 --- a/__tests__/examples/build-backup/sample/component/basic/rating/index.js +++ b/__tests__/examples/build-backup/sample/component/basic/rating/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/basic/span/index.js b/__tests__/examples/build-backup/sample/component/basic/span/index.js index 35533ac2..049ff0a2 100644 --- a/__tests__/examples/build-backup/sample/component/basic/span/index.js +++ b/__tests__/examples/build-backup/sample/component/basic/span/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/basic/text/index.js b/__tests__/examples/build-backup/sample/component/basic/text/index.js index ce1bb1b3..9aa2ca18 100644 --- a/__tests__/examples/build-backup/sample/component/basic/text/index.js +++ b/__tests__/examples/build-backup/sample/component/basic/text/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/div/index.js b/__tests__/examples/build-backup/sample/component/container/div/index.js index 7c9abeaf..ec80f57a 100644 --- a/__tests__/examples/build-backup/sample/component/container/div/index.js +++ b/__tests__/examples/build-backup/sample/component/container/div/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/list/index.js b/__tests__/examples/build-backup/sample/component/container/list/index.js index d0154762..fb7ef9b7 100644 --- a/__tests__/examples/build-backup/sample/component/container/list/index.js +++ b/__tests__/examples/build-backup/sample/component/container/list/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/popup/index.js b/__tests__/examples/build-backup/sample/component/container/popup/index.js index 6d30501b..a6962aa5 100644 --- a/__tests__/examples/build-backup/sample/component/container/popup/index.js +++ b/__tests__/examples/build-backup/sample/component/container/popup/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/refresh/index.js b/__tests__/examples/build-backup/sample/component/container/refresh/index.js index f73c8c3b..1d7c64fb 100644 --- a/__tests__/examples/build-backup/sample/component/container/refresh/index.js +++ b/__tests__/examples/build-backup/sample/component/container/refresh/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/richtext/index.js b/__tests__/examples/build-backup/sample/component/container/richtext/index.js index 35808b23..dcf83010 100644 --- a/__tests__/examples/build-backup/sample/component/container/richtext/index.js +++ b/__tests__/examples/build-backup/sample/component/container/richtext/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/stack/index.js b/__tests__/examples/build-backup/sample/component/container/stack/index.js index 0447a0cc..e6eb9c2b 100644 --- a/__tests__/examples/build-backup/sample/component/container/stack/index.js +++ b/__tests__/examples/build-backup/sample/component/container/stack/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/swiper/index.js b/__tests__/examples/build-backup/sample/component/container/swiper/index.js index b85bf9aa..eb40b8bc 100644 --- a/__tests__/examples/build-backup/sample/component/container/swiper/index.js +++ b/__tests__/examples/build-backup/sample/component/container/swiper/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/container/tabs/index.js b/__tests__/examples/build-backup/sample/component/container/tabs/index.js index e6c81634..f8672098 100644 --- a/__tests__/examples/build-backup/sample/component/container/tabs/index.js +++ b/__tests__/examples/build-backup/sample/component/container/tabs/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/input/index.js b/__tests__/examples/build-backup/sample/component/form/input/index.js index 0b04c754..ca909405 100644 --- a/__tests__/examples/build-backup/sample/component/form/input/index.js +++ b/__tests__/examples/build-backup/sample/component/form/input/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/label/index.js b/__tests__/examples/build-backup/sample/component/form/label/index.js index 7854546c..a6b90131 100644 --- a/__tests__/examples/build-backup/sample/component/form/label/index.js +++ b/__tests__/examples/build-backup/sample/component/form/label/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/multi-picker/index.js b/__tests__/examples/build-backup/sample/component/form/multi-picker/index.js index 82bbd7b0..f3c23eaa 100644 --- a/__tests__/examples/build-backup/sample/component/form/multi-picker/index.js +++ b/__tests__/examples/build-backup/sample/component/form/multi-picker/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/picker/index.js b/__tests__/examples/build-backup/sample/component/form/picker/index.js index f721bab6..5ccf1873 100644 --- a/__tests__/examples/build-backup/sample/component/form/picker/index.js +++ b/__tests__/examples/build-backup/sample/component/form/picker/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/slider/index.js b/__tests__/examples/build-backup/sample/component/form/slider/index.js index 62051d10..19894a54 100644 --- a/__tests__/examples/build-backup/sample/component/form/slider/index.js +++ b/__tests__/examples/build-backup/sample/component/form/slider/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/switch/index.js b/__tests__/examples/build-backup/sample/component/form/switch/index.js index d524889f..7be272c9 100644 --- a/__tests__/examples/build-backup/sample/component/form/switch/index.js +++ b/__tests__/examples/build-backup/sample/component/form/switch/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/form/textarea/index.js b/__tests__/examples/build-backup/sample/component/form/textarea/index.js index 4f9a752d..21cd7ff2 100644 --- a/__tests__/examples/build-backup/sample/component/form/textarea/index.js +++ b/__tests__/examples/build-backup/sample/component/form/textarea/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/media/audio/index.js b/__tests__/examples/build-backup/sample/component/media/audio/index.js index 2137ba3e..2fe75fee 100644 --- a/__tests__/examples/build-backup/sample/component/media/audio/index.js +++ b/__tests__/examples/build-backup/sample/component/media/audio/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/media/canvas/index.js b/__tests__/examples/build-backup/sample/component/media/canvas/index.js index f3b353b8..916072b9 100644 --- a/__tests__/examples/build-backup/sample/component/media/canvas/index.js +++ b/__tests__/examples/build-backup/sample/component/media/canvas/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/media/video/index.js b/__tests__/examples/build-backup/sample/component/media/video/index.js index 775cb204..4cebf3eb 100644 --- a/__tests__/examples/build-backup/sample/component/media/video/index.js +++ b/__tests__/examples/build-backup/sample/component/media/video/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/media/web/detail/index.js b/__tests__/examples/build-backup/sample/component/media/web/detail/index.js index 1382015f..a01ed390 100644 --- a/__tests__/examples/build-backup/sample/component/media/web/detail/index.js +++ b/__tests__/examples/build-backup/sample/component/media/web/detail/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/media/web/index.js b/__tests__/examples/build-backup/sample/component/media/web/index.js index 6339e45f..ead7fb2d 100644 --- a/__tests__/examples/build-backup/sample/component/media/web/index.js +++ b/__tests__/examples/build-backup/sample/component/media/web/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/style/animation/index.js b/__tests__/examples/build-backup/sample/component/style/animation/index.js index b71d6c26..fa77abbf 100644 --- a/__tests__/examples/build-backup/sample/component/style/animation/index.js +++ b/__tests__/examples/build-backup/sample/component/style/animation/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/style/background9image/index.js b/__tests__/examples/build-backup/sample/component/style/background9image/index.js index 1cdd3a18..9bd29b27 100644 --- a/__tests__/examples/build-backup/sample/component/style/background9image/index.js +++ b/__tests__/examples/build-backup/sample/component/style/background9image/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/style/backgroundposition/index.js b/__tests__/examples/build-backup/sample/component/style/backgroundposition/index.js index 40a5e4ad..d87e63d9 100644 --- a/__tests__/examples/build-backup/sample/component/style/backgroundposition/index.js +++ b/__tests__/examples/build-backup/sample/component/style/backgroundposition/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/style/font-family/index.js b/__tests__/examples/build-backup/sample/component/style/font-family/index.js index 72d12703..31bec02a 100644 --- a/__tests__/examples/build-backup/sample/component/style/font-family/index.js +++ b/__tests__/examples/build-backup/sample/component/style/font-family/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/style/transform/index.js b/__tests__/examples/build-backup/sample/component/style/transform/index.js index ef3df72f..9c16f01f 100644 --- a/__tests__/examples/build-backup/sample/component/style/transform/index.js +++ b/__tests__/examples/build-backup/sample/component/style/transform/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/style/translatepercent/index.js b/__tests__/examples/build-backup/sample/component/style/translatepercent/index.js index 050afe3b..2cf2a3c5 100644 --- a/__tests__/examples/build-backup/sample/component/style/translatepercent/index.js +++ b/__tests__/examples/build-backup/sample/component/style/translatepercent/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/component/thirdParty/map/index.js b/__tests__/examples/build-backup/sample/component/thirdParty/map/index.js index 4c89af90..096416a6 100644 --- a/__tests__/examples/build-backup/sample/component/thirdParty/map/index.js +++ b/__tests__/examples/build-backup/sample/component/thirdParty/map/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/framework/deeplink/index.js b/__tests__/examples/build-backup/sample/framework/deeplink/index.js index 2aec325d..04df1341 100644 --- a/__tests__/examples/build-backup/sample/framework/deeplink/index.js +++ b/__tests__/examples/build-backup/sample/framework/deeplink/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/framework/exit/index.js b/__tests__/examples/build-backup/sample/framework/exit/index.js index a1b3aa24..2cbf0f24 100644 --- a/__tests__/examples/build-backup/sample/framework/exit/index.js +++ b/__tests__/examples/build-backup/sample/framework/exit/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/framework/exit/pages/page1/index.js b/__tests__/examples/build-backup/sample/framework/exit/pages/page1/index.js index be41bfe8..0522c0b2 100644 --- a/__tests__/examples/build-backup/sample/framework/exit/pages/page1/index.js +++ b/__tests__/examples/build-backup/sample/framework/exit/pages/page1/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/framework/exit/pages/page2/index.js b/__tests__/examples/build-backup/sample/framework/exit/pages/page2/index.js index fe1d940d..987b31e4 100644 --- a/__tests__/examples/build-backup/sample/framework/exit/pages/page2/index.js +++ b/__tests__/examples/build-backup/sample/framework/exit/pages/page2/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/framework/exit/pages/page3/index.js b/__tests__/examples/build-backup/sample/framework/exit/pages/page3/index.js index 68330f6d..a81a1fea 100644 --- a/__tests__/examples/build-backup/sample/framework/exit/pages/page3/index.js +++ b/__tests__/examples/build-backup/sample/framework/exit/pages/page3/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/framework/lifecycle/index.js b/__tests__/examples/build-backup/sample/framework/lifecycle/index.js index 16c2a2ef..fa0fa13e 100644 --- a/__tests__/examples/build-backup/sample/framework/lifecycle/index.js +++ b/__tests__/examples/build-backup/sample/framework/lifecycle/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/animationapi/index.js b/__tests__/examples/build-backup/sample/functionality/animationapi/index.js index ee6abb67..d31e63e8 100644 --- a/__tests__/examples/build-backup/sample/functionality/animationapi/index.js +++ b/__tests__/examples/build-backup/sample/functionality/animationapi/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/ceiling/index.js b/__tests__/examples/build-backup/sample/functionality/ceiling/index.js index aee3b32b..e33d104e 100644 --- a/__tests__/examples/build-backup/sample/functionality/ceiling/index.js +++ b/__tests__/examples/build-backup/sample/functionality/ceiling/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/changestyle/index.js b/__tests__/examples/build-backup/sample/functionality/changestyle/index.js index db091753..2703203a 100644 --- a/__tests__/examples/build-backup/sample/functionality/changestyle/index.js +++ b/__tests__/examples/build-backup/sample/functionality/changestyle/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/customWeb/index.js b/__tests__/examples/build-backup/sample/functionality/customWeb/index.js index cde8f8ca..5a0111e9 100644 --- a/__tests__/examples/build-backup/sample/functionality/customWeb/index.js +++ b/__tests__/examples/build-backup/sample/functionality/customWeb/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/form/index.js b/__tests__/examples/build-backup/sample/functionality/form/index.js index deab6440..4d073f50 100644 --- a/__tests__/examples/build-backup/sample/functionality/form/index.js +++ b/__tests__/examples/build-backup/sample/functionality/form/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/h5download/index.js b/__tests__/examples/build-backup/sample/functionality/h5download/index.js index 306dc6ff..871226bd 100644 --- a/__tests__/examples/build-backup/sample/functionality/h5download/index.js +++ b/__tests__/examples/build-backup/sample/functionality/h5download/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/listcombination/index.js b/__tests__/examples/build-backup/sample/functionality/listcombination/index.js index 50d522ab..77c57ae4 100644 --- a/__tests__/examples/build-backup/sample/functionality/listcombination/index.js +++ b/__tests__/examples/build-backup/sample/functionality/listcombination/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/menutop/index.js b/__tests__/examples/build-backup/sample/functionality/menutop/index.js index 878c529d..7284f855 100644 --- a/__tests__/examples/build-backup/sample/functionality/menutop/index.js +++ b/__tests__/examples/build-backup/sample/functionality/menutop/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/photo/index.js b/__tests__/examples/build-backup/sample/functionality/photo/index.js index 6dd46e91..1e8f2d27 100644 --- a/__tests__/examples/build-backup/sample/functionality/photo/index.js +++ b/__tests__/examples/build-backup/sample/functionality/photo/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/postMessage/index.js b/__tests__/examples/build-backup/sample/functionality/postMessage/index.js index df9ef374..20e276ba 100644 --- a/__tests__/examples/build-backup/sample/functionality/postMessage/index.js +++ b/__tests__/examples/build-backup/sample/functionality/postMessage/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/qrcode/index.js b/__tests__/examples/build-backup/sample/functionality/qrcode/index.js index ab05f744..a79b678a 100644 --- a/__tests__/examples/build-backup/sample/functionality/qrcode/index.js +++ b/__tests__/examples/build-backup/sample/functionality/qrcode/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/simulate-swipe/index.js b/__tests__/examples/build-backup/sample/functionality/simulate-swipe/index.js index d512fc5b..da2be61e 100644 --- a/__tests__/examples/build-backup/sample/functionality/simulate-swipe/index.js +++ b/__tests__/examples/build-backup/sample/functionality/simulate-swipe/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/template/elec-business/index.js b/__tests__/examples/build-backup/sample/functionality/template/elec-business/index.js index 83317ad2..d60b96c5 100644 --- a/__tests__/examples/build-backup/sample/functionality/template/elec-business/index.js +++ b/__tests__/examples/build-backup/sample/functionality/template/elec-business/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/titlebar/index.js b/__tests__/examples/build-backup/sample/functionality/titlebar/index.js index af1a0863..5e9314c4 100644 --- a/__tests__/examples/build-backup/sample/functionality/titlebar/index.js +++ b/__tests__/examples/build-backup/sample/functionality/titlebar/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/verification/index.js b/__tests__/examples/build-backup/sample/functionality/verification/index.js index 48fc8eb9..259e4464 100644 --- a/__tests__/examples/build-backup/sample/functionality/verification/index.js +++ b/__tests__/examples/build-backup/sample/functionality/verification/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/functionality/web/index.js b/__tests__/examples/build-backup/sample/functionality/web/index.js index 107ecffd..82050607 100644 --- a/__tests__/examples/build-backup/sample/functionality/web/index.js +++ b/__tests__/examples/build-backup/sample/functionality/web/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/home/index.js b/__tests__/examples/build-backup/sample/home/index.js index 9c64d146..fabd73ab 100644 --- a/__tests__/examples/build-backup/sample/home/index.js +++ b/__tests__/examples/build-backup/sample/home/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/app/index.js b/__tests__/examples/build-backup/sample/interface/system/app/index.js index 31a8f09e..13520f4f 100644 --- a/__tests__/examples/build-backup/sample/interface/system/app/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/app/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/battery/index.js b/__tests__/examples/build-backup/sample/interface/system/battery/index.js index 6a478d57..5adb418e 100644 --- a/__tests__/examples/build-backup/sample/interface/system/battery/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/battery/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/brightness/index.js b/__tests__/examples/build-backup/sample/interface/system/brightness/index.js index 78d75593..015ce7ab 100644 --- a/__tests__/examples/build-backup/sample/interface/system/brightness/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/brightness/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/calendar/index.js b/__tests__/examples/build-backup/sample/interface/system/calendar/index.js index af545898..82a9ad00 100644 --- a/__tests__/examples/build-backup/sample/interface/system/calendar/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/calendar/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/clipboard/index.js b/__tests__/examples/build-backup/sample/interface/system/clipboard/index.js index 3724c58f..308c1651 100644 --- a/__tests__/examples/build-backup/sample/interface/system/clipboard/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/clipboard/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/contact/index.js b/__tests__/examples/build-backup/sample/interface/system/contact/index.js index 7d397f01..de4b1280 100644 --- a/__tests__/examples/build-backup/sample/interface/system/contact/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/contact/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/device/index.js b/__tests__/examples/build-backup/sample/interface/system/device/index.js index 76302a7c..1e195f02 100644 --- a/__tests__/examples/build-backup/sample/interface/system/device/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/device/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/fetch/index.js b/__tests__/examples/build-backup/sample/interface/system/fetch/index.js index 0a3831bf..9099a80d 100644 --- a/__tests__/examples/build-backup/sample/interface/system/fetch/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/fetch/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/file/index.js b/__tests__/examples/build-backup/sample/interface/system/file/index.js index 4f88d235..7baf8e0b 100644 --- a/__tests__/examples/build-backup/sample/interface/system/file/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/file/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/filerw/index.js b/__tests__/examples/build-backup/sample/interface/system/filerw/index.js index 9b262aaa..8252eb3e 100644 --- a/__tests__/examples/build-backup/sample/interface/system/filerw/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/filerw/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/forbid/index.js b/__tests__/examples/build-backup/sample/interface/system/forbid/index.js index 52319870..6cc5f5ae 100644 --- a/__tests__/examples/build-backup/sample/interface/system/forbid/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/forbid/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/geolocation/index.js b/__tests__/examples/build-backup/sample/interface/system/geolocation/index.js index 4cecb444..ead9f921 100644 --- a/__tests__/examples/build-backup/sample/interface/system/geolocation/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/geolocation/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/image/index.js b/__tests__/examples/build-backup/sample/interface/system/image/index.js index e7acb109..cfca78f9 100644 --- a/__tests__/examples/build-backup/sample/interface/system/image/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/image/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/media/index.js b/__tests__/examples/build-backup/sample/interface/system/media/index.js index 90140540..c7c3a50d 100644 --- a/__tests__/examples/build-backup/sample/interface/system/media/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/media/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/network/index.js b/__tests__/examples/build-backup/sample/interface/system/network/index.js index 9c1dd162..447a3961 100644 --- a/__tests__/examples/build-backup/sample/interface/system/network/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/network/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/notification/index.js b/__tests__/examples/build-backup/sample/interface/system/notification/index.js index 7c67af21..0376f7ee 100644 --- a/__tests__/examples/build-backup/sample/interface/system/notification/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/notification/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/package/index.js b/__tests__/examples/build-backup/sample/interface/system/package/index.js index 2d593cd7..07978c12 100644 --- a/__tests__/examples/build-backup/sample/interface/system/package/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/package/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/prompt/index.js b/__tests__/examples/build-backup/sample/interface/system/prompt/index.js index 5d9baae4..1ec8d8c2 100644 --- a/__tests__/examples/build-backup/sample/interface/system/prompt/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/prompt/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/qrcode/index.js b/__tests__/examples/build-backup/sample/interface/system/qrcode/index.js index b1a73afd..b7d4159e 100644 --- a/__tests__/examples/build-backup/sample/interface/system/qrcode/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/qrcode/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/record/index.js b/__tests__/examples/build-backup/sample/interface/system/record/index.js index 2327d122..d5739e5c 100644 --- a/__tests__/examples/build-backup/sample/interface/system/record/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/record/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/request/index.js b/__tests__/examples/build-backup/sample/interface/system/request/index.js index 47c588b8..209767a3 100644 --- a/__tests__/examples/build-backup/sample/interface/system/request/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/request/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/router/detail/index.js b/__tests__/examples/build-backup/sample/interface/system/router/detail/index.js index 7e36810c..3a730c11 100644 --- a/__tests__/examples/build-backup/sample/interface/system/router/detail/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/router/detail/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/router/index.js b/__tests__/examples/build-backup/sample/interface/system/router/index.js index f106218e..8f1de940 100644 --- a/__tests__/examples/build-backup/sample/interface/system/router/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/router/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/sensor/index.js b/__tests__/examples/build-backup/sample/interface/system/sensor/index.js index 1931a86d..be7671e6 100644 --- a/__tests__/examples/build-backup/sample/interface/system/sensor/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/sensor/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/share/index.js b/__tests__/examples/build-backup/sample/interface/system/share/index.js index 9062438f..3b2a2f1d 100644 --- a/__tests__/examples/build-backup/sample/interface/system/share/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/share/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/shortcut/index.js b/__tests__/examples/build-backup/sample/interface/system/shortcut/index.js index f19d7259..be1865b5 100644 --- a/__tests__/examples/build-backup/sample/interface/system/shortcut/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/shortcut/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/sms/index.js b/__tests__/examples/build-backup/sample/interface/system/sms/index.js index c14a800c..c87fdee1 100644 --- a/__tests__/examples/build-backup/sample/interface/system/sms/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/sms/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/storage/index.js b/__tests__/examples/build-backup/sample/interface/system/storage/index.js index 664f76dc..16231631 100644 --- a/__tests__/examples/build-backup/sample/interface/system/storage/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/storage/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/vibrator/index.js b/__tests__/examples/build-backup/sample/interface/system/vibrator/index.js index bab0ebf2..4033dc45 100644 --- a/__tests__/examples/build-backup/sample/interface/system/vibrator/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/vibrator/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/volume/index.js b/__tests__/examples/build-backup/sample/interface/system/volume/index.js index 72095ca5..13ddc4f7 100644 --- a/__tests__/examples/build-backup/sample/interface/system/volume/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/volume/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/websocket/index.js b/__tests__/examples/build-backup/sample/interface/system/websocket/index.js index 5c4dabb9..803b916c 100644 --- a/__tests__/examples/build-backup/sample/interface/system/websocket/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/websocket/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/webview/index.js b/__tests__/examples/build-backup/sample/interface/system/webview/index.js index d5f0b597..154fba03 100644 --- a/__tests__/examples/build-backup/sample/interface/system/webview/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/webview/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/system/wifi/index.js b/__tests__/examples/build-backup/sample/interface/system/wifi/index.js index 1cb785af..fc0d9090 100644 --- a/__tests__/examples/build-backup/sample/interface/system/wifi/index.js +++ b/__tests__/examples/build-backup/sample/interface/system/wifi/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/thirdparty/alipay/index.js b/__tests__/examples/build-backup/sample/interface/thirdparty/alipay/index.js index 21ebce50..007cd37d 100644 --- a/__tests__/examples/build-backup/sample/interface/thirdparty/alipay/index.js +++ b/__tests__/examples/build-backup/sample/interface/thirdparty/alipay/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/thirdparty/qqaccount/index.js b/__tests__/examples/build-backup/sample/interface/thirdparty/qqaccount/index.js index ffb1c3d6..1a3c483d 100644 --- a/__tests__/examples/build-backup/sample/interface/thirdparty/qqaccount/index.js +++ b/__tests__/examples/build-backup/sample/interface/thirdparty/qqaccount/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/thirdparty/serviceshare/index.js b/__tests__/examples/build-backup/sample/interface/thirdparty/serviceshare/index.js index c181918f..902e737f 100644 --- a/__tests__/examples/build-backup/sample/interface/thirdparty/serviceshare/index.js +++ b/__tests__/examples/build-backup/sample/interface/thirdparty/serviceshare/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/thirdparty/wbaccount/index.js b/__tests__/examples/build-backup/sample/interface/thirdparty/wbaccount/index.js index 16e1110c..315471fb 100644 --- a/__tests__/examples/build-backup/sample/interface/thirdparty/wbaccount/index.js +++ b/__tests__/examples/build-backup/sample/interface/thirdparty/wbaccount/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/thirdparty/wxaccount/index.js b/__tests__/examples/build-backup/sample/interface/thirdparty/wxaccount/index.js index 0b7adc28..3c21b8e8 100644 --- a/__tests__/examples/build-backup/sample/interface/thirdparty/wxaccount/index.js +++ b/__tests__/examples/build-backup/sample/interface/thirdparty/wxaccount/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/build-backup/sample/interface/thirdparty/wxpay/index.js b/__tests__/examples/build-backup/sample/interface/thirdparty/wxpay/index.js index 1e4aac76..f62362be 100644 --- a/__tests__/examples/build-backup/sample/interface/thirdparty/wxpay/index.js +++ b/__tests__/examples/build-backup/sample/interface/thirdparty/wxpay/index.js @@ -1,4 +1,3 @@ -/*! For license information please see index.js.LICENSE.txt */ (function() { var createPageHandler = function() { return (() => { diff --git a/__tests__/examples/sample.test.js b/__tests__/examples/sample.test.js index b78cf835..32f7f289 100644 --- a/__tests__/examples/sample.test.js +++ b/__tests__/examples/sample.test.js @@ -178,11 +178,8 @@ describe('hap-toolkit', () => { ) await Promises - // Windows 编译产物与仓库中的 Linux 备份无法逐字节对齐(换行/license 头等) - if (process.platform !== 'win32') { - const files = execa.sync('git', ['ls-files', '-m']).stdout - expect(!files.match(`build-backup`)).toBeTruthy() - } + const files = execa.sync('git', ['ls-files', '-m']).stdout + expect(!files.match(`build-backup`)).toBeTruthy() }, 6 * 60 * 1000 ) From 34e315a315d459f8067e1c1eba865b4920516475 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Thu, 24 Sep 2026 15:29:15 +0800 Subject: [PATCH 09/10] =?UTF-8?q?test=E6=96=87=E4=BB=B6=E5=8F=8C=E6=96=9C?= =?UTF-8?q?=E6=9D=A0=E5=A4=84=E7=90=86,=E9=A2=84=E8=A7=88=E7=89=88?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=8D=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __tests__/examples/sample.test.js | 10 ++++++++-- packages/hap-dev-utils/src/index.js | 3 ++- packages/hap-shared-utils/src/compilation-config.js | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/__tests__/examples/sample.test.js b/__tests__/examples/sample.test.js index 32f7f289..890920aa 100644 --- a/__tests__/examples/sample.test.js +++ b/__tests__/examples/sample.test.js @@ -178,8 +178,14 @@ describe('hap-toolkit', () => { ) await Promises - const files = execa.sync('git', ['ls-files', '-m']).stdout - expect(!files.match(`build-backup`)).toBeTruthy() + // git ls-files -m 会把仅 CRLF/LF 差异也算进去,Windows 上会误报 + const diff = execa.sync('git', [ + 'diff', + '--ignore-cr-at-eol', + '--', + path.relative(process.cwd(), buildBackup) + ]).stdout + expect(diff).toBe('') }, 6 * 60 * 1000 ) diff --git a/packages/hap-dev-utils/src/index.js b/packages/hap-dev-utils/src/index.js index 6b8b34d4..73d2c558 100644 --- a/packages/hap-dev-utils/src/index.js +++ b/packages/hap-dev-utils/src/index.js @@ -269,7 +269,8 @@ function normalizeWinPathSeps(str) { let prev do { prev = str - str = str.replace(/([A-Za-z0-9_.-])\\+([A-Za-z0-9_.-])/g, '$1/$2') + // str = str.replace(/([A-Za-z0-9_.-])\\+([A-Za-z0-9_.-])/g, '$1/$2') + str = str.replace(/([A-Za-z0-9_.-])\\{2,}([A-Za-z0-9_.-])/g, '$1/$2') } while (str !== prev) return str } diff --git a/packages/hap-shared-utils/src/compilation-config.js b/packages/hap-shared-utils/src/compilation-config.js index 7035ab52..386a92fc 100644 --- a/packages/hap-shared-utils/src/compilation-config.js +++ b/packages/hap-shared-utils/src/compilation-config.js @@ -106,6 +106,10 @@ function mergeCompileOptionsObject(argopts) { // TODO release memeory, use optimize-prop only compileOptionsObject.devtool = argopts.devtool ? argopts.devtool : false Object.assign(compileOptionsObject, argopts) + // 未显式传入时复位,避免上一次 compile 的预览包配置泄漏到后续构建 + if (!argopts.buildPreviewRpkOptions) { + compileOptionsObject.buildPreviewRpkOptions = null + } } export { compileOptionsMeta, compileOptionsObject, mergeCompileOptionsObject } From 578d73cbec74d2a28d8e76d3caad040a4278bdc3 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Thu, 24 Sep 2026 15:41:46 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-dev-utils/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hap-dev-utils/src/index.js b/packages/hap-dev-utils/src/index.js index 73d2c558..58969d44 100644 --- a/packages/hap-dev-utils/src/index.js +++ b/packages/hap-dev-utils/src/index.js @@ -269,7 +269,7 @@ function normalizeWinPathSeps(str) { let prev do { prev = str - // str = str.replace(/([A-Za-z0-9_.-])\\+([A-Za-z0-9_.-])/g, '$1/$2') + // str = str.replace(/([A-Za-z0-9_.-])\\+([A-Za-z0-9_.-])/g, '$1/$2') str = str.replace(/([A-Za-z0-9_.-])\\{2,}([A-Za-z0-9_.-])/g, '$1/$2') } while (str !== prev) return str