hron-wasm 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 +21 -0
- package/README.md +45 -0
- package/hron_wasm.d.ts +45 -0
- package/hron_wasm.js +9 -0
- package/hron_wasm_bg.js +363 -0
- package/hron_wasm_bg.wasm +0 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Prasanna Ram Venkatachalam
|
|
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,45 @@
|
|
|
1
|
+
# hron-wasm
|
|
2
|
+
|
|
3
|
+
WASM bindings for [hron](https://github.com/prasrvenkat/hron) — human-readable cron expressions for JavaScript/TypeScript via WebAssembly.
|
|
4
|
+
|
|
5
|
+
For a native TypeScript implementation (no WASM), see [`hron-ts`](https://github.com/prasrvenkat/hron/tree/main/ts).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install hron-wasm
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { Schedule, fromCron } from "hron-wasm";
|
|
17
|
+
|
|
18
|
+
// Parse an expression
|
|
19
|
+
const schedule = Schedule.parse("every weekday at 9:00 in America/New_York");
|
|
20
|
+
|
|
21
|
+
// Next occurrence (ISO string, UTC)
|
|
22
|
+
const next = schedule.next();
|
|
23
|
+
|
|
24
|
+
// Next N occurrences
|
|
25
|
+
const nextFive = schedule.nextN(5);
|
|
26
|
+
|
|
27
|
+
// Convert to cron
|
|
28
|
+
const cron = schedule.toCron();
|
|
29
|
+
|
|
30
|
+
// Convert from cron
|
|
31
|
+
const fromCronSchedule = fromCron("0 9 * * *");
|
|
32
|
+
|
|
33
|
+
// Structured JSON
|
|
34
|
+
const json = schedule.toJSON();
|
|
35
|
+
|
|
36
|
+
// Canonical string
|
|
37
|
+
const str = schedule.toString();
|
|
38
|
+
|
|
39
|
+
// Validate
|
|
40
|
+
const valid = Schedule.validate("every day at 9:00");
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/hron_wasm.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A parsed hron schedule, usable from JavaScript.
|
|
6
|
+
*/
|
|
7
|
+
export class Schedule {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get the next occurrence as an ISO string.
|
|
13
|
+
* Uses UTC as the default timezone in WASM.
|
|
14
|
+
*/
|
|
15
|
+
next(): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Get the next N occurrences as an array of ISO strings.
|
|
18
|
+
*/
|
|
19
|
+
nextN(n: number): any;
|
|
20
|
+
/**
|
|
21
|
+
* Parse an hron expression string.
|
|
22
|
+
*/
|
|
23
|
+
static parse(input: string): Schedule;
|
|
24
|
+
/**
|
|
25
|
+
* Convert this schedule to a cron expression (if possible).
|
|
26
|
+
*/
|
|
27
|
+
toCron(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get the structured JSON representation.
|
|
30
|
+
*/
|
|
31
|
+
toJSON(): any;
|
|
32
|
+
/**
|
|
33
|
+
* Get the display string.
|
|
34
|
+
*/
|
|
35
|
+
toString(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Validate an expression (returns true if valid).
|
|
38
|
+
*/
|
|
39
|
+
static validate(input: string): boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Parse a cron expression and return an hron Schedule.
|
|
44
|
+
*/
|
|
45
|
+
export function fromCron(cron_expr: string): Schedule;
|
package/hron_wasm.js
ADDED
package/hron_wasm_bg.js
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A parsed hron schedule, usable from JavaScript.
|
|
3
|
+
*/
|
|
4
|
+
export class Schedule {
|
|
5
|
+
static __wrap(ptr) {
|
|
6
|
+
ptr = ptr >>> 0;
|
|
7
|
+
const obj = Object.create(Schedule.prototype);
|
|
8
|
+
obj.__wbg_ptr = ptr;
|
|
9
|
+
ScheduleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
__destroy_into_raw() {
|
|
13
|
+
const ptr = this.__wbg_ptr;
|
|
14
|
+
this.__wbg_ptr = 0;
|
|
15
|
+
ScheduleFinalization.unregister(this);
|
|
16
|
+
return ptr;
|
|
17
|
+
}
|
|
18
|
+
free() {
|
|
19
|
+
const ptr = this.__destroy_into_raw();
|
|
20
|
+
wasm.__wbg_schedule_free(ptr, 0);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the next occurrence as an ISO string.
|
|
24
|
+
* Uses UTC as the default timezone in WASM.
|
|
25
|
+
* @returns {string | undefined}
|
|
26
|
+
*/
|
|
27
|
+
next() {
|
|
28
|
+
const ret = wasm.schedule_next(this.__wbg_ptr);
|
|
29
|
+
if (ret[3]) {
|
|
30
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
31
|
+
}
|
|
32
|
+
let v1;
|
|
33
|
+
if (ret[0] !== 0) {
|
|
34
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
35
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
36
|
+
}
|
|
37
|
+
return v1;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get the next N occurrences as an array of ISO strings.
|
|
41
|
+
* @param {number} n
|
|
42
|
+
* @returns {any}
|
|
43
|
+
*/
|
|
44
|
+
nextN(n) {
|
|
45
|
+
const ret = wasm.schedule_nextN(this.__wbg_ptr, n);
|
|
46
|
+
if (ret[2]) {
|
|
47
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
48
|
+
}
|
|
49
|
+
return takeFromExternrefTable0(ret[0]);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parse an hron expression string.
|
|
53
|
+
* @param {string} input
|
|
54
|
+
* @returns {Schedule}
|
|
55
|
+
*/
|
|
56
|
+
static parse(input) {
|
|
57
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
58
|
+
const len0 = WASM_VECTOR_LEN;
|
|
59
|
+
const ret = wasm.schedule_parse(ptr0, len0);
|
|
60
|
+
if (ret[2]) {
|
|
61
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
62
|
+
}
|
|
63
|
+
return Schedule.__wrap(ret[0]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Convert this schedule to a cron expression (if possible).
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
toCron() {
|
|
70
|
+
let deferred2_0;
|
|
71
|
+
let deferred2_1;
|
|
72
|
+
try {
|
|
73
|
+
const ret = wasm.schedule_toCron(this.__wbg_ptr);
|
|
74
|
+
var ptr1 = ret[0];
|
|
75
|
+
var len1 = ret[1];
|
|
76
|
+
if (ret[3]) {
|
|
77
|
+
ptr1 = 0; len1 = 0;
|
|
78
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
79
|
+
}
|
|
80
|
+
deferred2_0 = ptr1;
|
|
81
|
+
deferred2_1 = len1;
|
|
82
|
+
return getStringFromWasm0(ptr1, len1);
|
|
83
|
+
} finally {
|
|
84
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get the structured JSON representation.
|
|
89
|
+
* @returns {any}
|
|
90
|
+
*/
|
|
91
|
+
toJSON() {
|
|
92
|
+
const ret = wasm.schedule_toJSON(this.__wbg_ptr);
|
|
93
|
+
if (ret[2]) {
|
|
94
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
95
|
+
}
|
|
96
|
+
return takeFromExternrefTable0(ret[0]);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the display string.
|
|
100
|
+
* @returns {string}
|
|
101
|
+
*/
|
|
102
|
+
toString() {
|
|
103
|
+
let deferred1_0;
|
|
104
|
+
let deferred1_1;
|
|
105
|
+
try {
|
|
106
|
+
const ret = wasm.schedule_toString(this.__wbg_ptr);
|
|
107
|
+
deferred1_0 = ret[0];
|
|
108
|
+
deferred1_1 = ret[1];
|
|
109
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
110
|
+
} finally {
|
|
111
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Validate an expression (returns true if valid).
|
|
116
|
+
* @param {string} input
|
|
117
|
+
* @returns {boolean}
|
|
118
|
+
*/
|
|
119
|
+
static validate(input) {
|
|
120
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
121
|
+
const len0 = WASM_VECTOR_LEN;
|
|
122
|
+
const ret = wasm.schedule_validate(ptr0, len0);
|
|
123
|
+
return ret !== 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (Symbol.dispose) Schedule.prototype[Symbol.dispose] = Schedule.prototype.free;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Parse a cron expression and return an hron Schedule.
|
|
130
|
+
* @param {string} cron_expr
|
|
131
|
+
* @returns {Schedule}
|
|
132
|
+
*/
|
|
133
|
+
export function fromCron(cron_expr) {
|
|
134
|
+
const ptr0 = passStringToWasm0(cron_expr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
135
|
+
const len0 = WASM_VECTOR_LEN;
|
|
136
|
+
const ret = wasm.fromCron(ptr0, len0);
|
|
137
|
+
if (ret[2]) {
|
|
138
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
139
|
+
}
|
|
140
|
+
return Schedule.__wrap(ret[0]);
|
|
141
|
+
}
|
|
142
|
+
export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
|
|
143
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
144
|
+
return ret;
|
|
145
|
+
}
|
|
146
|
+
export function __wbg_Number_04624de7d0e8332d(arg0) {
|
|
147
|
+
const ret = Number(arg0);
|
|
148
|
+
return ret;
|
|
149
|
+
}
|
|
150
|
+
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
151
|
+
const ret = String(arg1);
|
|
152
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
153
|
+
const len1 = WASM_VECTOR_LEN;
|
|
154
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
155
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
156
|
+
}
|
|
157
|
+
export function __wbg___wbindgen_is_string_cd444516edc5b180(arg0) {
|
|
158
|
+
const ret = typeof(arg0) === 'string';
|
|
159
|
+
return ret;
|
|
160
|
+
}
|
|
161
|
+
export function __wbg___wbindgen_string_get_72fb696202c56729(arg0, arg1) {
|
|
162
|
+
const obj = arg1;
|
|
163
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
164
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
165
|
+
var len1 = WASM_VECTOR_LEN;
|
|
166
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
167
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
168
|
+
}
|
|
169
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
170
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
171
|
+
}
|
|
172
|
+
export function __wbg_getTime_1e3cd1391c5c3995(arg0) {
|
|
173
|
+
const ret = arg0.getTime();
|
|
174
|
+
return ret;
|
|
175
|
+
}
|
|
176
|
+
export function __wbg_get_b3ed3ad4be2bc8ac() { return handleError(function (arg0, arg1) {
|
|
177
|
+
const ret = Reflect.get(arg0, arg1);
|
|
178
|
+
return ret;
|
|
179
|
+
}, arguments); }
|
|
180
|
+
export function __wbg_new_0_73afc35eb544e539() {
|
|
181
|
+
const ret = new Date();
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
export function __wbg_new_361308b2356cecd0() {
|
|
185
|
+
const ret = new Object();
|
|
186
|
+
return ret;
|
|
187
|
+
}
|
|
188
|
+
export function __wbg_new_3eb36ae241fe6f44() {
|
|
189
|
+
const ret = new Array();
|
|
190
|
+
return ret;
|
|
191
|
+
}
|
|
192
|
+
export function __wbg_new_c155239f1b113b68(arg0, arg1) {
|
|
193
|
+
const ret = new Intl.DateTimeFormat(arg0, arg1);
|
|
194
|
+
return ret;
|
|
195
|
+
}
|
|
196
|
+
export function __wbg_new_dca287b076112a51() {
|
|
197
|
+
const ret = new Map();
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
export function __wbg_resolvedOptions_4c36dbfa1c4ba2bf(arg0) {
|
|
201
|
+
const ret = arg0.resolvedOptions();
|
|
202
|
+
return ret;
|
|
203
|
+
}
|
|
204
|
+
export function __wbg_set_1eb0999cf5d27fc8(arg0, arg1, arg2) {
|
|
205
|
+
const ret = arg0.set(arg1, arg2);
|
|
206
|
+
return ret;
|
|
207
|
+
}
|
|
208
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
209
|
+
arg0[arg1] = arg2;
|
|
210
|
+
}
|
|
211
|
+
export function __wbg_set_f43e577aea94465b(arg0, arg1, arg2) {
|
|
212
|
+
arg0[arg1 >>> 0] = arg2;
|
|
213
|
+
}
|
|
214
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
215
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
216
|
+
const ret = arg0;
|
|
217
|
+
return ret;
|
|
218
|
+
}
|
|
219
|
+
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
220
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
221
|
+
const ret = arg0;
|
|
222
|
+
return ret;
|
|
223
|
+
}
|
|
224
|
+
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
225
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
226
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
227
|
+
return ret;
|
|
228
|
+
}
|
|
229
|
+
export function __wbindgen_cast_0000000000000004(arg0) {
|
|
230
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
231
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
232
|
+
return ret;
|
|
233
|
+
}
|
|
234
|
+
export function __wbindgen_init_externref_table() {
|
|
235
|
+
const table = wasm.__wbindgen_externrefs;
|
|
236
|
+
const offset = table.grow(4);
|
|
237
|
+
table.set(0, undefined);
|
|
238
|
+
table.set(offset + 0, undefined);
|
|
239
|
+
table.set(offset + 1, null);
|
|
240
|
+
table.set(offset + 2, true);
|
|
241
|
+
table.set(offset + 3, false);
|
|
242
|
+
}
|
|
243
|
+
const ScheduleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
244
|
+
? { register: () => {}, unregister: () => {} }
|
|
245
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_schedule_free(ptr >>> 0, 1));
|
|
246
|
+
|
|
247
|
+
function addToExternrefTable0(obj) {
|
|
248
|
+
const idx = wasm.__externref_table_alloc();
|
|
249
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
250
|
+
return idx;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
let cachedDataViewMemory0 = null;
|
|
254
|
+
function getDataViewMemory0() {
|
|
255
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
256
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
257
|
+
}
|
|
258
|
+
return cachedDataViewMemory0;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function getStringFromWasm0(ptr, len) {
|
|
262
|
+
ptr = ptr >>> 0;
|
|
263
|
+
return decodeText(ptr, len);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
let cachedUint8ArrayMemory0 = null;
|
|
267
|
+
function getUint8ArrayMemory0() {
|
|
268
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
269
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
270
|
+
}
|
|
271
|
+
return cachedUint8ArrayMemory0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function handleError(f, args) {
|
|
275
|
+
try {
|
|
276
|
+
return f.apply(this, args);
|
|
277
|
+
} catch (e) {
|
|
278
|
+
const idx = addToExternrefTable0(e);
|
|
279
|
+
wasm.__wbindgen_exn_store(idx);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function isLikeNone(x) {
|
|
284
|
+
return x === undefined || x === null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
288
|
+
if (realloc === undefined) {
|
|
289
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
290
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
291
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
292
|
+
WASM_VECTOR_LEN = buf.length;
|
|
293
|
+
return ptr;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
let len = arg.length;
|
|
297
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
298
|
+
|
|
299
|
+
const mem = getUint8ArrayMemory0();
|
|
300
|
+
|
|
301
|
+
let offset = 0;
|
|
302
|
+
|
|
303
|
+
for (; offset < len; offset++) {
|
|
304
|
+
const code = arg.charCodeAt(offset);
|
|
305
|
+
if (code > 0x7F) break;
|
|
306
|
+
mem[ptr + offset] = code;
|
|
307
|
+
}
|
|
308
|
+
if (offset !== len) {
|
|
309
|
+
if (offset !== 0) {
|
|
310
|
+
arg = arg.slice(offset);
|
|
311
|
+
}
|
|
312
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
313
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
314
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
315
|
+
|
|
316
|
+
offset += ret.written;
|
|
317
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
WASM_VECTOR_LEN = offset;
|
|
321
|
+
return ptr;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function takeFromExternrefTable0(idx) {
|
|
325
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
326
|
+
wasm.__externref_table_dealloc(idx);
|
|
327
|
+
return value;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
331
|
+
cachedTextDecoder.decode();
|
|
332
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
333
|
+
let numBytesDecoded = 0;
|
|
334
|
+
function decodeText(ptr, len) {
|
|
335
|
+
numBytesDecoded += len;
|
|
336
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
337
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
338
|
+
cachedTextDecoder.decode();
|
|
339
|
+
numBytesDecoded = len;
|
|
340
|
+
}
|
|
341
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const cachedTextEncoder = new TextEncoder();
|
|
345
|
+
|
|
346
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
347
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
348
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
349
|
+
view.set(buf);
|
|
350
|
+
return {
|
|
351
|
+
read: arg.length,
|
|
352
|
+
written: buf.length
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
let WASM_VECTOR_LEN = 0;
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
let wasm;
|
|
361
|
+
export function __wbg_set_wasm(val) {
|
|
362
|
+
wasm = val;
|
|
363
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hron-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WASM bindings for hron — human-readable cron",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/prasrvenkat/hron"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"hron_wasm_bg.wasm",
|
|
13
|
+
"hron_wasm.js",
|
|
14
|
+
"hron_wasm_bg.js",
|
|
15
|
+
"hron_wasm.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"main": "hron_wasm.js",
|
|
18
|
+
"homepage": "https://github.com/prasrvenkat/hron",
|
|
19
|
+
"types": "hron_wasm.d.ts",
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"./hron_wasm.js",
|
|
22
|
+
"./snippets/*"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"cron",
|
|
26
|
+
"schedule",
|
|
27
|
+
"wasm",
|
|
28
|
+
"human-readable"
|
|
29
|
+
]
|
|
30
|
+
}
|