@bilig/wasm-kernel 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Greg Konush
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @bilig/wasm-kernel
2
+
3
+ AssemblyScript and WebAssembly acceleration kernel for bilig spreadsheet execution.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @bilig/wasm-kernel
9
+ ```
10
+
11
+ ## Package entrypoints
12
+
13
+ - ESM: `./dist/index.js`
14
+ - Types: `./dist/index.d.ts`
15
+
16
+ This package is part of the [bilig](https://github.com/proompteng/bilig) monorepo.
Binary file
@@ -0,0 +1,52 @@
1
+ export interface SpreadsheetKernel {
2
+ init(cellCapacity: number, formulaCapacity: number, constantCapacity: number, rangeCapacity: number, memberCapacity: number): void;
3
+ ensureCellCapacity(nextCapacity: number): void;
4
+ ensureFormulaCapacity(nextCapacity: number): void;
5
+ ensureConstantCapacity(nextCapacity: number): void;
6
+ ensureRangeCapacity(nextCapacity: number): void;
7
+ ensureMemberCapacity(nextCapacity: number): void;
8
+ uploadPrograms(programs: Uint32Array, offsets: Uint32Array, lengths: Uint32Array, targets: Uint32Array): void;
9
+ uploadConstants(constants: Float64Array, offsets: Uint32Array, lengths: Uint32Array): void;
10
+ uploadRangeMembers(members: Uint32Array, offsets: Uint32Array, lengths: Uint32Array): void;
11
+ uploadRangeShapes(rowCounts: Uint32Array, colCounts: Uint32Array): void;
12
+ uploadVolatileNowSerial(nowSerial: number): void;
13
+ uploadVolatileRandomValues(values: Float64Array): void;
14
+ uploadStringLengths(lengths: Uint32Array): void;
15
+ uploadStrings(offsets: Uint32Array, lengths: Uint32Array, data: Uint16Array): void;
16
+ writeCells(tags: Uint8Array, numbers: Float64Array, stringIds: Uint32Array, errors: Uint16Array): void;
17
+ evalBatch(cellIndices: Uint32Array): void;
18
+ materializePivotTable(sourceRangeIndex: number, sourceWidth: number, groupByColumnIndices: Uint32Array, valueColumnIndices: Uint32Array, valueAggregations: Uint8Array): {
19
+ rows: number;
20
+ cols: number;
21
+ tags: Uint8Array;
22
+ numbers: Float64Array;
23
+ stringIds: Uint32Array;
24
+ errors: Uint16Array;
25
+ };
26
+ readTags(): Uint8Array;
27
+ readNumbers(): Float64Array;
28
+ readStringIds(): Uint32Array;
29
+ readErrors(): Uint16Array;
30
+ readProgramOffsets(): Uint32Array;
31
+ readProgramLengths(): Uint32Array;
32
+ readConstantOffsets(): Uint32Array;
33
+ readConstantLengths(): Uint32Array;
34
+ readConstants(): Float64Array;
35
+ readRangeOffsets(): Uint32Array;
36
+ readRangeLengths(): Uint32Array;
37
+ readRangeMembers(): Uint32Array;
38
+ readOutputStrings(): string[];
39
+ readSpillRows(): Uint32Array;
40
+ readSpillCols(): Uint32Array;
41
+ readSpillOffsets(): Uint32Array;
42
+ readSpillLengths(): Uint32Array;
43
+ readSpillTags(): Uint8Array;
44
+ readSpillNumbers(): Float64Array;
45
+ getSpillValueCount(): number;
46
+ getCellCapacity(): number;
47
+ getFormulaCapacity(): number;
48
+ getConstantCapacity(): number;
49
+ getRangeCapacity(): number;
50
+ getMemberCapacity(): number;
51
+ }
52
+ export declare function createKernel(): Promise<SpreadsheetKernel>;
package/dist/index.js ADDED
@@ -0,0 +1,515 @@
1
+ const ARRAY_BUFFER_CLASS_ID = 1;
2
+ const UINT8_ARRAY_CLASS_ID = 4;
3
+ const FLOAT64_ARRAY_CLASS_ID = 5;
4
+ const UINT16_ARRAY_CLASS_ID = 6;
5
+ const UINT32_ARRAY_CLASS_ID = 7;
6
+ function isRawKernelExports(value) {
7
+ if (typeof value !== "object" || value === null) {
8
+ return false;
9
+ }
10
+ const requiredKeys = [
11
+ "memory",
12
+ "__new",
13
+ "__pin",
14
+ "__unpin",
15
+ "init",
16
+ "ensureCellCapacity",
17
+ "ensureFormulaCapacity",
18
+ "ensureConstantCapacity",
19
+ "ensureRangeCapacity",
20
+ "ensureMemberCapacity",
21
+ "uploadPrograms",
22
+ "uploadConstants",
23
+ "uploadRangeMembers",
24
+ "uploadRangeShapes",
25
+ "uploadVolatileNowSerial",
26
+ "uploadVolatileRandomValues",
27
+ "uploadStringLengths",
28
+ "uploadStrings",
29
+ "writeCells",
30
+ "evalBatch",
31
+ "materializePivotTable",
32
+ "getPivotResultTagsPtr",
33
+ "getPivotResultNumbersPtr",
34
+ "getPivotResultStringIdsPtr",
35
+ "getPivotResultErrorsPtr",
36
+ "pivotResultRows",
37
+ "pivotResultCols",
38
+ "getTagsPtr",
39
+ "getNumbersPtr",
40
+ "getStringIdsPtr",
41
+ "getErrorsPtr",
42
+ "getProgramOffsetsPtr",
43
+ "getProgramLengthsPtr",
44
+ "getConstantOffsetsPtr",
45
+ "getConstantLengthsPtr",
46
+ "getConstantArenaPtr",
47
+ "getRangeOffsetsPtr",
48
+ "getRangeLengthsPtr",
49
+ "getRangeMembersPtr",
50
+ "getOutputStringLengthsPtr",
51
+ "getOutputStringOffsetsPtr",
52
+ "getOutputStringDataPtr",
53
+ "getOutputStringCount",
54
+ "getOutputStringDataLength",
55
+ "getSpillResultRowsPtr",
56
+ "getSpillResultColsPtr",
57
+ "getSpillResultOffsetsPtr",
58
+ "getSpillResultLengthsPtr",
59
+ "getSpillResultTagsPtr",
60
+ "getSpillResultNumbersPtr",
61
+ "getSpillResultValueCount",
62
+ "getCellCapacity",
63
+ "getFormulaCapacity",
64
+ "getConstantCapacity",
65
+ "getRangeCapacity",
66
+ "getMemberCapacity",
67
+ ];
68
+ return requiredKeys.every((key) => key in value);
69
+ }
70
+ const uint8Spec = {
71
+ align: 0,
72
+ classId: UINT8_ARRAY_CLASS_ID,
73
+ ctor: Uint8Array,
74
+ };
75
+ const uint16Spec = {
76
+ align: 1,
77
+ classId: UINT16_ARRAY_CLASS_ID,
78
+ ctor: Uint16Array,
79
+ };
80
+ const uint32Spec = {
81
+ align: 2,
82
+ classId: UINT32_ARRAY_CLASS_ID,
83
+ ctor: Uint32Array,
84
+ };
85
+ const float64Spec = {
86
+ align: 3,
87
+ classId: FLOAT64_ARRAY_CLASS_ID,
88
+ ctor: Float64Array,
89
+ };
90
+ class RawKernelBridge {
91
+ raw;
92
+ dataView;
93
+ constructor(raw) {
94
+ this.raw = raw;
95
+ this.dataView = new DataView(raw.memory.buffer);
96
+ }
97
+ init(cellCapacity, formulaCapacity, constantCapacity, rangeCapacity, memberCapacity) {
98
+ this.raw.init(cellCapacity, formulaCapacity, constantCapacity, rangeCapacity, memberCapacity);
99
+ }
100
+ ensureCellCapacity(nextCapacity) {
101
+ this.raw.ensureCellCapacity(nextCapacity);
102
+ }
103
+ ensureFormulaCapacity(nextCapacity) {
104
+ this.raw.ensureFormulaCapacity(nextCapacity);
105
+ }
106
+ ensureConstantCapacity(nextCapacity) {
107
+ this.raw.ensureConstantCapacity(nextCapacity);
108
+ }
109
+ ensureRangeCapacity(nextCapacity) {
110
+ this.raw.ensureRangeCapacity(nextCapacity);
111
+ }
112
+ ensureMemberCapacity(nextCapacity) {
113
+ this.raw.ensureMemberCapacity(nextCapacity);
114
+ }
115
+ uploadPrograms(programs, offsets, lengths, targets) {
116
+ const programsPtr = this.lowerTypedArray(programs, uint32Spec);
117
+ const offsetsPtr = this.lowerTypedArray(offsets, uint32Spec);
118
+ const lengthsPtr = this.lowerTypedArray(lengths, uint32Spec);
119
+ const targetsPtr = this.lowerTypedArray(targets, uint32Spec);
120
+ try {
121
+ this.raw.uploadPrograms(programsPtr, offsetsPtr, lengthsPtr, targetsPtr);
122
+ }
123
+ finally {
124
+ this.raw.__unpin(programsPtr);
125
+ this.raw.__unpin(offsetsPtr);
126
+ this.raw.__unpin(lengthsPtr);
127
+ this.raw.__unpin(targetsPtr);
128
+ }
129
+ }
130
+ uploadConstants(constants, offsets, lengths) {
131
+ const constantsPtr = this.lowerTypedArray(constants, float64Spec);
132
+ const offsetsPtr = this.lowerTypedArray(offsets, uint32Spec);
133
+ const lengthsPtr = this.lowerTypedArray(lengths, uint32Spec);
134
+ try {
135
+ this.raw.uploadConstants(constantsPtr, offsetsPtr, lengthsPtr);
136
+ }
137
+ finally {
138
+ this.raw.__unpin(constantsPtr);
139
+ this.raw.__unpin(offsetsPtr);
140
+ this.raw.__unpin(lengthsPtr);
141
+ }
142
+ }
143
+ uploadRangeMembers(members, offsets, lengths) {
144
+ const membersPtr = this.lowerTypedArray(members, uint32Spec);
145
+ const offsetsPtr = this.lowerTypedArray(offsets, uint32Spec);
146
+ const lengthsPtr = this.lowerTypedArray(lengths, uint32Spec);
147
+ try {
148
+ this.raw.uploadRangeMembers(membersPtr, offsetsPtr, lengthsPtr);
149
+ }
150
+ finally {
151
+ this.raw.__unpin(membersPtr);
152
+ this.raw.__unpin(offsetsPtr);
153
+ this.raw.__unpin(lengthsPtr);
154
+ }
155
+ }
156
+ uploadRangeShapes(rowCounts, colCounts) {
157
+ const rowCountsPtr = this.lowerTypedArray(rowCounts, uint32Spec);
158
+ const colCountsPtr = this.lowerTypedArray(colCounts, uint32Spec);
159
+ try {
160
+ this.raw.uploadRangeShapes(rowCountsPtr, colCountsPtr);
161
+ }
162
+ finally {
163
+ this.raw.__unpin(rowCountsPtr);
164
+ this.raw.__unpin(colCountsPtr);
165
+ }
166
+ }
167
+ uploadVolatileNowSerial(nowSerial) {
168
+ this.raw.uploadVolatileNowSerial(nowSerial);
169
+ }
170
+ uploadVolatileRandomValues(values) {
171
+ const valuesPtr = this.lowerTypedArray(values, float64Spec);
172
+ try {
173
+ this.raw.uploadVolatileRandomValues(valuesPtr);
174
+ }
175
+ finally {
176
+ this.raw.__unpin(valuesPtr);
177
+ }
178
+ }
179
+ uploadStringLengths(lengths) {
180
+ const lengthsPtr = this.lowerTypedArray(lengths, uint32Spec);
181
+ try {
182
+ this.raw.uploadStringLengths(lengthsPtr);
183
+ }
184
+ finally {
185
+ this.raw.__unpin(lengthsPtr);
186
+ }
187
+ }
188
+ uploadStrings(offsets, lengths, data) {
189
+ const offsetsPtr = this.lowerTypedArray(offsets, uint32Spec);
190
+ const lengthsPtr = this.lowerTypedArray(lengths, uint32Spec);
191
+ const dataPtr = this.lowerTypedArray(data, uint16Spec);
192
+ try {
193
+ this.raw.uploadStrings(offsetsPtr, lengthsPtr, dataPtr);
194
+ }
195
+ finally {
196
+ this.raw.__unpin(offsetsPtr);
197
+ this.raw.__unpin(lengthsPtr);
198
+ this.raw.__unpin(dataPtr);
199
+ }
200
+ }
201
+ writeCells(tags, numbers, stringIds, errors) {
202
+ const tagsPtr = this.lowerTypedArray(tags, uint8Spec);
203
+ const numbersPtr = this.lowerTypedArray(numbers, float64Spec);
204
+ const stringIdsPtr = this.lowerTypedArray(stringIds, uint32Spec);
205
+ const errorsPtr = this.lowerTypedArray(errors, uint16Spec);
206
+ try {
207
+ this.raw.writeCells(tagsPtr, numbersPtr, stringIdsPtr, errorsPtr);
208
+ }
209
+ finally {
210
+ this.raw.__unpin(tagsPtr);
211
+ this.raw.__unpin(numbersPtr);
212
+ this.raw.__unpin(stringIdsPtr);
213
+ this.raw.__unpin(errorsPtr);
214
+ }
215
+ }
216
+ evalBatch(cellIndices) {
217
+ const cellIndicesPtr = this.lowerTypedArray(cellIndices, uint32Spec);
218
+ try {
219
+ this.raw.evalBatch(cellIndicesPtr);
220
+ }
221
+ finally {
222
+ this.raw.__unpin(cellIndicesPtr);
223
+ }
224
+ }
225
+ materializePivotTable(sourceRangeIndex, sourceWidth, groupByColumnIndices, valueColumnIndices, valueAggregations) {
226
+ const groupByPtr = this.lowerTypedArray(groupByColumnIndices, uint32Spec);
227
+ const valueColsPtr = this.lowerTypedArray(valueColumnIndices, uint32Spec);
228
+ const valueAggsPtr = this.lowerTypedArray(valueAggregations, uint8Spec);
229
+ try {
230
+ this.raw.materializePivotTable(sourceRangeIndex, sourceWidth, groupByColumnIndices.length, groupByPtr, valueColumnIndices.length, valueColsPtr, valueAggsPtr);
231
+ }
232
+ finally {
233
+ this.raw.__unpin(groupByPtr);
234
+ this.raw.__unpin(valueColsPtr);
235
+ this.raw.__unpin(valueAggsPtr);
236
+ }
237
+ }
238
+ lowerTypedArray(values, spec) {
239
+ const byteLength = values.length << spec.align;
240
+ const bufferPtr = this.raw.__pin(this.raw.__new(byteLength, ARRAY_BUFFER_CLASS_ID));
241
+ const headerPtr = this.raw.__pin(this.raw.__new(12, spec.classId));
242
+ try {
243
+ this.setUint32(headerPtr, bufferPtr);
244
+ this.setUint32(headerPtr + 4, bufferPtr);
245
+ this.setUint32(headerPtr + 8, byteLength);
246
+ new spec.ctor(this.raw.memory.buffer, bufferPtr, values.length).set(values);
247
+ return headerPtr;
248
+ }
249
+ finally {
250
+ this.raw.__unpin(bufferPtr);
251
+ }
252
+ }
253
+ setUint32(pointer, value) {
254
+ try {
255
+ this.dataView.setUint32(pointer, value, true);
256
+ }
257
+ catch {
258
+ this.dataView = new DataView(this.raw.memory.buffer);
259
+ this.dataView.setUint32(pointer, value, true);
260
+ }
261
+ }
262
+ }
263
+ class KernelHandle {
264
+ raw;
265
+ bridge;
266
+ tags = new Uint8Array();
267
+ numbers = new Float64Array();
268
+ stringIds = new Uint32Array();
269
+ errors = new Uint16Array();
270
+ programOffsets = new Uint32Array();
271
+ programLengths = new Uint32Array();
272
+ constantOffsets = new Uint32Array();
273
+ constantLengths = new Uint32Array();
274
+ constants = new Float64Array();
275
+ rangeOffsets = new Uint32Array();
276
+ rangeLengths = new Uint32Array();
277
+ rangeMembers = new Uint32Array();
278
+ spillRows = new Uint32Array();
279
+ spillCols = new Uint32Array();
280
+ spillOffsets = new Uint32Array();
281
+ spillLengths = new Uint32Array();
282
+ spillTags = new Uint8Array();
283
+ spillNumbers = new Float64Array();
284
+ constructor(raw) {
285
+ this.raw = raw;
286
+ this.bridge = new RawKernelBridge(raw);
287
+ this.refreshViews();
288
+ }
289
+ init(cellCapacity, formulaCapacity, constantCapacity, rangeCapacity, memberCapacity) {
290
+ this.bridge.init(cellCapacity, formulaCapacity, constantCapacity, rangeCapacity, memberCapacity);
291
+ this.refreshViews();
292
+ }
293
+ ensureCellCapacity(nextCapacity) {
294
+ this.bridge.ensureCellCapacity(nextCapacity);
295
+ this.refreshViews();
296
+ }
297
+ ensureFormulaCapacity(nextCapacity) {
298
+ this.bridge.ensureFormulaCapacity(nextCapacity);
299
+ this.refreshViews();
300
+ }
301
+ ensureConstantCapacity(nextCapacity) {
302
+ this.bridge.ensureConstantCapacity(nextCapacity);
303
+ this.refreshViews();
304
+ }
305
+ ensureRangeCapacity(nextCapacity) {
306
+ this.bridge.ensureRangeCapacity(nextCapacity);
307
+ this.refreshViews();
308
+ }
309
+ ensureMemberCapacity(nextCapacity) {
310
+ this.bridge.ensureMemberCapacity(nextCapacity);
311
+ this.refreshViews();
312
+ }
313
+ uploadPrograms(programs, offsets, lengths, targets) {
314
+ this.bridge.uploadPrograms(programs, offsets, lengths, targets);
315
+ this.refreshViews();
316
+ }
317
+ uploadConstants(constants, offsets, lengths) {
318
+ this.bridge.uploadConstants(constants, offsets, lengths);
319
+ this.refreshViews();
320
+ }
321
+ uploadRangeMembers(members, offsets, lengths) {
322
+ this.bridge.uploadRangeMembers(members, offsets, lengths);
323
+ this.refreshViews();
324
+ }
325
+ uploadRangeShapes(rowCounts, colCounts) {
326
+ this.bridge.uploadRangeShapes(rowCounts, colCounts);
327
+ this.refreshViews();
328
+ }
329
+ uploadVolatileNowSerial(nowSerial) {
330
+ this.bridge.uploadVolatileNowSerial(nowSerial);
331
+ }
332
+ uploadVolatileRandomValues(values) {
333
+ this.bridge.uploadVolatileRandomValues(values);
334
+ }
335
+ uploadStringLengths(lengths) {
336
+ this.bridge.uploadStringLengths(lengths);
337
+ this.refreshViews();
338
+ }
339
+ uploadStrings(offsets, lengths, data) {
340
+ this.bridge.uploadStrings(offsets, lengths, data);
341
+ this.refreshViews();
342
+ }
343
+ writeCells(tags, numbers, stringIds, errors) {
344
+ this.bridge.writeCells(tags, numbers, stringIds, errors);
345
+ this.refreshViews();
346
+ }
347
+ evalBatch(cellIndices) {
348
+ this.bridge.evalBatch(cellIndices);
349
+ this.refreshViews();
350
+ }
351
+ materializePivotTable(sourceRangeIndex, sourceWidth, groupByColumnIndices, valueColumnIndices, valueAggregations) {
352
+ this.bridge.materializePivotTable(sourceRangeIndex, sourceWidth, groupByColumnIndices, valueColumnIndices, valueAggregations);
353
+ const rows = this.raw.pivotResultRows.value;
354
+ const cols = this.raw.pivotResultCols.value;
355
+ const size = rows * cols;
356
+ const memory = this.raw.memory.buffer;
357
+ return {
358
+ rows,
359
+ cols,
360
+ tags: new Uint8Array(memory, this.raw.getPivotResultTagsPtr(), size),
361
+ numbers: new Float64Array(memory, this.raw.getPivotResultNumbersPtr(), size),
362
+ stringIds: new Uint32Array(memory, this.raw.getPivotResultStringIdsPtr(), size),
363
+ errors: new Uint16Array(memory, this.raw.getPivotResultErrorsPtr(), size),
364
+ };
365
+ }
366
+ readTags() {
367
+ return this.tags;
368
+ }
369
+ readNumbers() {
370
+ return this.numbers;
371
+ }
372
+ readStringIds() {
373
+ return this.stringIds;
374
+ }
375
+ readErrors() {
376
+ return this.errors;
377
+ }
378
+ readProgramOffsets() {
379
+ return this.programOffsets;
380
+ }
381
+ readProgramLengths() {
382
+ return this.programLengths;
383
+ }
384
+ readConstantOffsets() {
385
+ return this.constantOffsets;
386
+ }
387
+ readConstantLengths() {
388
+ return this.constantLengths;
389
+ }
390
+ readConstants() {
391
+ return this.constants;
392
+ }
393
+ readRangeOffsets() {
394
+ return this.rangeOffsets;
395
+ }
396
+ readRangeLengths() {
397
+ return this.rangeLengths;
398
+ }
399
+ readRangeMembers() {
400
+ return this.rangeMembers;
401
+ }
402
+ readOutputStrings() {
403
+ const memory = this.raw.memory.buffer;
404
+ const count = this.raw.getOutputStringCount();
405
+ if (count === 0)
406
+ return [];
407
+ const lengths = new Uint32Array(memory, this.raw.getOutputStringLengthsPtr(), count);
408
+ const offsets = new Uint32Array(memory, this.raw.getOutputStringOffsetsPtr(), count);
409
+ const data = new Uint16Array(memory, this.raw.getOutputStringDataPtr(), this.raw.getOutputStringDataLength());
410
+ const strings = [];
411
+ for (let index = 0; index < count; index += 1) {
412
+ const length = lengths[index];
413
+ const offset = offsets[index];
414
+ let str = "";
415
+ for (let charIndex = 0; charIndex < length; charIndex += 1) {
416
+ str += String.fromCharCode(data[offset + charIndex]);
417
+ }
418
+ strings.push(str);
419
+ }
420
+ return strings;
421
+ }
422
+ readSpillRows() {
423
+ return this.spillRows;
424
+ }
425
+ readSpillCols() {
426
+ return this.spillCols;
427
+ }
428
+ readSpillOffsets() {
429
+ return this.spillOffsets;
430
+ }
431
+ readSpillLengths() {
432
+ return this.spillLengths;
433
+ }
434
+ readSpillTags() {
435
+ return this.spillTags;
436
+ }
437
+ readSpillNumbers() {
438
+ return this.spillNumbers;
439
+ }
440
+ getSpillValueCount() {
441
+ return this.raw.getSpillResultValueCount();
442
+ }
443
+ getCellCapacity() {
444
+ return this.raw.getCellCapacity();
445
+ }
446
+ getFormulaCapacity() {
447
+ return this.raw.getFormulaCapacity();
448
+ }
449
+ getConstantCapacity() {
450
+ return this.raw.getConstantCapacity();
451
+ }
452
+ getRangeCapacity() {
453
+ return this.raw.getRangeCapacity();
454
+ }
455
+ getMemberCapacity() {
456
+ return this.raw.getMemberCapacity();
457
+ }
458
+ refreshViews() {
459
+ const memory = this.raw.memory.buffer;
460
+ this.tags = new Uint8Array(memory, this.raw.getTagsPtr(), this.raw.getCellCapacity());
461
+ this.numbers = new Float64Array(memory, this.raw.getNumbersPtr(), this.raw.getCellCapacity());
462
+ this.stringIds = new Uint32Array(memory, this.raw.getStringIdsPtr(), this.raw.getCellCapacity());
463
+ this.errors = new Uint16Array(memory, this.raw.getErrorsPtr(), this.raw.getCellCapacity());
464
+ this.programOffsets = new Uint32Array(memory, this.raw.getProgramOffsetsPtr(), this.raw.getFormulaCapacity());
465
+ this.programLengths = new Uint32Array(memory, this.raw.getProgramLengthsPtr(), this.raw.getFormulaCapacity());
466
+ this.constantOffsets = new Uint32Array(memory, this.raw.getConstantOffsetsPtr(), this.raw.getFormulaCapacity());
467
+ this.constantLengths = new Uint32Array(memory, this.raw.getConstantLengthsPtr(), this.raw.getFormulaCapacity());
468
+ this.constants = new Float64Array(memory, this.raw.getConstantArenaPtr(), this.raw.getConstantCapacity());
469
+ this.rangeOffsets = new Uint32Array(memory, this.raw.getRangeOffsetsPtr(), this.raw.getRangeCapacity());
470
+ this.rangeLengths = new Uint32Array(memory, this.raw.getRangeLengthsPtr(), this.raw.getRangeCapacity());
471
+ this.rangeMembers = new Uint32Array(memory, this.raw.getRangeMembersPtr(), this.raw.getMemberCapacity());
472
+ this.spillRows = new Uint32Array(memory, this.raw.getSpillResultRowsPtr(), this.raw.getCellCapacity());
473
+ this.spillCols = new Uint32Array(memory, this.raw.getSpillResultColsPtr(), this.raw.getCellCapacity());
474
+ this.spillOffsets = new Uint32Array(memory, this.raw.getSpillResultOffsetsPtr(), this.raw.getCellCapacity());
475
+ this.spillLengths = new Uint32Array(memory, this.raw.getSpillResultLengthsPtr(), this.raw.getCellCapacity());
476
+ this.spillTags = new Uint8Array(memory, this.raw.getSpillResultTagsPtr(), this.raw.getSpillResultValueCount());
477
+ this.spillNumbers = new Float64Array(memory, this.raw.getSpillResultNumbersPtr(), this.raw.getSpillResultValueCount());
478
+ }
479
+ }
480
+ function isNodeLike() {
481
+ return (typeof process !== "undefined" && process.versions != null && process.versions.node != null);
482
+ }
483
+ async function loadWasmModule() {
484
+ const wasmUrl = new URL("../build/release.wasm", import.meta.url);
485
+ const imports = {
486
+ env: {
487
+ abort(_message, _fileName, lineNumber, columnNumber) {
488
+ throw new Error(`AssemblyScript abort at ${lineNumber}:${columnNumber}`);
489
+ },
490
+ },
491
+ };
492
+ if (isNodeLike()) {
493
+ const fsPromises = process.getBuiltinModule("fs/promises");
494
+ if (!fsPromises) {
495
+ throw new Error("Node fs/promises module is unavailable");
496
+ }
497
+ const { readFile } = fsPromises;
498
+ const bytes = await readFile(wasmUrl);
499
+ return WebAssembly.instantiate(bytes, imports);
500
+ }
501
+ const response = await fetch(wasmUrl);
502
+ if (!response.ok) {
503
+ throw new Error(`Failed to load wasm kernel: ${response.status} ${response.statusText}`);
504
+ }
505
+ const bytes = await response.arrayBuffer();
506
+ return WebAssembly.instantiate(bytes, imports);
507
+ }
508
+ export async function createKernel() {
509
+ const { instance } = await loadWasmModule();
510
+ if (!isRawKernelExports(instance.exports)) {
511
+ throw new Error("WASM exports did not match the kernel contract");
512
+ }
513
+ return new KernelHandle(instance.exports);
514
+ }
515
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,qBA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AC;IACD,OAAO,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@bilig/wasm-kernel",
3
+ "version": "0.1.0",
4
+ "description": "AssemblyScript and WebAssembly acceleration kernel for bilig spreadsheet execution.",
5
+ "keywords": [
6
+ "assemblyscript",
7
+ "bilig",
8
+ "kernel",
9
+ "spreadsheet",
10
+ "wasm"
11
+ ],
12
+ "homepage": "https://github.com/proompteng/bilig/tree/main/packages/wasm-kernel#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/proompteng/bilig/issues"
15
+ },
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/proompteng/bilig.git",
20
+ "directory": "packages/wasm-kernel"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "build/release.wasm",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "type": "module",
29
+ "sideEffects": false,
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js"
36
+ }
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "dependencies": {
42
+ "@bilig/protocol": "0.1.0"
43
+ },
44
+ "devDependencies": {
45
+ "assemblyscript": "0.28.12"
46
+ },
47
+ "engines": {
48
+ "node": ">=24.0.0"
49
+ },
50
+ "scripts": {
51
+ "build": "bun ./scripts/build.ts && tsc -p tsconfig.json"
52
+ }
53
+ }