mlogjs 0.1.11 → 0.2.2

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.
Files changed (225) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +68 -18
  3. package/build/bin.cjs +69 -0
  4. package/dist/bin.cjs +69 -0
  5. package/dist/index.cjs +1817 -0
  6. package/dist/index.mjs +1813 -0
  7. package/dist/types/Compiler.d.ts +18 -0
  8. package/{build → dist/types}/Scope.d.ts +8 -11
  9. package/dist/types/bin.d.ts +1 -0
  10. package/dist/types/handlers/BlockStatement.d.ts +2 -0
  11. package/dist/types/handlers/CallExpression.d.ts +3 -0
  12. package/dist/types/handlers/ForStatement.d.ts +2 -0
  13. package/{build → dist/types}/handlers/Function.d.ts +0 -0
  14. package/{build → dist/types}/handlers/Identifier.d.ts +0 -0
  15. package/dist/types/handlers/IfStatement.d.ts +2 -0
  16. package/{build → dist/types}/handlers/Literal.d.ts +0 -0
  17. package/{build → dist/types}/handlers/Object.d.ts +0 -0
  18. package/{build → dist/types}/handlers/OperationExpressions.d.ts +0 -0
  19. package/dist/types/handlers/Program.d.ts +2 -0
  20. package/dist/types/handlers/Statements.d.ts +5 -0
  21. package/dist/types/handlers/TemplateExpression.d.ts +2 -0
  22. package/dist/types/handlers/VariableDeclaration.d.ts +3 -0
  23. package/dist/types/handlers/WhileStatement.d.ts +2 -0
  24. package/{build → dist/types}/handlers/index.d.ts +0 -0
  25. package/dist/types/index.d.ts +1 -0
  26. package/dist/types/initScope.d.ts +2 -0
  27. package/{build → dist/types}/instructions/AddressResolver.d.ts +1 -1
  28. package/{build → dist/types}/instructions/ControlInstructions.d.ts +0 -0
  29. package/{build → dist/types}/instructions/EndInstruction.d.ts +0 -0
  30. package/{build → dist/types}/instructions/InstructionBase.d.ts +2 -2
  31. package/{build → dist/types}/instructions/JumpInstruction.d.ts +1 -1
  32. package/{build → dist/types}/instructions/OperationInstruction.d.ts +1 -1
  33. package/{build → dist/types}/instructions/SetCounterInstruction.d.ts +0 -0
  34. package/{build → dist/types}/instructions/SetInstruction.d.ts +0 -0
  35. package/{build → dist/types}/instructions/ZeroSpaceInstruction.d.ts +0 -0
  36. package/{build → dist/types}/instructions/index.d.ts +0 -0
  37. package/dist/types/macros/Building.d.ts +11 -0
  38. package/dist/types/macros/Function.d.ts +12 -0
  39. package/{build → dist/types}/macros/Math.d.ts +0 -0
  40. package/{build/macros/Blocks.d.ts → dist/types/macros/Memory.d.ts} +1 -1
  41. package/dist/types/macros/Namespace.d.ts +21 -0
  42. package/{build/macros/Draw.d.ts → dist/types/macros/Other.d.ts} +1 -1
  43. package/dist/types/macros/RawValue.d.ts +5 -0
  44. package/dist/types/macros/commands/Control.d.ts +5 -0
  45. package/dist/types/macros/commands/Draw.d.ts +5 -0
  46. package/dist/types/macros/commands/DrawFlush.d.ts +5 -0
  47. package/dist/types/macros/commands/GetLink.d.ts +5 -0
  48. package/dist/types/macros/commands/Lookup.d.ts +5 -0
  49. package/dist/types/macros/commands/Print.d.ts +5 -0
  50. package/dist/types/macros/commands/PrintFlush.d.ts +5 -0
  51. package/dist/types/macros/commands/Radar.d.ts +7 -0
  52. package/dist/types/macros/commands/Sensor.d.ts +5 -0
  53. package/dist/types/macros/commands/UnitBind.d.ts +5 -0
  54. package/dist/types/macros/commands/UnitControl.d.ts +5 -0
  55. package/dist/types/macros/commands/UnitLocate.d.ts +5 -0
  56. package/dist/types/macros/commands/UnitRadar.d.ts +5 -0
  57. package/dist/types/macros/commands/Wait.d.ts +5 -0
  58. package/dist/types/macros/commands/index.d.ts +14 -0
  59. package/dist/types/macros/index.d.ts +7 -0
  60. package/{build → dist/types}/operators.d.ts +3 -0
  61. package/dist/types/types.d.ts +100 -0
  62. package/{build → dist/types}/utils.d.ts +1 -0
  63. package/{build → dist/types}/values/BaseValue.d.ts +0 -0
  64. package/{build → dist/types}/values/FunctionValue.d.ts +1 -1
  65. package/{build → dist/types}/values/LiteralValue.d.ts +0 -0
  66. package/dist/types/values/ObjectValue.d.ts +19 -0
  67. package/{build → dist/types}/values/StoreValue.d.ts +0 -0
  68. package/{build → dist/types}/values/TempValue.d.ts +0 -0
  69. package/{build → dist/types}/values/VoidValue.d.ts +3 -1
  70. package/{build → dist/types}/values/index.d.ts +0 -0
  71. package/{docs → doc}/README.md +9 -17
  72. package/lib/commands.d.ts +326 -0
  73. package/lib/eslib/index.d.ts +3 -0
  74. package/lib/eslib/lib.d.ts +9 -0
  75. package/lib/eslib/lib.es2015.collection.d.ts +89 -0
  76. package/lib/eslib/lib.es2015.core.d.ts +16 -0
  77. package/lib/eslib/lib.es2015.d.ts +30 -0
  78. package/lib/eslib/lib.es2015.generator.d.ts +79 -0
  79. package/lib/eslib/lib.es2015.iterable.d.ts +70 -0
  80. package/lib/eslib/lib.es5.d.ts +295 -0
  81. package/lib/eslib/lib.es6.d.ts +18 -0
  82. package/lib/globals.d.ts +328 -0
  83. package/lib/helpers.d.ts +23 -0
  84. package/lib/index.d.ts +7 -0
  85. package/lib/kinds.d.ts +36 -0
  86. package/lib/memory.d.ts +17 -0
  87. package/lib/traits.d.ts +120 -0
  88. package/lib/util.d.ts +32 -0
  89. package/package.json +63 -37
  90. package/.gitattributes +0 -2
  91. package/build/Compiler.d.ts +0 -18
  92. package/build/Compiler.js +0 -93
  93. package/build/Compiler.js.map +0 -1
  94. package/build/Scope.js +0 -61
  95. package/build/Scope.js.map +0 -1
  96. package/build/bin.d.ts +0 -2
  97. package/build/bin.js +0 -35
  98. package/build/bin.js.map +0 -1
  99. package/build/handlers/BlockStatement.d.ts +0 -2
  100. package/build/handlers/BlockStatement.js +0 -14
  101. package/build/handlers/BlockStatement.js.map +0 -1
  102. package/build/handlers/CallExpression.d.ts +0 -3
  103. package/build/handlers/CallExpression.js +0 -20
  104. package/build/handlers/CallExpression.js.map +0 -1
  105. package/build/handlers/ForStatement.d.ts +0 -2
  106. package/build/handlers/ForStatement.js +0 -32
  107. package/build/handlers/ForStatement.js.map +0 -1
  108. package/build/handlers/Function.js +0 -33
  109. package/build/handlers/Function.js.map +0 -1
  110. package/build/handlers/Identifier.js +0 -8
  111. package/build/handlers/Identifier.js.map +0 -1
  112. package/build/handlers/IfStatement.d.ts +0 -2
  113. package/build/handlers/IfStatement.js +0 -25
  114. package/build/handlers/IfStatement.js.map +0 -1
  115. package/build/handlers/Literal.js +0 -16
  116. package/build/handlers/Literal.js.map +0 -1
  117. package/build/handlers/Object.js +0 -44
  118. package/build/handlers/Object.js.map +0 -1
  119. package/build/handlers/OperationExpressions.js +0 -32
  120. package/build/handlers/OperationExpressions.js.map +0 -1
  121. package/build/handlers/Program.d.ts +0 -2
  122. package/build/handlers/Program.js +0 -9
  123. package/build/handlers/Program.js.map +0 -1
  124. package/build/handlers/Statements.d.ts +0 -5
  125. package/build/handlers/Statements.js +0 -28
  126. package/build/handlers/Statements.js.map +0 -1
  127. package/build/handlers/TemplateExpression.d.ts +0 -2
  128. package/build/handlers/TemplateExpression.js +0 -18
  129. package/build/handlers/TemplateExpression.js.map +0 -1
  130. package/build/handlers/VariableDeclaration.d.ts +0 -3
  131. package/build/handlers/VariableDeclaration.js +0 -32
  132. package/build/handlers/VariableDeclaration.js.map +0 -1
  133. package/build/handlers/WhileStatement.d.ts +0 -2
  134. package/build/handlers/WhileStatement.js +0 -23
  135. package/build/handlers/WhileStatement.js.map +0 -1
  136. package/build/handlers/index.js +0 -27
  137. package/build/handlers/index.js.map +0 -1
  138. package/build/index.d.ts +0 -1
  139. package/build/index.js +0 -8
  140. package/build/index.js.map +0 -1
  141. package/build/instructions/AddressResolver.js +0 -32
  142. package/build/instructions/AddressResolver.js.map +0 -1
  143. package/build/instructions/ControlInstructions.js +0 -23
  144. package/build/instructions/ControlInstructions.js.map +0 -1
  145. package/build/instructions/EndInstruction.js +0 -11
  146. package/build/instructions/EndInstruction.js.map +0 -1
  147. package/build/instructions/InstructionBase.js +0 -21
  148. package/build/instructions/InstructionBase.js.map +0 -1
  149. package/build/instructions/JumpInstruction.js +0 -22
  150. package/build/instructions/JumpInstruction.js.map +0 -1
  151. package/build/instructions/OperationInstruction.js +0 -11
  152. package/build/instructions/OperationInstruction.js.map +0 -1
  153. package/build/instructions/SetCounterInstruction.js +0 -11
  154. package/build/instructions/SetCounterInstruction.js.map +0 -1
  155. package/build/instructions/SetInstruction.js +0 -11
  156. package/build/instructions/SetInstruction.js.map +0 -1
  157. package/build/instructions/ZeroSpaceInstruction.js +0 -11
  158. package/build/instructions/ZeroSpaceInstruction.js.map +0 -1
  159. package/build/instructions/index.js +0 -22
  160. package/build/instructions/index.js.map +0 -1
  161. package/build/macros/Blocks.js +0 -137
  162. package/build/macros/Blocks.js.map +0 -1
  163. package/build/macros/Draw.js +0 -34
  164. package/build/macros/Draw.js.map +0 -1
  165. package/build/macros/Function.d.ts +0 -12
  166. package/build/macros/Function.js +0 -20
  167. package/build/macros/Function.js.map +0 -1
  168. package/build/macros/Math.js +0 -57
  169. package/build/macros/Math.js.map +0 -1
  170. package/build/macros/Other.d.ts +0 -8
  171. package/build/macros/Other.js +0 -29
  172. package/build/macros/Other.js.map +0 -1
  173. package/build/macros/TypeFactory.d.ts +0 -8
  174. package/build/macros/TypeFactory.js +0 -22
  175. package/build/macros/TypeFactory.js.map +0 -1
  176. package/build/macros/index.d.ts +0 -5
  177. package/build/macros/index.js +0 -18
  178. package/build/macros/index.js.map +0 -1
  179. package/build/operators.js +0 -39
  180. package/build/operators.js.map +0 -1
  181. package/build/scopes/FunctionScope.d.ts +0 -5
  182. package/build/scopes/FunctionScope.js +0 -13
  183. package/build/scopes/FunctionScope.js.map +0 -1
  184. package/build/scopes/LoopScope.d.ts +0 -5
  185. package/build/scopes/LoopScope.js +0 -13
  186. package/build/scopes/LoopScope.js.map +0 -1
  187. package/build/scopes/Scope.d.ts +0 -36
  188. package/build/scopes/Scope.js +0 -93
  189. package/build/scopes/Scope.js.map +0 -1
  190. package/build/scopes/index.d.ts +0 -3
  191. package/build/scopes/index.js +0 -16
  192. package/build/scopes/index.js.map +0 -1
  193. package/build/types.d.ts +0 -49
  194. package/build/types.js +0 -24
  195. package/build/types.js.map +0 -1
  196. package/build/utils.js +0 -9
  197. package/build/utils.js.map +0 -1
  198. package/build/values/BaseValue.js +0 -102
  199. package/build/values/BaseValue.js.map +0 -1
  200. package/build/values/FunctionValue.js +0 -101
  201. package/build/values/FunctionValue.js.map +0 -1
  202. package/build/values/LiteralValue.js +0 -89
  203. package/build/values/LiteralValue.js.map +0 -1
  204. package/build/values/ObjectValue.d.ts +0 -17
  205. package/build/values/ObjectValue.js +0 -50
  206. package/build/values/ObjectValue.js.map +0 -1
  207. package/build/values/StoreValue.js +0 -31
  208. package/build/values/StoreValue.js.map +0 -1
  209. package/build/values/TempValue.js +0 -53
  210. package/build/values/TempValue.js.map +0 -1
  211. package/build/values/VoidValue.js +0 -31
  212. package/build/values/VoidValue.js.map +0 -1
  213. package/build/values/index.js +0 -19
  214. package/build/values/index.js.map +0 -1
  215. package/dist/bundle.js +0 -553
  216. package/docs/.nojekyll +0 -0
  217. package/docs/_coverpage.md +0 -8
  218. package/docs/_sidebar.md +0 -3
  219. package/docs/data-types.md +0 -56
  220. package/docs/getting-started.md +0 -19
  221. package/docs/index.html +0 -41
  222. package/docs/mlogjs.png +0 -0
  223. package/mlogjs.d.ts +0 -72
  224. package/tsconfig.json +0 -22
  225. package/webpack.config.js +0 -22
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 STR1Z
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Wei
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,18 +1,68 @@
1
- # MlogJS
2
-
3
- MlogJS is a compiler that allows users to compile complex JavaScript programs into Mindustry Logic Code.
4
-
5
- ## Discord
6
-
7
- You can join the Discord server for more information and help.
8
-
9
- https://discord.gg/SvgjCtZnR5
10
-
11
- ## Getting started!
12
-
13
- ```
14
- npm i mlogjs -g
15
- ```
16
-
17
- After installing the package from NPM, please visit the docs.
18
- https://weisrc.github.io/mlogjs/
1
+ <div markdown="1" align="center">
2
+
3
+ [![mlogjs](https://weisrc.github.io/mlogjs/logo.png)][docs]
4
+
5
+ # **JavaScript [MLog](https://mindustrygame.github.io/wiki/logic/0-introduction/) Compiler**
6
+
7
+ [![ci](https://github.com/weisrc/mlogjs/actions/workflows/ci.yml/badge.svg)][ci]
8
+ [![npm](https://img.shields.io/npm/v/mlogjs?color=cb3837&logo=npm)][npm]
9
+ [![docs](https://img.shields.io/badge/docs-mlogjs-41B883?logo=readthedocs)][docs]
10
+
11
+ </div>
12
+
13
+ ## Features
14
+
15
+ - Optimzing compiler
16
+ - Easy to use
17
+ - Fully Typed API
18
+ - Macros
19
+ - All Instructions and Variables
20
+
21
+ ## Installation
22
+
23
+ #### In the terminal
24
+
25
+ ```sh
26
+ npm i -g mlogjs
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ #### Creating `hello.js`
32
+
33
+ ```js
34
+ const message1 = getBuilding("message1")
35
+ print("Hello world")
36
+ printFlush(message1)
37
+ ```
38
+
39
+ #### Compile
40
+
41
+ ```sh
42
+ mlogjs hello.js hello.mlog
43
+ ```
44
+
45
+ ## Resources
46
+
47
+ - [Discord](https://discord.gg/SvgjCtZnR5)
48
+ - [Documentation][docs]
49
+ - [NPM package][npm]
50
+ - [GitHub Action CI][ci]
51
+
52
+ ## Maintainers
53
+
54
+ Massive thanks to [@JeanJPNM](https://github.com/JeanJPNM) for adding new features!
55
+
56
+ ## Contribute
57
+
58
+ Help and suggestions are welcomed!
59
+
60
+ ## License
61
+
62
+ MIT
63
+
64
+ <!-- url -->
65
+
66
+ [npm]: https://www.npmjs.com/package/mlogjs
67
+ [ci]: https://github.com/weisrc/mlogjs/actions/workflows/ci.yml
68
+ [docs]: https://weisrc.github.io/mlogjs
package/build/bin.cjs ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ var fs = require('fs');
5
+ var helpers = require('yargs/helpers');
6
+ var index_cjs = require('./index.cjs');
7
+ var cliHighlight = require('cli-highlight');
8
+ var yargs = require('yargs');
9
+ var chalk = require('chalk');
10
+ var path = require('path');
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var yargs__default = /*#__PURE__*/_interopDefaultLegacy(yargs);
15
+ var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
16
+
17
+ yargs__default["default"](helpers.hideBin(process.argv))
18
+ .command("$0 [path] [out]", "compiles your Javascript file to MLog", yargs => {
19
+ return yargs
20
+ .positional("path", {
21
+ describe: "path of the file to compile",
22
+ type: "string",
23
+ })
24
+ .positional("out", {
25
+ describe: "path of the output file",
26
+ type: "string",
27
+ });
28
+ }, argv => {
29
+ const path$1 = argv.path;
30
+ if (!path$1)
31
+ return console.log("missing required path argument");
32
+ if (!fs.existsSync(path$1))
33
+ return console.log(`file at ${path$1} does not exist`);
34
+ const out = argv.out ?? defaultOutPath(path$1);
35
+ if (path$1 == out)
36
+ return console.log("The out path cannot be the same as the input path");
37
+ const code = fs.readFileSync(path$1, "utf8");
38
+ const [output, error, [node]] = index_cjs.compile(code);
39
+ if (error) {
40
+ // @ts-ignore
41
+ let start = error?.loc;
42
+ let end = start;
43
+ if (node) {
44
+ start = node.loc.start;
45
+ end = node.loc.end;
46
+ }
47
+ const lines = code.split("\n");
48
+ console.log(chalk__default["default"].cyanBright([path.resolve(path$1), start.line, start.column].join(":")));
49
+ for (let i = Math.max(start.line - 3, 0); i < Math.min(end.line + 2, lines.length); i++) {
50
+ const n = i + 1;
51
+ const head = chalk__default["default"].gray((n + " | ").padStart(6, " "));
52
+ console.log(head + cliHighlight.highlight(lines[i], { language: "js" }));
53
+ if (n === start.line) {
54
+ console.log(chalk__default["default"].red(" ".repeat(6 + start.column) + "^ " + error.message));
55
+ }
56
+ }
57
+ return;
58
+ }
59
+ fs.writeFileSync(out, output);
60
+ console.log(`Success: Compiled ${path$1}. Your compiled code is at ${out}.`);
61
+ })
62
+ .help()
63
+ .scriptName("mlogjs")
64
+ .demandCommand()
65
+ .parse();
66
+ function defaultOutPath(path$1) {
67
+ const parsed = path.parse(path$1);
68
+ return path.join(parsed.dir, `${parsed.name}.mlog`);
69
+ }
package/dist/bin.cjs ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ var fs = require('fs');
5
+ var helpers = require('yargs/helpers');
6
+ var index_cjs = require('./index.cjs');
7
+ var cliHighlight = require('cli-highlight');
8
+ var yargs = require('yargs');
9
+ var chalk = require('chalk');
10
+ var path = require('path');
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var yargs__default = /*#__PURE__*/_interopDefaultLegacy(yargs);
15
+ var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
16
+
17
+ yargs__default["default"](helpers.hideBin(process.argv))
18
+ .command("$0 [path] [out]", "compiles your Javascript file to MLog", yargs => {
19
+ return yargs
20
+ .positional("path", {
21
+ describe: "path of the file to compile",
22
+ type: "string",
23
+ })
24
+ .positional("out", {
25
+ describe: "path of the output file",
26
+ type: "string",
27
+ });
28
+ }, argv => {
29
+ const path$1 = argv.path;
30
+ if (!path$1)
31
+ return console.log("missing required path argument");
32
+ if (!fs.existsSync(path$1))
33
+ return console.log(`file at ${path$1} does not exist`);
34
+ const out = argv.out ?? defaultOutPath(path$1);
35
+ if (path$1 == out)
36
+ return console.log("The out path cannot be the same as the input path");
37
+ const code = fs.readFileSync(path$1, "utf8");
38
+ const [output, error, [node]] = index_cjs.compile(code);
39
+ if (error) {
40
+ // @ts-ignore
41
+ let start = error?.loc;
42
+ let end = start;
43
+ if (node) {
44
+ start = node.loc.start;
45
+ end = node.loc.end;
46
+ }
47
+ const lines = code.split("\n");
48
+ console.log(chalk__default["default"].cyanBright([path.resolve(path$1), start.line, start.column].join(":")));
49
+ for (let i = Math.max(start.line - 3, 0); i < Math.min(end.line + 2, lines.length); i++) {
50
+ const n = i + 1;
51
+ const head = chalk__default["default"].gray((n + " | ").padStart(6, " "));
52
+ console.log(head + cliHighlight.highlight(lines[i], { language: "js" }));
53
+ if (n === start.line) {
54
+ console.log(chalk__default["default"].red(" ".repeat(6 + start.column) + "^ " + error.message));
55
+ }
56
+ }
57
+ return;
58
+ }
59
+ fs.writeFileSync(out, output);
60
+ console.log(`Success: Compiled ${path$1}. Your compiled code is at ${out}.`);
61
+ })
62
+ .help()
63
+ .scriptName("mlogjs")
64
+ .demandCommand()
65
+ .parse();
66
+ function defaultOutPath(path$1) {
67
+ const parsed = path.parse(path$1);
68
+ return path.join(parsed.dir, `${parsed.name}.mlog`);
69
+ }