cj-tauri 2.1.3 → 2.3.0
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/bin/cj-tauri.js +87 -0
- package/cjpm.toml +1 -1
- package/cli/cjpm.toml +1 -1
- package/cli/src/doctor.cj +1 -1
- package/cli/src/manifest.cj +5 -2
- package/cli/src/project.cj +1 -1
- package/cli/templates/ohos-skeleton/entry/cjpm.toml +7 -1
- package/native/core/bridge_core.c +8 -5
- package/native/core/bridge_core.h +5 -2
- package/native/platforms/linux/bridge_linux.c +6 -3
- package/native/platforms/windows/bridge_win.c +44 -9
- package/native/tests/test_bridge_core.c +27 -3
- package/package.json +1 -1
- package/src/app.cj +1 -1
- package/src/app_events.cj +5 -5
- package/src/app_host_ops.cj +8 -8
- package/src/app_run.cj +8 -8
- package/src/capability.cj +3 -3
- package/src/capability_loader.cj +8 -8
- package/src/embedded_assets.cj +5 -5
- package/src/host.cj +6 -6
- package/src/host_arkweb.cj +31 -31
- package/src/host_webkit.cj +31 -10
- package/src/host_webview2.cj +31 -9
- package/src/ipc_hub.cj +8 -8
- package/src/launch.cj +1 -1
- package/src/log_bridge.cj +141 -13
- package/src/logging.cj +2 -2
- package/src/menu.cj +1 -1
- package/src/plugin.cj +6 -6
- package/src/plugins/http/http_ohos.cj +2 -2
- package/src/plugins/http/plugin_http.cj +2 -2
- package/src/plugins/mqtt/plugin_mqtt.cj +4 -4
- package/src/plugins/redis/plugin_redis.cj +20 -20
- package/src/plugins/sqlite/sqlite_ffi.cj +3 -3
- package/src/plugins/store/plugin_store.cj +3 -3
- package/src/plugins/ws/plugin_ws.cj +7 -7
- package/src/process_hidden.cj +5 -5
- package/src/tests/logging_test.cj +66 -0
- package/src/tests/plugin_store_test.cj +1 -1
- package/src/tests/scope_test.cj +2 -2
- package/src/tray.cj +2 -2
- package/src/version.cj +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package cjTauri.tests
|
|
2
2
|
|
|
3
3
|
import cjTauri.*
|
|
4
|
+
import std.collection.*
|
|
4
5
|
import std.unittest.*
|
|
5
6
|
import std.unittest.testmacro.*
|
|
6
7
|
|
|
@@ -60,3 +61,68 @@ func testLogPathOrDefaultPrefersEnvOverPlatformDir(): Unit {
|
|
|
60
61
|
@Expect(d.contains("cj-tauri"), true)
|
|
61
62
|
@Expect(d == defaultLogPath("music"), true)
|
|
62
63
|
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* 鸿蒙 hilog 分片器(2026-11-12):hilog 对单条日志有长度上限,框架的超长诊断行要切多条送出去。
|
|
67
|
+
* 分片器与平台无关、无 FFI 依赖,所以在本机能验——鸿蒙分支其余部分编不了(本机 SDK 只有
|
|
68
|
+
* linux / windows 两个目标),能本地验证的部分别留成「未验证」。
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
@Test
|
|
72
|
+
func testHilogSplitKeepsShortLineIntact(): Unit {
|
|
73
|
+
@Expect(hilogSplit("", 1000).size, 1)
|
|
74
|
+
@Expect(hilogSplit("", 1000)[0], "")
|
|
75
|
+
@Expect(hilogSplit("abc", 1000).size, 1)
|
|
76
|
+
// 恰好等于预算也是单片:不因「相等」多切一条空的出来
|
|
77
|
+
@Expect(hilogSplit("abcdefgh", 8).size, 1)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Test
|
|
81
|
+
func testHilogSplitChunksLongAsciiLine(): Unit {
|
|
82
|
+
let sb = StringBuilder()
|
|
83
|
+
for (_ in 0..2500) {
|
|
84
|
+
sb.append("x")
|
|
85
|
+
}
|
|
86
|
+
let line = sb.toString()
|
|
87
|
+
let parts = hilogSplit(line, 1000)
|
|
88
|
+
@Expect(parts.size, 3)
|
|
89
|
+
var joined = ""
|
|
90
|
+
for (p in parts) {
|
|
91
|
+
@Expect(p.size <= 1000, true)
|
|
92
|
+
joined = joined + p
|
|
93
|
+
}
|
|
94
|
+
@Expect(joined, line) // 不丢内容、不改内容:取证要对得上原文
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@Test
|
|
98
|
+
func testHilogSplitNeverCutsInsideUtf8Char(): Unit {
|
|
99
|
+
// 400 个汉字 = 1200 字节;1000 字节预算硬切就落在第 334 个汉字中间
|
|
100
|
+
let sb = StringBuilder()
|
|
101
|
+
for (_ in 0..400) {
|
|
102
|
+
sb.append("汉")
|
|
103
|
+
}
|
|
104
|
+
let line = sb.toString()
|
|
105
|
+
let parts = hilogSplit(line, 1000)
|
|
106
|
+
@Expect(parts.size, 2)
|
|
107
|
+
var joined = ""
|
|
108
|
+
for (p in parts) {
|
|
109
|
+
// 分片器内部走 String.fromUtf8(非法 UTF-8 会抛),这里再钉住两条可观测性质
|
|
110
|
+
@Expect(p.size <= 1000, true)
|
|
111
|
+
@Expect(p.size % 3, 0) // 汉字 3 字节:每片都落在整字边界上
|
|
112
|
+
joined = joined + p
|
|
113
|
+
}
|
|
114
|
+
@Expect(joined, line)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@Test
|
|
118
|
+
func testHilogSplitSurvivesTinyBudget(): Unit {
|
|
119
|
+
// 预算比一个汉字还小:按 4 字节下限走,仍须是合法 UTF-8 且能拼回原文
|
|
120
|
+
let line = "仓颉日志"
|
|
121
|
+
let parts = hilogSplit(line, 2)
|
|
122
|
+
var joined = ""
|
|
123
|
+
for (p in parts) {
|
|
124
|
+
joined = joined + p
|
|
125
|
+
}
|
|
126
|
+
@Expect(joined, line)
|
|
127
|
+
@Expect(parts.size > 0, true)
|
|
128
|
+
}
|
package/src/tests/scope_test.cj
CHANGED
|
@@ -298,7 +298,7 @@ func testScopeSymlinkEscapeIsDenied(): Unit {
|
|
|
298
298
|
try {
|
|
299
299
|
SymbolicLink.create("${base}/target/scope-sym/escape.txt", to: outside)
|
|
300
300
|
} catch (e: Exception) {
|
|
301
|
-
|
|
301
|
+
logd("[skip] testScopeSymlinkEscapeIsDenied: 本机无法创建符号链接(${e.message})")
|
|
302
302
|
removeIfExists(outside)
|
|
303
303
|
return
|
|
304
304
|
}
|
|
@@ -323,7 +323,7 @@ func testScopeSymlinkInsideIsAllowed(): Unit {
|
|
|
323
323
|
try {
|
|
324
324
|
SymbolicLink.create("${base}/target/scope-sym2/link.txt", to: "${base}/target/scope-sym2/inner.txt")
|
|
325
325
|
} catch (e: Exception) {
|
|
326
|
-
|
|
326
|
+
logd("[skip] testScopeSymlinkInsideIsAllowed: 本机无法创建符号链接(${e.message})")
|
|
327
327
|
return
|
|
328
328
|
}
|
|
329
329
|
let ctx = fsCtxWithScopes([scopeCwdPath() + "/target/**"], [])
|
package/src/tray.cj
CHANGED
|
@@ -51,7 +51,7 @@ public class TrayModel {
|
|
|
51
51
|
let flat = ArrayList<MenuItem>()
|
|
52
52
|
for (it in this.items) {
|
|
53
53
|
if (TrayModel.isSubmenu(it.kind)) {
|
|
54
|
-
|
|
54
|
+
logd("[cj-tauri] tray: submenu item dropped (v1 tray menu is flat): ${it.label}")
|
|
55
55
|
continue
|
|
56
56
|
}
|
|
57
57
|
flat.add(it)
|
|
@@ -60,7 +60,7 @@ public class TrayModel {
|
|
|
60
60
|
var icon = this.icon
|
|
61
61
|
var tooltip = this.tooltip
|
|
62
62
|
if (TrayModel.hasStructChar(icon) || TrayModel.hasStructChar(tooltip)) {
|
|
63
|
-
|
|
63
|
+
logd("[cj-tauri] tray: icon/tooltip contains tab or newline - dropped to empty")
|
|
64
64
|
icon = ""
|
|
65
65
|
tooltip = ""
|
|
66
66
|
}
|
package/src/version.cj
CHANGED