@diaryx/wasm-node 1.2.1-dev.ddf29e2 → 1.3.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/diaryx_wasm.d.ts +2 -33
- package/diaryx_wasm.js +4 -85
- package/diaryx_wasm_bg.wasm +0 -0
- package/diaryx_wasm_bg.wasm.d.ts +2 -4
- package/package.json +1 -1
package/diaryx_wasm.d.ts
CHANGED
|
@@ -220,35 +220,6 @@ export class DiaryxBackend {
|
|
|
220
220
|
* ```
|
|
221
221
|
*/
|
|
222
222
|
onFileSystemEvent(callback: Function): bigint;
|
|
223
|
-
/**
|
|
224
|
-
* Parse a Day One export (ZIP or JSON) and return entries as JSON.
|
|
225
|
-
*
|
|
226
|
-
* Auto-detects the format: ZIP files (with media directories) have
|
|
227
|
-
* attachments populated with binary data. Plain JSON files are parsed
|
|
228
|
-
* with empty attachment data (backward compatible).
|
|
229
|
-
*
|
|
230
|
-
* ## Example
|
|
231
|
-
* ```javascript
|
|
232
|
-
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
233
|
-
* const result = backend.parseDayOneJson(bytes);
|
|
234
|
-
* const { entries, errors } = JSON.parse(result);
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
parseDayOneJson(bytes: Uint8Array): string;
|
|
238
|
-
/**
|
|
239
|
-
* Parse a single markdown file and return the entry as JSON.
|
|
240
|
-
*
|
|
241
|
-
* Takes the raw bytes of a `.md` file and its filename, and returns
|
|
242
|
-
* a JSON-serialized `ImportedEntry`.
|
|
243
|
-
*
|
|
244
|
-
* ## Example
|
|
245
|
-
* ```javascript
|
|
246
|
-
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
247
|
-
* const entryJson = backend.parseMarkdownFile(bytes, file.name);
|
|
248
|
-
* const entry = JSON.parse(entryJson);
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
parseMarkdownFile(bytes: Uint8Array, filename: string): string;
|
|
252
223
|
/**
|
|
253
224
|
* Read binary file.
|
|
254
225
|
*
|
|
@@ -338,8 +309,6 @@ export interface InitOutput {
|
|
|
338
309
|
readonly diaryxbackend_hasNativeSync: (a: number) => number;
|
|
339
310
|
readonly diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
340
311
|
readonly diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
341
|
-
readonly diaryxbackend_parseDayOneJson: (a: number, b: number, c: number) => [number, number, number, number];
|
|
342
|
-
readonly diaryxbackend_parseMarkdownFile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
343
312
|
readonly diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
344
313
|
readonly diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
345
314
|
readonly diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
@@ -350,9 +319,9 @@ export interface InitOutput {
|
|
|
350
319
|
readonly today_formatted: (a: number, b: number) => [number, number];
|
|
351
320
|
readonly diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
352
321
|
readonly init: () => void;
|
|
353
|
-
readonly
|
|
322
|
+
readonly wasm_bindgen__closure__destroy__h88c09826c7bdcc04: (a: number, b: number) => void;
|
|
354
323
|
readonly wasm_bindgen__convert__closures_____invoke__h0d59e9d6e6af2fb0: (a: number, b: number, c: any, d: any) => void;
|
|
355
|
-
readonly
|
|
324
|
+
readonly wasm_bindgen__convert__closures_____invoke__h225c842405c0a80f: (a: number, b: number, c: any) => void;
|
|
356
325
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
357
326
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
358
327
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/diaryx_wasm.js
CHANGED
|
@@ -209,80 +209,6 @@ export class DiaryxBackend {
|
|
|
209
209
|
const ret = wasm.diaryxbackend_onFileSystemEvent(this.__wbg_ptr, callback);
|
|
210
210
|
return BigInt.asUintN(64, ret);
|
|
211
211
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Parse a Day One export (ZIP or JSON) and return entries as JSON.
|
|
214
|
-
*
|
|
215
|
-
* Auto-detects the format: ZIP files (with media directories) have
|
|
216
|
-
* attachments populated with binary data. Plain JSON files are parsed
|
|
217
|
-
* with empty attachment data (backward compatible).
|
|
218
|
-
*
|
|
219
|
-
* ## Example
|
|
220
|
-
* ```javascript
|
|
221
|
-
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
222
|
-
* const result = backend.parseDayOneJson(bytes);
|
|
223
|
-
* const { entries, errors } = JSON.parse(result);
|
|
224
|
-
* ```
|
|
225
|
-
* @param {Uint8Array} bytes
|
|
226
|
-
* @returns {string}
|
|
227
|
-
*/
|
|
228
|
-
parseDayOneJson(bytes) {
|
|
229
|
-
let deferred3_0;
|
|
230
|
-
let deferred3_1;
|
|
231
|
-
try {
|
|
232
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
233
|
-
const len0 = WASM_VECTOR_LEN;
|
|
234
|
-
const ret = wasm.diaryxbackend_parseDayOneJson(this.__wbg_ptr, ptr0, len0);
|
|
235
|
-
var ptr2 = ret[0];
|
|
236
|
-
var len2 = ret[1];
|
|
237
|
-
if (ret[3]) {
|
|
238
|
-
ptr2 = 0; len2 = 0;
|
|
239
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
240
|
-
}
|
|
241
|
-
deferred3_0 = ptr2;
|
|
242
|
-
deferred3_1 = len2;
|
|
243
|
-
return getStringFromWasm0(ptr2, len2);
|
|
244
|
-
} finally {
|
|
245
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Parse a single markdown file and return the entry as JSON.
|
|
250
|
-
*
|
|
251
|
-
* Takes the raw bytes of a `.md` file and its filename, and returns
|
|
252
|
-
* a JSON-serialized `ImportedEntry`.
|
|
253
|
-
*
|
|
254
|
-
* ## Example
|
|
255
|
-
* ```javascript
|
|
256
|
-
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
257
|
-
* const entryJson = backend.parseMarkdownFile(bytes, file.name);
|
|
258
|
-
* const entry = JSON.parse(entryJson);
|
|
259
|
-
* ```
|
|
260
|
-
* @param {Uint8Array} bytes
|
|
261
|
-
* @param {string} filename
|
|
262
|
-
* @returns {string}
|
|
263
|
-
*/
|
|
264
|
-
parseMarkdownFile(bytes, filename) {
|
|
265
|
-
let deferred4_0;
|
|
266
|
-
let deferred4_1;
|
|
267
|
-
try {
|
|
268
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
269
|
-
const len0 = WASM_VECTOR_LEN;
|
|
270
|
-
const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
271
|
-
const len1 = WASM_VECTOR_LEN;
|
|
272
|
-
const ret = wasm.diaryxbackend_parseMarkdownFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
273
|
-
var ptr3 = ret[0];
|
|
274
|
-
var len3 = ret[1];
|
|
275
|
-
if (ret[3]) {
|
|
276
|
-
ptr3 = 0; len3 = 0;
|
|
277
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
278
|
-
}
|
|
279
|
-
deferred4_0 = ptr3;
|
|
280
|
-
deferred4_1 = len3;
|
|
281
|
-
return getStringFromWasm0(ptr3, len3);
|
|
282
|
-
} finally {
|
|
283
|
-
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
212
|
/**
|
|
287
213
|
* Read binary file.
|
|
288
214
|
*
|
|
@@ -794,8 +720,8 @@ function __wbg_get_imports() {
|
|
|
794
720
|
console.warn(arg0, arg1, arg2, arg3);
|
|
795
721
|
},
|
|
796
722
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
797
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
798
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
723
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
724
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h88c09826c7bdcc04, wasm_bindgen__convert__closures_____invoke__h225c842405c0a80f);
|
|
799
725
|
return ret;
|
|
800
726
|
},
|
|
801
727
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -834,8 +760,8 @@ function __wbg_get_imports() {
|
|
|
834
760
|
};
|
|
835
761
|
}
|
|
836
762
|
|
|
837
|
-
function
|
|
838
|
-
wasm.
|
|
763
|
+
function wasm_bindgen__convert__closures_____invoke__h225c842405c0a80f(arg0, arg1, arg2) {
|
|
764
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h225c842405c0a80f(arg0, arg1, arg2);
|
|
839
765
|
}
|
|
840
766
|
|
|
841
767
|
function wasm_bindgen__convert__closures_____invoke__h0d59e9d6e6af2fb0(arg0, arg1, arg2, arg3) {
|
|
@@ -991,13 +917,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
991
917
|
return real;
|
|
992
918
|
}
|
|
993
919
|
|
|
994
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
995
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
996
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
997
|
-
WASM_VECTOR_LEN = arg.length;
|
|
998
|
-
return ptr;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
920
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
1002
921
|
if (realloc === undefined) {
|
|
1003
922
|
const buf = cachedTextEncoder.encode(arg);
|
package/diaryx_wasm_bg.wasm
CHANGED
|
Binary file
|
package/diaryx_wasm_bg.wasm.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export const diaryxbackend_getConfig: (a: number) => any;
|
|
|
14
14
|
export const diaryxbackend_hasNativeSync: (a: number) => number;
|
|
15
15
|
export const diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
16
16
|
export const diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
17
|
-
export const diaryxbackend_parseDayOneJson: (a: number, b: number, c: number) => [number, number, number, number];
|
|
18
|
-
export const diaryxbackend_parseMarkdownFile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
19
17
|
export const diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
20
18
|
export const diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
21
19
|
export const diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
@@ -26,9 +24,9 @@ export const now_timestamp: () => [number, number];
|
|
|
26
24
|
export const today_formatted: (a: number, b: number) => [number, number];
|
|
27
25
|
export const diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
28
26
|
export const init: () => void;
|
|
29
|
-
export const
|
|
27
|
+
export const wasm_bindgen__closure__destroy__h88c09826c7bdcc04: (a: number, b: number) => void;
|
|
30
28
|
export const wasm_bindgen__convert__closures_____invoke__h0d59e9d6e6af2fb0: (a: number, b: number, c: any, d: any) => void;
|
|
31
|
-
export const
|
|
29
|
+
export const wasm_bindgen__convert__closures_____invoke__h225c842405c0a80f: (a: number, b: number, c: any) => void;
|
|
32
30
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
33
31
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
34
32
|
export const __wbindgen_exn_store: (a: number) => void;
|
package/package.json
CHANGED