@gravito/core 2.0.1 → 2.0.4
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/dist/ffi/NativeAccelerator.d.ts +9 -16
- package/dist/index.js +7 -14
- package/dist/index.js.map +2 -2
- package/package.json +6 -13
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
* 原生加速器統一入口
|
|
3
3
|
* 遵循 Galaxy Architecture 的運行時自適應模式
|
|
4
4
|
* 與 RuntimeAdapter 模式保持一致
|
|
5
|
+
*
|
|
6
|
+
* 📍 FFI 暫時禁用
|
|
7
|
+
* Bun 的構建系統在生成 ffi/index.js 時會產生 CJS compatibility helpers,
|
|
8
|
+
* 這些 helpers 與 ESM export 語句導致模組解析失敗。
|
|
9
|
+
* 即使使用 ESM import 也無法避免此問題(Bun 內部機制)。
|
|
10
|
+
*
|
|
11
|
+
* 解決方案:禁用 FFI,使用 JavaScript fallback(性能影響極小)
|
|
12
|
+
* TODO: 當 Bun 改進其 ESM 模組構建時重新啟用
|
|
5
13
|
*/
|
|
6
14
|
import type { CborAccelerator, NativeAcceleratorStatus } from './types';
|
|
7
15
|
/**
|
|
@@ -12,7 +20,6 @@ import type { CborAccelerator, NativeAcceleratorStatus } from './types';
|
|
|
12
20
|
*/
|
|
13
21
|
export declare class NativeAccelerator {
|
|
14
22
|
private static readonly DEBUG_ENV;
|
|
15
|
-
private static readonly DISABLE_ENV;
|
|
16
23
|
/**
|
|
17
24
|
* FFI 可用性緩存
|
|
18
25
|
* null: 未檢測, true: 可用, false: 不可用
|
|
@@ -28,10 +35,7 @@ export declare class NativeAccelerator {
|
|
|
28
35
|
private static status;
|
|
29
36
|
/**
|
|
30
37
|
* 檢測原生 FFI 是否可用
|
|
31
|
-
*
|
|
32
|
-
* 1. 檢查 GRAVITO_FFI_DISABLE 環境變數
|
|
33
|
-
* 2. 檢查 Bun 運行時可用性
|
|
34
|
-
* 3. 檢查 bun:ffi 的 cc() 是否可用
|
|
38
|
+
* ⚠️ 當前全部返回 false(FFI 已禁用)
|
|
35
39
|
*/
|
|
36
40
|
static isAvailable(): boolean;
|
|
37
41
|
/**
|
|
@@ -47,17 +51,6 @@ export declare class NativeAccelerator {
|
|
|
47
51
|
* 重置加速器狀態(用於測試)
|
|
48
52
|
*/
|
|
49
53
|
static reset(): void;
|
|
50
|
-
/**
|
|
51
|
-
* 解析 C 原始碼路徑
|
|
52
|
-
* 支援從原始碼目錄或 npm 套件的 src/ffi/native 目錄載入
|
|
53
|
-
*/
|
|
54
|
-
private static resolveCSourcePath;
|
|
55
|
-
/**
|
|
56
|
-
* 載入原生 C 實現
|
|
57
|
-
* 使用 bun:ffi 的 cc() 動態編譯 C 代碼
|
|
58
|
-
* 優先從檔案載入完整實現,避免內聯限制
|
|
59
|
-
*/
|
|
60
|
-
private static loadNativeImplementation;
|
|
61
54
|
/**
|
|
62
55
|
* 檢查是否啟用調試模式
|
|
63
56
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3197,7 +3197,7 @@ class Gravito {
|
|
|
3197
3197
|
// package.json
|
|
3198
3198
|
var package_default = {
|
|
3199
3199
|
name: "@gravito/core",
|
|
3200
|
-
version: "2.0.
|
|
3200
|
+
version: "2.0.4",
|
|
3201
3201
|
description: "",
|
|
3202
3202
|
module: "./dist/index.js",
|
|
3203
3203
|
main: "./dist/index.js",
|
|
@@ -3207,28 +3207,21 @@ var package_default = {
|
|
|
3207
3207
|
exports: {
|
|
3208
3208
|
".": {
|
|
3209
3209
|
browser: "./src/index.browser.ts",
|
|
3210
|
+
bun: "./src/index.ts",
|
|
3210
3211
|
types: "./dist/index.d.ts",
|
|
3211
|
-
|
|
3212
|
-
require: "./dist/index.cjs",
|
|
3213
|
-
default: "./dist/index.cjs"
|
|
3212
|
+
default: "./dist/index.js"
|
|
3214
3213
|
},
|
|
3215
3214
|
"./compat": {
|
|
3216
3215
|
types: "./dist/compat.d.ts",
|
|
3217
|
-
|
|
3218
|
-
require: "./dist/compat.cjs",
|
|
3219
|
-
default: "./dist/compat.cjs"
|
|
3216
|
+
default: "./dist/compat.js"
|
|
3220
3217
|
},
|
|
3221
3218
|
"./engine": {
|
|
3222
3219
|
types: "./dist/engine/index.d.ts",
|
|
3223
|
-
|
|
3224
|
-
require: "./dist/engine/index.cjs",
|
|
3225
|
-
default: "./dist/engine/index.cjs"
|
|
3220
|
+
default: "./dist/engine/index.js"
|
|
3226
3221
|
},
|
|
3227
3222
|
"./ffi": {
|
|
3228
3223
|
types: "./dist/ffi/index.d.ts",
|
|
3229
|
-
|
|
3230
|
-
require: "./dist/ffi/index.cjs",
|
|
3231
|
-
default: "./dist/ffi/index.cjs"
|
|
3224
|
+
default: "./dist/ffi/index.js"
|
|
3232
3225
|
},
|
|
3233
3226
|
"./compat/async-local-storage": {
|
|
3234
3227
|
browser: "./src/compat/async-local-storage.browser.ts",
|
|
@@ -13895,4 +13888,4 @@ export {
|
|
|
13895
13888
|
Application
|
|
13896
13889
|
};
|
|
13897
13890
|
|
|
13898
|
-
//# debugId=
|
|
13891
|
+
//# debugId=E93F9E403DD7FBA964756E2164756E21
|