cj-tauri 2.1.0 → 2.1.3
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/README.md +203 -115
- package/cjpm.toml +1 -1
- package/cli/cjpm.toml +1 -1
- package/cli/src/manifest.cj +13 -2
- package/cli/src/project.cj +1 -1
- package/cli/src/sync.cj +213 -4
- package/native/core/bridge_core.c +26 -0
- package/native/core/bridge_core.h +22 -0
- package/native/platforms/linux/bridge_linux.c +247 -5
- package/native/platforms/windows/bridge_win.c +405 -2
- package/native/tests/test_bridge_core.c +49 -1
- package/package.json +4 -4
- package/src/app.cj +10 -0
- package/src/cookies_bridge.cj +42 -0
- package/src/host.cj +14 -0
- package/src/host_webkit.cj +25 -0
- package/src/host_webview2.cj +25 -0
- package/src/ipc_hub.cj +66 -2
- package/src/tests/app_spec_test.cj +5 -1
- package/src/tests/fake_host.cj +8 -0
- package/src/tests/ipc_hub_test.cj +76 -0
- package/src/tests/platform_contract_test.cj +15 -2
- package/src/version.cj +1 -1
- package/prebuilt/linux-x64/cj-tauri +0 -0
package/README.md
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
# cj-tauri
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
A scaffold CLI for building desktop apps in the [Cangjie language](https://cangjie-lang.cn) — it brings
|
|
4
|
+
Tauri's trio to Cangjie: a Cangjie backend (statically compiled) plus a system WebView frontend
|
|
5
|
+
(HTML/CSS/JS), with the same three pieces Tauri has — a WebView host, a bidirectional IPC bridge
|
|
6
|
+
(`invoke` / `resolve` / `event`), and a capability-based security model (capability allowlists).
|
|
7
|
+
|
|
8
|
+
- Repository and full documentation: <https://github.com/yangyongzhen/cj-tauri>
|
|
9
|
+
- Current version: **2.1.3** (new in this release: `scripts/winbuild.sh` now pairs the Windows stdx
|
|
10
|
+
package with the installed `cjc` — a mismatched pair compiles and links fine but aborts at startup,
|
|
11
|
+
and under a GUI subsystem it leaves **no log at all** — plus the `cookie-export` round of Windows
|
|
12
|
+
fixes: `USERPROFILE` fallback for the home directory, an empty cookie filter that reads the whole
|
|
13
|
+
store instead of matching `about:blank`, a borrowed `ICoreWebView2CookieList` that was being
|
|
14
|
+
released, and a cookie reply buffer too small to stay valid JSON)
|
|
15
|
+
- Current status: **Windows (WebView2), Linux (WebKitGTK) and HarmonyOS PC (ArkWeb) all run on real
|
|
16
|
+
hardware**; on the HarmonyOS side the menu capability bit and `fs` / `mqtt` / `redis` / `sqlite` /
|
|
17
|
+
`store` / `http` have been verified on a device
|
|
18
|
+
|
|
19
|
+
## Prerequisite: the Cangjie SDK
|
|
20
|
+
|
|
21
|
+
**This package does not replace the Cangjie SDK.** Your app backend is Cangjie code, and
|
|
22
|
+
`cj-tauri dev` / `build` invoke the SDK's `cjc` / `cjpm` to compile it. So install the SDK first
|
|
23
|
+
(verified with version **1.2.0**, including **stdx**) and make it discoverable:
|
|
17
24
|
|
|
18
25
|
```bash
|
|
19
26
|
# Linux
|
|
@@ -23,108 +30,117 @@ export CANGJIE_HOME=/opt/cangjie/cangjie
|
|
|
23
30
|
set CANGJIE_HOME=D:\Program Files (x86)\Cangjie
|
|
24
31
|
```
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
Linux `/opt/cangjie/cangjie
|
|
33
|
+
When `CANGJIE_HOME` is unset, the package probes the usual install locations (Windows
|
|
34
|
+
`D:\Program Files (x86)\Cangjie`, Linux `/opt/cangjie/cangjie`). Three more variables are needed
|
|
35
|
+
in some situations:
|
|
28
36
|
|
|
29
|
-
|
|
|
37
|
+
| Variable | When you need it |
|
|
30
38
|
|---|---|
|
|
31
|
-
| `CJ_TAURI_ROOT` |
|
|
32
|
-
| `CANGJIE_STDX` |
|
|
33
|
-
| `CANGJIE_STDX_OHOS` |
|
|
39
|
+
| `CJ_TAURI_ROOT` | Running outside the cj-tauri repo when the framework root can't be located (`create` writes the framework path into your project) |
|
|
40
|
+
| `CANGJIE_STDX` | Your app's `cjpm.toml` expands the stdx path via `${CANGJIE_STDX}`; the package probes the framework/project toml for it and falls back to this variable |
|
|
41
|
+
| `CANGJIE_STDX_OHOS` | Only when building a HarmonyOS project (the HarmonyOS build of stdx; `build-hap.sh` locates its dynamic libraries through it) |
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
Self-check once it's installed:
|
|
36
44
|
|
|
37
45
|
```bash
|
|
38
|
-
npx cj-tauri info #
|
|
46
|
+
npx cj-tauri info # prints the resolved framework / project / stdx / SDK / cjpm / C bridge
|
|
39
47
|
```
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
Without the SDK the package prints a clear hint and install instructions instead of throwing
|
|
50
|
+
`cjpm: command not found`. Note that `npx cj-tauri --version` works without the SDK.
|
|
43
51
|
|
|
44
|
-
##
|
|
52
|
+
## Usage
|
|
45
53
|
|
|
46
54
|
```bash
|
|
47
|
-
npx cj-tauri create myapp --template app #
|
|
55
|
+
npx cj-tauri create myapp --template app # inline HTML, zero Node (the default template)
|
|
48
56
|
cd myapp
|
|
49
|
-
npx cj-tauri sync #
|
|
50
|
-
npx cj-tauri dev #
|
|
57
|
+
npx cj-tauri sync # derive the targets/ skeletons from the manifest (first run; idempotent)
|
|
58
|
+
npx cj-tauri dev # build the C bridge + cjpm build + open the window
|
|
51
59
|
|
|
52
|
-
npx cj-tauri create myapp-vue --template vue # Vue 3 + Vite
|
|
60
|
+
npx cj-tauri create myapp-vue --template vue # Vue 3 + Vite (frontend project under assets/ui/)
|
|
53
61
|
npx cj-tauri create myapp-react --template react # React 18 + Vite
|
|
54
62
|
|
|
55
|
-
npx cj-tauri create myohos --template ohos #
|
|
56
|
-
npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "
|
|
63
|
+
npx cj-tauri create myohos --template ohos # HarmonyOS PC: same business code + targets/ohos
|
|
64
|
+
npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "My App"
|
|
57
65
|
|
|
58
|
-
npm i -g cj-tauri #
|
|
66
|
+
npm i -g cj-tauri # or install globally and call cj-tauri <subcommand> directly
|
|
59
67
|
```
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
**One body of business code, skeletons derived per target** — `create` only generates the manifest and
|
|
70
|
+
the business side; the platform skeletons are what `sync` produces:
|
|
62
71
|
|
|
63
72
|
```
|
|
64
73
|
myapp/
|
|
65
|
-
├── cj-tauri.toml #
|
|
66
|
-
├── cjpm.toml #
|
|
67
|
-
├── src/main.cj #
|
|
74
|
+
├── cj-tauri.toml # app manifest — the single source of truth (id/version/window/assets/capability dir)
|
|
75
|
+
├── cjpm.toml # business package (a static library; skeletons reference it by path)
|
|
76
|
+
├── src/main.cj # business assembly point build(): AppSpec (zero platform knowledge)
|
|
68
77
|
├── assets/
|
|
69
|
-
│ ├── ui/index.html #
|
|
70
|
-
│ └── capabilities/default.json #
|
|
71
|
-
└── targets/ # cj-tauri sync
|
|
72
|
-
├── desktop/ #
|
|
73
|
-
└── ohos/ #
|
|
78
|
+
│ ├── ui/index.html # frontend page (any web stack)
|
|
79
|
+
│ └── capabilities/default.json # capability allowlist (commands / events / permission sets)
|
|
80
|
+
└── targets/ # generated by cj-tauri sync (don't hand-edit; check reports drift)
|
|
81
|
+
├── desktop/ # desktop executable (the launcher calls build())
|
|
82
|
+
└── ohos/ # HarmonyOS hap project (DevEco + build-hap.sh)
|
|
74
83
|
```
|
|
75
84
|
|
|
76
|
-
|
|
|
85
|
+
| Subcommand | What it does |
|
|
77
86
|
|---|---|
|
|
78
|
-
| `create
|
|
79
|
-
| `sync [desktop\|ohos]` |
|
|
80
|
-
| `dev` |
|
|
81
|
-
| `build` |
|
|
82
|
-
| `run` |
|
|
83
|
-
| `check` |
|
|
84
|
-
| `info [--json]` |
|
|
85
|
-
| `doctor` |
|
|
86
|
-
| `help` |
|
|
87
|
-
|
|
88
|
-
##
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
| `create <name> [--template app\|vue\|react\|ohos]` | Generate the unified project (manifest + `src/` + `assets/`); `--bundle` / `--label` only matter for the `ohos` template, otherwise they're derived from the project name |
|
|
88
|
+
| `sync [desktop\|ohos]` | Derive the `targets/` skeletons from the manifest (both ends by default; idempotent) |
|
|
89
|
+
| `dev` | Build the C bridge + `cjpm build` + launch the app; Vite templates take over their dev server (HMR) |
|
|
90
|
+
| `build` | Build the C bridge + `cjpm build`; on HarmonyOS run `bash build-hap.sh` inside `targets/ohos` |
|
|
91
|
+
| `run` | Run the built artifact; on HarmonyOS `bash build-hap.sh --install` (build + install + launch) |
|
|
92
|
+
| `check` | Validate `cj-tauri.toml` (id / window / assets present) + `targets/` skeleton drift + three-way plugin comparison |
|
|
93
|
+
| `info [--json]` | Environment self-check (run this first when troubleshooting); `--json` prints only the plugin manifest, machine-readable |
|
|
94
|
+
| `doctor` | Environment self-check with a verdict per line (each line says what to do if it's missing) |
|
|
95
|
+
| `help` | Help |
|
|
96
|
+
|
|
97
|
+
## HarmonyOS PC (`--template ohos`)
|
|
98
|
+
|
|
99
|
+
The same framework with a different host: desktop uses WebView2 / WebKitGTK, HarmonyOS PC uses **ArkWeb**,
|
|
100
|
+
while the page layer, the command layer and capability validation stay untouched. `--template ohos` still
|
|
101
|
+
generates that **unified project** (`cj-tauri.toml` + `src/` + `assets/`), only the manifest carries the
|
|
102
|
+
HarmonyOS side (`[app] id` is the `bundleName`); the DevEco project is a product of `sync`, landing in
|
|
103
|
+
`targets/ohos/`:
|
|
93
104
|
|
|
94
105
|
```bash
|
|
95
|
-
npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "
|
|
106
|
+
npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "My App"
|
|
96
107
|
cd myohos
|
|
97
|
-
npx cj-tauri sync ohos #
|
|
108
|
+
npx cj-tauri sync ohos # derive targets/ohos (DevEco skeleton + the page and capability manifest in rawfile)
|
|
98
109
|
cd targets/ohos
|
|
99
|
-
bash build-hap.sh --install #
|
|
110
|
+
bash build-hap.sh --install # build the hap + install via hdc + aa start
|
|
100
111
|
```
|
|
101
112
|
|
|
102
|
-
`targets/ohos/`
|
|
103
|
-
|
|
113
|
+
`targets/ohos/` is a standard DevEco project (`entry/` + `AppScope/` + `build-profile.json5` +
|
|
114
|
+
`hvigorfile.ts`), and the HarmonyOS-specific layer is thin:
|
|
104
115
|
|
|
105
|
-
|
|
|
116
|
+
| Path | Purpose |
|
|
106
117
|
|---|---|
|
|
107
|
-
| `entry/src/main/cangjie/main_ability.cj` | UIAbility
|
|
108
|
-
| `entry/src/main/cangjie/app_host.cj` | `@Component`
|
|
109
|
-
| `entry/src/main/resources/rawfile/` | `index.html`
|
|
110
|
-
| `build-hap.sh` |
|
|
118
|
+
| `entry/src/main/cangjie/main_ability.cj` | UIAbility: `ArkWebRuntime.configure(filesDir)` → `spawn { run() }` off the UI thread → wait for the host to register, then `loadContent` |
|
|
119
|
+
| `entry/src/main/cangjie/app_host.cj` | the `@Component` ArkWeb host + bidirectional bridge (**must live in the app module**; a framework package referencing ArkUI crashes at startup); calls the business `build()` in your `assets/` |
|
|
120
|
+
| `entry/src/main/resources/rawfile/` | `index.html` and the capability manifest (real files copied in from `assets/`) |
|
|
121
|
+
| `build-hap.sh` | the single build entry: probes DevEco / stdx, runs hvigor with `--no-daemon`, optional `--install` |
|
|
111
122
|
|
|
112
|
-
|
|
123
|
+
Two prerequisites:
|
|
113
124
|
|
|
114
|
-
- **DevEco Studio 6.1
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
- **DevEco Studio 6.1** (with the Cangjie plugin) and signing already configured. `build-hap.sh` finds the
|
|
126
|
+
install root via `DEVECO_WIN` (default `D:\oh\DevEcoStudio`) and the HarmonyOS build of stdx's dynamic
|
|
127
|
+
libraries via `CANGJIE_STDX_OHOS`; when either is missing the script says exactly which one.
|
|
128
|
+
- A device with **developer mode + USB debugging** on, so `hdc` lists it; `aa start` needs the **screen unlocked**.
|
|
117
129
|
|
|
118
|
-
|
|
119
|
-
`cangjieOptions.checkDeviceTypes = false
|
|
120
|
-
|
|
130
|
+
The project defaults to desktop form factor: `deviceTypes` in `module.json5` is `2in1`, and
|
|
131
|
+
`cangjieOptions.checkDeviceTypes = false` in `entry/build-profile.json5` (the plugin only allows
|
|
132
|
+
`phone` / `tablet` by default, and writing `2in1` fails with `01103012`). The window **does not touch the
|
|
133
|
+
size** and keeps the system default rectangle (measured at `2090×1394`, about two thirds of the screen
|
|
134
|
+
width and centered).
|
|
121
135
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
Known limitations: signing is configured in DevEco (the command line does not auto-sign, and changing the
|
|
137
|
+
`bundleName` requires re-signing); two projects under the same debug signature evict each other's install;
|
|
138
|
+
single window with no native dialogs yet (those two capability bits honestly return 0); there is no usable
|
|
139
|
+
C bridge, so host capabilities like `launchHidden` / serial / tray are not available on HarmonyOS. After
|
|
140
|
+
editing pages or the capability manifest under `assets/`, re-run `cj-tauri sync ohos` (`targets/` is
|
|
141
|
+
generated, and `check` reports it as drift).
|
|
126
142
|
|
|
127
|
-
|
|
143
|
+
How to prove it works on a device (hilog, `CjTauri` tag):
|
|
128
144
|
|
|
129
145
|
```
|
|
130
146
|
host registered after N polls label=main
|
|
@@ -133,42 +149,114 @@ page begin label=main
|
|
|
133
149
|
main window keeps system default 2090x1394 px at density 190% on screen 3120x2080
|
|
134
150
|
```
|
|
135
151
|
|
|
136
|
-
##
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
- **
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
152
|
+
## What this wrapper layer does
|
|
153
|
+
|
|
154
|
+
- **One cross-platform entry point**: Windows / Linux / Git Bash all use the same `cj-tauri` command, with
|
|
155
|
+
no more separate `.bat` and `.sh`;
|
|
156
|
+
- **Environment self-check**: locating `cjpm` and the SDK runtime libraries, and assembling `PATH` /
|
|
157
|
+
`LD_LIBRARY_PATH`, all happen here;
|
|
158
|
+
- **Obtaining the CLI itself**: the packaged prebuilt binary is preferred (`prebuilt/<platform-arch>/`);
|
|
159
|
+
otherwise the CLI sources are copied to `~/.cache/cj-tauri/<version>/`, built once with the local
|
|
160
|
+
`cjpm build` and cached — nothing is written into the install directory, so a global install can stay
|
|
161
|
+
read-only;
|
|
162
|
+
- **Data directories**: `$XDG_CACHE_HOME/cj-tauri` on Linux (default `~/.cache/cj-tauri`),
|
|
163
|
+
`%LOCALAPPDATA%\cj-tauri` on Windows.
|
|
164
|
+
|
|
165
|
+
Known limitation: the first `dev` / `build` builds the C bridge into the **framework directory's `native/`**
|
|
166
|
+
(that's where the app's `cjpm.toml` link options point), so the package install directory must be writable;
|
|
167
|
+
if you installed under a read-only path, run from inside the repository instead.
|
|
168
|
+
|
|
169
|
+
## Changes in 2.1.3
|
|
170
|
+
|
|
171
|
+
- **Windows single-file builds use the cjc-matched stdx**: `scripts/winbuild.sh` defaulted to the
|
|
172
|
+
`1.0.5.1` Windows stdx while `cjc` was `1.2.0`. That pair builds, links and ships, but the app
|
|
173
|
+
aborts at startup — and with `--subsystem=windows` stderr is not connected, so double-clicking a
|
|
174
|
+
broken exe produced **no log whatsoever**. The default now points at the matched package
|
|
175
|
+
(log line `[winbuild] cjc 1.2.0 + windows stdx 1.2.0.1`) and a guard refuses to build when the
|
|
176
|
+
major/minor versions differ.
|
|
177
|
+
- `examples/cookie-export` Windows fixes: `homeDir()` falls back to `USERPROFILE` (and only wins when
|
|
178
|
+
the directory really exists), an empty cookie filter reads the whole store instead of matching the
|
|
179
|
+
`about:blank` URL, the borrowed `ICoreWebView2CookieList` is no longer released (it crashed the
|
|
180
|
+
WebView2 process with `0xc0000005`), and the cookie reply buffer is large enough to stay valid JSON.
|
|
181
|
+
|
|
182
|
+
For the full list see `[2.1.3] - 2026-11-06` in the repository's `CHANGELOG.md`.
|
|
183
|
+
|
|
184
|
+
## Changes in 2.1.2
|
|
185
|
+
|
|
186
|
+
- **Native CookieManager bridge**: `WebViewHost.cookiesJson(filter)` (C side `cj_bridge_get_cookies`)
|
|
187
|
+
returns the whole cookie store as `{"ok":true,"cookies":[…]}` — `webkit_cookie_manager_get_all_cookies`
|
|
188
|
+
on Linux, `ICoreWebView2_2::getCookieManager` + `GetCookies` on Windows. Embedded page views share the
|
|
189
|
+
host's WebKit context / WebView2 environment, so **httpOnly** session cookies (`z_c0`, `sessionid`,
|
|
190
|
+
`UserToken`) are readable — the ones `document.cookie` can never see. Blocking on the outside,
|
|
191
|
+
asynchronous on the inside: the platform layer posts the read to the UI thread and the caller waits
|
|
192
|
+
with a timeout, reporting `ok=false` with a reason instead of hanging.
|
|
193
|
+
- New `examples/cookie-export` app: embedded login for 5 platforms (CSDN / Zhihu / Juejin / OSChina /
|
|
194
|
+
Baijiahao), field validation against cspub's hard requirements, and export in both formats
|
|
195
|
+
(`~/.cspub/config.json` merged — other platforms' keys are preserved — plus `~/.cspub/cookie_<platform>`
|
|
196
|
+
at mode 600). Ships with 8 unit tests covering bridge-reply parsing, domain filtering, header assembly,
|
|
197
|
+
required-field checks and the merge-write.
|
|
198
|
+
- **Fixed** the `GLib-GObject-CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed` printed
|
|
199
|
+
on every bridge round-trip on Linux: `on_js_done` used the deprecated `webkit_web_view_run_javascript`,
|
|
200
|
+
whose finished result must not be unreffed as a `GObject` on WebKitGTK 2.52. Switched to
|
|
201
|
+
`evaluate_javascript` (`JSCValue`, transfer full) — warning gone, bridge builds warning-free.
|
|
202
|
+
|
|
203
|
+
## Changes in 2.1.1
|
|
204
|
+
|
|
205
|
+
- **Serial command groups** (issue #6-4): `IpcHub.registerSerial(cmd, handler, group)` /
|
|
206
|
+
`TauriApp.registerSerial` — commands in the same group execute strictly in **arrival order**,
|
|
207
|
+
while other groups and plain commands keep the concurrent semantics. Guaranteed by structure:
|
|
208
|
+
dispatch happens on the bridge's message-callback thread, so enqueue order is arrival order,
|
|
209
|
+
and each group has a single worker draining the queue under one lock. ai-chat's five web-tab
|
|
210
|
+
commands are enrolled in the `webtab` group (the front-end queue stays — page emission order
|
|
211
|
+
and host execution order are two halves of the same guarantee).
|
|
212
|
+
- **sync keeps the launcher on the business package's framework path** (issue #6-1): the launcher's
|
|
213
|
+
`cjTauri` dependency now reads the path the business package declares in its own `cjpm.toml`
|
|
214
|
+
(relative paths absolutized against the project root), so editing that path no longer causes
|
|
215
|
+
a cjpm module conflict between two framework copies.
|
|
216
|
+
- **The desktop launcher locates its assets** (issue #6-2/3): `assets/` and `capabilities/` are
|
|
217
|
+
found by walking up two levels, so running the binary straight from `targets/desktop/` no longer
|
|
218
|
+
dies with "asset not found"; sync's next-steps output names the runtime library path
|
|
219
|
+
(`<framework>/native` for `libcjtbridge.so`).
|
|
220
|
+
- New `examples/hello-world` (smallest runnable app, generated by this CLI) and
|
|
221
|
+
`docs/hello-world-入门教程.md` — a starter guide written from an actual npx-create-to-window run.
|
|
222
|
+
|
|
223
|
+
For the full list see `[2.1.2] - 2026-11-05` in the repository's `CHANGELOG.md`.
|
|
224
|
+
|
|
225
|
+
## Changes in 2.1.0
|
|
226
|
+
|
|
227
|
+
- **New**: in-window multi-WebView views (`webview:*` — several page views inside one window with an LRU
|
|
228
|
+
cap of 4, which is what drives ai-chat's nine web-version tabs); the four commands `fs:mkdir` /
|
|
229
|
+
`fs:rename` / `fs:copy` / `fs:stat` (with overwrite and two-path scope validation); the `http` plugin's
|
|
230
|
+
HarmonyOS transport layer (over the `ohos.net.http` system stack, which brings https back); `sqlite` /
|
|
231
|
+
`serial` landing on HarmonyOS; a `notification` capability bit in `system:host`; a pointer to the SDK
|
|
232
|
+
download in the CLI's `doctor`.
|
|
233
|
+
- **Fixed**: the Linux C bridge `duplicate member 'h'` compile error (the embedded view's geometry field
|
|
234
|
+
collided with the host pointer), ai-chat's embedded view not following the widening after the sidebar
|
|
235
|
+
collapses, and the documented state of the HarmonyOS host capability bits (the menu bit is verified on a
|
|
236
|
+
device, so it's no longer all zeros).
|
|
237
|
+
- Verified on a HarmonyOS device: `fs` / `mqtt` / `redis` / `sqlite` / `store` / `http` and the menu
|
|
238
|
+
capability bit.
|
|
239
|
+
|
|
240
|
+
For the full list see `[2.1.0] - 2026-10-25` in the repository's `CHANGELOG.md`.
|
|
241
|
+
|
|
242
|
+
## Changes in 2.0.0
|
|
243
|
+
|
|
244
|
+
- **Breaking**: removed the dead public APIs `setHostFactory` / `requireInjectedHost` (the framework's
|
|
245
|
+
single-slot host injection). Apps still calling them will fail to compile — and those calls never took
|
|
246
|
+
effect anyway (`requireInjectedHost` had no callers at all). Multi-host injection goes through
|
|
247
|
+
`registerHost(HostProvider)` (with priorities); the HarmonyOS host is built in.
|
|
248
|
+
- **Fixed**: projects generated by `sync` wouldn't compile on Windows (TOML paths keeping backslashes
|
|
249
|
+
triggered `errLexEscape`, the HarmonyOS entry's `compile-option` had unescaped inner quotes, and
|
|
250
|
+
`url=\"…\"` in the generated sources was one escape level short); `cj-tauri check`'s three-way
|
|
251
|
+
comparison was always skipped on Windows because of the `main.exe` artifact name; the `modbus-poll`
|
|
252
|
+
example was missing the serial plugin import.
|
|
253
|
+
- **Gates**: version validation grew from five sites to six (adding the website's `website/index.html`),
|
|
254
|
+
and the images / diagrams that share a source with `docs/` now get a byte-for-byte comparison — the
|
|
255
|
+
website is an independent copy that previously sat outside the gate, which is exactly why it went stale.
|
|
256
|
+
|
|
257
|
+
For the full list see `[2.0.0] - 2026-10-23` in the repository's `CHANGELOG.md`.
|
|
171
258
|
|
|
172
259
|
## License
|
|
173
260
|
|
|
174
|
-
[MIT](https://
|
|
261
|
+
[MIT](https://github.com/yangyongzhen/cj-tauri/blob/main/LICENSE) © 2026 yangyongzhen
|
|
262
|
+
|
package/cjpm.toml
CHANGED
package/cli/cjpm.toml
CHANGED
package/cli/src/manifest.cj
CHANGED
|
@@ -366,13 +366,24 @@ public class Manifest {
|
|
|
366
366
|
"import cjTauri.*\n" +
|
|
367
367
|
"import cjTauri.platform.*\n" +
|
|
368
368
|
"import " + this.pkg + ".*\n" +
|
|
369
|
+
"import std.fs.*\n" +
|
|
370
|
+
"\n" +
|
|
371
|
+
"// assets/ 与 capabilities/ 按启动时工作目录相对读取;从 targets/<端>/ 直接启动会找不到\n" +
|
|
372
|
+
"//(issue #6-②,实测「资产未找到」秒退)——向上探两级回到项目根;都找不到就原样返回,\n" +
|
|
373
|
+
"// 让框架按自己的口径报错。\n" +
|
|
374
|
+
"func findDir(rel: String): String {\n" +
|
|
375
|
+
" if (exists(rel)) { return rel }\n" +
|
|
376
|
+
" if (exists(\"../\" + rel)) { return \"../\" + rel }\n" +
|
|
377
|
+
" if (exists(\"../../\" + rel)) { return \"../../\" + rel }\n" +
|
|
378
|
+
" return rel\n" +
|
|
379
|
+
"}\n" +
|
|
369
380
|
"\n" +
|
|
370
381
|
"main(): Int64 {\n" +
|
|
371
382
|
" let spec = build()\n" +
|
|
372
383
|
" .page(PageSource.Asset(\"" + this.page + "\"))\n" +
|
|
373
384
|
" .window(WindowConfig(\"${w.title}\", ${w.width}, ${w.height}))\n" +
|
|
374
|
-
" .assets(DirectoryAssetResolver(\"" + this.assetsRoot + "\"))\n" +
|
|
375
|
-
" .capabilities(\"" + this.capabilitiesDir + "\")\n" +
|
|
385
|
+
" .assets(DirectoryAssetResolver(findDir(\"" + this.assetsRoot + "\")))\n" +
|
|
386
|
+
" .capabilities(findDir(\"" + this.capabilitiesDir + "\"))\n" +
|
|
376
387
|
" launch(spec)\n" +
|
|
377
388
|
" return 0\n" +
|
|
378
389
|
"}\n"
|