toilscript 0.0.1 → 0.1.1
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 +201 -201
- package/NOTICE +94 -94
- package/README.md +101 -114
- package/bin/asc.js +0 -0
- package/bin/asinit.js +6 -6
- package/dist/asc.generated.d.ts +10027 -0
- package/dist/asc.js +24474 -0
- package/dist/asc.js.map +7 -0
- package/dist/importmap.json +9 -0
- package/dist/toilscript.generated.d.ts +11242 -0
- package/dist/toilscript.js +337 -0
- package/dist/toilscript.js.map +7 -0
- package/dist/web.js +22 -0
- package/lib/binaryen.d.ts +2 -2
- package/lib/binaryen.js +2 -2
- package/package.json +115 -114
- package/std/README.md +6 -6
- package/std/assembly/array.ts +550 -550
- package/std/assembly/arraybuffer.ts +77 -77
- package/std/assembly/atomics.ts +127 -127
- package/std/assembly/bindings/asyncify.ts +16 -16
- package/std/assembly/bindings/dom.ts +291 -291
- package/std/assembly/bindings/node.ts +6 -6
- package/std/assembly/bitflags.ts +53 -53
- package/std/assembly/builtins.ts +2650 -2650
- package/std/assembly/byteslice.ts +177 -177
- package/std/assembly/compat.ts +2 -2
- package/std/assembly/console.ts +42 -42
- package/std/assembly/crypto.ts +9 -9
- package/std/assembly/dataview.ts +181 -181
- package/std/assembly/date.ts +375 -375
- package/std/assembly/diagnostics.ts +11 -11
- package/std/assembly/encoding.ts +151 -151
- package/std/assembly/endian.ts +45 -45
- package/std/assembly/error.ts +44 -44
- package/std/assembly/fixedarray.ts +173 -173
- package/std/assembly/fixedmap.ts +326 -326
- package/std/assembly/fixedset.ts +275 -275
- package/std/assembly/function.ts +42 -42
- package/std/assembly/index.d.ts +2892 -2891
- package/std/assembly/iterator.ts +35 -35
- package/std/assembly/map.ts +269 -269
- package/std/assembly/math.ts +3289 -3289
- package/std/assembly/memory.ts +123 -123
- package/std/assembly/number.ts +388 -388
- package/std/assembly/object.ts +36 -36
- package/std/assembly/performance.ts +9 -9
- package/std/assembly/pointer.ts +80 -80
- package/std/assembly/polyfills.ts +27 -27
- package/std/assembly/process.ts +50 -50
- package/std/assembly/reference.ts +48 -48
- package/std/assembly/regexp.ts +12 -12
- package/std/assembly/rt/README.md +83 -83
- package/std/assembly/rt/common.ts +81 -81
- package/std/assembly/rt/index-incremental.ts +2 -2
- package/std/assembly/rt/index-memory.ts +1 -1
- package/std/assembly/rt/index-minimal.ts +2 -2
- package/std/assembly/rt/index-stub.ts +1 -1
- package/std/assembly/rt/index.d.ts +37 -37
- package/std/assembly/rt/itcms.ts +419 -419
- package/std/assembly/rt/memory-runtime.ts +94 -94
- package/std/assembly/rt/rtrace.ts +15 -15
- package/std/assembly/rt/stub.ts +133 -133
- package/std/assembly/rt/tcms.ts +254 -254
- package/std/assembly/rt/tlsf.ts +592 -592
- package/std/assembly/rt.ts +90 -90
- package/std/assembly/set.ts +225 -225
- package/std/assembly/shared/feature.ts +68 -68
- package/std/assembly/shared/runtime.ts +13 -13
- package/std/assembly/shared/target.ts +11 -11
- package/std/assembly/shared/tsconfig.json +11 -11
- package/std/assembly/shared/typeinfo.ts +72 -72
- package/std/assembly/staticarray.ts +423 -423
- package/std/assembly/string.ts +850 -850
- package/std/assembly/symbol.ts +114 -114
- package/std/assembly/table.ts +16 -16
- package/std/assembly/toilscript.ts +16 -0
- package/std/assembly/tsconfig.json +6 -6
- package/std/assembly/typedarray.ts +1954 -1954
- package/std/assembly/uri.ts +17 -17
- package/std/assembly/util/bytes.ts +107 -107
- package/std/assembly/util/casemap.ts +497 -497
- package/std/assembly/util/error.ts +58 -58
- package/std/assembly/util/hash.ts +117 -117
- package/std/assembly/util/math.ts +1922 -1922
- package/std/assembly/util/memory.ts +290 -290
- package/std/assembly/util/number.ts +873 -873
- package/std/assembly/util/sort.ts +313 -313
- package/std/assembly/util/string.ts +1202 -1202
- package/std/assembly/util/uri.ts +275 -275
- package/std/assembly/vector.ts +4 -4
- package/std/assembly.json +16 -16
- package/std/portable/index.d.ts +461 -461
- package/std/portable/index.js +416 -416
- package/std/portable.json +11 -11
- package/std/types/assembly/index.d.ts +1 -1
- package/std/types/assembly/package.json +2 -2
- package/std/types/portable/index.d.ts +1 -1
- package/std/types/portable/package.json +2 -2
- package/tsconfig-base.json +13 -13
- package/util/README.md +23 -23
- package/util/browser/fs.js +1 -1
- package/util/browser/module.js +5 -5
- package/util/browser/path.js +520 -520
- package/util/browser/process.js +59 -59
- package/util/browser/url.js +23 -23
- package/util/cpu.d.ts +9 -9
- package/util/cpu.js +42 -42
- package/util/find.d.ts +6 -6
- package/util/find.js +20 -20
- package/util/node.d.ts +21 -21
- package/util/node.js +34 -34
- package/util/options.d.ts +70 -70
- package/util/options.js +262 -262
- package/util/terminal.d.ts +52 -52
- package/util/terminal.js +35 -35
- package/util/text.d.ts +26 -26
- package/util/text.js +114 -114
- package/util/tsconfig.json +9 -9
- package/util/web.d.ts +11 -11
- package/util/web.js +33 -33
package/README.md
CHANGED
|
@@ -1,114 +1,101 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://www.assemblyscript.org" target="_blank" rel="noopener"><img width="100" src="https://avatars1.githubusercontent.com/u/28916798?s=200&v=4" alt="AssemblyScript logo"></a>
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<p align="center">
|
|
6
|
-
<a href="https://www.npmjs.com/package/toilscript"><img src="https://img.shields.io/npm/v/toilscript.svg?color=007acc&logo=npm" alt="npm version" /></a>
|
|
7
|
-
<a href="https://github.com/
|
|
8
|
-
</p>
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
**
|
|
15
|
-
|
|
16
|
-
###
|
|
17
|
-
|
|
18
|
-
- **Closures**
|
|
19
|
-
- **Try-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
npm install
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```sh
|
|
104
|
-
git clone https://github.com/btc-vision/assemblyscript.git
|
|
105
|
-
cd assemblyscript
|
|
106
|
-
npm install
|
|
107
|
-
npm link
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The link step is optional and makes the development instance available globally. The full process is documented as part of the repository:
|
|
111
|
-
|
|
112
|
-
* [Compiler instructions](./src)
|
|
113
|
-
* [Runtime instructions](./std/assembly/rt)
|
|
114
|
-
* [Test instructions](./tests)
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.assemblyscript.org" target="_blank" rel="noopener"><img width="100" src="https://avatars1.githubusercontent.com/u/28916798?s=200&v=4" alt="AssemblyScript logo"></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/toilscript"><img src="https://img.shields.io/npm/v/toilscript.svg?color=007acc&logo=npm" alt="npm version" /></a>
|
|
7
|
+
<a href="https://github.com/dacely-cloud/toilscript/releases"><img src="https://img.shields.io/github/v/release/dacely-cloud/toilscript?color=green&logo=github" alt="GitHub release" /></a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ToilScript
|
|
13
|
+
|
|
14
|
+
**ToilScript is a fork of [AssemblyScript](https://github.com/AssemblyScript/assemblyscript)** that tracks the latest upstream and adds language features not yet available in the official release.
|
|
15
|
+
|
|
16
|
+
### Added features
|
|
17
|
+
|
|
18
|
+
- **Closures** — full closure support with captured variables
|
|
19
|
+
- **Try-catch-finally** — exception handling (a `throw` must be an `Error` or a subclass)
|
|
20
|
+
|
|
21
|
+
### How it's built
|
|
22
|
+
|
|
23
|
+
ToilScript is the latest AssemblyScript `main` (Binaryen `129.0.0-nightly`, BigInt-based i64) with the closure and exception-handling work — originally from the [btc-vision](https://github.com/btc-vision/assemblyscript) fork — merged on top. The compiler's config file defaults to `toilconfig.json` (instead of `asconfig.json`).
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm install toilscript
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Usage
|
|
34
|
+
|
|
35
|
+
This fork is a drop-in replacement for AssemblyScript. Simply replace your import:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"toilscript": "^0.1.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or if migrating from official AssemblyScript:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm uninstall assemblyscript
|
|
49
|
+
npm install toilscript
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The CLI is `toilscript` (with `toilinit` to scaffold a project):
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npx toilscript your-file.ts --outFile output.wasm
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Original README
|
|
61
|
+
|
|
62
|
+
<p align="justify"><strong>AssemblyScript</strong> compiles a variant of <a href="http://www.typescriptlang.org">TypeScript</a> (basically JavaScript with types) to <a href="http://webassembly.org">WebAssembly</a> using <a href="https://github.com/WebAssembly/binaryen">Binaryen</a>. It generates lean and mean WebAssembly modules while being just an <code>npm install</code> away.</p>
|
|
63
|
+
|
|
64
|
+
<h3 align="center">
|
|
65
|
+
<a href="https://www.assemblyscript.org">About</a> ·
|
|
66
|
+
<a href="https://www.assemblyscript.org/getting-started.html">Getting started</a> ·
|
|
67
|
+
<a href="https://www.assemblyscript.org/examples.html">Examples</a> ·
|
|
68
|
+
<a href="https://www.assemblyscript.org/built-with-assemblyscript.html">Built with AssemblyScript</a>
|
|
69
|
+
</h3>
|
|
70
|
+
<br>
|
|
71
|
+
|
|
72
|
+
<h2 align="center">Contributors</h2>
|
|
73
|
+
|
|
74
|
+
<p align="center">
|
|
75
|
+
<a href="https://www.assemblyscript.org/#contributors"><img src="https://www.assemblyscript.org/contributors.svg" alt="Contributor logos" width="720" /></a>
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
<h2 align="center">Thanks to our sponsors!</h2>
|
|
79
|
+
|
|
80
|
+
<p align="justify">Most of the maintainers and contributors do this open source work in their free time. If you use AssemblyScript for a serious task or plan to do so, and you'd like us to invest more time on it, <a href="https://opencollective.com/assemblyscript/donate" target="_blank" rel="noopener">please donate</a> to our <a href="https://opencollective.com/assemblyscript" target="_blank" rel="noopener">OpenCollective</a>. By sponsoring this project, your logo will show up below. Thank you so much for your support!</p>
|
|
81
|
+
|
|
82
|
+
<p align="center">
|
|
83
|
+
<a href="https://www.assemblyscript.org/#sponsors"><img src="https://www.assemblyscript.org/sponsors.svg" alt="Sponsor logos" width="720" /></a>
|
|
84
|
+
</p>
|
|
85
|
+
|
|
86
|
+
## Development instructions
|
|
87
|
+
|
|
88
|
+
A development environment can be set up by cloning the repository:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
git clone https://github.com/dacely-cloud/toilscript.git
|
|
92
|
+
cd toilscript
|
|
93
|
+
npm install
|
|
94
|
+
npm link
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The link step is optional and makes the development instance available globally. The full process is documented as part of the repository:
|
|
98
|
+
|
|
99
|
+
* [Compiler instructions](./src)
|
|
100
|
+
* [Runtime instructions](./std/assembly/rt)
|
|
101
|
+
* [Test instructions](./tests)
|
package/bin/asc.js
CHANGED
|
File without changes
|
package/bin/asinit.js
CHANGED
|
@@ -76,11 +76,11 @@ function printHelp() {
|
|
|
76
76
|
"Sets up a new ToilScript project or updates an existing one.",
|
|
77
77
|
"",
|
|
78
78
|
stdoutColors.white("SYNTAX"),
|
|
79
|
-
" " + stdoutColors.cyan("
|
|
79
|
+
" " + stdoutColors.cyan("toilinit") + " directory [options]",
|
|
80
80
|
"",
|
|
81
81
|
stdoutColors.white("EXAMPLES"),
|
|
82
|
-
" " + stdoutColors.cyan("
|
|
83
|
-
" " + stdoutColors.cyan("
|
|
82
|
+
" " + stdoutColors.cyan("toilinit") + " .",
|
|
83
|
+
" " + stdoutColors.cyan("toilinit") + " ./newProject -y",
|
|
84
84
|
"",
|
|
85
85
|
stdoutColors.white("OPTIONS"),
|
|
86
86
|
optionsUtil.help(asinitOptions, { noCategories: true })
|
|
@@ -126,7 +126,7 @@ if (fs.existsSync(packageFile)) {
|
|
|
126
126
|
if ("type" in pkg && pkg["type"] !== "module") {
|
|
127
127
|
console.error(stdoutColors.red([
|
|
128
128
|
`Error: The "type" field in ${formatPath(packageFile)} is set to "${pkg["type"]}".`,
|
|
129
|
-
`
|
|
129
|
+
` toilinit requires the "type" field to be set to "module" (ES modules).`
|
|
130
130
|
].join("\n")));
|
|
131
131
|
process.exit(1);
|
|
132
132
|
}
|
|
@@ -342,8 +342,8 @@ function ensureGitignore() {
|
|
|
342
342
|
function ensurePackageJson() {
|
|
343
343
|
console.log("- Making sure that 'package.json' contains the build commands...");
|
|
344
344
|
const entryPath = path.relative(projectDir, entryFile).replace(/\\/g, "/");
|
|
345
|
-
const buildDebug = "
|
|
346
|
-
const buildRelease = "
|
|
345
|
+
const buildDebug = "toilscript " + entryPath + " --target debug";
|
|
346
|
+
const buildRelease = "toilscript " + entryPath + " --target release";
|
|
347
347
|
const buildAll = commands[pm].run + " asbuild:debug && " + commands[pm].run + " asbuild:release";
|
|
348
348
|
if (!fs.existsSync(packageFile)) {
|
|
349
349
|
fs.writeFileSync(packageFile, JSON.stringify({
|