luau2ts 0.1.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.
- package/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/cli/args.d.ts +19 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +130 -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 +65 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/modes.d.ts +17 -0
- package/dist/cli/modes.d.ts.map +1 -0
- package/dist/cli/modes.js +134 -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 +43 -0
- package/dist/compile/index.d.ts.map +1 -0
- package/dist/compile/index.js +2028 -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 +70 -0
|
@@ -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
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "luau2ts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A Luau-to-TypeScript compiler for Roblox.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Tony Bolivar",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"luau2ts": "./dist/cli/bin.js"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./runtime": {
|
|
20
|
+
"types": "./dist/runtime/index.d.ts",
|
|
21
|
+
"import": "./dist/runtime/index.js",
|
|
22
|
+
"default": "./dist/runtime/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./rojo": {
|
|
25
|
+
"types": "./dist/rojo/index.d.ts",
|
|
26
|
+
"import": "./dist/rojo/index.js",
|
|
27
|
+
"default": "./dist/rojo/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
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
|
+
"dependencies": {
|
|
43
|
+
"prettier": "^3.4.0",
|
|
44
|
+
"typescript": "^5.5.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^22.10.0",
|
|
48
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
49
|
+
"vitest": "^2.0.0"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"luau",
|
|
53
|
+
"typescript",
|
|
54
|
+
"compiler",
|
|
55
|
+
"roblox",
|
|
56
|
+
"roblox-ts",
|
|
57
|
+
"transpiler"
|
|
58
|
+
],
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git+https://github.com/luau2ts/luau2ts.git"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://luau2ts.com",
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/luau2ts/luau2ts/issues"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=18"
|
|
69
|
+
}
|
|
70
|
+
}
|