@primate/go 0.1.6 → 0.2.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.
@@ -0,0 +1,502 @@
1
+ // Copyright 2018 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+ export default () => {
5
+ const enosys = () => {
6
+ const err = new Error("not implemented");
7
+ err.code = "ENOSYS";
8
+ return err;
9
+ };
10
+ if (!globalThis.fs) {
11
+ let outputBuf = "";
12
+ globalThis.fs = {
13
+ constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
14
+ writeSync(fd, buf) {
15
+ outputBuf += decoder.decode(buf);
16
+ const nl = outputBuf.lastIndexOf("\n");
17
+ if (nl != -1) {
18
+ console.log(outputBuf.substring(0, nl));
19
+ outputBuf = outputBuf.substring(nl + 1);
20
+ }
21
+ return buf.length;
22
+ },
23
+ write(fd, buf, offset, length, position, callback) {
24
+ if (offset !== 0 || length !== buf.length || position !== null) {
25
+ callback(enosys());
26
+ return;
27
+ }
28
+ const n = this.writeSync(fd, buf);
29
+ callback(null, n);
30
+ },
31
+ chmod(path, mode, callback) { callback(enosys()); },
32
+ chown(path, uid, gid, callback) { callback(enosys()); },
33
+ close(fd, callback) { callback(enosys()); },
34
+ fchmod(fd, mode, callback) { callback(enosys()); },
35
+ fchown(fd, uid, gid, callback) { callback(enosys()); },
36
+ fstat(fd, callback) { callback(enosys()); },
37
+ fsync(fd, callback) { callback(null); },
38
+ ftruncate(fd, length, callback) { callback(enosys()); },
39
+ lchown(path, uid, gid, callback) { callback(enosys()); },
40
+ link(path, link, callback) { callback(enosys()); },
41
+ lstat(path, callback) { callback(enosys()); },
42
+ mkdir(path, perm, callback) { callback(enosys()); },
43
+ open(path, flags, mode, callback) { callback(enosys()); },
44
+ read(fd, buffer, offset, length, position, callback) { callback(enosys()); },
45
+ readdir(path, callback) { callback(enosys()); },
46
+ readlink(path, callback) { callback(enosys()); },
47
+ rename(from, to, callback) { callback(enosys()); },
48
+ rmdir(path, callback) { callback(enosys()); },
49
+ stat(path, callback) { callback(enosys()); },
50
+ symlink(path, link, callback) { callback(enosys()); },
51
+ truncate(path, length, callback) { callback(enosys()); },
52
+ unlink(path, callback) { callback(enosys()); },
53
+ utimes(path, atime, mtime, callback) { callback(enosys()); },
54
+ };
55
+ }
56
+ if (!globalThis.process) {
57
+ globalThis.process = {
58
+ getuid() { return -1; },
59
+ getgid() { return -1; },
60
+ geteuid() { return -1; },
61
+ getegid() { return -1; },
62
+ getgroups() { throw enosys(); },
63
+ pid: -1,
64
+ ppid: -1,
65
+ umask() { throw enosys(); },
66
+ cwd() { throw enosys(); },
67
+ chdir() { throw enosys(); },
68
+ };
69
+ }
70
+ if (!globalThis.crypto) {
71
+ throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
72
+ }
73
+ if (!globalThis.performance) {
74
+ throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");
75
+ }
76
+ if (!globalThis.TextEncoder) {
77
+ throw new Error("globalThis.TextEncoder is not available, polyfill required");
78
+ }
79
+ if (!globalThis.TextDecoder) {
80
+ throw new Error("globalThis.TextDecoder is not available, polyfill required");
81
+ }
82
+ const encoder = new TextEncoder("utf-8");
83
+ const decoder = new TextDecoder("utf-8");
84
+ globalThis.Go = class {
85
+ constructor() {
86
+ this.argv = ["js"];
87
+ this.env = {};
88
+ this.exit = (code) => {
89
+ if (code !== 0) {
90
+ console.warn("exit code:", code);
91
+ }
92
+ };
93
+ this._exitPromise = new Promise((resolve) => {
94
+ this._resolveExitPromise = resolve;
95
+ });
96
+ this._pendingEvent = null;
97
+ this._scheduledTimeouts = new Map();
98
+ this._nextCallbackTimeoutID = 1;
99
+ const setInt64 = (addr, v) => {
100
+ this.mem.setUint32(addr + 0, v, true);
101
+ this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
102
+ };
103
+ const setInt32 = (addr, v) => {
104
+ this.mem.setUint32(addr + 0, v, true);
105
+ };
106
+ const getInt64 = (addr) => {
107
+ const low = this.mem.getUint32(addr + 0, true);
108
+ const high = this.mem.getInt32(addr + 4, true);
109
+ return low + high * 4294967296;
110
+ };
111
+ const loadValue = (addr) => {
112
+ const f = this.mem.getFloat64(addr, true);
113
+ if (f === 0) {
114
+ return undefined;
115
+ }
116
+ if (!isNaN(f)) {
117
+ return f;
118
+ }
119
+ const id = this.mem.getUint32(addr, true);
120
+ return this._values[id];
121
+ };
122
+ const storeValue = (addr, v) => {
123
+ const nanHead = 0x7FF80000;
124
+ if (typeof v === "number" && v !== 0) {
125
+ if (isNaN(v)) {
126
+ this.mem.setUint32(addr + 4, nanHead, true);
127
+ this.mem.setUint32(addr, 0, true);
128
+ return;
129
+ }
130
+ this.mem.setFloat64(addr, v, true);
131
+ return;
132
+ }
133
+ if (v === undefined) {
134
+ this.mem.setFloat64(addr, 0, true);
135
+ return;
136
+ }
137
+ let id = this._ids.get(v);
138
+ if (id === undefined) {
139
+ id = this._idPool.pop();
140
+ if (id === undefined) {
141
+ id = this._values.length;
142
+ }
143
+ this._values[id] = v;
144
+ this._goRefCounts[id] = 0;
145
+ this._ids.set(v, id);
146
+ }
147
+ this._goRefCounts[id]++;
148
+ let typeFlag = 0;
149
+ switch (typeof v) {
150
+ case "object":
151
+ if (v !== null) {
152
+ typeFlag = 1;
153
+ }
154
+ break;
155
+ case "string":
156
+ typeFlag = 2;
157
+ break;
158
+ case "symbol":
159
+ typeFlag = 3;
160
+ break;
161
+ case "function":
162
+ typeFlag = 4;
163
+ break;
164
+ }
165
+ this.mem.setUint32(addr + 4, nanHead | typeFlag, true);
166
+ this.mem.setUint32(addr, id, true);
167
+ };
168
+ const loadSlice = (addr) => {
169
+ const array = getInt64(addr + 0);
170
+ const len = getInt64(addr + 8);
171
+ return new Uint8Array(this._inst.exports.mem.buffer, array, len);
172
+ };
173
+ const loadSliceOfValues = (addr) => {
174
+ const array = getInt64(addr + 0);
175
+ const len = getInt64(addr + 8);
176
+ const a = new Array(len);
177
+ for (let i = 0; i < len; i++) {
178
+ a[i] = loadValue(array + i * 8);
179
+ }
180
+ return a;
181
+ };
182
+ const loadString = (addr) => {
183
+ const saddr = getInt64(addr + 0);
184
+ const len = getInt64(addr + 8);
185
+ return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));
186
+ };
187
+ const timeOrigin = Date.now() - performance.now();
188
+ this.importObject = {
189
+ _gotest: {
190
+ add: (a, b) => a + b,
191
+ },
192
+ gojs: {
193
+ // Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
194
+ // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
195
+ // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
196
+ // This changes the SP, thus we have to update the SP used by the imported function.
197
+ // func wasmExit(code int32)
198
+ "runtime.wasmExit": (sp) => {
199
+ sp >>>= 0;
200
+ const code = this.mem.getInt32(sp + 8, true);
201
+ this.exited = true;
202
+ delete this._inst;
203
+ delete this._values;
204
+ delete this._goRefCounts;
205
+ delete this._ids;
206
+ delete this._idPool;
207
+ this.exit(code);
208
+ },
209
+ // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)
210
+ "runtime.wasmWrite": (sp) => {
211
+ sp >>>= 0;
212
+ const fd = getInt64(sp + 8);
213
+ const p = getInt64(sp + 16);
214
+ const n = this.mem.getInt32(sp + 24, true);
215
+ fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));
216
+ },
217
+ // func resetMemoryDataView()
218
+ "runtime.resetMemoryDataView": (sp) => {
219
+ sp >>>= 0;
220
+ this.mem = new DataView(this._inst.exports.mem.buffer);
221
+ },
222
+ // func nanotime1() int64
223
+ "runtime.nanotime1": (sp) => {
224
+ sp >>>= 0;
225
+ setInt64(sp + 8, (timeOrigin + performance.now()) * 1000000);
226
+ },
227
+ // func walltime() (sec int64, nsec int32)
228
+ "runtime.walltime": (sp) => {
229
+ sp >>>= 0;
230
+ const msec = (new Date).getTime();
231
+ setInt64(sp + 8, msec / 1000);
232
+ this.mem.setInt32(sp + 16, (msec % 1000) * 1000000, true);
233
+ },
234
+ // func scheduleTimeoutEvent(delay int64) int32
235
+ "runtime.scheduleTimeoutEvent": (sp) => {
236
+ sp >>>= 0;
237
+ const id = this._nextCallbackTimeoutID;
238
+ this._nextCallbackTimeoutID++;
239
+ this._scheduledTimeouts.set(id, setTimeout(() => {
240
+ this._resume();
241
+ while (this._scheduledTimeouts.has(id)) {
242
+ // for some reason Go failed to register the timeout event, log and try again
243
+ // (temporary workaround for https://github.com/golang/go/issues/28975)
244
+ console.warn("scheduleTimeoutEvent: missed timeout event");
245
+ this._resume();
246
+ }
247
+ }, getInt64(sp + 8)));
248
+ this.mem.setInt32(sp + 16, id, true);
249
+ },
250
+ // func clearTimeoutEvent(id int32)
251
+ "runtime.clearTimeoutEvent": (sp) => {
252
+ sp >>>= 0;
253
+ const id = this.mem.getInt32(sp + 8, true);
254
+ clearTimeout(this._scheduledTimeouts.get(id));
255
+ this._scheduledTimeouts.delete(id);
256
+ },
257
+ // func getRandomData(r []byte)
258
+ "runtime.getRandomData": (sp) => {
259
+ sp >>>= 0;
260
+ crypto.getRandomValues(loadSlice(sp + 8));
261
+ },
262
+ // func finalizeRef(v ref)
263
+ "syscall/js.finalizeRef": (sp) => {
264
+ sp >>>= 0;
265
+ const id = this.mem.getUint32(sp + 8, true);
266
+ this._goRefCounts[id]--;
267
+ if (this._goRefCounts[id] === 0) {
268
+ const v = this._values[id];
269
+ this._values[id] = null;
270
+ this._ids.delete(v);
271
+ this._idPool.push(id);
272
+ }
273
+ },
274
+ // func stringVal(value string) ref
275
+ "syscall/js.stringVal": (sp) => {
276
+ sp >>>= 0;
277
+ storeValue(sp + 24, loadString(sp + 8));
278
+ },
279
+ // func valueGet(v ref, p string) ref
280
+ "syscall/js.valueGet": (sp) => {
281
+ sp >>>= 0;
282
+ const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));
283
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
284
+ storeValue(sp + 32, result);
285
+ },
286
+ // func valueSet(v ref, p string, x ref)
287
+ "syscall/js.valueSet": (sp) => {
288
+ sp >>>= 0;
289
+ Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));
290
+ },
291
+ // func valueDelete(v ref, p string)
292
+ "syscall/js.valueDelete": (sp) => {
293
+ sp >>>= 0;
294
+ Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));
295
+ },
296
+ // func valueIndex(v ref, i int) ref
297
+ "syscall/js.valueIndex": (sp) => {
298
+ sp >>>= 0;
299
+ storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));
300
+ },
301
+ // valueSetIndex(v ref, i int, x ref)
302
+ "syscall/js.valueSetIndex": (sp) => {
303
+ sp >>>= 0;
304
+ Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));
305
+ },
306
+ // func valueCall(v ref, m string, args []ref) (ref, bool)
307
+ "syscall/js.valueCall": (sp) => {
308
+ sp >>>= 0;
309
+ try {
310
+ const v = loadValue(sp + 8);
311
+ const m = Reflect.get(v, loadString(sp + 16));
312
+ const args = loadSliceOfValues(sp + 32);
313
+ const result = Reflect.apply(m, v, args);
314
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
315
+ storeValue(sp + 56, result);
316
+ this.mem.setUint8(sp + 64, 1);
317
+ }
318
+ catch (err) {
319
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
320
+ storeValue(sp + 56, err);
321
+ this.mem.setUint8(sp + 64, 0);
322
+ }
323
+ },
324
+ // func valueInvoke(v ref, args []ref) (ref, bool)
325
+ "syscall/js.valueInvoke": (sp) => {
326
+ sp >>>= 0;
327
+ try {
328
+ const v = loadValue(sp + 8);
329
+ const args = loadSliceOfValues(sp + 16);
330
+ const result = Reflect.apply(v, undefined, args);
331
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
332
+ storeValue(sp + 40, result);
333
+ this.mem.setUint8(sp + 48, 1);
334
+ }
335
+ catch (err) {
336
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
337
+ storeValue(sp + 40, err);
338
+ this.mem.setUint8(sp + 48, 0);
339
+ }
340
+ },
341
+ // func valueNew(v ref, args []ref) (ref, bool)
342
+ "syscall/js.valueNew": (sp) => {
343
+ sp >>>= 0;
344
+ try {
345
+ const v = loadValue(sp + 8);
346
+ const args = loadSliceOfValues(sp + 16);
347
+ const result = Reflect.construct(v, args);
348
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
349
+ storeValue(sp + 40, result);
350
+ this.mem.setUint8(sp + 48, 1);
351
+ }
352
+ catch (err) {
353
+ sp = this._inst.exports.getsp() >>> 0; // see comment above
354
+ storeValue(sp + 40, err);
355
+ this.mem.setUint8(sp + 48, 0);
356
+ }
357
+ },
358
+ // func valueLength(v ref) int
359
+ "syscall/js.valueLength": (sp) => {
360
+ sp >>>= 0;
361
+ setInt64(sp + 16, parseInt(loadValue(sp + 8).length));
362
+ },
363
+ // valuePrepareString(v ref) (ref, int)
364
+ "syscall/js.valuePrepareString": (sp) => {
365
+ sp >>>= 0;
366
+ const str = encoder.encode(String(loadValue(sp + 8)));
367
+ storeValue(sp + 16, str);
368
+ setInt64(sp + 24, str.length);
369
+ },
370
+ // valueLoadString(v ref, b []byte)
371
+ "syscall/js.valueLoadString": (sp) => {
372
+ sp >>>= 0;
373
+ const str = loadValue(sp + 8);
374
+ loadSlice(sp + 16).set(str);
375
+ },
376
+ // func valueInstanceOf(v ref, t ref) bool
377
+ "syscall/js.valueInstanceOf": (sp) => {
378
+ sp >>>= 0;
379
+ this.mem.setUint8(sp + 24, (loadValue(sp + 8) instanceof loadValue(sp + 16)) ? 1 : 0);
380
+ },
381
+ // func copyBytesToGo(dst []byte, src ref) (int, bool)
382
+ "syscall/js.copyBytesToGo": (sp) => {
383
+ sp >>>= 0;
384
+ const dst = loadSlice(sp + 8);
385
+ const src = loadValue(sp + 32);
386
+ if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {
387
+ this.mem.setUint8(sp + 48, 0);
388
+ return;
389
+ }
390
+ const toCopy = src.subarray(0, dst.length);
391
+ dst.set(toCopy);
392
+ setInt64(sp + 40, toCopy.length);
393
+ this.mem.setUint8(sp + 48, 1);
394
+ },
395
+ // func copyBytesToJS(dst ref, src []byte) (int, bool)
396
+ "syscall/js.copyBytesToJS": (sp) => {
397
+ sp >>>= 0;
398
+ const dst = loadValue(sp + 8);
399
+ const src = loadSlice(sp + 16);
400
+ if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {
401
+ this.mem.setUint8(sp + 48, 0);
402
+ return;
403
+ }
404
+ const toCopy = src.subarray(0, dst.length);
405
+ dst.set(toCopy);
406
+ setInt64(sp + 40, toCopy.length);
407
+ this.mem.setUint8(sp + 48, 1);
408
+ },
409
+ "debug": (value) => {
410
+ console.log(value);
411
+ },
412
+ },
413
+ };
414
+ }
415
+ async run(instance) {
416
+ if (!(instance instanceof WebAssembly.Instance)) {
417
+ throw new Error("Go.run: WebAssembly.Instance expected");
418
+ }
419
+ this._inst = instance;
420
+ this.mem = new DataView(this._inst.exports.mem.buffer);
421
+ this._values = [
422
+ NaN,
423
+ 0,
424
+ null,
425
+ true,
426
+ false,
427
+ globalThis,
428
+ this,
429
+ ];
430
+ this._goRefCounts = new Array(this._values.length).fill(Infinity); // number of references that Go has to a JS value, indexed by reference id
431
+ this._ids = new Map([
432
+ [0, 1],
433
+ [null, 2],
434
+ [true, 3],
435
+ [false, 4],
436
+ [globalThis, 5],
437
+ [this, 6],
438
+ ]);
439
+ this._idPool = []; // unused ids that have been garbage collected
440
+ this.exited = false; // whether the Go program has exited
441
+ // Pass command line arguments and environment variables to WebAssembly by writing them to the linear memory.
442
+ let offset = 4096;
443
+ const strPtr = (str) => {
444
+ const ptr = offset;
445
+ const bytes = encoder.encode(str + "\0");
446
+ new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);
447
+ offset += bytes.length;
448
+ if (offset % 8 !== 0) {
449
+ offset += 8 - (offset % 8);
450
+ }
451
+ return ptr;
452
+ };
453
+ const argc = this.argv.length;
454
+ const argvPtrs = [];
455
+ this.argv.forEach((arg) => {
456
+ argvPtrs.push(strPtr(arg));
457
+ });
458
+ argvPtrs.push(0);
459
+ const keys = Object.keys(this.env).sort();
460
+ keys.forEach((key) => {
461
+ argvPtrs.push(strPtr(`${key}=${this.env[key]}`));
462
+ });
463
+ argvPtrs.push(0);
464
+ const argv = offset;
465
+ argvPtrs.forEach((ptr) => {
466
+ this.mem.setUint32(offset, ptr, true);
467
+ this.mem.setUint32(offset + 4, 0, true);
468
+ offset += 8;
469
+ });
470
+ // The linker guarantees global data starts from at least wasmMinDataAddr.
471
+ // Keep in sync with cmd/link/internal/ld/data.go:wasmMinDataAddr.
472
+ const wasmMinDataAddr = 4096 + 8192;
473
+ if (offset >= wasmMinDataAddr) {
474
+ throw new Error("total length of command line and environment variables exceeds limit");
475
+ }
476
+ this._inst.exports.run(argc, argv);
477
+ if (this.exited) {
478
+ this._resolveExitPromise();
479
+ }
480
+ await this._exitPromise;
481
+ }
482
+ _resume() {
483
+ if (this.exited) {
484
+ throw new Error("Go program has already exited");
485
+ }
486
+ this._inst.exports.resume();
487
+ if (this.exited) {
488
+ this._resolveExitPromise();
489
+ }
490
+ }
491
+ _makeFuncWrapper(id) {
492
+ const go = this;
493
+ return function () {
494
+ const event = { id: id, this: this, args: arguments };
495
+ go._pendingEvent = event;
496
+ go._resume();
497
+ return event.result;
498
+ };
499
+ }
500
+ };
501
+ };
502
+ //# sourceMappingURL=wasm_exec.js.map
@@ -0,0 +1,4 @@
1
+ import Default from "#Default";
2
+ declare const _default: (options?: typeof Default.input) => Default;
3
+ export default _default;
4
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1,3 @@
1
+ import Default from "#Default";
2
+ export default (options) => new Default(options);
3
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#vendored/wasm_exec";
2
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#vendored/wasm_exec";
2
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1,4 @@
1
+ import Runtime from "#Runtime";
2
+ declare const _default: (options?: typeof Runtime.input) => Runtime;
3
+ export default _default;
4
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1,3 @@
1
+ import Runtime from "#Runtime";
2
+ export default (options) => new Runtime(options);
3
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#to-request";
2
+ //# sourceMappingURL=to-request.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#to-request";
2
+ //# sourceMappingURL=to-request.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#to-response";
2
+ //# sourceMappingURL=to-response.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#to-response";
2
+ //# sourceMappingURL=to-response.js.map
package/package.json CHANGED
@@ -1,52 +1,53 @@
1
1
  {
2
2
  "name": "@primate/go",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "description": "Primate Go backend",
5
- "homepage": "https://primatejs.com/modules/go",
6
- "bugs": "https://github.com/primatejs/primate/issues",
5
+ "homepage": "https://primate.run/docs/backend/go",
6
+ "bugs": "https://github.com/primate-run/primate/issues",
7
7
  "license": "MIT",
8
8
  "files": [
9
- "src/**/*.js",
10
- "!src/**/*.spec.js",
11
- "src/**/*.go",
12
- "src/**/*.sum",
13
- "src/**/*.mod"
9
+ "/lib/**/*.js",
10
+ "/lib/**/*.d.ts",
11
+ "!/**/*.spec.*"
14
12
  ],
15
13
  "repository": {
16
14
  "type": "git",
17
- "url": "https://github.com/primatejs/primate",
15
+ "url": "https://github.com/primate-run/primate",
18
16
  "directory": "packages/go"
19
17
  },
20
18
  "dependencies": {
21
- "@rcompat/cli": "^0.5.1",
22
- "@rcompat/env": "^0.4.0",
23
- "@rcompat/fs": "^0.7.0",
24
- "@rcompat/invariant": "^0.5.0",
25
- "@rcompat/object": "^0.5.0",
26
- "@rcompat/runtime": "^0.1.0",
27
- "@rcompat/stdio": "^0.6.0",
28
- "@rcompat/string": "^0.4.0",
29
- "@primate/core": "^0.1.10"
19
+ "@rcompat/assert": "^0.3.1",
20
+ "@rcompat/cli": "^0.11.3",
21
+ "@rcompat/env": "^0.9.0",
22
+ "@rcompat/fs": "^0.21.1",
23
+ "@rcompat/runtime": "^0.6.0",
24
+ "@rcompat/stdio": "^0.12.2",
25
+ "@rcompat/string": "^0.10.0",
26
+ "@primate/core": "^0.2.0"
30
27
  },
31
28
  "peerDependencies": {
32
- "primate": "^0.32.6"
29
+ "primate": "^0.33.0"
33
30
  },
34
31
  "type": "module",
35
32
  "imports": {
36
33
  "#*": {
37
- "livetypes": "./src/private/*.js",
38
- "default": "./src/private/*.js"
39
- },
40
- "#error/*": {
41
- "livetypes": "./src/private/error/*.js",
42
- "default": "./src/private/error/*.js"
34
+ "apekit": "./src/private/*.ts",
35
+ "default": "./lib/private/*.js"
43
36
  }
44
37
  },
45
38
  "exports": {
46
39
  ".": {
47
- "runtime": "./src/runtime.js",
48
- "default": "./src/default.js"
40
+ "runtime": "./lib/public/runtime.js",
41
+ "default": "./lib/public/default.js"
49
42
  },
50
- "./*": "./src/*.js"
43
+ "./*": {
44
+ "apekit": "./src/public/*.ts",
45
+ "default": "./lib/public/*.js"
46
+ }
47
+ },
48
+ "scripts": {
49
+ "build": "npm run clean && tsc",
50
+ "clean": "rm -rf ./lib",
51
+ "lint": "eslint ."
51
52
  }
52
53
  }
package/src/default.js DELETED
@@ -1,12 +0,0 @@
1
- import build from "#build";
2
- import default_extension from "#extension";
3
- import pkgname from "#pkgname";
4
-
5
- export default ({ extension = default_extension } = {}) => ({
6
- name: pkgname,
7
- build: build({ extension }),
8
- init(app, next) {
9
- app.bind(extension, () => null);
10
- return next(app);
11
- },
12
- });
package/src/env.js DELETED
@@ -1 +0,0 @@
1
- export { default } from "./vendored/wasm_exec.js";