@spade-lang/spade 0.20.0-dev50.50.eba48a-eba48a → 0.21.0-dev1.1.0052ab-0052ab
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/README.md +1 -1
- package/gen/bundle.js +153 -110
- package/gen/spade.core.wasm +0 -0
- package/gen/spade.core2.wasm +0 -0
- package/gen/spade.core3.wasm +0 -0
- package/gen/spade.core4.wasm +0 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This package provides [Spade][] binaries built for [WebAssembly][]. This is usin
|
|
|
5
5
|
|
|
6
6
|
At the moment, this package only provides an API allowing to run Spade in a virtual filesystem; no binaries are provided.
|
|
7
7
|
|
|
8
|
-
[Spade]: https://
|
|
8
|
+
[Spade]: https://codeberg.org/spade-lang/spade/
|
|
9
9
|
[webassembly]: https://webassembly.org/
|
|
10
10
|
[yowasp]: https://yowasp.github.io/
|
|
11
11
|
|
package/gen/bundle.js
CHANGED
|
@@ -121,8 +121,13 @@ var TerminalInput = class {
|
|
|
121
121
|
};
|
|
122
122
|
var TerminalOutput = class {
|
|
123
123
|
};
|
|
124
|
+
var nextFilesystemId = /* @__PURE__ */ function() {
|
|
125
|
+
let id = 0;
|
|
126
|
+
return () => id++;
|
|
127
|
+
}();
|
|
124
128
|
var File = class {
|
|
125
129
|
constructor(data = "") {
|
|
130
|
+
this.id = nextFilesystemId();
|
|
126
131
|
if (data instanceof Uint8Array) {
|
|
127
132
|
this.data = data;
|
|
128
133
|
} else if (typeof data === "string") {
|
|
@@ -135,40 +140,15 @@ var File = class {
|
|
|
135
140
|
return this.data.length;
|
|
136
141
|
}
|
|
137
142
|
};
|
|
138
|
-
var ReadStream = class extends InputStream {
|
|
139
|
-
constructor(file, offset) {
|
|
140
|
-
super();
|
|
141
|
-
this.file = file;
|
|
142
|
-
this.offset = offset;
|
|
143
|
-
}
|
|
144
|
-
read(len) {
|
|
145
|
-
const data = this.file.data.subarray(Number(this.offset), Number(this.offset + len));
|
|
146
|
-
this.offset += len;
|
|
147
|
-
return data;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
var WriteStream = class extends OutputStream {
|
|
151
|
-
constructor(file, offset) {
|
|
152
|
-
super();
|
|
153
|
-
this.file = file;
|
|
154
|
-
this.offset = offset;
|
|
155
|
-
}
|
|
156
|
-
write(contents) {
|
|
157
|
-
const newData = new Uint8Array(this.file.data.length + contents.length);
|
|
158
|
-
newData.set(this.file.data);
|
|
159
|
-
newData.subarray(Number(this.offset)).set(contents);
|
|
160
|
-
this.file.data = newData;
|
|
161
|
-
this.offset += BigInt(contents.length);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
143
|
var Directory = class _Directory {
|
|
165
144
|
constructor(files = {}) {
|
|
145
|
+
this.id = nextFilesystemId();
|
|
166
146
|
this.files = files;
|
|
167
147
|
}
|
|
168
148
|
get size() {
|
|
169
149
|
return Object.keys(this.files).length;
|
|
170
150
|
}
|
|
171
|
-
traverse(path,
|
|
151
|
+
traverse(path, { create = null, remove = false } = {}) {
|
|
172
152
|
let entry = this;
|
|
173
153
|
let separatorAt = -1;
|
|
174
154
|
do {
|
|
@@ -177,7 +157,7 @@ var Directory = class _Directory {
|
|
|
177
157
|
const files = entry.files;
|
|
178
158
|
separatorAt = path.indexOf("/");
|
|
179
159
|
const segment = separatorAt === -1 ? path : path.substring(0, separatorAt);
|
|
180
|
-
if (separatorAt === -1 &&
|
|
160
|
+
if (separatorAt === -1 && remove)
|
|
181
161
|
delete files[segment];
|
|
182
162
|
else if (segment === "" || segment === ".")
|
|
183
163
|
;
|
|
@@ -185,10 +165,12 @@ var Directory = class _Directory {
|
|
|
185
165
|
;
|
|
186
166
|
else if (Object.hasOwn(files, segment))
|
|
187
167
|
entry = files[segment];
|
|
188
|
-
else if (
|
|
168
|
+
else if (create === "directory" || create !== null && separatorAt !== -1)
|
|
189
169
|
entry = files[segment] = new _Directory({});
|
|
190
|
-
else if (
|
|
170
|
+
else if (create === "file")
|
|
191
171
|
entry = files[segment] = new File(new Uint8Array());
|
|
172
|
+
else if (create instanceof File || create instanceof _Directory)
|
|
173
|
+
entry = files[segment] = create;
|
|
192
174
|
else
|
|
193
175
|
throw "no-entry";
|
|
194
176
|
path = path.substring(separatorAt + 1);
|
|
@@ -196,6 +178,33 @@ var Directory = class _Directory {
|
|
|
196
178
|
return entry;
|
|
197
179
|
}
|
|
198
180
|
};
|
|
181
|
+
var ReadStream = class extends InputStream {
|
|
182
|
+
constructor(file, offset) {
|
|
183
|
+
super();
|
|
184
|
+
this.file = file;
|
|
185
|
+
this.offset = offset;
|
|
186
|
+
}
|
|
187
|
+
read(len) {
|
|
188
|
+
const data = this.file.data.subarray(Number(this.offset), Number(this.offset + len));
|
|
189
|
+
this.offset += len;
|
|
190
|
+
return data;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var WriteStream = class extends OutputStream {
|
|
194
|
+
constructor(file, offset) {
|
|
195
|
+
super();
|
|
196
|
+
this.file = file;
|
|
197
|
+
this.offset = offset;
|
|
198
|
+
}
|
|
199
|
+
write(contents) {
|
|
200
|
+
const offset = Number(this.offset);
|
|
201
|
+
const newData = new Uint8Array(Math.max(this.file.data.length, offset + contents.length));
|
|
202
|
+
newData.set(this.file.data);
|
|
203
|
+
newData.subarray(offset).set(contents);
|
|
204
|
+
this.file.data = newData;
|
|
205
|
+
this.offset += BigInt(contents.length);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
199
208
|
var Descriptor = class _Descriptor {
|
|
200
209
|
constructor(entry) {
|
|
201
210
|
this.entry = entry;
|
|
@@ -210,7 +219,7 @@ var Descriptor = class _Descriptor {
|
|
|
210
219
|
return {};
|
|
211
220
|
}
|
|
212
221
|
metadataHash() {
|
|
213
|
-
return { upper: 0, lower:
|
|
222
|
+
return { upper: 0, lower: this.entry.id };
|
|
214
223
|
}
|
|
215
224
|
metadataHashAt(_pathFlags, path) {
|
|
216
225
|
if (!(this.entry instanceof Directory))
|
|
@@ -242,7 +251,7 @@ var Descriptor = class _Descriptor {
|
|
|
242
251
|
openAt(_pathFlags, path, openFlags, _descriptorFlags) {
|
|
243
252
|
if (!(this.entry instanceof Directory))
|
|
244
253
|
throw "invalid";
|
|
245
|
-
const openEntry = this.entry.traverse(path,
|
|
254
|
+
const openEntry = this.entry.traverse(path, openFlags.create ? { create: "file" } : {});
|
|
246
255
|
if (openFlags.directory) {
|
|
247
256
|
if (!(openEntry instanceof Directory))
|
|
248
257
|
throw "not-directory";
|
|
@@ -272,6 +281,18 @@ var Descriptor = class _Descriptor {
|
|
|
272
281
|
writeViaStream(offset) {
|
|
273
282
|
return new WriteStream(this.entry, offset);
|
|
274
283
|
}
|
|
284
|
+
setSize(size) {
|
|
285
|
+
if (this.entry instanceof Directory)
|
|
286
|
+
throw "is-directory";
|
|
287
|
+
size = Number(size);
|
|
288
|
+
if (size > this.entry.data.length) {
|
|
289
|
+
const newData = new Uint8Array(size);
|
|
290
|
+
newData.set(this.entry.data);
|
|
291
|
+
this.entry.data = newData;
|
|
292
|
+
} else if (size < this.entry.data.length) {
|
|
293
|
+
this.entry.data = this.entry.data.subarray(0, size);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
275
296
|
readDirectory() {
|
|
276
297
|
return new DirectoryEntryStream(this.entry);
|
|
277
298
|
}
|
|
@@ -281,15 +302,28 @@ var Descriptor = class _Descriptor {
|
|
|
281
302
|
unlinkFileAt(path) {
|
|
282
303
|
const pathEntry = this.entry.traverse(path);
|
|
283
304
|
if (pathEntry instanceof Directory)
|
|
284
|
-
|
|
305
|
+
throw "is-directory";
|
|
285
306
|
this.entry.traverse(path, { remove: true });
|
|
286
307
|
}
|
|
287
308
|
removeDirectoryAt(path) {
|
|
288
309
|
const pathEntry = this.entry.traverse(path);
|
|
289
310
|
if (!(pathEntry instanceof Directory))
|
|
290
|
-
|
|
311
|
+
throw "not-directory";
|
|
291
312
|
this.entry.traverse(path, { remove: true });
|
|
292
313
|
}
|
|
314
|
+
readlinkAt(path) {
|
|
315
|
+
const _pathEntry = this.entry.traverse(path);
|
|
316
|
+
throw "invalid";
|
|
317
|
+
}
|
|
318
|
+
renameAt(oldPath, newDescriptor, newPath) {
|
|
319
|
+
if (!(this.entry instanceof Directory))
|
|
320
|
+
throw "not-directory";
|
|
321
|
+
if (!(newDescriptor.entry instanceof Directory))
|
|
322
|
+
throw "not-directory";
|
|
323
|
+
const oldEntry = this.entry.traverse(oldPath);
|
|
324
|
+
this.entry.traverse(newPath, { create: oldEntry });
|
|
325
|
+
this.entry.traverse(oldPath, { remove: true });
|
|
326
|
+
}
|
|
293
327
|
};
|
|
294
328
|
var DirectoryEntryStream = class {
|
|
295
329
|
constructor(directory) {
|
|
@@ -466,7 +500,11 @@ async function fetchObject(obj, fetchFn) {
|
|
|
466
500
|
return obj;
|
|
467
501
|
}
|
|
468
502
|
function fetchWebAssembly(url) {
|
|
469
|
-
|
|
503
|
+
if (WebAssembly.compileStreaming !== void 0) {
|
|
504
|
+
return fetch_default(url).then(WebAssembly.compileStreaming);
|
|
505
|
+
} else {
|
|
506
|
+
return fetch_default(url).then((resp) => resp.arrayBuffer()).then(WebAssembly.compile);
|
|
507
|
+
}
|
|
470
508
|
}
|
|
471
509
|
function fetchUint8Array(url) {
|
|
472
510
|
return fetch_default(url).then((resp) => resp.arrayBuffer()).then((buf) => new Uint8Array(buf));
|
|
@@ -486,53 +524,56 @@ var Application = class {
|
|
|
486
524
|
this.instantiate = instantiate2;
|
|
487
525
|
this.argv0 = argv0;
|
|
488
526
|
}
|
|
489
|
-
async preload() {
|
|
490
|
-
if (this.resourceData === null)
|
|
491
|
-
this.resourceData = await this.resources().then(fetchResources);
|
|
492
|
-
}
|
|
493
527
|
// The `printLine` option is deprecated and not documented but still accepted for compatibility.
|
|
494
|
-
|
|
528
|
+
run(args = null, files = {}, options = {}) {
|
|
529
|
+
if (this.resourceData === null) {
|
|
530
|
+
if (options.synchronously)
|
|
531
|
+
throw new Error("Cannot run application synchronously unless resources are prefetched first; use `await run()` to do so");
|
|
532
|
+
return this.resources().then(fetchResources).then((resourceData) => {
|
|
533
|
+
this.resourceData = resourceData;
|
|
534
|
+
return this.run(args, files, options);
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
if (args === null)
|
|
538
|
+
return;
|
|
495
539
|
const environment = new Environment();
|
|
496
540
|
environment.args = [this.argv0].concat(args);
|
|
497
541
|
environment.root = directoryFromTree(files);
|
|
498
542
|
for (const [dirName, dirContents] of Object.entries(this.resourceData.filesystem))
|
|
499
543
|
environment.root.files[dirName] = directoryFromTree(dirContents);
|
|
500
|
-
const lineBufferedConsole = lineBuffered(printLine ?? console.log);
|
|
501
|
-
environment.stdin = stdin === void 0 ? null : stdin;
|
|
502
|
-
environment.stdout = stdout === void 0 ? lineBufferedConsole : stdout;
|
|
503
|
-
environment.stderr = stderr === void 0 ? lineBufferedConsole : stderr;
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
{
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
544
|
+
const lineBufferedConsole = lineBuffered(options.printLine ?? console.log);
|
|
545
|
+
environment.stdin = options.stdin === void 0 ? null : options.stdin;
|
|
546
|
+
environment.stdout = options.stdout === void 0 ? lineBufferedConsole : options.stdout;
|
|
547
|
+
environment.stderr = options.stderr === void 0 ? lineBufferedConsole : options.stderr;
|
|
548
|
+
const runCommand = (wasmCommand) => {
|
|
549
|
+
let error = null;
|
|
550
|
+
try {
|
|
551
|
+
wasmCommand.run.run();
|
|
552
|
+
} catch (e) {
|
|
553
|
+
if (!(e instanceof Exit))
|
|
554
|
+
throw e;
|
|
555
|
+
if (e instanceof Exit && e.code !== 0)
|
|
556
|
+
error = e;
|
|
557
|
+
}
|
|
558
|
+
for (const dirName of Object.keys(this.resourceData.filesystem))
|
|
559
|
+
delete environment.root.files[dirName];
|
|
560
|
+
files = directoryIntoTree(environment.root, { decodeASCII: options.decodeASCII ?? true });
|
|
561
|
+
if (error !== null) {
|
|
562
|
+
error.files = files;
|
|
563
|
+
throw error;
|
|
564
|
+
} else {
|
|
565
|
+
return files;
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
const getCoreModule = (filename) => this.resourceData.modules[filename];
|
|
569
|
+
const imports = { runtime: environment.exports };
|
|
570
|
+
if (options.synchronously) {
|
|
571
|
+
const instantiateCore = (module, imports2) => new WebAssembly.Instance(module, imports2);
|
|
572
|
+
return runCommand(this.instantiate(getCoreModule, imports, instantiateCore));
|
|
525
573
|
} else {
|
|
526
|
-
return
|
|
574
|
+
return this.instantiate(getCoreModule, imports).then(runCommand);
|
|
527
575
|
}
|
|
528
576
|
}
|
|
529
|
-
run(args = null, files = {}, options = {}) {
|
|
530
|
-
if (this.resourceData === null)
|
|
531
|
-
return this.preload().then((_) => this.run(args, files, options));
|
|
532
|
-
if (args === null)
|
|
533
|
-
return;
|
|
534
|
-
return this.execute(args, files, options);
|
|
535
|
-
}
|
|
536
577
|
};
|
|
537
578
|
|
|
538
579
|
// gen/spade.js
|
|
@@ -582,7 +623,7 @@ function utf8Encode(s, realloc, memory) {
|
|
|
582
623
|
utf8EncodedLen = writtenTotal;
|
|
583
624
|
return ptr;
|
|
584
625
|
}
|
|
585
|
-
function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.
|
|
626
|
+
async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.instantiate) {
|
|
586
627
|
const module0 = getCoreModule("spade.core.wasm");
|
|
587
628
|
const module1 = getCoreModule("spade.core2.wasm");
|
|
588
629
|
const module2 = getCoreModule("spade.core3.wasm");
|
|
@@ -3005,29 +3046,31 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.Insta
|
|
|
3005
3046
|
handleEntry.rep[symbolDispose]();
|
|
3006
3047
|
}
|
|
3007
3048
|
}
|
|
3008
|
-
(
|
|
3009
|
-
|
|
3049
|
+
Promise.all([module0, module1, module2, module3]).catch(() => {
|
|
3050
|
+
});
|
|
3051
|
+
({ exports: exports0 } = await instantiateCore(await module2));
|
|
3052
|
+
({ exports: exports1 } = await instantiateCore(await module0, {
|
|
3010
3053
|
wasi_snapshot_preview1: {
|
|
3011
|
-
args_get: exports0["
|
|
3054
|
+
args_get: exports0["23"],
|
|
3012
3055
|
args_sizes_get: exports0["24"],
|
|
3013
|
-
clock_time_get: exports0["
|
|
3014
|
-
environ_get: exports0["
|
|
3015
|
-
environ_sizes_get: exports0["
|
|
3016
|
-
fd_close: exports0["
|
|
3017
|
-
fd_fdstat_get: exports0["
|
|
3018
|
-
fd_filestat_get: exports0["
|
|
3019
|
-
fd_prestat_dir_name: exports0["
|
|
3020
|
-
fd_prestat_get: exports0["
|
|
3021
|
-
fd_read: exports0["
|
|
3022
|
-
|
|
3023
|
-
fd_write: exports0["
|
|
3024
|
-
path_open: exports0["
|
|
3025
|
-
proc_exit: exports0["
|
|
3026
|
-
random_get: exports0["
|
|
3027
|
-
sched_yield: exports0["
|
|
3056
|
+
clock_time_get: exports0["25"],
|
|
3057
|
+
environ_get: exports0["33"],
|
|
3058
|
+
environ_sizes_get: exports0["34"],
|
|
3059
|
+
fd_close: exports0["35"],
|
|
3060
|
+
fd_fdstat_get: exports0["36"],
|
|
3061
|
+
fd_filestat_get: exports0["26"],
|
|
3062
|
+
fd_prestat_dir_name: exports0["38"],
|
|
3063
|
+
fd_prestat_get: exports0["37"],
|
|
3064
|
+
fd_read: exports0["27"],
|
|
3065
|
+
fd_tell: exports0["28"],
|
|
3066
|
+
fd_write: exports0["29"],
|
|
3067
|
+
path_open: exports0["30"],
|
|
3068
|
+
proc_exit: exports0["39"],
|
|
3069
|
+
random_get: exports0["32"],
|
|
3070
|
+
sched_yield: exports0["31"]
|
|
3028
3071
|
}
|
|
3029
3072
|
}));
|
|
3030
|
-
({ exports: exports2 } = instantiateCore(module1, {
|
|
3073
|
+
({ exports: exports2 } = await instantiateCore(await module1, {
|
|
3031
3074
|
__main_module__: {
|
|
3032
3075
|
_start: exports1._start
|
|
3033
3076
|
},
|
|
@@ -3106,7 +3149,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.Insta
|
|
|
3106
3149
|
}));
|
|
3107
3150
|
memory0 = exports1.memory;
|
|
3108
3151
|
realloc0 = exports2.cabi_import_realloc;
|
|
3109
|
-
({ exports: exports3 } = instantiateCore(module3, {
|
|
3152
|
+
({ exports: exports3 } = await instantiateCore(await module3, {
|
|
3110
3153
|
"": {
|
|
3111
3154
|
$imports: exports0.$imports,
|
|
3112
3155
|
"0": trampoline12,
|
|
@@ -3125,24 +3168,24 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.Insta
|
|
|
3125
3168
|
"20": trampoline32,
|
|
3126
3169
|
"21": trampoline33,
|
|
3127
3170
|
"22": trampoline34,
|
|
3128
|
-
"23": exports2.
|
|
3171
|
+
"23": exports2.args_get,
|
|
3129
3172
|
"24": exports2.args_sizes_get,
|
|
3130
|
-
"25": exports2.
|
|
3131
|
-
"26": exports2.
|
|
3132
|
-
"27": exports2.
|
|
3133
|
-
"28": exports2.
|
|
3134
|
-
"29": exports2.
|
|
3173
|
+
"25": exports2.clock_time_get,
|
|
3174
|
+
"26": exports2.fd_filestat_get,
|
|
3175
|
+
"27": exports2.fd_read,
|
|
3176
|
+
"28": exports2.fd_tell,
|
|
3177
|
+
"29": exports2.fd_write,
|
|
3135
3178
|
"3": trampoline15,
|
|
3136
|
-
"30": exports2.
|
|
3137
|
-
"31": exports2.
|
|
3138
|
-
"32": exports2.
|
|
3139
|
-
"33": exports2.
|
|
3140
|
-
"34": exports2.
|
|
3141
|
-
"35": exports2.
|
|
3142
|
-
"36": exports2.
|
|
3143
|
-
"37": exports2.
|
|
3144
|
-
"38": exports2.
|
|
3145
|
-
"39": exports2.
|
|
3179
|
+
"30": exports2.path_open,
|
|
3180
|
+
"31": exports2.sched_yield,
|
|
3181
|
+
"32": exports2.random_get,
|
|
3182
|
+
"33": exports2.environ_get,
|
|
3183
|
+
"34": exports2.environ_sizes_get,
|
|
3184
|
+
"35": exports2.fd_close,
|
|
3185
|
+
"36": exports2.fd_fdstat_get,
|
|
3186
|
+
"37": exports2.fd_prestat_get,
|
|
3187
|
+
"38": exports2.fd_prestat_dir_name,
|
|
3188
|
+
"39": exports2.proc_exit,
|
|
3146
3189
|
"4": trampoline16,
|
|
3147
3190
|
"5": trampoline17,
|
|
3148
3191
|
"6": trampoline18,
|
package/gen/spade.core.wasm
CHANGED
|
Binary file
|
package/gen/spade.core2.wasm
CHANGED
|
Binary file
|
package/gen/spade.core3.wasm
CHANGED
|
Binary file
|
package/gen/spade.core4.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spade-lang/spade",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0-dev1.1.0052ab-0052ab",
|
|
4
4
|
"description": "Spade HDL (YoWASP package)",
|
|
5
5
|
"author": "Frans Skarman <frans.skarman@liu.se>",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"homepage": "https://spade-lang.org/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://
|
|
10
|
+
"url": "git+https://codeberg.org/spade-lang/spade.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://
|
|
13
|
+
"url": "https://codeberg.org/spade-lang/spade/issues"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"files": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"types": "./lib/api.d.ts",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@bytecodealliance/jco": "1.0.0",
|
|
30
|
-
"@yowasp/runtime": "
|
|
30
|
+
"@yowasp/runtime": "9.0.58",
|
|
31
31
|
"esbuild": "^0.19.8"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
|
-
"transpile": "jco new ${CARGO_TARGET_DIR:-../../target}/wasm32-wasip1/release/spade.wasm --wasi-command --output spade.wasm && jco transpile spade.wasm --instantiation
|
|
34
|
+
"transpile": "jco new ${CARGO_TARGET_DIR:-../../target}/wasm32-wasip1/release/spade.wasm --wasi-command --output spade.wasm && jco transpile spade.wasm --instantiation async --no-typescript --no-namespaced-exports --map 'wasi:io/*=runtime#io' --map 'wasi:cli/*=runtime#cli' --map 'wasi:clocks/*=runtime#*' --map 'wasi:filesystem/*=runtime#fs' --map 'wasi:random/*=runtime#random' --out-dir gen/",
|
|
35
35
|
"pack": "yowasp-pack-resources gen/resources-spade.js gen",
|
|
36
36
|
"build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --external:./resources-*.js",
|
|
37
37
|
"all": "npm run transpile && npm run pack && npm run build"
|