cj-tauri 2.3.0 → 2.3.1

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 CHANGED
@@ -116,8 +116,12 @@ function resolveCjpm(home) {
116
116
  * 1. 用户已设的 CANGJIE_STDX(存在才用,指错了会拿到假的「已配置」);
117
117
  * 2. ~/.cangjie/stdx/<包>/dynamic/stdx(CI / 教程的落位);
118
118
  * 3. SDK 根的兄弟目录 cangjie-stdx-<版本>/<三元组>/dynamic/stdx(解压在 SDK 旁边的习惯)。
119
- * 要求目录里有 stdx.* 的库文件,防止指到 stdx 包根(那是「create 成功、build 才炸」的另一种指错)。
120
- */
119
+ * 要求目录里有 stdx.* 的库文件,防止指到 stdx 包根(那是「create 成功、build 才炸」的另一种指错);
120
+ * 自动探测的候选还必须匹配**宿主平台**(包名含 windows/linux、不含 ohos)——
121
+ * 机器上可能同时躺着给鸿蒙交叉编译用的 cangjie-stdx-ohos-aarch64 包,它里面没有
122
+ * 宿主目标的库文件,链上去就是 `lld: error: unable to find library -lstdx.encoding.json`
123
+ * (2026-11-12 Windows 实测)。用户显式设置的 CANGJIE_STDX 仍然优先(那是他自己的选择),
124
+ * 但若路径里带 ohos 会打一行警告。 */
121
125
  function resolveStdx(home) {
122
126
  const looksRight = (p) => {
123
127
  try {
@@ -126,14 +130,23 @@ function resolveStdx(home) {
126
130
  return false;
127
131
  }
128
132
  };
133
+ // 宿主平台关键词:自动探测的包名必须含它且不含 ohos(交叉编译包不能当宿主 stdx 用)
134
+ const platKey = IS_WIN ? 'windows' : (process.platform === 'darwin' ? 'darwin' : 'linux');
135
+ const hostUsable = (pkgName) => pkgName.includes(platKey) && !pkgName.includes('ohos');
136
+
129
137
  const candidates = [];
130
138
  if (process.env.CANGJIE_STDX && fs.existsSync(process.env.CANGJIE_STDX)) {
139
+ if (process.env.CANGJIE_STDX.includes('ohos')) {
140
+ note('告警: CANGJIE_STDX 指向 ohos 包(给鸿蒙交叉编译用),主机构建用不了,请改指宿主平台的 stdx');
141
+ }
131
142
  candidates.push(process.env.CANGJIE_STDX);
132
143
  }
133
144
  const cjStdxBase = path.join(os.homedir(), '.cangjie', 'stdx');
134
145
  try {
135
146
  for (const pkg of fs.readdirSync(cjStdxBase)) {
136
- candidates.push(path.join(cjStdxBase, pkg, 'dynamic', 'stdx'));
147
+ if (hostUsable(pkg)) {
148
+ candidates.push(path.join(cjStdxBase, pkg, 'dynamic', 'stdx'));
149
+ }
137
150
  }
138
151
  } catch (e) {
139
152
  // 目录不存在 = 没按这个布局装过,忽略
@@ -144,8 +157,10 @@ function resolveStdx(home) {
144
157
  if (!pkg.startsWith('cangjie-stdx-')) {
145
158
  continue;
146
159
  }
147
- const triple = IS_WIN ? 'windows_x86_64_cjnative' : 'linux_x86_64_cjnative';
148
- candidates.push(path.join(sdkParent, pkg, triple, 'dynamic', 'stdx'));
160
+ const triple = IS_WIN ? 'windows_x86_64_cjnative' : (process.platform === 'darwin' ? 'darwin_x86_64_cjnative' : 'linux_x86_64_cjnative');
161
+ if (hostUsable(pkg)) {
162
+ candidates.push(path.join(sdkParent, pkg, triple, 'dynamic', 'stdx'));
163
+ }
149
164
  }
150
165
  } catch (e) {
151
166
  // 同上
package/cjpm.toml CHANGED
@@ -2,7 +2,7 @@
2
2
  cjc-version = "1.0.5"
3
3
  name = "cjTauri"
4
4
  description = "仓颉版 Tauri:轻量跨端混合开发框架(WebView 宿主 + IPC 桥 + 能力安全模型)"
5
- version = "2.3.0"
5
+ version = "2.3.1"
6
6
  target-dir = ""
7
7
  output-type = "static"
8
8
  compile-option = ""
package/cli/cjpm.toml CHANGED
@@ -2,7 +2,7 @@
2
2
  cjc-version = "1.0.5"
3
3
  name = "cli"
4
4
  description = "cj-tauri CLI:脚手架 create / dev / build / run / info"
5
- version = "2.3.0"
5
+ version = "2.3.1"
6
6
  target-dir = ""
7
7
  output-type = "executable"
8
8
  compile-option = ""
@@ -10,7 +10,7 @@ import std.collection.*
10
10
 
11
11
  /** CLI 版本:须与 cli/cjpm.toml 的 version、CHANGELOG 顶部版本一致(scripts/check-version.sh 校验) */
12
12
  func cliVersion(): String {
13
- return "2.3.0"
13
+ return "2.3.1"
14
14
  }
15
15
 
16
16
  /** 一次命令所需的路径上下文 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cj-tauri",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Tauri for the Cangjie language: a scaffold CLI for hybrid desktop apps — Cangjie backend (statically compiled) plus a system WebView frontend (HTML/CSS/JS), with a bidirectional IPC bridge and a capability-based security model. Windows, Linux and HarmonyOS PC.",
5
5
  "keywords": [
6
6
  "cangjie",
package/src/version.cj CHANGED
@@ -9,7 +9,7 @@ package cjTauri
9
9
  * - cli/src/project.cj 的 cliVersion()
10
10
  * - CHANGELOG.md 顶部第一个已发版段
11
11
  */
12
- public let CJ_TAURI_VERSION = "2.3.0"
12
+ public let CJ_TAURI_VERSION = "2.3.1"
13
13
 
14
14
  /**
15
15
  * IPC 报文协议版本(报文形状是跨层契约,加版本字段是协议治理惯例):事件 / 回执信封的 `protocol` 字段