luau2ts 0.2.1 → 0.2.3
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/dist/cli/args.d.ts +23 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +177 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +71 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/modes.d.ts +20 -0
- package/dist/cli/modes.d.ts.map +1 -0
- package/dist/cli/modes.js +145 -0
- package/dist/cli/modes.js.map +1 -0
- package/dist/compile/class-shape.d.ts +31 -0
- package/dist/compile/class-shape.d.ts.map +1 -0
- package/dist/compile/class-shape.js +291 -0
- package/dist/compile/class-shape.js.map +1 -0
- package/dist/compile/context.d.ts +86 -0
- package/dist/compile/context.d.ts.map +1 -0
- package/dist/compile/context.js +144 -0
- package/dist/compile/context.js.map +1 -0
- package/dist/compile/index.d.ts +58 -0
- package/dist/compile/index.d.ts.map +1 -0
- package/dist/compile/index.js +2155 -0
- package/dist/compile/index.js.map +1 -0
- package/dist/compile/macros/datatypes.d.ts +2 -0
- package/dist/compile/macros/datatypes.d.ts.map +1 -0
- package/dist/compile/macros/datatypes.js +76 -0
- package/dist/compile/macros/datatypes.js.map +1 -0
- package/dist/compile/macros/index.d.ts +33 -0
- package/dist/compile/macros/index.d.ts.map +1 -0
- package/dist/compile/macros/index.js +71 -0
- package/dist/compile/macros/index.js.map +1 -0
- package/dist/compile/macros/instance.d.ts +2 -0
- package/dist/compile/macros/instance.d.ts.map +1 -0
- package/dist/compile/macros/instance.js +58 -0
- package/dist/compile/macros/instance.js.map +1 -0
- package/dist/compile/macros/stdlib.d.ts +2 -0
- package/dist/compile/macros/stdlib.d.ts.map +1 -0
- package/dist/compile/macros/stdlib.js +140 -0
- package/dist/compile/macros/stdlib.js.map +1 -0
- package/dist/compile/rbxts-runtime.d.ts +2 -0
- package/dist/compile/rbxts-runtime.d.ts.map +1 -0
- package/dist/compile/rbxts-runtime.js +163 -0
- package/dist/compile/rbxts-runtime.js.map +1 -0
- package/dist/compile/sourcemap.d.ts +25 -0
- package/dist/compile/sourcemap.d.ts.map +1 -0
- package/dist/compile/sourcemap.js +71 -0
- package/dist/compile/sourcemap.js.map +1 -0
- package/dist/compile/type.d.ts +6 -0
- package/dist/compile/type.d.ts.map +1 -0
- package/dist/compile/type.js +122 -0
- package/dist/compile/type.js.map +1 -0
- package/dist/compile/util.d.ts +38 -0
- package/dist/compile/util.d.ts.map +1 -0
- package/dist/compile/util.js +153 -0
- package/dist/compile/util.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +227 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/types.d.ts +430 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +14 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/parser/wasm/luau-parser.d.mts +21 -0
- package/dist/parser/wasm/luau-parser.mjs +2 -0
- package/dist/parser/wasm/luau-parser.wasm +0 -0
- package/dist/rojo/index.d.ts +4 -0
- package/dist/rojo/index.d.ts.map +1 -0
- package/dist/rojo/index.js +3 -0
- package/dist/rojo/index.js.map +1 -0
- package/dist/rojo/load-project.d.ts +12 -0
- package/dist/rojo/load-project.d.ts.map +1 -0
- package/dist/rojo/load-project.js +35 -0
- package/dist/rojo/load-project.js.map +1 -0
- package/dist/rojo/types.d.ts +39 -0
- package/dist/rojo/types.d.ts.map +1 -0
- package/dist/rojo/types.js +2 -0
- package/dist/rojo/types.js.map +1 -0
- package/dist/rojo/walk-tree.d.ts +40 -0
- package/dist/rojo/walk-tree.d.ts.map +1 -0
- package/dist/rojo/walk-tree.js +164 -0
- package/dist/rojo/walk-tree.js.map +1 -0
- package/dist/runtime/arith.d.ts +13 -0
- package/dist/runtime/arith.d.ts.map +1 -0
- package/dist/runtime/arith.js +151 -0
- package/dist/runtime/arith.js.map +1 -0
- package/dist/runtime/index-helper.d.ts +3 -0
- package/dist/runtime/index-helper.d.ts.map +1 -0
- package/dist/runtime/index-helper.js +40 -0
- package/dist/runtime/index-helper.js.map +1 -0
- package/dist/runtime/index.d.ts +13 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +13 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/iterator.d.ts +58 -0
- package/dist/runtime/iterator.d.ts.map +1 -0
- package/dist/runtime/iterator.js +181 -0
- package/dist/runtime/iterator.js.map +1 -0
- package/dist/runtime/length.d.ts +2 -0
- package/dist/runtime/length.d.ts.map +1 -0
- package/dist/runtime/length.js +15 -0
- package/dist/runtime/length.js.map +1 -0
- package/dist/runtime/lua-stdlib.d.ts +186 -0
- package/dist/runtime/lua-stdlib.d.ts.map +1 -0
- package/dist/runtime/lua-stdlib.js +502 -0
- package/dist/runtime/lua-stdlib.js.map +1 -0
- package/dist/runtime/metatable.d.ts +16 -0
- package/dist/runtime/metatable.d.ts.map +1 -0
- package/dist/runtime/metatable.js +129 -0
- package/dist/runtime/metatable.js.map +1 -0
- package/dist/runtime/pattern.d.ts +21 -0
- package/dist/runtime/pattern.d.ts.map +1 -0
- package/dist/runtime/pattern.js +375 -0
- package/dist/runtime/pattern.js.map +1 -0
- package/dist/runtime/pcall.d.ts +12 -0
- package/dist/runtime/pcall.d.ts.map +1 -0
- package/dist/runtime/pcall.js +54 -0
- package/dist/runtime/pcall.js.map +1 -0
- package/dist/runtime/string-lib.d.ts +31 -0
- package/dist/runtime/string-lib.d.ts.map +1 -0
- package/dist/runtime/string-lib.js +296 -0
- package/dist/runtime/string-lib.js.map +1 -0
- package/dist/runtime/table-lib.d.ts +18 -0
- package/dist/runtime/table-lib.d.ts.map +1 -0
- package/dist/runtime/table-lib.js +133 -0
- package/dist/runtime/table-lib.js.map +1 -0
- package/dist/runtime/tostring.d.ts +3 -0
- package/dist/runtime/tostring.d.ts.map +1 -0
- package/dist/runtime/tostring.js +82 -0
- package/dist/runtime/tostring.js.map +1 -0
- package/dist/runtime/truthy.d.ts +13 -0
- package/dist/runtime/truthy.d.ts.map +1 -0
- package/dist/runtime/truthy.js +26 -0
- package/dist/runtime/truthy.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function isTruthy(value) {
|
|
2
|
+
return (value !== false
|
|
3
|
+
&& value !== null
|
|
4
|
+
&& value !== undefined
|
|
5
|
+
&& !(typeof value === 'object'
|
|
6
|
+
&& value !== null
|
|
7
|
+
&& value.__isNull === true));
|
|
8
|
+
}
|
|
9
|
+
export function luaNot(value) {
|
|
10
|
+
return !isTruthy(value);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `a and b` in Lua: returns the first falsy value, otherwise the last value.
|
|
14
|
+
* Note both operands are passed already-evaluated; this helper does NOT
|
|
15
|
+
* short-circuit (the compiler emits its own short-circuit when it can).
|
|
16
|
+
*/
|
|
17
|
+
export function luaAnd(a, b) {
|
|
18
|
+
return isTruthy(a) ? b : a;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* `a or b` in Lua: returns the first truthy value, otherwise the last.
|
|
22
|
+
*/
|
|
23
|
+
export function luaOr(a, b) {
|
|
24
|
+
return isTruthy(a) ? a : b;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=truthy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truthy.js","sourceRoot":"","sources":["../../src/runtime/truthy.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,CACL,KAAK,KAAK,KAAK;WACZ,KAAK,KAAK,IAAI;WACd,KAAK,KAAK,SAAS;WACnB,CAAC,CACF,OAAO,KAAK,KAAK,QAAQ;eACtB,KAAK,KAAK,IAAI;eACb,KAAgC,CAAC,QAAQ,KAAK,IAAI,CACvD,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAO,CAAI,EAAE,CAAI;IACrC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAO,CAAI,EAAE,CAAI;IACpC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "luau2ts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A Luau-to-TypeScript compiler for Roblox.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,13 +32,6 @@
|
|
|
32
32
|
"README.md",
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "tsc -b && node scripts/copy-wasm.mjs",
|
|
37
|
-
"clean": "tsc -b --clean",
|
|
38
|
-
"test": "vitest run",
|
|
39
|
-
"test:watch": "vitest",
|
|
40
|
-
"typecheck": "tsc --noEmit"
|
|
41
|
-
},
|
|
42
35
|
"dependencies": {
|
|
43
36
|
"prettier": "^3.4.0",
|
|
44
37
|
"typescript": "^5.5.0"
|
|
@@ -49,7 +42,7 @@
|
|
|
49
42
|
"vitest": "^2.0.0"
|
|
50
43
|
},
|
|
51
44
|
"optionalDependencies": {
|
|
52
|
-
"@luau2ts/analyzer": "
|
|
45
|
+
"@luau2ts/analyzer": "0.1.0"
|
|
53
46
|
},
|
|
54
47
|
"keywords": [
|
|
55
48
|
"luau",
|
|
@@ -69,5 +62,12 @@
|
|
|
69
62
|
},
|
|
70
63
|
"engines": {
|
|
71
64
|
"node": ">=18"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsc -b && node scripts/copy-wasm.mjs",
|
|
68
|
+
"clean": "tsc -b --clean",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"typecheck": "tsc --noEmit"
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
}
|