mimo-lang 1.0.8 → 1.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/bun.lockb CHANGED
Binary file
@@ -1,4 +1,5 @@
1
- import esformatter from 'esformatter';
1
+ import pkg from 'js-beautify';
2
+ const { js_beautify } = pkg;
2
3
 
3
4
 
4
5
  let declaredVariables = new Set();
@@ -37,7 +38,7 @@ export function generateCodeFromAst(node) {
37
38
 
38
39
  export function generateCodeJsFromAstArray(ast) {
39
40
  const generatedCode = ast.map(generateCodeFromAst).join("\n");
40
- return esformatter.format(generatedCode);
41
+ return js_beautify(generatedCode);
41
42
  }
42
43
 
43
44
  function generateFunction(node) {
package/i.js ADDED
@@ -0,0 +1,30 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ function addJsExtensionToImports(filePath) {
5
+ const code = fs.readFileSync(filePath, 'utf8');
6
+ const newCode = code.replace(/from\s+(['"])(.*?)(?<!\.js)\1/g, 'from $1$2.js$1');
7
+
8
+ if (code !== newCode) {
9
+ fs.writeFileSync(filePath, newCode, 'utf8');
10
+ console.log(`Updated imports in ${filePath}`);
11
+ }
12
+ }
13
+
14
+ function traverseDirectory(dirPath) {
15
+ const files = fs.readdirSync(dirPath);
16
+
17
+ for (const file of files) {
18
+ const filePath = path.join(dirPath, file);
19
+ const stats = fs.statSync(filePath);
20
+
21
+ if (stats.isDirectory()) {
22
+ traverseDirectory(filePath);
23
+ } else if (path.extname(filePath) === '.js') {
24
+ addJsExtensionToImports(filePath);
25
+ }
26
+ }
27
+ }
28
+
29
+ const rootDir = './'; // replace with your directory path
30
+ traverseDirectory(rootDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mimo-lang",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "A programming language made in javascript mostly for learning purposes.",
5
5
  "keywords": [
6
6
  "programing language"
@@ -16,13 +16,13 @@
16
16
  "scripts": {
17
17
  "mimo": "bun cli.js",
18
18
  "dev": "bun index.js",
19
- "test": "bun test/index.js"
19
+ "test": "node test/index.js"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/bun": "latest"
23
23
  },
24
24
  "dependencies": {
25
- "esformatter": "^0.11.3"
25
+ "js-beautify": "^1.15.1"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",