mlogjs 0.1.10 → 0.2.1

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 (245) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +68 -18
  3. package/build/Compiler.d.ts +18 -18
  4. package/build/Compiler.js +99 -92
  5. package/build/Compiler.js.map +1 -1
  6. package/build/Scope.d.ts +26 -26
  7. package/build/Scope.js +60 -60
  8. package/build/Scope.js.map +1 -1
  9. package/build/bin.d.ts +2 -2
  10. package/build/bin.js +59 -33
  11. package/build/bin.js.map +1 -1
  12. package/build/handlers/BlockStatement.d.ts +2 -2
  13. package/build/handlers/BlockStatement.js +13 -13
  14. package/build/handlers/BlockStatement.js.map +1 -1
  15. package/build/handlers/CallExpression.d.ts +3 -3
  16. package/build/handlers/CallExpression.js +19 -19
  17. package/build/handlers/CallExpression.js.map +1 -1
  18. package/build/handlers/ForStatement.d.ts +2 -2
  19. package/build/handlers/ForStatement.js +31 -31
  20. package/build/handlers/ForStatement.js.map +1 -1
  21. package/build/handlers/Function.d.ts +4 -4
  22. package/build/handlers/Function.js +35 -32
  23. package/build/handlers/Function.js.map +1 -1
  24. package/build/handlers/Identifier.d.ts +2 -2
  25. package/build/handlers/Identifier.js +7 -7
  26. package/build/handlers/Identifier.js.map +1 -1
  27. package/build/handlers/IfStatement.d.ts +2 -2
  28. package/build/handlers/IfStatement.js +24 -24
  29. package/build/handlers/IfStatement.js.map +1 -1
  30. package/build/handlers/Literal.d.ts +2 -2
  31. package/build/handlers/Literal.js +17 -15
  32. package/build/handlers/Literal.js.map +1 -1
  33. package/build/handlers/Object.d.ts +4 -4
  34. package/build/handlers/Object.js +43 -43
  35. package/build/handlers/Object.js.map +1 -1
  36. package/build/handlers/OperationExpressions.d.ts +7 -7
  37. package/build/handlers/OperationExpressions.js +32 -31
  38. package/build/handlers/OperationExpressions.js.map +1 -1
  39. package/build/handlers/Program.d.ts +2 -2
  40. package/build/handlers/Program.js +8 -8
  41. package/build/handlers/Program.js.map +1 -1
  42. package/build/handlers/Statements.d.ts +5 -5
  43. package/build/handlers/Statements.js +29 -27
  44. package/build/handlers/Statements.js.map +1 -1
  45. package/build/handlers/TemplateExpression.d.ts +2 -2
  46. package/build/handlers/TemplateExpression.js +17 -17
  47. package/build/handlers/TemplateExpression.js.map +1 -1
  48. package/build/handlers/VariableDeclaration.d.ts +3 -3
  49. package/build/handlers/VariableDeclaration.js +55 -31
  50. package/build/handlers/VariableDeclaration.js.map +1 -1
  51. package/build/handlers/WhileStatement.d.ts +2 -2
  52. package/build/handlers/WhileStatement.js +22 -22
  53. package/build/handlers/WhileStatement.js.map +1 -1
  54. package/build/handlers/index.d.ts +14 -14
  55. package/build/handlers/index.js +30 -26
  56. package/build/handlers/index.js.map +1 -1
  57. package/build/index.d.ts +1 -1
  58. package/build/index.js +7 -7
  59. package/build/index.js.map +1 -1
  60. package/build/initScope.d.ts +2 -0
  61. package/build/initScope.js +40 -0
  62. package/build/initScope.js.map +1 -0
  63. package/build/instructions/AddressResolver.d.ts +12 -12
  64. package/build/instructions/AddressResolver.js +30 -31
  65. package/build/instructions/AddressResolver.js.map +1 -1
  66. package/build/instructions/ControlInstructions.d.ts +11 -11
  67. package/build/instructions/ControlInstructions.js +22 -22
  68. package/build/instructions/ControlInstructions.js.map +1 -1
  69. package/build/instructions/EndInstruction.d.ts +4 -4
  70. package/build/instructions/EndInstruction.js +10 -10
  71. package/build/instructions/EndInstruction.js.map +1 -1
  72. package/build/instructions/InstructionBase.d.ts +10 -10
  73. package/build/instructions/InstructionBase.js +20 -20
  74. package/build/instructions/InstructionBase.js.map +1 -1
  75. package/build/instructions/JumpInstruction.d.ts +15 -15
  76. package/build/instructions/JumpInstruction.js +21 -21
  77. package/build/instructions/JumpInstruction.js.map +1 -1
  78. package/build/instructions/OperationInstruction.d.ts +5 -5
  79. package/build/instructions/OperationInstruction.js +10 -10
  80. package/build/instructions/OperationInstruction.js.map +1 -1
  81. package/build/instructions/SetCounterInstruction.d.ts +5 -5
  82. package/build/instructions/SetCounterInstruction.js +10 -10
  83. package/build/instructions/SetCounterInstruction.js.map +1 -1
  84. package/build/instructions/SetInstruction.d.ts +5 -5
  85. package/build/instructions/SetInstruction.js +10 -10
  86. package/build/instructions/SetInstruction.js.map +1 -1
  87. package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
  88. package/build/instructions/ZeroSpaceInstruction.js +10 -10
  89. package/build/instructions/ZeroSpaceInstruction.js.map +1 -1
  90. package/build/instructions/index.d.ts +9 -9
  91. package/build/instructions/index.js +25 -21
  92. package/build/instructions/index.js.map +1 -1
  93. package/build/macros/Building.d.ts +11 -0
  94. package/build/macros/Building.js +81 -0
  95. package/build/macros/Building.js.map +1 -0
  96. package/build/macros/Function.d.ts +12 -12
  97. package/build/macros/Function.js +19 -19
  98. package/build/macros/Function.js.map +1 -1
  99. package/build/macros/Math.d.ts +5 -5
  100. package/build/macros/Math.js +56 -56
  101. package/build/macros/Math.js.map +1 -1
  102. package/build/macros/{Blocks.d.ts → Memory.d.ts} +5 -5
  103. package/build/macros/Memory.js +61 -0
  104. package/build/macros/Memory.js.map +1 -0
  105. package/build/macros/Namespace.d.ts +21 -0
  106. package/build/macros/Namespace.js +98 -0
  107. package/build/macros/Namespace.js.map +1 -0
  108. package/build/macros/Other.d.ts +5 -8
  109. package/build/macros/Other.js +19 -28
  110. package/build/macros/Other.js.map +1 -1
  111. package/build/macros/{Draw.d.ts → RawValue.d.ts} +5 -5
  112. package/build/macros/RawValue.js +16 -0
  113. package/build/macros/RawValue.js.map +1 -0
  114. package/build/macros/commands/Control.d.ts +5 -0
  115. package/build/macros/commands/Control.js +25 -0
  116. package/build/macros/commands/Control.js.map +1 -0
  117. package/build/macros/commands/Draw.d.ts +5 -0
  118. package/build/macros/{Draw.js → commands/Draw.js} +38 -33
  119. package/build/macros/commands/Draw.js.map +1 -0
  120. package/build/macros/commands/DrawFlush.d.ts +5 -0
  121. package/build/macros/commands/DrawFlush.js +17 -0
  122. package/build/macros/commands/DrawFlush.js.map +1 -0
  123. package/build/macros/commands/GetLink.d.ts +5 -0
  124. package/build/macros/commands/GetLink.js +21 -0
  125. package/build/macros/commands/GetLink.js.map +1 -0
  126. package/build/macros/commands/Lookup.d.ts +5 -0
  127. package/build/macros/commands/Lookup.js +24 -0
  128. package/build/macros/commands/Lookup.js.map +1 -0
  129. package/build/macros/commands/Print.d.ts +5 -0
  130. package/build/macros/commands/Print.js +14 -0
  131. package/build/macros/commands/Print.js.map +1 -0
  132. package/build/macros/commands/PrintFlush.d.ts +5 -0
  133. package/build/macros/commands/PrintFlush.js +17 -0
  134. package/build/macros/commands/PrintFlush.js.map +1 -0
  135. package/build/macros/commands/Radar.d.ts +7 -0
  136. package/build/macros/commands/Radar.js +61 -0
  137. package/build/macros/commands/Radar.js.map +1 -0
  138. package/build/macros/commands/Sensor.d.ts +5 -0
  139. package/build/macros/commands/Sensor.js +20 -0
  140. package/build/macros/commands/Sensor.js.map +1 -0
  141. package/build/macros/commands/UnitBind.d.ts +5 -0
  142. package/build/macros/commands/UnitBind.js +17 -0
  143. package/build/macros/commands/UnitBind.js.map +1 -0
  144. package/build/macros/commands/UnitControl.d.ts +5 -0
  145. package/build/macros/commands/UnitControl.js +68 -0
  146. package/build/macros/commands/UnitControl.js.map +1 -0
  147. package/build/macros/commands/UnitLocate.d.ts +5 -0
  148. package/build/macros/commands/UnitLocate.js +55 -0
  149. package/build/macros/commands/UnitLocate.js.map +1 -0
  150. package/build/macros/commands/UnitRadar.d.ts +5 -0
  151. package/build/macros/commands/UnitRadar.js +41 -0
  152. package/build/macros/commands/UnitRadar.js.map +1 -0
  153. package/build/macros/commands/Wait.d.ts +5 -0
  154. package/build/macros/commands/Wait.js +18 -0
  155. package/build/macros/commands/Wait.js.map +1 -0
  156. package/build/macros/commands/index.d.ts +14 -0
  157. package/build/macros/commands/index.js +33 -0
  158. package/build/macros/commands/index.js.map +1 -0
  159. package/build/macros/index.d.ts +7 -5
  160. package/build/macros/index.js +39 -17
  161. package/build/macros/index.js.map +1 -1
  162. package/build/operators.d.ts +25 -22
  163. package/build/operators.js +101 -38
  164. package/build/operators.js.map +1 -1
  165. package/build/types.d.ts +49 -49
  166. package/build/types.js +27 -23
  167. package/build/types.js.map +1 -1
  168. package/build/utils.d.ts +3 -2
  169. package/build/utils.js +12 -8
  170. package/build/utils.js.map +1 -1
  171. package/build/values/BaseValue.d.ts +5 -5
  172. package/build/values/BaseValue.js +111 -101
  173. package/build/values/BaseValue.js.map +1 -1
  174. package/build/values/FunctionValue.d.ts +34 -34
  175. package/build/values/FunctionValue.js +103 -100
  176. package/build/values/FunctionValue.js.map +1 -1
  177. package/build/values/LiteralValue.d.ts +12 -12
  178. package/build/values/LiteralValue.js +87 -88
  179. package/build/values/LiteralValue.js.map +1 -1
  180. package/build/values/ObjectValue.d.ts +17 -17
  181. package/build/values/ObjectValue.js +49 -49
  182. package/build/values/ObjectValue.js.map +1 -1
  183. package/build/values/StoreValue.d.ts +11 -11
  184. package/build/values/StoreValue.js +30 -30
  185. package/build/values/StoreValue.js.map +1 -1
  186. package/build/values/TempValue.d.ts +12 -12
  187. package/build/values/TempValue.js +66 -52
  188. package/build/values/TempValue.js.map +1 -1
  189. package/build/values/VoidValue.d.ts +11 -11
  190. package/build/values/VoidValue.js +30 -30
  191. package/build/values/VoidValue.js.map +1 -1
  192. package/build/values/index.d.ts +6 -6
  193. package/build/values/index.js +22 -18
  194. package/build/values/index.js.map +1 -1
  195. package/dist/mlogjs.es.js +6366 -0
  196. package/dist/mlogjs.umd.js +8 -0
  197. package/lib/commands.d.ts +326 -0
  198. package/lib/eslib/index.d.ts +3 -0
  199. package/lib/eslib/lib.d.ts +9 -0
  200. package/lib/eslib/lib.es2015.collection.d.ts +89 -0
  201. package/lib/eslib/lib.es2015.core.d.ts +16 -0
  202. package/lib/eslib/lib.es2015.d.ts +30 -0
  203. package/lib/eslib/lib.es2015.generator.d.ts +79 -0
  204. package/lib/eslib/lib.es2015.iterable.d.ts +70 -0
  205. package/lib/eslib/lib.es5.d.ts +295 -0
  206. package/lib/eslib/lib.es6.d.ts +18 -0
  207. package/lib/globals.d.ts +328 -0
  208. package/lib/helpers.d.ts +23 -0
  209. package/lib/index.d.ts +7 -0
  210. package/lib/kinds.d.ts +36 -0
  211. package/lib/memory.d.ts +17 -0
  212. package/lib/traits.d.ts +121 -0
  213. package/lib/util.d.ts +32 -0
  214. package/package.json +73 -37
  215. package/.gitattributes +0 -2
  216. package/build/macros/Blocks.js +0 -134
  217. package/build/macros/Blocks.js.map +0 -1
  218. package/build/macros/Draw.js.map +0 -1
  219. package/build/macros/TypeFactory.d.ts +0 -8
  220. package/build/macros/TypeFactory.js +0 -22
  221. package/build/macros/TypeFactory.js.map +0 -1
  222. package/build/scopes/FunctionScope.d.ts +0 -5
  223. package/build/scopes/FunctionScope.js +0 -13
  224. package/build/scopes/FunctionScope.js.map +0 -1
  225. package/build/scopes/LoopScope.d.ts +0 -5
  226. package/build/scopes/LoopScope.js +0 -13
  227. package/build/scopes/LoopScope.js.map +0 -1
  228. package/build/scopes/Scope.d.ts +0 -36
  229. package/build/scopes/Scope.js +0 -93
  230. package/build/scopes/Scope.js.map +0 -1
  231. package/build/scopes/index.d.ts +0 -3
  232. package/build/scopes/index.js +0 -16
  233. package/build/scopes/index.js.map +0 -1
  234. package/dist/bundle.js +0 -553
  235. package/docs/.nojekyll +0 -0
  236. package/docs/README.md +0 -17
  237. package/docs/_coverpage.md +0 -8
  238. package/docs/_sidebar.md +0 -3
  239. package/docs/data-types.md +0 -56
  240. package/docs/getting-started.md +0 -19
  241. package/docs/index.html +0 -41
  242. package/docs/mlogjs.png +0 -0
  243. package/mlogjs.d.ts +0 -72
  244. package/tsconfig.json +0 -22
  245. package/webpack.config.js +0 -22
package/docs/.nojekyll DELETED
File without changes
package/docs/README.md DELETED
@@ -1,17 +0,0 @@
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 for help.
8
-
9
- <iframe src="https://discord.com/widget?id=841105039211888710&theme=dark" width="350" height="300" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
10
-
11
- ## Getting started!
12
-
13
- ```
14
- npm i mlogjs -g
15
- ```
16
-
17
- After installing the package from NPM, read the [docs](https://str1z.github.io/mlogjs).
@@ -1,8 +0,0 @@
1
- # MlogJS <small>0.1.1</small>
2
-
3
- > Effortless JavaScript to Mindustry Logic Code compiler.
4
-
5
- ![](mlogjs.png)
6
-
7
- [GitHub](https://github.com/str1z/mlogcc)
8
- [Get Started](#getting-started)
package/docs/_sidebar.md DELETED
@@ -1,3 +0,0 @@
1
- - [MlogJS](/)
2
- - [Getting Started](/getting-started)
3
- - [Data Types](/data-types)
@@ -1,56 +0,0 @@
1
- # Data Types
2
-
3
- There are a total of four different data types:
4
-
5
- - Literal
6
- - Stora
7
- - Function
8
- - Object
9
-
10
- ## Literal
11
-
12
- Literal values are the raw values that you write directly. They are constant strings or numbers.
13
-
14
- ```js
15
- 123 // is a literal
16
- const a = 123 // is a literal as well
17
- const b = "some string" // string literal
18
- typeof a === "literal" // true
19
- ```
20
-
21
- ## Store
22
-
23
- Store values are the registers in the game inside a processor. They are mutable.
24
-
25
- ```js
26
- let a = 123 // is a store number
27
- let b = "string" // is a store string
28
- typeof b === "store" // true
29
- ```
30
-
31
- ## Function
32
-
33
- Function values are constants.
34
-
35
- ```js
36
- function add(a,b) {
37
- return a + b
38
- }
39
- typeof add === "function" // true
40
- ```
41
-
42
- ## Object
43
-
44
- Object values are constants and support operator overriding.
45
-
46
- ```js
47
- const obj = {
48
- a: 1,
49
- b: (a,b) => a + b,
50
- $call: (a,b) => a * b,
51
- }
52
- obj.a // 1
53
- obj.b(1,2) // 3
54
- obj(2,2) // 4
55
- typeof obj === "object" // true
56
- ```
@@ -1,19 +0,0 @@
1
- # Getting started.
2
-
3
- ## How to use it?
4
-
5
- You can use it through the online version, the Discord bot, or the command-line interface tool.
6
-
7
- ## CLI installation
8
-
9
- ```
10
- npm i -g mlogjs
11
- ```
12
-
13
- ## Web version
14
-
15
- https://weisrc.github.io/mlogjs-web-editor/
16
-
17
- ## Discord bot
18
-
19
- Coming soon!
package/docs/index.html DELETED
@@ -1,41 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <title>Document</title>
7
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
8
- <meta name="description" content="Description" />
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
10
- <link rel="stylesheet"
11
- href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css" />
12
-
13
-
14
- </head>
15
-
16
- <body>
17
- <div id="app"></div>
18
- <script src="//cdn.jsdelivr.net/npm/docsify-edit-on-github"></script>
19
-
20
- <script>
21
- window.$docsify = {
22
- plugins: [EditOnGithubPlugin.create("https://github.com/str1z/mlogcc/tree/main/docs/")],
23
- name: "MlogJS",
24
- repo: "https://github.com/str1z/mlogcc",
25
- coverpage: true,
26
- loadSidebar: true,
27
- subMaxLevel: 3,
28
- copyCode: {
29
- buttonText: "Copy",
30
- errorText: "Error",
31
- successText: "Copied",
32
- },
33
- };
34
- </script>
35
- <!-- Docsify v4 -->
36
- <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
37
- <script src="https://unpkg.com/docsify-copy-code@2"></script>
38
- <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
39
- </body>
40
-
41
- </html>
package/docs/mlogjs.png DELETED
Binary file
package/mlogjs.d.ts DELETED
@@ -1,72 +0,0 @@
1
- declare type TTarget =
2
- | "any"
3
- | "enemy"
4
- | "ally"
5
- | "player"
6
- | "attacker"
7
- | "flying"
8
- | "boss"
9
- | "ground";
10
-
11
- declare class Block {
12
- constructor(name: string);
13
- write(i: number, value: number): number;
14
- read(i: number): number;
15
- printFlush(): void;
16
- drawFlush(): void;
17
- puts(...values: (number | string)[]): void;
18
- sensor(attr: string): number | boolean;
19
- control(attr: "enabled" | "shoot" | "shootp" | "configure" | "color", ...args: number[]): void;
20
- radar(
21
- target0: TTarget,
22
- target1: TTarget,
23
- target2: TTarget,
24
- sort: "distance" | "health" | "shield" | "armor" | "maxHealth",
25
- distance: number
26
- ): any;
27
- }
28
-
29
- declare class Store {
30
- constructor(name: string);
31
- }
32
-
33
- declare class Temp {}
34
-
35
- // @ts-ignore
36
- declare const Math = {
37
- max: (a: number, b: number) => Math.max(a, b),
38
- min: (a: number, b: number) => Math.min(a, b),
39
- angle: (a: number, b: number) => Math.atan2(a, b),
40
- len: (a: number, b: number) => Math.sqrt(a ** 2 + b ** 2),
41
- noise: (x: any, y: any) => x + y,
42
- abs: (a: number) => Math.abs(a),
43
- log: (a: number) => Math.log(a),
44
- log10: (a: number) => Math.log(a) / Math.log(10),
45
- sin: (a: number) => Math.sin(a),
46
- cos: (a: number) => Math.cos(a),
47
- tan: (a: number) => Math.tan(a),
48
- floor: (a: number) => Math.floor(a),
49
- ceil: (a: number) => Math.ceil(a),
50
- sqrt: (a: number) => Math.ceil(a),
51
- rand: (range: number) => Math.random() * range,
52
- };
53
-
54
- declare function draw(
55
- kind:
56
- | "clear"
57
- | "color"
58
- | "stroke"
59
- | "line"
60
- | "rect"
61
- | "lineRect"
62
- | "poly"
63
- | "linePoly"
64
- | "triangle"
65
- | "image",
66
- ...args: any
67
- ): void;
68
-
69
- declare function print(...values: any): void;
70
- declare function concat(...values: string[]): string;
71
-
72
- declare class Entity extends Block {}
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "declaration": true,
5
- "esModuleInterop": true,
6
- "allowSyntheticDefaultImports": true,
7
- "target": "es6",
8
- "moduleResolution": "node",
9
- "sourceMap": true,
10
- "outDir": "build",
11
- "baseUrl": ".",
12
- "paths": {
13
- "*": [
14
- "node_modules/*",
15
- "src/types/*"
16
- ]
17
- }
18
- },
19
- "include": [
20
- "src/**/*"
21
- ]
22
- }
package/webpack.config.js DELETED
@@ -1,22 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- entry: './src/index.ts',
5
- module: {
6
- rules: [
7
- {
8
- test: /\.tsx?$/,
9
- use: 'ts-loader',
10
- exclude: /node_modules/,
11
- },
12
- ],
13
- },
14
- output: {
15
- path: path.resolve(__dirname, 'dist'),
16
- filename: 'bundle.js',
17
- library: "mlogcc"
18
- },
19
- resolve: {
20
- extensions: ['.ts', '.js'],
21
- },
22
- };