@flun/node-mobile-app 4.0.4 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# 变更日志
|
|
2
|
-
## [4.0.
|
|
3
|
-
###
|
|
2
|
+
## [4.0.6] - 2026-10-22 16:31
|
|
3
|
+
### 更新
|
|
4
|
+
- 同步升级了一些依赖包;
|
|
4
5
|
|
|
5
|
-
## [4.0.
|
|
6
|
-
###
|
|
7
|
-
-
|
|
8
|
-
- **删除依赖快照误用 `removeDir`**:`.deps-snapshot.json` 是文件,原代码调用 `removeDir` 删除;该函数名与实现均针对目录,当前靠 `fs.rmSync` 的兼容性正常工作,但语义错位,一旦 `removeDir` 实现收紧(如增加 `isDirectory` 判断)会静默失效,导致快照残留、`[5/11]` 误判"依赖与环境未变化";现改用 `fs.rmSync(path, { force: true })` 直接删除文件;
|
|
6
|
+
## [4.0.5] - 2026-10-21 12:10
|
|
7
|
+
### 优化
|
|
8
|
+
- 进一步优化 .md 文件;
|
|
9
9
|
|
|
10
|
-
## [4.0.
|
|
11
|
-
###
|
|
12
|
-
-
|
|
13
|
-
- **`[3/11]` 提示与实际清理范围不符**:原提示"清理全部缓存"实际只清 Gradle 构建目录;`depsChanged` / `appInfoChanged` 分支提示"清理 nodejs-assets 缓存 + app/build",但 `nodejs-assets` 从未被清理;现提示按实际清理目标拼接--版本类变化为"清理 Gradle 缓存、CMake 缓存与依赖缓存",依赖变化为"清理依赖缓存、Gradle 缓存",仅应用信息变化为"清理 Gradle 缓存";
|
|
10
|
+
## [4.0.4] - 2026-10-21 10:02
|
|
11
|
+
### 优化
|
|
12
|
+
- 优化了大量文件细节
|
package/README.md
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
|
|
26
26
|
## 环境要求(最低)
|
|
27
27
|
|
|
28
|
-
| 项 | 要求
|
|
29
|
-
| ------------ |
|
|
30
|
-
| Node.js | 需满足 `package.json` 的 `engines.node` 字段
|
|
28
|
+
| 项 | 要求 |
|
|
29
|
+
| ------------ | ---------------------------------------------------------------- |
|
|
30
|
+
| Node.js | 需满足 `package.json` 的 `engines.node` 字段 |
|
|
31
31
|
| Android 构建 | JDK **17**,Android SDK(minSdk 29 / targetSdk 36 / compileSdk 37) |
|
|
32
|
-
| iOS 构建 | macOS + 完整 Xcode + CocoaPods
|
|
33
|
-
| 可选 | watchman(提升 Metro 文件监听性能)
|
|
34
|
-
| Windows 额外 | Visual Studio + Git for Windows(仅编译原生模块时需要,见下方说明)
|
|
32
|
+
| iOS 构建 | macOS + 完整 Xcode + CocoaPods |
|
|
33
|
+
| 可选 | watchman(提升 Metro 文件监听性能) |
|
|
34
|
+
| Windows 额外 | Visual Studio + Git for Windows(仅编译原生模块时需要,见下方说明) |
|
|
35
35
|
|
|
36
36
|
**JDK 必须是 17**,Android Gradle Plugin 目前不支持更高版本;
|
|
37
37
|
|
|
@@ -160,23 +160,23 @@ npx node-mobile-app build --release
|
|
|
160
160
|
|
|
161
161
|
## 命令说明
|
|
162
162
|
|
|
163
|
-
| 命令 | 用途
|
|
164
|
-
| ------------------------------------- |
|
|
163
|
+
| 命令 | 用途 |
|
|
164
|
+
| ------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
165
165
|
| `npx node-mobile-app test` | 编译并安装到设备(**需连 USB**);自动启动 Metro 并后台常驻,支持热更新;设备已装包签名不一致时自动卸载 |
|
|
166
|
-
| `npx node-mobile-app test --ios` | iOS 版(仅 macOS)
|
|
167
|
-
| `npx node-mobile-app build` | 打 debug APK(**离线可用**)
|
|
168
|
-
| `npx node-mobile-app build --release` | 打 release APK(默认用 debug keystore 签名,可安装;上架需配置 `android.signing`)
|
|
169
|
-
| `npx node-mobile-app build --ios` | 打 IPA(仅 macOS)
|
|
170
|
-
| `npx node-mobile-app clean` | 清理构建缓存
|
|
166
|
+
| `npx node-mobile-app test --ios` | iOS 版(仅 macOS) |
|
|
167
|
+
| `npx node-mobile-app build` | 打 debug APK(**离线可用**) |
|
|
168
|
+
| `npx node-mobile-app build --release` | 打 release APK(默认用 debug keystore 签名,可安装;上架需配置 `android.signing`) |
|
|
169
|
+
| `npx node-mobile-app build --ios` | 打 IPA(仅 macOS) |
|
|
170
|
+
| `npx node-mobile-app clean` | 清理构建缓存 |
|
|
171
171
|
|
|
172
172
|
### 常用选项
|
|
173
173
|
|
|
174
|
-
| 选项 | 用途
|
|
175
|
-
| --------------- |
|
|
176
|
-
| `--ios` | 目标平台为 iOS(默认 Android)
|
|
177
|
-
| `--release` | 打 release 包(仅 `build`)
|
|
178
|
-
| `--device <id>` | 指定设备(`test`)
|
|
179
|
-
| `--arch <abi>` | 指定 ABI,逗号分隔(`build`,仅 Android)
|
|
174
|
+
| 选项 | 用途 |
|
|
175
|
+
| --------------- | ------------------------------------------- |
|
|
176
|
+
| `--ios` | 目标平台为 iOS(默认 Android) |
|
|
177
|
+
| `--release` | 打 release 包(仅 `build`) |
|
|
178
|
+
| `--device <id>` | 指定设备(`test`) |
|
|
179
|
+
| `--arch <abi>` | 指定 ABI,逗号分隔(`build`,仅 Android) |
|
|
180
180
|
| `--debug` | 显示详细日志(优化各阶段明细,各命令完整输出) |
|
|
181
181
|
|
|
182
182
|
### 安装 APK 到手机
|
|
@@ -231,14 +231,14 @@ adb install -r "./out/myapp-1.0.0-release.apk"
|
|
|
231
231
|
|
|
232
232
|
### 必填
|
|
233
233
|
|
|
234
|
-
| 字段 | 类型 | 说明
|
|
235
|
-
| ------------ | -------- |
|
|
234
|
+
| 字段 | 类型 | 说明 |
|
|
235
|
+
| ------------ | -------- | --------------------------------------- |
|
|
236
236
|
| `serverPath` | `string` | Node 启动脚本路径(默认 `'./server.js'`) |
|
|
237
237
|
|
|
238
238
|
### 应用信息
|
|
239
239
|
|
|
240
|
-
| 字段 | 类型 | 说明
|
|
241
|
-
| ------------- | ---------------- |
|
|
240
|
+
| 字段 | 类型 | 说明 |
|
|
241
|
+
| ------------- | ---------------- | ------------------------------------------------------------------------ |
|
|
242
242
|
| `appName` | `string \| null` | 应用显示名称(默认从 `package.json` 的 `name` 读) |
|
|
243
243
|
| `outputDir` | `string \| null` | APK / IPA 输出目录(默认 `./out`) |
|
|
244
244
|
| `appId` | `string` | 应用唯一标识,反向域名格式(Android `applicationId` / iOS Bundle ID) |
|
|
@@ -247,36 +247,36 @@ adb install -r "./out/myapp-1.0.0-release.apk"
|
|
|
247
247
|
|
|
248
248
|
### WebView
|
|
249
249
|
|
|
250
|
-
| 字段 | 类型 | 默认 | 说明
|
|
251
|
-
| --------------------- | --------- | ------------------- |
|
|
252
|
-
| `showLoading` | `boolean` | `true` | 是否显示加载指示器
|
|
253
|
-
| `loadingText` | `string` | `'正在启动服务...'` | 加载提示文字
|
|
254
|
-
| `enableJavaScript` | `boolean` | `true` | 是否启用 JavaScript
|
|
255
|
-
| `enableDomStorage` | `boolean` | `true` | 是否启用 DOM Storage
|
|
256
|
-
| `allowFileAccess` | `boolean` | `true` | 是否允许访问本地文件
|
|
250
|
+
| 字段 | 类型 | 默认 | 说明 |
|
|
251
|
+
| --------------------- | --------- | ------------------- | ----------------------------------------------------------------------------------------- |
|
|
252
|
+
| `showLoading` | `boolean` | `true` | 是否显示加载指示器 |
|
|
253
|
+
| `loadingText` | `string` | `'正在启动服务...'` | 加载提示文字 |
|
|
254
|
+
| `enableJavaScript` | `boolean` | `true` | 是否启用 JavaScript |
|
|
255
|
+
| `enableDomStorage` | `boolean` | `true` | 是否启用 DOM Storage |
|
|
256
|
+
| `allowFileAccess` | `boolean` | `true` | 是否允许访问本地文件 |
|
|
257
257
|
| `mixedContentMode` | `string` | `'always'` | 混合内容模式:`never` / `always` / `compatibility` |
|
|
258
258
|
| `backgroundColor` | 见下 | `'#ffffff'` | WebView 背景色;支持:固定色 `'#ffffff'` / 跟随系统 `'system'` / 深浅两值 `{ light, dark }` |
|
|
259
|
-
| `allowSelfSignedCert` | `boolean` | `false` | 见下文"HTTPS 自签证书"
|
|
259
|
+
| `allowSelfSignedCert` | `boolean` | `false` | 见下文"HTTPS 自签证书" |
|
|
260
260
|
|
|
261
261
|
### Android
|
|
262
262
|
|
|
263
|
-
| 字段 | 类型 | 默认 | 说明
|
|
264
|
-
| ----------------------- | ---------------- | -------------------- |
|
|
265
|
-
| `sdkPath` | `string \| null` | `null` | Android SDK 路径(默认自动查找)
|
|
266
|
-
| `adbPath` | `string \| null` | `null` | adb 路径(默认自动查找)
|
|
267
|
-
| `minSdkVersion` | `int` | `29` | 最低 SDK(29=Android 10.0)
|
|
268
|
-
| `targetSdkVersion` | `int` | `36` | 目标 SDK
|
|
269
|
-
| `compileSdkVersion` | `int` | `37` | 编译 SDK
|
|
270
|
-
| `buildToolsVersion` | `string` | `'37.0.0'` | 构建工具版本
|
|
271
|
-
| `abiFilters` | `string[]` | `['arm64-v8a']` | 打包架构(真机 `arm64-v8a`,模拟器加 `x86_64`)
|
|
272
|
-
| `icon` | `string` | `'./build/icon.png'` | 应用图标(建议 512×512 PNG)
|
|
273
|
-
| `usesCleartextTraffic` | `boolean` | `true` | 是否允许明文 HTTP
|
|
274
|
-
| `permissions` | `string[]` | `[]` | 额外权限(如 `'android.permission.CAMERA'`)
|
|
263
|
+
| 字段 | 类型 | 默认 | 说明 |
|
|
264
|
+
| ----------------------- | ---------------- | -------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
265
|
+
| `sdkPath` | `string \| null` | `null` | Android SDK 路径(默认自动查找) |
|
|
266
|
+
| `adbPath` | `string \| null` | `null` | adb 路径(默认自动查找) |
|
|
267
|
+
| `minSdkVersion` | `int` | `29` | 最低 SDK(29=Android 10.0) |
|
|
268
|
+
| `targetSdkVersion` | `int` | `36` | 目标 SDK |
|
|
269
|
+
| `compileSdkVersion` | `int` | `37` | 编译 SDK |
|
|
270
|
+
| `buildToolsVersion` | `string` | `'37.0.0'` | 构建工具版本 |
|
|
271
|
+
| `abiFilters` | `string[]` | `['arm64-v8a']` | 打包架构(真机 `arm64-v8a`,模拟器加 `x86_64`) |
|
|
272
|
+
| `icon` | `string` | `'./build/icon.png'` | 应用图标(建议 512×512 PNG) |
|
|
273
|
+
| `usesCleartextTraffic` | `boolean` | `true` | 是否允许明文 HTTP |
|
|
274
|
+
| `permissions` | `string[]` | `[]` | 额外权限(如 `'android.permission.CAMERA'`) |
|
|
275
275
|
| `signing` | `object` | - | 自定义签名配置.**不填则用模板自带的 debug keystore 签名**(可安装测试,不可上架);填则以下 4 项均为必填 |
|
|
276
|
-
| `signing.keystore` | `string` | - | keystore 路径(相对你的项目根)
|
|
277
|
-
| `signing.storePassword` | `string` | - | keystore 密码
|
|
278
|
-
| `signing.keyAlias` | `string` | - | 密钥别名
|
|
279
|
-
| `signing.keyPassword` | `string` | - | 密钥密码(通常与 `storePassword` 相同)
|
|
276
|
+
| `signing.keystore` | `string` | - | keystore 路径(相对你的项目根) |
|
|
277
|
+
| `signing.storePassword` | `string` | - | keystore 密码 |
|
|
278
|
+
| `signing.keyAlias` | `string` | - | 密钥别名 |
|
|
279
|
+
| `signing.keyPassword` | `string` | - | 密钥密码(通常与 `storePassword` 相同) |
|
|
280
280
|
|
|
281
281
|
#### 生成自签名 keystore
|
|
282
282
|
|
|
@@ -320,43 +320,43 @@ signing: {
|
|
|
320
320
|
|
|
321
321
|
### iOS
|
|
322
322
|
|
|
323
|
-
| 字段 | 类型 | 默认 | 说明
|
|
324
|
-
| ----------------------------- | -------- | -------------------- |
|
|
325
|
-
| `deploymentTarget` | `string` | `'15.1'` | 最低 iOS 版本
|
|
323
|
+
| 字段 | 类型 | 默认 | 说明 |
|
|
324
|
+
| ----------------------------- | -------- | -------------------- | ---------------------------------------------------- |
|
|
325
|
+
| `deploymentTarget` | `string` | `'15.1'` | 最低 iOS 版本 |
|
|
326
326
|
| `icon` | `string` | `'./build/icon.png'` | 应用图标(建议 1024×1024 PNG) |
|
|
327
|
-
| `signing.teamId` | `string` | - | Apple Developer Team ID
|
|
327
|
+
| `signing.teamId` | `string` | - | Apple Developer Team ID |
|
|
328
328
|
| `signing.provisioningProfile` | `string` | - | 描述文件路径(写入 `exportOptions.plist`) |
|
|
329
329
|
| `signing.certificate` | `string` | - | P12 证书路径(导入临时 keychain 供 xcodebuild 签名用) |
|
|
330
|
-
| `signing.certificatePassword` | `string` | - | P12 密码
|
|
330
|
+
| `signing.certificatePassword` | `string` | - | P12 密码 |
|
|
331
331
|
|
|
332
332
|
### 高级
|
|
333
333
|
|
|
334
334
|
| 字段 | 类型 | 默认 | 说明 |
|
|
335
335
|
| ---------------------------- | --------- | ------ | -------------------------- |
|
|
336
336
|
| `advanced.keepAlive` | `boolean` | `true` | 是否发送心跳保持 Node 进程 |
|
|
337
|
-
| `advanced.heartbeatInterval` | `int` | `5000` | 心跳间隔(毫秒)
|
|
337
|
+
| `advanced.heartbeatInterval` | `int` | `5000` | 心跳间隔(毫秒) |
|
|
338
338
|
|
|
339
339
|
### 扩展点
|
|
340
340
|
|
|
341
|
-
| 字段 | 类型 | 默认 | 说明
|
|
342
|
-
| --------------------- | ---------- | ---- |
|
|
341
|
+
| 字段 | 类型 | 默认 | 说明 |
|
|
342
|
+
| --------------------- | ---------- | ---- | --------------------------------------------------- |
|
|
343
343
|
| `keepFiles` | `string[]` | `[]` | 不重置的模板文件(路径相对 `node-mobile-app-build/`) |
|
|
344
344
|
| `extraRnDependencies` | `string[]` | `[]` | 额外 RN 原生依赖包名(需先安装在你的开发字段中) |
|
|
345
345
|
|
|
346
346
|
### 排除 / 白名单
|
|
347
347
|
|
|
348
|
-
| 字段 | 说明
|
|
349
|
-
| -------------- |
|
|
350
|
-
| `excludeFiles` | 复制到 build 目录时跳过的文件/目录(支持 `*.log`,`build/` 等)
|
|
348
|
+
| 字段 | 说明 |
|
|
349
|
+
| -------------- | -------------------------------------------------------------------------- |
|
|
350
|
+
| `excludeFiles` | 复制到 build 目录时跳过的文件/目录(支持 `*.log`,`build/` 等) |
|
|
351
351
|
| `allowScripts` | 移动端 Node 环境里允许跑安装脚本的包(会写入 `nodejs-project/package.json`) |
|
|
352
352
|
|
|
353
353
|
### node_modules 优化
|
|
354
354
|
|
|
355
355
|
构建时自动优化 `node_modules`(默认开启,无需配置),减少打包文件数与体积,加速启动.
|
|
356
356
|
|
|
357
|
-
| 字段 | 类型 | 默认 | 说明
|
|
358
|
-
| --------- | ---------- | ------ |
|
|
359
|
-
| `enabled` | `boolean` | `true` | 是否启用优化
|
|
357
|
+
| 字段 | 类型 | 默认 | 说明 |
|
|
358
|
+
| --------- | ---------- | ------ | --------------------------------------------------------- |
|
|
359
|
+
| `enabled` | `boolean` | `true` | 是否启用优化 |
|
|
360
360
|
| `exclude` | `string[]` | `[]` | 排除优化时异常或不想优化的包(写 `package.json` 的 `name`) |
|
|
361
361
|
|
|
362
362
|
**编译与优化顺序**:先交叉编译原生模块(见 `install.js`),再执行以下六阶段优化:
|
|
@@ -394,11 +394,11 @@ CLI **自动识别 `server.js` 实际监听的协议和端口**--拦截 `net.Ser
|
|
|
394
394
|
|
|
395
395
|
`webview.allowSelfSignedCert` 控制是否放行**不受信任的 HTTPS 证书**:
|
|
396
396
|
|
|
397
|
-
| 场景
|
|
398
|
-
|
|
|
399
|
-
| HTTP
|
|
397
|
+
| 场景 | 是否受开关影响 |
|
|
398
|
+
| ------------------------------------------- | ------------------- |
|
|
399
|
+
| HTTP | 无关 |
|
|
400
400
|
| HTTPS + 真证书(Let's Encrypt 等) | 无关 |
|
|
401
|
-
| HTTPS + 自签证书 + 已装进设备信任库
|
|
401
|
+
| HTTPS + 自签证书 + 已装进设备信任库 | 无关 |
|
|
402
402
|
| HTTPS + 自签证书 + 未装设备(本地测试最常见) | **必须设为 `true`** |
|
|
403
403
|
|
|
404
404
|
**实现方式**:
|
|
@@ -417,8 +417,8 @@ CLI **自动识别 `server.js` 实际监听的协议和端口**--拦截 `net.Ser
|
|
|
417
417
|
| 运行时版本 | 官方提供多个版本,可用 `NODE_MOBILE_PREBUILT_VERSION` 切换 | **当前为 v18.20.4**,更高版本后续逐步适配 |
|
|
418
418
|
| Express 版本 | 产物带 full-icu,4.x / 5.x 均可用 | 当前产物不带 full-icu,**必须用 4.x** |
|
|
419
419
|
| full-icu | 自 v22.23.2 产物起支持 | 暂无 |
|
|
420
|
-
| `test` 离线 | ✓(内置 bundle)
|
|
421
|
-
| 图标尺寸 | 5 个密度(48~192)
|
|
420
|
+
| `test` 离线 | ✓(内置 bundle) | ✓(需 `FORCE_BUNDLING=1`) |
|
|
421
|
+
| 图标尺寸 | 5 个密度(48~192) | 9 个尺寸(40~1024) |
|
|
422
422
|
|
|
423
423
|
**iOS 运行时版本**:iOS 附件的实际运行时版本随适配进度变化,**当前对应 v18.20.4**;如需更高版本,可克隆 [nodejs-mobile 仓库](https://github.com/OpenFlun/nodejs-mobile) 自行编译 `NodeMobile.xcframework`,流程与 Android 自编译 `libnode.so` 类似(见 `自定义libnode指南.md`);
|
|
424
424
|
|
|
@@ -511,9 +511,9 @@ Express 5 的路由语法与 4 不同(如 `app.get('*')` 要改成 `app.get('/{*
|
|
|
511
511
|
|
|
512
512
|
从 `@flun/nodejs-mobile-react-native` 1.0.1 起,两套预编译二进制**不在 npm 包里**,改为 postinstall 阶段自动从 Gitee / GitHub Release 下载:
|
|
513
513
|
|
|
514
|
-
| 资源
|
|
515
|
-
|
|
|
516
|
-
| `android-libnode.zip`
|
|
514
|
+
| 资源 | 目标位置 |
|
|
515
|
+
| ------------------------------ | --------------------------------------------------------------------------- |
|
|
516
|
+
| `android-libnode.zip` | `node_modules/@flun/nodejs-mobile-react-native/android/libnode/` |
|
|
517
517
|
| `ios-nodemobile.zip`(仅 macOS) | `node_modules/@flun/nodejs-mobile-react-native/ios/NodeMobile.xcframework/` |
|
|
518
518
|
|
|
519
519
|
- 默认下载版本以 `@flun/nodejs-mobile-react-native` 的 `package.json` 中 `prebuiltAssets.version` 字段为准
|
|
@@ -556,4 +556,4 @@ RN 0.87 的 API 若变动,`AppDelegate.swift` 里的 fallback 可能不生效--
|
|
|
556
556
|
|
|
557
557
|
## 许可
|
|
558
558
|
|
|
559
|
-
ISC
|
|
559
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flun/node-mobile-app",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "将 Node.js 项目一键打包为 Android / iOS 移动应用,运行时由 @flun/nodejs-mobile-react-native 提供,无需修改你的 Node 代码;",
|
|
5
5
|
"author": "flun <open@flun.top>",
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/core": "^8.0.7",
|
|
44
|
-
"@eslint-react/eslint-plugin": "^5.28.
|
|
44
|
+
"@eslint-react/eslint-plugin": "^5.28.0",
|
|
45
45
|
"@eslint/js": "^10.0.1",
|
|
46
46
|
"@flun/nodejs-mobile-react-native": "^2.1.0",
|
|
47
47
|
"@react-native/babel-preset": "^0.88.0",
|