@gravito/core 2.0.3 → 2.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.
@@ -0,0 +1,398 @@
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, {
40
+ get: all[name],
41
+ enumerable: true,
42
+ configurable: true,
43
+ set: __exportSetter.bind(all, name)
44
+ });
45
+ };
46
+ var __require = import.meta.require;
47
+
48
+ // src/ffi/types.ts
49
+ var CBOR_MAJOR_TYPES = {
50
+ UINT: 0,
51
+ NEGINT: 1,
52
+ BYTES: 2,
53
+ TEXT: 3,
54
+ ARRAY: 4,
55
+ MAP: 5,
56
+ TAG: 6,
57
+ SIMPLE: 7
58
+ };
59
+ var CBOR_SIMPLE_VALUES = {
60
+ FALSE: 20,
61
+ TRUE: 21,
62
+ NULL: 22,
63
+ UNDEFINED: 23
64
+ };
65
+ var CBOR_LENGTH_ENCODING = {
66
+ SMALL_RANGE_END: 23,
67
+ UINT8: 24,
68
+ UINT16: 25,
69
+ UINT32: 26,
70
+ UINT64: 27,
71
+ FLOAT16: 25,
72
+ FLOAT32: 26,
73
+ FLOAT64: 27,
74
+ INDEFINITE: 31
75
+ };
76
+
77
+ // src/ffi/cbor-fallback.ts
78
+ class CborFallbackEncoder {
79
+ static DEFAULT_BUFFER_SIZE = 4096;
80
+ static MAX_DEPTH = 16;
81
+ static MAX_BUFFER_SIZE = 1024 * 1024;
82
+ buffer;
83
+ offset;
84
+ constructor() {
85
+ this.buffer = new Uint8Array(CborFallbackEncoder.DEFAULT_BUFFER_SIZE);
86
+ this.offset = 0;
87
+ }
88
+ encode(data) {
89
+ this.buffer = new Uint8Array(CborFallbackEncoder.DEFAULT_BUFFER_SIZE);
90
+ this.offset = 0;
91
+ this.encodeValue(data, 0);
92
+ return this.buffer.slice(0, this.offset);
93
+ }
94
+ decode(bytes) {
95
+ const decoder = new CborFallbackDecoder(bytes);
96
+ const value = decoder.decode();
97
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
98
+ throw new Error("CBOR \u6839\u503C\u5FC5\u9808\u662F\u7269\u4EF6");
99
+ }
100
+ return value;
101
+ }
102
+ ensureCapacity(required) {
103
+ let newCapacity = this.buffer.length;
104
+ while (this.offset + required > newCapacity) {
105
+ newCapacity *= 2;
106
+ if (newCapacity > CborFallbackEncoder.MAX_BUFFER_SIZE) {
107
+ throw new Error(`CBOR \u7DE8\u78BC\u8D85\u904E\u6700\u5927 buffer \u5927\u5C0F ${CborFallbackEncoder.MAX_BUFFER_SIZE} \u4F4D\u5143\u7D44`);
108
+ }
109
+ }
110
+ if (newCapacity !== this.buffer.length) {
111
+ const newBuffer = new Uint8Array(newCapacity);
112
+ newBuffer.set(this.buffer);
113
+ this.buffer = newBuffer;
114
+ }
115
+ }
116
+ writeByte(byte) {
117
+ this.ensureCapacity(1);
118
+ this.buffer[this.offset++] = byte & 255;
119
+ }
120
+ writeBytes(bytes) {
121
+ this.ensureCapacity(bytes.length);
122
+ this.buffer.set(bytes, this.offset);
123
+ this.offset += bytes.length;
124
+ }
125
+ writeLength(majorType, length) {
126
+ const type = majorType << 5;
127
+ if (length < 24) {
128
+ this.writeByte(type | length);
129
+ } else if (length <= 255) {
130
+ this.writeByte(type | CBOR_LENGTH_ENCODING.UINT8);
131
+ this.writeByte(length);
132
+ } else if (length <= 65535) {
133
+ this.writeByte(type | CBOR_LENGTH_ENCODING.UINT16);
134
+ this.writeByte(length >> 8 & 255);
135
+ this.writeByte(length & 255);
136
+ } else if (length <= 4294967295) {
137
+ this.writeByte(type | CBOR_LENGTH_ENCODING.UINT32);
138
+ this.writeByte(length >> 24 & 255);
139
+ this.writeByte(length >> 16 & 255);
140
+ this.writeByte(length >> 8 & 255);
141
+ this.writeByte(length & 255);
142
+ } else {
143
+ throw new Error(`CBOR \u4E0D\u652F\u63F4 > 2^32 \u7684\u9577\u5EA6: ${length}`);
144
+ }
145
+ }
146
+ encodeValue(value, depth) {
147
+ if (depth > CborFallbackEncoder.MAX_DEPTH) {
148
+ throw new Error(`CBOR \u7DE8\u78BC\u6DF1\u5EA6\u8D85\u904E\u9650\u5236 ${CborFallbackEncoder.MAX_DEPTH}`);
149
+ }
150
+ if (value === null) {
151
+ this.writeByte(CBOR_MAJOR_TYPES.SIMPLE << 5 | CBOR_SIMPLE_VALUES.NULL);
152
+ } else if (value === true) {
153
+ this.writeByte(CBOR_MAJOR_TYPES.SIMPLE << 5 | CBOR_SIMPLE_VALUES.TRUE);
154
+ } else if (value === false) {
155
+ this.writeByte(CBOR_MAJOR_TYPES.SIMPLE << 5 | CBOR_SIMPLE_VALUES.FALSE);
156
+ } else if (typeof value === "number") {
157
+ this.encodeNumber(value);
158
+ } else if (typeof value === "string") {
159
+ this.encodeString(value);
160
+ } else if (value instanceof Uint8Array) {
161
+ this.encodeBytes(value);
162
+ } else if (Array.isArray(value)) {
163
+ this.encodeArray(value, depth);
164
+ } else if (typeof value === "object") {
165
+ this.encodeMap(value, depth);
166
+ } else {
167
+ throw new Error(`CBOR \u4E0D\u652F\u63F4\u985E\u578B: ${typeof value}`);
168
+ }
169
+ }
170
+ encodeNumber(num) {
171
+ if (Number.isInteger(num) && !Object.is(num, -0)) {
172
+ if (num >= 0 && num <= 4294967295) {
173
+ this.writeLength(CBOR_MAJOR_TYPES.UINT, num);
174
+ return;
175
+ }
176
+ if (num < 0 && -1 - num <= 4294967295) {
177
+ this.writeLength(CBOR_MAJOR_TYPES.NEGINT, -1 - num);
178
+ return;
179
+ }
180
+ }
181
+ {
182
+ const bytes = new Uint8Array(9);
183
+ bytes[0] = CBOR_MAJOR_TYPES.SIMPLE << 5 | CBOR_LENGTH_ENCODING.FLOAT64;
184
+ const view = new DataView(new ArrayBuffer(8));
185
+ view.setFloat64(0, num, false);
186
+ for (let i = 0;i < 8; i++) {
187
+ bytes[i + 1] = view.getUint8(i);
188
+ }
189
+ this.writeBytes(bytes);
190
+ }
191
+ }
192
+ encodeString(str) {
193
+ const encoder = new TextEncoder;
194
+ const bytes = encoder.encode(str);
195
+ this.writeLength(CBOR_MAJOR_TYPES.TEXT, bytes.length);
196
+ this.writeBytes(bytes);
197
+ }
198
+ encodeBytes(bytes) {
199
+ this.writeLength(CBOR_MAJOR_TYPES.BYTES, bytes.length);
200
+ this.writeBytes(bytes);
201
+ }
202
+ encodeArray(arr, depth) {
203
+ this.writeLength(CBOR_MAJOR_TYPES.ARRAY, arr.length);
204
+ for (const item of arr) {
205
+ this.encodeValue(item, depth + 1);
206
+ }
207
+ }
208
+ encodeMap(obj, depth) {
209
+ const keys = Object.keys(obj);
210
+ this.writeLength(CBOR_MAJOR_TYPES.MAP, keys.length);
211
+ for (const key of keys) {
212
+ this.encodeString(key);
213
+ this.encodeValue(obj[key], depth + 1);
214
+ }
215
+ }
216
+ }
217
+
218
+ class CborFallbackDecoder {
219
+ static MAX_DEPTH = 16;
220
+ data;
221
+ offset;
222
+ constructor(data) {
223
+ this.data = data;
224
+ this.offset = 0;
225
+ }
226
+ decode() {
227
+ return this.decodeValue(0);
228
+ }
229
+ readByte() {
230
+ if (this.offset >= this.data.length) {
231
+ throw new Error("CBOR \u8CC7\u6599\u4E0D\u8DB3");
232
+ }
233
+ return this.data[this.offset++];
234
+ }
235
+ readBytes(length) {
236
+ if (this.offset + length > this.data.length) {
237
+ throw new Error("CBOR \u8CC7\u6599\u4E0D\u8DB3");
238
+ }
239
+ const result = this.data.slice(this.offset, this.offset + length);
240
+ this.offset += length;
241
+ return result;
242
+ }
243
+ readLength(additionalInfo) {
244
+ if (additionalInfo < 24) {
245
+ return additionalInfo;
246
+ }
247
+ if (additionalInfo === 24) {
248
+ return this.readByte();
249
+ }
250
+ if (additionalInfo === 25) {
251
+ const b1 = this.readByte();
252
+ const b2 = this.readByte();
253
+ return b1 << 8 | b2;
254
+ }
255
+ if (additionalInfo === 26) {
256
+ const b1 = this.readByte();
257
+ const b2 = this.readByte();
258
+ const b3 = this.readByte();
259
+ const b4 = this.readByte();
260
+ return b1 << 24 | b2 << 16 | b3 << 8 | b4;
261
+ }
262
+ if (additionalInfo === 27) {
263
+ const high = this.readByte() << 24 | this.readByte() << 16 | this.readByte() << 8 | this.readByte();
264
+ const low = this.readByte() << 24 | this.readByte() << 16 | this.readByte() << 8 | this.readByte();
265
+ return high * 4294967296 + low;
266
+ }
267
+ throw new Error(`CBOR \u7121\u6548\u7684\u9577\u5EA6\u7DE8\u78BC: ${additionalInfo}`);
268
+ }
269
+ decodeValue(depth) {
270
+ if (depth > CborFallbackDecoder.MAX_DEPTH) {
271
+ throw new Error(`CBOR \u89E3\u78BC\u6DF1\u5EA6\u8D85\u904E\u9650\u5236 ${CborFallbackDecoder.MAX_DEPTH}`);
272
+ }
273
+ const byte = this.readByte();
274
+ const majorType = byte >> 5 & 7;
275
+ const additionalInfo = byte & 31;
276
+ switch (majorType) {
277
+ case CBOR_MAJOR_TYPES.UINT:
278
+ return this.readLength(additionalInfo);
279
+ case CBOR_MAJOR_TYPES.NEGINT:
280
+ return -1 - this.readLength(additionalInfo);
281
+ case CBOR_MAJOR_TYPES.BYTES: {
282
+ const length = this.readLength(additionalInfo);
283
+ return this.readBytes(length);
284
+ }
285
+ case CBOR_MAJOR_TYPES.TEXT: {
286
+ const length = this.readLength(additionalInfo);
287
+ const bytes = this.readBytes(length);
288
+ const decoder = new TextDecoder;
289
+ return decoder.decode(bytes);
290
+ }
291
+ case CBOR_MAJOR_TYPES.ARRAY: {
292
+ const length = this.readLength(additionalInfo);
293
+ const result = [];
294
+ for (let i = 0;i < length; i++) {
295
+ result.push(this.decodeValue(depth + 1));
296
+ }
297
+ return result;
298
+ }
299
+ case CBOR_MAJOR_TYPES.MAP: {
300
+ const length = this.readLength(additionalInfo);
301
+ const result = {};
302
+ for (let i = 0;i < length; i++) {
303
+ const key = this.decodeValue(depth + 1);
304
+ if (typeof key !== "string") {
305
+ throw new Error(`CBOR Map \u7684 key \u5FC5\u9808\u662F\u5B57\u4E32\uFF0C\u5F97\u5230: ${typeof key}`);
306
+ }
307
+ result[key] = this.decodeValue(depth + 1);
308
+ }
309
+ return result;
310
+ }
311
+ case CBOR_MAJOR_TYPES.SIMPLE:
312
+ if (additionalInfo === CBOR_SIMPLE_VALUES.FALSE) {
313
+ return false;
314
+ }
315
+ if (additionalInfo === CBOR_SIMPLE_VALUES.TRUE) {
316
+ return true;
317
+ }
318
+ if (additionalInfo === CBOR_SIMPLE_VALUES.NULL) {
319
+ return null;
320
+ }
321
+ if (additionalInfo === CBOR_LENGTH_ENCODING.FLOAT32) {
322
+ const bytes = this.readBytes(4);
323
+ const view = new DataView(bytes.buffer, bytes.byteOffset);
324
+ return view.getFloat32(0, false);
325
+ }
326
+ if (additionalInfo === CBOR_LENGTH_ENCODING.FLOAT64) {
327
+ const bytes = this.readBytes(8);
328
+ const view = new DataView(bytes.buffer, bytes.byteOffset);
329
+ return view.getFloat64(0, false);
330
+ }
331
+ throw new Error(`CBOR \u4E0D\u652F\u63F4\u7684 simple value: ${additionalInfo}`);
332
+ case CBOR_MAJOR_TYPES.TAG:
333
+ return this.decodeValue(depth);
334
+ default:
335
+ throw new Error(`CBOR \u7121\u6548\u7684 major type: ${majorType}`);
336
+ }
337
+ }
338
+ }
339
+
340
+ // src/ffi/NativeAccelerator.ts
341
+ class NativeAccelerator {
342
+ static DEBUG_ENV = "GRAVITO_FFI_DEBUG";
343
+ static available = null;
344
+ static cborAccelerator = null;
345
+ static status = null;
346
+ static isAvailable() {
347
+ if (this.available !== null) {
348
+ return this.available;
349
+ }
350
+ this.available = false;
351
+ return false;
352
+ }
353
+ static getCborAccelerator() {
354
+ if (this.cborAccelerator !== null) {
355
+ return this.cborAccelerator;
356
+ }
357
+ const fallback = new CborFallbackEncoder;
358
+ this.cborAccelerator = fallback;
359
+ this.updateStatus("js-fallback");
360
+ if (this.isDebugEnabled()) {
361
+ console.log("[GRAVITO_FFI] \u4F7F\u7528 JavaScript \u56DE\u9000\u5BE6\u73FE\uFF08FFI \u5DF2\u7981\u7528\uFF09");
362
+ }
363
+ return fallback;
364
+ }
365
+ static getStatus() {
366
+ if (this.status === null) {
367
+ this.getCborAccelerator();
368
+ }
369
+ return this.status || {
370
+ available: false,
371
+ runtime: "js-fallback",
372
+ version: "1.0.0"
373
+ };
374
+ }
375
+ static reset() {
376
+ this.available = null;
377
+ this.cborAccelerator = null;
378
+ this.status = null;
379
+ }
380
+ static isDebugEnabled() {
381
+ if (typeof process !== "undefined" && process.env) {
382
+ return process.env[this.DEBUG_ENV] === "1";
383
+ }
384
+ return false;
385
+ }
386
+ static updateStatus(runtime) {
387
+ this.status = {
388
+ available: runtime === "bun-ffi",
389
+ runtime,
390
+ version: runtime === "bun-ffi" ? "native-1.0.0" : "js-fallback-1.0.0"
391
+ };
392
+ }
393
+ }
394
+ export {
395
+ NativeAccelerator
396
+ };
397
+
398
+ //# debugId=F722DECAD53319BE64756E2164756E21
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/ffi/types.ts", "../src/ffi/cbor-fallback.ts", "../src/ffi/NativeAccelerator.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * FFI (Foreign Function Interface) 類型定義\n * 支持 bun:ffi 的原生加速層\n */\n\n/**\n * CBOR 編碼/解碼加速器介面\n * 可由原生 C 實現或 JavaScript 回退實現\n */\nexport interface CborAccelerator {\n /**\n * 將任意 JavaScript 物件編碼為 CBOR 二進制格式\n * @param data - 要編碼的物件(支援:map、string、uint、float64、bytes、null、boolean)\n * @returns CBOR 編碼的二進制資料\n */\n encode(data: Record<string, unknown>): Uint8Array\n\n /**\n * 將 CBOR 二進制格式解碼為 JavaScript 物件\n * @param bytes - CBOR 編碼的二進制資料\n * @returns 解碼後的物件\n */\n decode(bytes: Uint8Array): Record<string, unknown>\n}\n\n/**\n * FFI 加速層狀態報告\n */\nexport interface NativeAcceleratorStatus {\n /**\n * 原生 FFI 加速是否可用\n */\n readonly available: boolean\n\n /**\n * 當前使用的運行時實現\n * - 'bun-ffi': Bun C 編譯器(bun:ffi 的 cc())\n * - 'js-fallback': 手寫 JavaScript CBOR 實現\n * - 'cborg': npm 的 cborg 套件(已棄用,僅用於向後相容)\n */\n readonly runtime: 'bun-ffi' | 'js-fallback' | 'cborg'\n\n /**\n * 運行時版本或詳細資訊\n */\n readonly version: string\n}\n\n/**\n * FFI 層配置選項\n */\nexport interface FfiConfig {\n /**\n * 啟用調試日誌\n * @default false\n */\n readonly debug?: boolean\n\n /**\n * 最大 buffer 大小(位元組)\n * @default 1048576 (1MB)\n */\n readonly maxBufferSize?: number\n\n /**\n * 強制使用特定的加速器實現\n * - undefined: 自動選擇(優先 bun-ffi,降級到 js-fallback)\n * - 'bun-ffi': 只使用原生 C 實現\n * - 'js-fallback': 只使用 JavaScript 實現\n */\n readonly forceImplementation?: 'bun-ffi' | 'js-fallback'\n}\n\n/**\n * CBOR Major Type 常數\n * 符合 RFC 7049 規範\n */\nexport const CBOR_MAJOR_TYPES = {\n UINT: 0, // 正整數 (0 to 2^64-1)\n NEGINT: 1, // 負整數 (-1 to -2^64)\n BYTES: 2, // 位元組字串\n TEXT: 3, // 文字字串\n ARRAY: 4, // 陣列\n MAP: 5, // Map 物件\n TAG: 6, // 語意 tag\n SIMPLE: 7, // 簡單值與浮點數\n} as const\n\n/**\n * CBOR 簡單值常數\n */\nexport const CBOR_SIMPLE_VALUES = {\n FALSE: 20, // Boolean false\n TRUE: 21, // Boolean true\n NULL: 22, // null\n UNDEFINED: 23, // undefined (不常用)\n} as const\n\n/**\n * CBOR 長度編碼的附加資訊\n */\nexport const CBOR_LENGTH_ENCODING = {\n SMALL_RANGE_END: 23, // 0-23: 直接作為值\n UINT8: 24, // 24: 接下來 1 byte 為 uint8_t\n UINT16: 25, // 25: 接下來 2 bytes 為 uint16_t (大端序)\n UINT32: 26, // 26: 接下來 4 bytes 為 uint32_t (大端序)\n UINT64: 27, // 27: 接下來 8 bytes 為 uint64_t (大端序)\n FLOAT16: 25, // 25: IEEE 754 半精度浮點數 (special case for SIMPLE)\n FLOAT32: 26, // 26: IEEE 754 單精度浮點數\n FLOAT64: 27, // 27: IEEE 754 雙精度浮點數\n INDEFINITE: 31, // 31: 無限長度編碼\n} as const\n\n/**\n * 雜湊加速器介面\n * 可由 Bun 原生實現或 Node.js 回退實現\n */\nexport interface HashAccelerator {\n /**\n * SHA-256 雜湊計算\n * @param input - 輸入(字串或二進制)\n * @returns 十六進制編碼的 SHA-256 雜湊值(64 字元)\n */\n sha256(input: string | Uint8Array): string\n\n /**\n * HMAC-SHA256 計算\n * @param key - 密鑰\n * @param data - 要雜湊的數據\n * @returns 十六進制編碼的 HMAC-SHA256 值(64 字元)\n */\n hmacSha256(key: string, data: string): string\n}\n\n/**\n * 雜湊加速器狀態報告\n */\nexport interface NativeHasherStatus {\n /**\n * 雜湊加速層是否可用\n */\n readonly available: boolean\n\n /**\n * 當前使用的運行時實現\n * - 'bun-crypto-hasher': Bun 原生 CryptoHasher(C 實現,推薦)\n * - 'node-crypto': node:crypto 回退實現\n */\n readonly runtime: 'bun-crypto-hasher' | 'node-crypto'\n}\n",
6
+ "/**\n * JavaScript CBOR 回退實現\n * 用於非 Bun 環境或 FFI 不可用的情況\n * 符合 RFC 7049 規範\n */\n\nimport type { CborAccelerator } from './types'\nimport { CBOR_LENGTH_ENCODING, CBOR_MAJOR_TYPES, CBOR_SIMPLE_VALUES } from './types'\n\n/**\n * CBOR 編碼器\n * 將 JavaScript 物件編碼為 CBOR 二進制格式\n */\nexport class CborFallbackEncoder implements CborAccelerator {\n private static readonly DEFAULT_BUFFER_SIZE = 4096\n private static readonly MAX_DEPTH = 16\n private static readonly MAX_BUFFER_SIZE = 1024 * 1024 // 1MB\n\n private buffer: Uint8Array\n private offset: number\n\n constructor() {\n this.buffer = new Uint8Array(CborFallbackEncoder.DEFAULT_BUFFER_SIZE)\n this.offset = 0\n }\n\n /**\n * 編碼 JavaScript 物件為 CBOR 格式\n */\n encode(data: Record<string, unknown>): Uint8Array {\n this.buffer = new Uint8Array(CborFallbackEncoder.DEFAULT_BUFFER_SIZE)\n this.offset = 0\n this.encodeValue(data, 0)\n return this.buffer.slice(0, this.offset)\n }\n\n /**\n * 解碼 CBOR 二進制為 JavaScript 物件\n */\n decode(bytes: Uint8Array): Record<string, unknown> {\n const decoder = new CborFallbackDecoder(bytes)\n const value = decoder.decode()\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error('CBOR 根值必須是物件')\n }\n return value as Record<string, unknown>\n }\n\n /**\n * 確保 buffer 有足夠空間\n */\n private ensureCapacity(required: number): void {\n let newCapacity = this.buffer.length\n while (this.offset + required > newCapacity) {\n newCapacity *= 2\n if (newCapacity > CborFallbackEncoder.MAX_BUFFER_SIZE) {\n throw new Error(\n `CBOR 編碼超過最大 buffer 大小 ${CborFallbackEncoder.MAX_BUFFER_SIZE} 位元組`\n )\n }\n }\n if (newCapacity !== this.buffer.length) {\n const newBuffer = new Uint8Array(newCapacity)\n newBuffer.set(this.buffer)\n this.buffer = newBuffer\n }\n }\n\n /**\n * 編寫一個位元組\n */\n private writeByte(byte: number): void {\n this.ensureCapacity(1)\n this.buffer[this.offset++] = byte & 0xff\n }\n\n /**\n * 編寫多個位元組\n */\n private writeBytes(bytes: ArrayLike<number>): void {\n this.ensureCapacity(bytes.length)\n this.buffer.set(bytes, this.offset)\n this.offset += bytes.length\n }\n\n /**\n * 編寫 CBOR 長度(Major Type + Additional Info)\n */\n private writeLength(majorType: number, length: number): void {\n const type = majorType << 5\n\n if (length < 24) {\n this.writeByte(type | length)\n } else if (length <= 0xff) {\n this.writeByte(type | CBOR_LENGTH_ENCODING.UINT8)\n this.writeByte(length)\n } else if (length <= 0xffff) {\n this.writeByte(type | CBOR_LENGTH_ENCODING.UINT16)\n this.writeByte((length >> 8) & 0xff)\n this.writeByte(length & 0xff)\n } else if (length <= 0xffffffff) {\n this.writeByte(type | CBOR_LENGTH_ENCODING.UINT32)\n this.writeByte((length >> 24) & 0xff)\n this.writeByte((length >> 16) & 0xff)\n this.writeByte((length >> 8) & 0xff)\n this.writeByte(length & 0xff)\n } else {\n throw new Error(`CBOR 不支援 > 2^32 的長度: ${length}`)\n }\n }\n\n /**\n * 遞迴編碼值\n */\n private encodeValue(value: unknown, depth: number): void {\n if (depth > CborFallbackEncoder.MAX_DEPTH) {\n throw new Error(`CBOR 編碼深度超過限制 ${CborFallbackEncoder.MAX_DEPTH}`)\n }\n\n if (value === null) {\n this.writeByte((CBOR_MAJOR_TYPES.SIMPLE << 5) | CBOR_SIMPLE_VALUES.NULL)\n } else if (value === true) {\n this.writeByte((CBOR_MAJOR_TYPES.SIMPLE << 5) | CBOR_SIMPLE_VALUES.TRUE)\n } else if (value === false) {\n this.writeByte((CBOR_MAJOR_TYPES.SIMPLE << 5) | CBOR_SIMPLE_VALUES.FALSE)\n } else if (typeof value === 'number') {\n this.encodeNumber(value)\n } else if (typeof value === 'string') {\n this.encodeString(value)\n } else if (value instanceof Uint8Array) {\n this.encodeBytes(value)\n } else if (Array.isArray(value)) {\n this.encodeArray(value, depth)\n } else if (typeof value === 'object') {\n this.encodeMap(value as Record<string, unknown>, depth)\n } else {\n throw new Error(`CBOR 不支援類型: ${typeof value}`)\n }\n }\n\n /**\n * 編碼整數或浮點數\n * 對於超過 uint32 範圍的整數,使用 float64 編碼(JavaScript 精度限制)\n */\n private encodeNumber(num: number): void {\n // 檢查是否為整數且在 uint32/negint32 範圍內\n if (Number.isInteger(num) && !Object.is(num, -0)) {\n if (num >= 0 && num <= 0xffffffff) {\n this.writeLength(CBOR_MAJOR_TYPES.UINT, num)\n return\n }\n if (num < 0 && -1 - num <= 0xffffffff) {\n this.writeLength(CBOR_MAJOR_TYPES.NEGINT, -1 - num)\n return\n }\n // 超過 32-bit 範圍的整數,降級為 float64\n }\n {\n // 浮點數(float64)\n const bytes = new Uint8Array(9)\n bytes[0] = (CBOR_MAJOR_TYPES.SIMPLE << 5) | CBOR_LENGTH_ENCODING.FLOAT64\n\n // IEEE 754 雙精度大端序\n const view = new DataView(new ArrayBuffer(8))\n view.setFloat64(0, num, false)\n for (let i = 0; i < 8; i++) {\n bytes[i + 1] = view.getUint8(i)\n }\n this.writeBytes(bytes)\n }\n }\n\n /**\n * 編碼字串\n */\n private encodeString(str: string): void {\n const encoder = new TextEncoder()\n const bytes = encoder.encode(str)\n this.writeLength(CBOR_MAJOR_TYPES.TEXT, bytes.length)\n this.writeBytes(bytes)\n }\n\n /**\n * 編碼位元組陣列\n */\n private encodeBytes(bytes: Uint8Array): void {\n this.writeLength(CBOR_MAJOR_TYPES.BYTES, bytes.length)\n this.writeBytes(bytes)\n }\n\n /**\n * 編碼陣列\n */\n private encodeArray(arr: unknown[], depth: number): void {\n this.writeLength(CBOR_MAJOR_TYPES.ARRAY, arr.length)\n for (const item of arr) {\n this.encodeValue(item, depth + 1)\n }\n }\n\n /**\n * 編碼物件(Map)\n */\n private encodeMap(obj: Record<string, unknown>, depth: number): void {\n const keys = Object.keys(obj)\n this.writeLength(CBOR_MAJOR_TYPES.MAP, keys.length)\n for (const key of keys) {\n this.encodeString(key)\n this.encodeValue(obj[key], depth + 1)\n }\n }\n}\n\n/**\n * CBOR 解碼器\n */\nexport class CborFallbackDecoder {\n private static readonly MAX_DEPTH = 16\n private data: Uint8Array\n private offset: number\n\n constructor(data: Uint8Array) {\n this.data = data\n this.offset = 0\n }\n\n /**\n * 解碼 CBOR 資料\n */\n decode(): unknown {\n return this.decodeValue(0)\n }\n\n /**\n * 讀取一個位元組\n */\n private readByte(): number {\n if (this.offset >= this.data.length) {\n throw new Error('CBOR 資料不足')\n }\n return this.data[this.offset++]\n }\n\n /**\n * 讀取固定長度的位元組\n */\n private readBytes(length: number): Uint8Array {\n if (this.offset + length > this.data.length) {\n throw new Error('CBOR 資料不足')\n }\n const result = this.data.slice(this.offset, this.offset + length)\n this.offset += length\n return result\n }\n\n /**\n * 讀取 CBOR 長度\n */\n private readLength(additionalInfo: number): number {\n if (additionalInfo < 24) {\n return additionalInfo\n }\n if (additionalInfo === 24) {\n return this.readByte()\n }\n if (additionalInfo === 25) {\n const b1 = this.readByte()\n const b2 = this.readByte()\n return (b1 << 8) | b2\n }\n if (additionalInfo === 26) {\n const b1 = this.readByte()\n const b2 = this.readByte()\n const b3 = this.readByte()\n const b4 = this.readByte()\n return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4\n }\n if (additionalInfo === 27) {\n // 64-bit,但 JavaScript 無法精確表示,只支援到 2^53\n const high =\n (this.readByte() << 24) | (this.readByte() << 16) | (this.readByte() << 8) | this.readByte()\n const low =\n (this.readByte() << 24) | (this.readByte() << 16) | (this.readByte() << 8) | this.readByte()\n return high * 0x100000000 + low\n }\n throw new Error(`CBOR 無效的長度編碼: ${additionalInfo}`)\n }\n\n /**\n * 遞迴解碼值\n */\n private decodeValue(depth: number): unknown {\n if (depth > CborFallbackDecoder.MAX_DEPTH) {\n throw new Error(`CBOR 解碼深度超過限制 ${CborFallbackDecoder.MAX_DEPTH}`)\n }\n\n const byte = this.readByte()\n const majorType = (byte >> 5) & 0x07\n const additionalInfo = byte & 0x1f\n\n switch (majorType) {\n case CBOR_MAJOR_TYPES.UINT:\n return this.readLength(additionalInfo)\n\n case CBOR_MAJOR_TYPES.NEGINT:\n return -1 - this.readLength(additionalInfo)\n\n case CBOR_MAJOR_TYPES.BYTES: {\n const length = this.readLength(additionalInfo)\n return this.readBytes(length)\n }\n\n case CBOR_MAJOR_TYPES.TEXT: {\n const length = this.readLength(additionalInfo)\n const bytes = this.readBytes(length)\n const decoder = new TextDecoder()\n return decoder.decode(bytes)\n }\n\n case CBOR_MAJOR_TYPES.ARRAY: {\n const length = this.readLength(additionalInfo)\n const result: unknown[] = []\n for (let i = 0; i < length; i++) {\n result.push(this.decodeValue(depth + 1))\n }\n return result\n }\n\n case CBOR_MAJOR_TYPES.MAP: {\n const length = this.readLength(additionalInfo)\n const result: Record<string, unknown> = {}\n for (let i = 0; i < length; i++) {\n const key = this.decodeValue(depth + 1)\n if (typeof key !== 'string') {\n throw new Error(`CBOR Map 的 key 必須是字串,得到: ${typeof key}`)\n }\n result[key] = this.decodeValue(depth + 1)\n }\n return result\n }\n\n case CBOR_MAJOR_TYPES.SIMPLE:\n if (additionalInfo === CBOR_SIMPLE_VALUES.FALSE) {\n return false\n }\n if (additionalInfo === CBOR_SIMPLE_VALUES.TRUE) {\n return true\n }\n if (additionalInfo === CBOR_SIMPLE_VALUES.NULL) {\n return null\n }\n\n // 浮點數\n if (additionalInfo === CBOR_LENGTH_ENCODING.FLOAT32) {\n const bytes = this.readBytes(4)\n const view = new DataView(bytes.buffer, bytes.byteOffset)\n return view.getFloat32(0, false)\n }\n if (additionalInfo === CBOR_LENGTH_ENCODING.FLOAT64) {\n const bytes = this.readBytes(8)\n const view = new DataView(bytes.buffer, bytes.byteOffset)\n return view.getFloat64(0, false)\n }\n\n throw new Error(`CBOR 不支援的 simple value: ${additionalInfo}`)\n\n case CBOR_MAJOR_TYPES.TAG:\n // TAG 類型在此實現中跳過\n return this.decodeValue(depth)\n\n default:\n throw new Error(`CBOR 無效的 major type: ${majorType}`)\n }\n }\n}\n",
7
+ "/**\n * 原生加速器統一入口\n * 遵循 Galaxy Architecture 的運行時自適應模式\n * 與 RuntimeAdapter 模式保持一致\n *\n * 📍 FFI 暫時禁用\n * Bun 的構建系統在生成 ffi/index.js 時會產生 CJS compatibility helpers,\n * 這些 helpers 與 ESM export 語句導致模組解析失敗。\n * 即使使用 ESM import 也無法避免此問題(Bun 內部機制)。\n *\n * 解決方案:禁用 FFI,使用 JavaScript fallback(性能影響極小)\n * TODO: 當 Bun 改進其 ESM 模組構建時重新啟用\n */\n\nimport { CborFallbackEncoder } from './cbor-fallback'\nimport type { CborAccelerator, NativeAcceleratorStatus } from './types'\n\n/**\n * 原生加速器類別\n * 提供運行時自適應的 CBOR 編碼/解碼加速\n * - 在 Bun 環境下優先使用 C 編譯器實現(bun:ffi)\n * - 在非 Bun 環境或 FFI 不可用時自動降級到 JavaScript 實現\n */\nexport class NativeAccelerator {\n private static readonly DEBUG_ENV = 'GRAVITO_FFI_DEBUG'\n\n /**\n * FFI 可用性緩存\n * null: 未檢測, true: 可用, false: 不可用\n */\n private static available: boolean | null = null\n\n /**\n * 當前加速器實例緩存\n */\n private static cborAccelerator: CborAccelerator | null = null\n\n /**\n * 當前狀態\n */\n private static status: NativeAcceleratorStatus | null = null\n\n /**\n * 檢測原生 FFI 是否可用\n * ⚠️ 當前全部返回 false(FFI 已禁用)\n */\n static isAvailable(): boolean {\n if (this.available !== null) {\n return this.available\n }\n\n // FFI 已禁用 - Bun ESM 模組解析問題\n this.available = false\n return false\n }\n\n /**\n * 取得 CBOR 加速器實例\n * 優先使用 Native,失敗則降級到 Fallback\n */\n static getCborAccelerator(): CborAccelerator {\n if (this.cborAccelerator !== null) {\n return this.cborAccelerator\n }\n\n // FFI 已禁用,直接使用 JavaScript fallback\n const fallback = new CborFallbackEncoder()\n this.cborAccelerator = fallback\n this.updateStatus('js-fallback')\n\n if (this.isDebugEnabled()) {\n console.log('[GRAVITO_FFI] 使用 JavaScript 回退實現(FFI 已禁用)')\n }\n\n return fallback\n }\n\n /**\n * 取得加速器狀態\n */\n static getStatus(): NativeAcceleratorStatus {\n // 確保狀態已初始化\n if (this.status === null) {\n this.getCborAccelerator()\n }\n return (\n this.status || {\n available: false,\n runtime: 'js-fallback',\n version: '1.0.0',\n }\n )\n }\n\n /**\n * 重置加速器狀態(用於測試)\n */\n static reset(): void {\n this.available = null\n this.cborAccelerator = null\n this.status = null\n }\n\n /**\n * 檢查是否啟用調試模式\n */\n private static isDebugEnabled(): boolean {\n if (typeof process !== 'undefined' && process.env) {\n return process.env[this.DEBUG_ENV] === '1'\n }\n return false\n }\n\n /**\n * 更新狀態\n */\n private static updateStatus(runtime: 'bun-ffi' | 'js-fallback'): void {\n this.status = {\n available: runtime === 'bun-ffi',\n runtime,\n version: runtime === 'bun-ffi' ? 'native-1.0.0' : 'js-fallback-1.0.0',\n }\n }\n}\n"
8
+ ],
9
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EO,IAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,QAAQ;AACV;AAKO,IAAM,qBAAqB;AAAA,EAChC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,WAAW;AACb;AAKO,IAAM,uBAAuB;AAAA,EAClC,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;A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ACrB,KAAK,kBAAkB;AAAA,IACvB,KAAK,aAAa,aAAa;AAAA,IAE/B,IAAI,KAAK,eAAe,GAAG;AAAA,MACzB,QAAQ,IAAI,kGAA0C;AAAA,IACxD;AAAA,IAEA,OAAO;AAAA;AAAA,SAMF,SAAS,GAA4B;AAAA,IAE1C,IAAI,KAAK,WAAW,MAAM;AAAA,MACxB,KAAK,mBAAmB;AAAA,IAC1B;AAAA,IACA,OACE,KAAK,UAAU;AAAA,MACb,WAAW;AAAA,MACX,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA;AAAA,SAOG,KAAK,GAAS;AAAA,IACnB,KAAK,YAAY;AAAA,IACjB,KAAK,kBAAkB;AAAA,IACvB,KAAK,SAAS;AAAA;AAAA,SAMD,cAAc,GAAY;AAAA,IACvC,IAAI,OAAO,YAAY,eAAe,QAAQ,KAAK;AAAA,MACjD,OAAO,QAAQ,IAAI,KAAK,eAAe;AAAA,IACzC;AAAA,IACA,OAAO;AAAA;AAAA,SAMM,YAAY,CAAC,SAA0C;AAAA,IACpE,KAAK,SAAS;AAAA,MACZ,WAAW,YAAY;AAAA,MACvB;AAAA,MACA,SAAS,YAAY,YAAY,iBAAiB;AAAA,IACpD;AAAA;AAEJ;",
10
+ "debugId": "F722DECAD53319BE64756E2164756E21",
11
+ "names": []
12
+ }
@@ -0,0 +1,125 @@
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, {
40
+ get: all[name],
41
+ enumerable: true,
42
+ configurable: true,
43
+ set: __exportSetter.bind(all, name)
44
+ });
45
+ };
46
+ var __require = import.meta.require;
47
+
48
+ // src/ffi/hash-fallback.ts
49
+ import { createHash, createHmac } from "crypto";
50
+
51
+ class HashFallback {
52
+ sha256(input) {
53
+ return createHash("sha256").update(input).digest("hex");
54
+ }
55
+ hmacSha256(key, data) {
56
+ return createHmac("sha256", key).update(data).digest("hex");
57
+ }
58
+ }
59
+
60
+ // src/ffi/NativeHasher.ts
61
+ class BunCryptoHasher {
62
+ sha256(input) {
63
+ return new Bun.CryptoHasher("sha256").update(input).digest("hex");
64
+ }
65
+ hmacSha256(key, data) {
66
+ return new Bun.CryptoHasher("sha256", key).update(data).digest("hex");
67
+ }
68
+ }
69
+
70
+ class NativeHasher {
71
+ static accelerator = null;
72
+ static status = null;
73
+ static getAccelerator() {
74
+ if (this.accelerator !== null) {
75
+ return this.accelerator;
76
+ }
77
+ if (this.isBunAvailable()) {
78
+ try {
79
+ this.accelerator = new BunCryptoHasher;
80
+ this.updateStatus("bun-crypto-hasher");
81
+ return this.accelerator;
82
+ } catch {}
83
+ }
84
+ this.accelerator = new HashFallback;
85
+ this.updateStatus("node-crypto");
86
+ return this.accelerator;
87
+ }
88
+ static isBunAvailable() {
89
+ try {
90
+ return typeof Bun !== "undefined" && typeof Bun.CryptoHasher === "function";
91
+ } catch {
92
+ return false;
93
+ }
94
+ }
95
+ static updateStatus(runtime) {
96
+ this.status = {
97
+ available: runtime === "bun-crypto-hasher",
98
+ runtime
99
+ };
100
+ }
101
+ static sha256(input) {
102
+ return this.getAccelerator().sha256(input);
103
+ }
104
+ static hmacSha256(key, data) {
105
+ return this.getAccelerator().hmacSha256(key, data);
106
+ }
107
+ static getStatus() {
108
+ if (this.status === null) {
109
+ this.getAccelerator();
110
+ }
111
+ return this.status || {
112
+ available: false,
113
+ runtime: "node-crypto"
114
+ };
115
+ }
116
+ static reset() {
117
+ this.accelerator = null;
118
+ this.status = null;
119
+ }
120
+ }
121
+ export {
122
+ NativeHasher
123
+ };
124
+
125
+ //# debugId=FE35356BCF78DD9B64756E2164756E21
@@ -5,7 +5,7 @@
5
5
  "/**\n * 雜湊加速器 JavaScript 回退實現\n * 基於 node:crypto 標準庫\n *\n * 使用場景:\n * - 非 Bun 環境(Node.js、Deno 等)\n * - Bun CryptoHasher 不可用的情況\n *\n * 性能特性:\n * - 短 key (<100 bytes):~1-2x 慢於 Bun.CryptoHasher(N-API 橋接開銷)\n * - 長 payload:差異較小(主要計算時間)\n * - 一致性:與 node:crypto 標準行為完全相同\n */\n\nimport { createHash, createHmac } from 'node:crypto'\nimport type { HashAccelerator } from './types'\n\n/**\n * Node.js crypto 回退實現\n * 適用於非 Bun 環境\n */\nexport class HashFallback implements HashAccelerator {\n /**\n * SHA-256 計算(回退實現)\n * @param input - 輸入(字串或 Uint8Array)\n * @returns 十六進制編碼的 SHA-256 雜湊值\n */\n sha256(input: string | Uint8Array): string {\n return createHash('sha256').update(input).digest('hex')\n }\n\n /**\n * HMAC-SHA256 計算(回退實現)\n * @param key - 密鑰\n * @param data - 要雜湊的數據\n * @returns 十六進制編碼的 HMAC-SHA256 值\n */\n hmacSha256(key: string, data: string): string {\n return createHmac('sha256', key).update(data).digest('hex')\n }\n}\n",
6
6
  "/**\n * 原生雜湊加速器\n * 運行時自適應實現,遵循 Galaxy Architecture 的設計模式\n *\n * 架構:\n * - 在 Bun 環境:使用 Bun.CryptoHasher(C 實現,高效)\n * - 其他環境:自動降級到 node:crypto\n * - 完全相同的 API 和結果保證\n *\n * 性能:\n * - Bun 環境:2-3x 快於 node:crypto(消除 N-API 開銷)\n * - 跨運行時:完全相容性\n *\n * 應用場景:\n * - FileStore.hashKey() 熱路徑\n * - Encrypter.hash() 加密雜湊\n * - 任何需要高效雜湊計算的地方\n */\n\nimport { HashFallback } from './hash-fallback'\nimport type { HashAccelerator, NativeHasherStatus } from './types'\n\n/**\n * Bun 原生 CryptoHasher 實現\n * 直接使用 Bun.CryptoHasher API\n */\nclass BunCryptoHasher implements HashAccelerator {\n /**\n * SHA-256 計算(Bun 原生)\n * @param input - 輸入(字串或 Uint8Array)\n * @returns 十六進制編碼的 SHA-256 雜湊值\n */\n sha256(input: string | Uint8Array): string {\n return new Bun.CryptoHasher('sha256').update(input).digest('hex')\n }\n\n /**\n * HMAC-SHA256 計算(Bun 原生)\n * Bun.CryptoHasher 第二參數直接支援 HMAC 密鑰\n *\n * @param key - 密鑰\n * @param data - 要雜湊的數據\n * @returns 十六進制編碼的 HMAC-SHA256 值\n */\n hmacSha256(key: string, data: string): string {\n return new Bun.CryptoHasher('sha256', key).update(data).digest('hex')\n }\n}\n\n/**\n * 原生雜湊加速器統一入口\n * 提供運行時自適應的 SHA-256/HMAC-SHA256 計算\n *\n * 使用範例:\n * ```typescript\n * // SHA-256\n * const hash = NativeHasher.sha256('data')\n *\n * // HMAC-SHA256\n * const hmac = NativeHasher.hmacSha256('secret', 'message')\n *\n * // 檢查狀態\n * const status = NativeHasher.getStatus()\n * console.log(`使用: ${status.runtime}`)\n * ```\n */\nexport class NativeHasher {\n /**\n * 當前加速器實例緩存\n */\n private static accelerator: HashAccelerator | null = null\n\n /**\n * 當前狀態緩存\n */\n private static status: NativeHasherStatus | null = null\n\n /**\n * 取得雜湊加速器實例\n * 優先使用 Bun.CryptoHasher,失敗則降級到 node:crypto\n *\n * @returns 雜湊加速器實例\n */\n private static getAccelerator(): HashAccelerator {\n if (this.accelerator !== null) {\n return this.accelerator\n }\n\n // 嘗試使用 Bun 原生實現\n if (this.isBunAvailable()) {\n try {\n this.accelerator = new BunCryptoHasher()\n this.updateStatus('bun-crypto-hasher')\n return this.accelerator\n } catch {\n // 降級到回退實現\n }\n }\n\n // 降級到 node:crypto 回退\n this.accelerator = new HashFallback()\n this.updateStatus('node-crypto')\n return this.accelerator\n }\n\n /**\n * 檢測 Bun 運行時和 CryptoHasher 可用性\n *\n * @returns Bun.CryptoHasher 是否可用\n */\n private static isBunAvailable(): boolean {\n try {\n return typeof Bun !== 'undefined' && typeof Bun.CryptoHasher === 'function'\n } catch {\n return false\n }\n }\n\n /**\n * 更新狀態\n *\n * @param runtime - 當前使用的運行時\n */\n private static updateStatus(runtime: 'bun-crypto-hasher' | 'node-crypto'): void {\n this.status = {\n available: runtime === 'bun-crypto-hasher',\n runtime,\n }\n }\n\n /**\n * 計算 SHA-256 雜湊\n * 支援字串和二進制輸入\n *\n * @param input - 要雜湊的數據(字串或 Uint8Array)\n * @returns 十六進制編碼的 SHA-256 雜湊值(64 字元)\n *\n * @example\n * ```typescript\n * const hash = NativeHasher.sha256('hello')\n * // '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'\n *\n * // 支援 Uint8Array\n * const bytes = new TextEncoder().encode('hello')\n * const hash2 = NativeHasher.sha256(bytes)\n * // 相同結果\n * ```\n */\n static sha256(input: string | Uint8Array): string {\n return this.getAccelerator().sha256(input)\n }\n\n /**\n * 計算 HMAC-SHA256\n * 用於認證消息完整性\n *\n * @param key - HMAC 密鑰\n * @param data - 要雜湊的數據\n * @returns 十六進制編碼的 HMAC-SHA256 值(64 字元)\n *\n * @example\n * ```typescript\n * const hmac = NativeHasher.hmacSha256('secret', 'message')\n * // '8b1a9953c4611296aed9e132b8502cf413b1b881fed3e8d26ab'...\n *\n * // 適用於加密驗證\n * const iv = Buffer.from('...').toString('base64')\n * const encrypted = '...'\n * const mac = NativeHasher.hmacSha256(key, iv + encrypted)\n * ```\n */\n static hmacSha256(key: string, data: string): string {\n return this.getAccelerator().hmacSha256(key, data)\n }\n\n /**\n * 取得加速器狀態\n * 用於診斷和性能監測\n *\n * @returns 加速器狀態報告\n *\n * @example\n * ```typescript\n * const status = NativeHasher.getStatus()\n * console.log(`可用: ${status.available}`)\n * console.log(`運行時: ${status.runtime}`)\n *\n * // 條件邏輯\n * if (status.runtime === 'bun-crypto-hasher') {\n * console.log('使用 Bun 原生實現(高效)')\n * } else {\n * console.log('使用 node:crypto(相容性回退)')\n * }\n * ```\n */\n static getStatus(): NativeHasherStatus {\n // 確保狀態已初始化\n if (this.status === null) {\n this.getAccelerator()\n }\n\n return (\n this.status || {\n available: false,\n runtime: 'node-crypto',\n }\n )\n }\n\n /**\n * 重置加速器狀態\n * 主要用於測試目的,允許重新初始化運行時檢測\n *\n * @internal\n * @example\n * ```typescript\n * // 測試中\n * NativeHasher.reset()\n * // 下一次呼叫會重新偵測運行時\n * const status = NativeHasher.getStatus()\n * ```\n */\n static reset(): void {\n this.accelerator = null\n this.status = null\n }\n}\n"
7
7
  ],
8
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;AAAA;AAOO,MAAM,aAAwC;AAAA,EAMnD,MAAM,CAAC,OAAoC;AAAA,IACzC,OAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AAAA;AAAA,EASxD,UAAU,CAAC,KAAa,MAAsB;AAAA,IAC5C,OAAO,WAAW,UAAU,GAAG,EAAE,OAAO,IAAI,EAAE,OAAO,KAAK;AAAA;AAE9D;;;ACdA,MAAM,gBAA2C;AAAA,EAM/C,MAAM,CAAC,O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