toilscript 0.1.2 → 0.1.4
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/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/importmap.json +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/toilscript.ts +1 -1
- package/std/assembly.json +1 -0
- package/std/ts-plugin.cjs +44 -0
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.4/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.4/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var ASSEMBLYSCRIPT_VERSION = "0.1.
|
|
1
|
+
var ASSEMBLYSCRIPT_VERSION = "0.1.4";
|
|
2
2
|
var ASSEMBLYSCRIPT_IMPORTMAP = {
|
|
3
3
|
"imports": {
|
|
4
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
5
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.4/dist/toilscript.js",
|
|
5
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.4/dist/cli.js",
|
|
6
6
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
|
|
7
7
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
8
8
|
}
|
package/package.json
CHANGED
package/std/assembly.json
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToilScript TypeScript Language Service plugin.
|
|
3
|
+
*
|
|
4
|
+
* Stock TypeScript has no grammar for toil-native decorators applied to
|
|
5
|
+
* top-level functions and globals (`@main`, `@inline`, `@unmanaged`, ...), so
|
|
6
|
+
* the editor's language service flags them as errors even though the toilscript
|
|
7
|
+
* compiler (asc) handles them correctly. This plugin runs only inside the
|
|
8
|
+
* editor's language service (VS Code, WebStorm, etc. — never `tsc`/asc builds)
|
|
9
|
+
* and removes exactly those decorator-grammar false positives:
|
|
10
|
+
*
|
|
11
|
+
* TS1206 "Decorators are not valid here."
|
|
12
|
+
* TS1249 "A decorator can only decorate a method implementation, not an overload."
|
|
13
|
+
*
|
|
14
|
+
* Every other diagnostic — unknown types, bad calls, missing names — passes
|
|
15
|
+
* through untouched, so real type errors are still surfaced.
|
|
16
|
+
*/
|
|
17
|
+
const DECORATOR_GRAMMAR_CODES = new Set([1206, 1249]);
|
|
18
|
+
|
|
19
|
+
function init() {
|
|
20
|
+
return {
|
|
21
|
+
create(info) {
|
|
22
|
+
const ls = info.languageService;
|
|
23
|
+
|
|
24
|
+
// Proxy the language service, forwarding everything to the real one.
|
|
25
|
+
const proxy = Object.create(null);
|
|
26
|
+
for (const key of Object.keys(ls)) {
|
|
27
|
+
const value = ls[key];
|
|
28
|
+
proxy[key] = typeof value === 'function' ? value.bind(ls) : value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const strip = (diagnostics) =>
|
|
32
|
+
diagnostics.filter((d) => !DECORATOR_GRAMMAR_CODES.has(d.code));
|
|
33
|
+
|
|
34
|
+
proxy.getSemanticDiagnostics = (fileName) =>
|
|
35
|
+
strip(ls.getSemanticDiagnostics(fileName));
|
|
36
|
+
proxy.getSyntacticDiagnostics = (fileName) =>
|
|
37
|
+
strip(ls.getSyntacticDiagnostics(fileName));
|
|
38
|
+
|
|
39
|
+
return proxy;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = init;
|