@tilua/compiler 1.0.2 → 2.0.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/README.md +44 -5
- package/dist/{chunk-QSRDDIU4.js → chunk-KG6W5XKA.js} +294 -248
- package/dist/cli.cjs +291 -245
- package/dist/cli.js +1 -1
- package/dist/index.cjs +291 -245
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -88,9 +88,13 @@ interface ModuleContext {
|
|
|
88
88
|
/** The bundle's `require`: an expression that, called with a module's
|
|
89
89
|
* name, returns its exports table. */
|
|
90
90
|
readonly require: L.Expression;
|
|
91
|
-
/** Luau reaching the bundle's line map — what
|
|
92
|
-
* name the file a frame was written in. */
|
|
91
|
+
/** Luau reaching the bundle's line map — what a library's runtime reads,
|
|
92
|
+
* as `__LINES__`, to name the file a frame was written in. */
|
|
93
93
|
readonly lines?: string;
|
|
94
|
+
/** Luau reaching the bundle's error reporter — what a library's runtime
|
|
95
|
+
* reads, as `__FAIL__`, to report an error from a callback the way an
|
|
96
|
+
* error that reached the entry is reported. */
|
|
97
|
+
readonly fail?: string;
|
|
94
98
|
}
|
|
95
99
|
interface LowerOptions {
|
|
96
100
|
/** Lower the file as a module of a bundle. Without it, `import` and
|
|
@@ -107,9 +111,12 @@ interface LowerOptions {
|
|
|
107
111
|
* `loadLowerings`). The compiler lowers the language; a call written
|
|
108
112
|
* against a library's types is the library's to explain. */
|
|
109
113
|
readonly lowerings?: readonly LoadedLowering[];
|
|
110
|
-
/** The file's own text, so
|
|
111
|
-
*
|
|
114
|
+
/** The file's own text, so a library can be told the code an argument was
|
|
115
|
+
* written as (`console:log` shows a function that way). */
|
|
112
116
|
readonly source?: string;
|
|
117
|
+
/** The file as a library's runtime names it — `src/shop/buy.tilua` —
|
|
118
|
+
* in the call sites it is handed. */
|
|
119
|
+
readonly file?: string;
|
|
113
120
|
/** Which Lua the output has to run on. Default `"luau"`. `"lua51"` also
|
|
114
121
|
* lowers what Luau adds to Lua and 5.1 has no syntax for — `a += b`,
|
|
115
122
|
* `continue`, `if c then a else b` as an expression, `//`. */
|
|
@@ -135,6 +142,9 @@ interface LowerResult {
|
|
|
135
142
|
* file it was lowered from, this is what turns a line of the bundle back
|
|
136
143
|
* into a place someone can open. */
|
|
137
144
|
readonly origins: WeakMap<L.Statement, number>;
|
|
145
|
+
/** The file reads `scriptArgs`: whatever runs it has to set it up, from
|
|
146
|
+
* the chunk's own `...` — this file, compiled alone, does it itself. */
|
|
147
|
+
readonly usesScriptArgs: boolean;
|
|
138
148
|
}
|
|
139
149
|
/** How a module's exports behave at runtime, beyond what its code assigns. */
|
|
140
150
|
interface ModuleInfo {
|
package/dist/index.d.ts
CHANGED
|
@@ -88,9 +88,13 @@ interface ModuleContext {
|
|
|
88
88
|
/** The bundle's `require`: an expression that, called with a module's
|
|
89
89
|
* name, returns its exports table. */
|
|
90
90
|
readonly require: L.Expression;
|
|
91
|
-
/** Luau reaching the bundle's line map — what
|
|
92
|
-
* name the file a frame was written in. */
|
|
91
|
+
/** Luau reaching the bundle's line map — what a library's runtime reads,
|
|
92
|
+
* as `__LINES__`, to name the file a frame was written in. */
|
|
93
93
|
readonly lines?: string;
|
|
94
|
+
/** Luau reaching the bundle's error reporter — what a library's runtime
|
|
95
|
+
* reads, as `__FAIL__`, to report an error from a callback the way an
|
|
96
|
+
* error that reached the entry is reported. */
|
|
97
|
+
readonly fail?: string;
|
|
94
98
|
}
|
|
95
99
|
interface LowerOptions {
|
|
96
100
|
/** Lower the file as a module of a bundle. Without it, `import` and
|
|
@@ -107,9 +111,12 @@ interface LowerOptions {
|
|
|
107
111
|
* `loadLowerings`). The compiler lowers the language; a call written
|
|
108
112
|
* against a library's types is the library's to explain. */
|
|
109
113
|
readonly lowerings?: readonly LoadedLowering[];
|
|
110
|
-
/** The file's own text, so
|
|
111
|
-
*
|
|
114
|
+
/** The file's own text, so a library can be told the code an argument was
|
|
115
|
+
* written as (`console:log` shows a function that way). */
|
|
112
116
|
readonly source?: string;
|
|
117
|
+
/** The file as a library's runtime names it — `src/shop/buy.tilua` —
|
|
118
|
+
* in the call sites it is handed. */
|
|
119
|
+
readonly file?: string;
|
|
113
120
|
/** Which Lua the output has to run on. Default `"luau"`. `"lua51"` also
|
|
114
121
|
* lowers what Luau adds to Lua and 5.1 has no syntax for — `a += b`,
|
|
115
122
|
* `continue`, `if c then a else b` as an expression, `//`. */
|
|
@@ -135,6 +142,9 @@ interface LowerResult {
|
|
|
135
142
|
* file it was lowered from, this is what turns a line of the bundle back
|
|
136
143
|
* into a place someone can open. */
|
|
137
144
|
readonly origins: WeakMap<L.Statement, number>;
|
|
145
|
+
/** The file reads `scriptArgs`: whatever runs it has to set it up, from
|
|
146
|
+
* the chunk's own `...` — this file, compiled alone, does it itself. */
|
|
147
|
+
readonly usesScriptArgs: boolean;
|
|
138
148
|
}
|
|
139
149
|
/** How a module's exports behave at runtime, beyond what its code assigns. */
|
|
140
150
|
interface ModuleInfo {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tilua/compiler",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Compiles tilua to Luau: lowers the @tilua/parser AST to a luau-parser AST and prints it",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"type": "module",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"luau-parser": "^1.0.3",
|
|
40
|
-
"@tilua/parser": "^
|
|
40
|
+
"@tilua/parser": "^2.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.20.2",
|