eolang 0.29.0 → 0.30.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.
Files changed (47) hide show
  1. package/README.md +7 -2
  2. package/REUSE.toml +8 -8
  3. package/eo-version.txt +1 -1
  4. package/eslint.config.js +75 -0
  5. package/home-tag.txt +1 -1
  6. package/mvnw/dependency-reduced-pom.xml +22 -3
  7. package/mvnw/pom.xml +24 -5
  8. package/package.json +14 -8
  9. package/patches/grunt-mocha-cli+7.0.0.patch +25 -0
  10. package/src/commands/assemble.js +4 -26
  11. package/src/commands/audit.js +0 -20
  12. package/src/commands/clean.js +0 -20
  13. package/src/commands/docs.js +41 -23
  14. package/src/commands/foreign.js +3 -23
  15. package/src/commands/generate_comments.js +128 -0
  16. package/src/commands/java/compile.js +1 -21
  17. package/src/commands/java/dataize.js +1 -21
  18. package/src/commands/java/link.js +0 -20
  19. package/src/commands/java/resolve.js +0 -20
  20. package/src/commands/java/test.js +0 -20
  21. package/src/commands/java/transpile.js +0 -20
  22. package/src/commands/jeo/assemble.js +0 -20
  23. package/src/commands/jeo/disassemble.js +0 -20
  24. package/src/commands/js/compile.js +0 -20
  25. package/src/commands/js/dataize.js +0 -20
  26. package/src/commands/js/link.js +5 -26
  27. package/src/commands/js/resolve.js +0 -20
  28. package/src/commands/js/test.js +0 -20
  29. package/src/commands/js/transpile.js +4 -25
  30. package/src/commands/latex.js +22 -0
  31. package/src/commands/lint.js +10 -30
  32. package/src/commands/parse.js +0 -20
  33. package/src/commands/phi.js +2 -22
  34. package/src/commands/print.js +0 -20
  35. package/src/commands/register.js +0 -20
  36. package/src/commands/sodg.js +2 -22
  37. package/src/commands/unphi.js +0 -20
  38. package/src/demand.js +0 -20
  39. package/src/elapsed.js +0 -20
  40. package/src/eo2jsw.js +28 -48
  41. package/src/eoc.js +101 -51
  42. package/src/mvnw.js +14 -36
  43. package/src/parser-version.js +17 -37
  44. package/src/tinted-console.js +17 -37
  45. package/src/version.js +2 -22
  46. package/.yamllint.yml +0 -12
  47. package/eodocs.html +0 -0
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  [![grunt](https://github.com/objectionary/eoc/actions/workflows/grunt.yml/badge.svg)](https://github.com/objectionary/eoc/actions/workflows/grunt.yml)
7
7
  [![node-current](https://img.shields.io/node/v/eolang)](https://www.npmjs.com/package/eolang)
8
- [![PDD status](http://www.0pdd.com/svg?name=objectionary/eoc)](http://www.0pdd.com/p?name=objectionary/eoc)
8
+ [![PDD status](https://www.0pdd.com/svg?name=objectionary/eoc)](https://www.0pdd.com/p?name=objectionary/eoc)
9
9
  [![Hits-of-Code](https://hitsofcode.com/github/objectionary/eoc)](https://hitsofcode.com/view/github/objectionary/eoc)
10
10
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/eoc/blob/master/LICENSE.txt)
11
11
 
@@ -18,7 +18,7 @@ First, you install [npm][npm-install] and [Java SE][java-se].
18
18
  Then, you install [eolang][npm] package:
19
19
 
20
20
  ```bash
21
- npm install -g eolang@0.28.0
21
+ npm install -g eolang@0.29.0
22
22
  ```
23
23
 
24
24
  Then, you write a simple [EO](https://www.eolang.org) program in `hello.eo` file
@@ -69,6 +69,11 @@ There are also commands that help manipulate with XMIR and EO sources
69
69
  * `phi` generates `.phi` files from `.xmir` files
70
70
  * `unphi` generates `.xmir` files from `.phi` files
71
71
  * `print` generates `.eo` files from `.phi` files
72
+ * `generate_comments` generates `.json` files with LLM-generated
73
+ documentation for `.eo` structures
74
+ * `docs` generates HTML documentation from `.xmir` files
75
+ * `latex` generates `.tex` files from `.eo` sources
76
+ * `fmt` formats `.eo` files in the source directory
72
77
  * ~~`translate` converts Java/C++/Python/etc. program to EO program~~
73
78
  * ~~`demu` removes `cage` and `memory` objects~~
74
79
  * ~~`dejump` removes `goto` objects~~
package/REUSE.toml CHANGED
@@ -4,11 +4,19 @@
4
4
  version = 1
5
5
  [[annotations]]
6
6
  path = [
7
+ ".DS_Store",
8
+ ".gitattributes",
9
+ ".gitignore",
10
+ ".npmignore",
11
+ ".pdd",
7
12
  "**.csv",
8
13
  "**.json",
9
14
  "**.md",
10
15
  "**.png",
11
16
  "**.txt",
17
+ "**/.DS_Store",
18
+ "**/.gitignore",
19
+ "**/.pdd",
12
20
  "**/*.csv",
13
21
  "**/*.jpg",
14
22
  "**/*.json",
@@ -18,17 +26,9 @@ path = [
18
26
  "**/*.svg",
19
27
  "**/*.txt",
20
28
  "**/*.vm",
21
- "**/.DS_Store",
22
- "**/.gitignore",
23
- "**/.pdd",
24
29
  "**/CITATION.cff",
25
30
  "**/CNAME",
26
31
  "**/MANIFEST.MF",
27
- ".DS_Store",
28
- ".gitattributes",
29
- ".gitignore",
30
- ".npmignore",
31
- ".pdd",
32
32
  "CITATION.cff",
33
33
  "MANIFEST.MF",
34
34
  "README.md",
package/eo-version.txt CHANGED
@@ -1 +1 @@
1
- 0.55.0
1
+ 0.56.7
@@ -0,0 +1,75 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: Copyright (c) 2022-2025 Objectionary.com
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ const { configs } = require('@eslint/js');
7
+ const promise = require('eslint-plugin-promise');
8
+
9
+ module.exports = [
10
+ {
11
+ ignores: ['node_modules/'],
12
+ },
13
+ {
14
+ ...configs.all,
15
+ files: ['**/*.js'],
16
+ languageOptions: {
17
+ ecmaVersion: 2019,
18
+ sourceType: 'module'
19
+ },
20
+ plugins: {
21
+ promise,
22
+ },
23
+ rules: {
24
+ ...configs.all.rules,
25
+ 'camelcase': 'off',
26
+ 'capitalized-comments': 'off',
27
+ 'consistent-return': 'off',
28
+ 'default-param-last': 'off',
29
+ 'eqeqeq': 'off',
30
+ 'func-names': 'off',
31
+ 'func-style': 'off',
32
+ 'id-length': 'off',
33
+ 'indent': ['error', 2, { "SwitchCase": 1 }],
34
+ 'init-declarations': 'off',
35
+ 'max-len': ['error', { code: 200 }],
36
+ 'max-lines': 'off',
37
+ 'max-lines-per-function': 'off',
38
+ 'max-params': 'off',
39
+ 'max-statements': 'off',
40
+ 'no-alert': 'off',
41
+ 'no-console': 'off',
42
+ 'no-dupe-keys': 'off',
43
+ 'no-inline-comments': 'off',
44
+ 'no-invalid-this': 'off',
45
+ 'no-magic-numbers': 'off',
46
+ 'no-multi-assign': 'off',
47
+ 'no-param-reassign': 'off',
48
+ 'no-plusplus': 'off',
49
+ 'no-promise-executor-return': 'off',
50
+ 'no-prototype-builtins': 'off',
51
+ 'no-shadow': 'off',
52
+ 'no-ternary': 'off',
53
+ 'no-undef': 'off',
54
+ 'no-undefined': 'off',
55
+ 'no-unused-vars': 'off',
56
+ 'no-use-before-define': 'off',
57
+ 'one-var': 'off',
58
+ 'prefer-destructuring': 'off',
59
+ 'require-await': 'off',
60
+ 'require-unicode-regexp': 'off',
61
+ 'sort-keys': 'off',
62
+ 'sort-vars': 'off',
63
+ "promise/prefer-await-to-then": "off"
64
+ }
65
+ },
66
+ {
67
+ files: [
68
+ 'src/commands/js/transpile.js',
69
+ 'src/commands/js/link.js',
70
+ ],
71
+ rules: {
72
+ 'promise/prefer-await-to-then': 'warn',
73
+ },
74
+ }
75
+ ];
package/home-tag.txt CHANGED
@@ -1 +1 @@
1
- 0.55.0
1
+ 0.56.7
@@ -7,7 +7,7 @@
7
7
  <build>
8
8
  <sourceDirectory>${eo.generatedDir}</sourceDirectory>
9
9
  <outputDirectory>${eo.targetDir}/classes</outputDirectory>
10
- <testOutputDirectory>${eo.targetDir}/classes</testOutputDirectory>
10
+ <testOutputDirectory>${eo.targetDir}/test-classes</testOutputDirectory>
11
11
  <directory>${eo.targetDir}</directory>
12
12
  <finalName>eoc</finalName>
13
13
  <plugins>
@@ -79,7 +79,7 @@
79
79
  </plugin>
80
80
  <plugin>
81
81
  <artifactId>maven-surefire-plugin</artifactId>
82
- <version>3.5.2</version>
82
+ <version>3.5.3</version>
83
83
  <configuration>
84
84
  <failIfNoTests>true</failIfNoTests>
85
85
  <useFile>false</useFile>
@@ -94,6 +94,25 @@
94
94
  </properties>
95
95
  </configuration>
96
96
  </plugin>
97
+ <plugin>
98
+ <groupId>org.codehaus.mojo</groupId>
99
+ <artifactId>build-helper-maven-plugin</artifactId>
100
+ <version>3.6.1</version>
101
+ <executions>
102
+ <execution>
103
+ <id>add-test-sources</id>
104
+ <phase>generate-test-sources</phase>
105
+ <goals>
106
+ <goal>add-test-source</goal>
107
+ </goals>
108
+ <configuration>
109
+ <sources>
110
+ <source>${project.build.directory}/generated-test-sources</source>
111
+ </sources>
112
+ </configuration>
113
+ </execution>
114
+ </executions>
115
+ </plugin>
97
116
  </plugins>
98
117
  </build>
99
118
  <properties>
@@ -102,6 +121,6 @@
102
121
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
103
122
  <heap-size>undefined</heap-size>
104
123
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
105
- <jeo.version>0.6.26</jeo.version>
124
+ <jeo.version>0.10.0</jeo.version>
106
125
  </properties>
107
126
  </project>
package/mvnw/pom.xml CHANGED
@@ -10,7 +10,7 @@
10
10
  <version>0.0.0</version>
11
11
  <packaging>jar</packaging>
12
12
  <properties>
13
- <jeo.version>0.6.26</jeo.version>
13
+ <jeo.version>0.10.0</jeo.version>
14
14
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
15
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
16
16
  <eo.version>undefined</eo.version>
@@ -26,13 +26,13 @@
26
26
  <dependency>
27
27
  <groupId>org.junit.jupiter</groupId>
28
28
  <artifactId>junit-jupiter-api</artifactId>
29
- <version>5.11.4</version>
29
+ <version>5.13.0</version>
30
30
  <scope>compile</scope>
31
31
  </dependency>
32
32
  <dependency>
33
33
  <groupId>org.junit.jupiter</groupId>
34
34
  <artifactId>junit-jupiter-engine</artifactId>
35
- <version>5.11.4</version>
35
+ <version>5.13.0</version>
36
36
  <scope>compile</scope>
37
37
  </dependency>
38
38
  </dependencies>
@@ -41,7 +41,7 @@
41
41
  <sourceDirectory>${eo.generatedDir}</sourceDirectory>
42
42
  <directory>${eo.targetDir}</directory>
43
43
  <outputDirectory>${eo.targetDir}/classes</outputDirectory>
44
- <testOutputDirectory>${eo.targetDir}/classes</testOutputDirectory>
44
+ <testOutputDirectory>${eo.targetDir}/test-classes</testOutputDirectory>
45
45
  <plugins>
46
46
  <plugin>
47
47
  <artifactId>maven-enforcer-plugin</artifactId>
@@ -111,7 +111,7 @@
111
111
  </plugin>
112
112
  <plugin>
113
113
  <artifactId>maven-surefire-plugin</artifactId>
114
- <version>3.5.2</version>
114
+ <version>3.5.3</version>
115
115
  <configuration>
116
116
  <failIfNoTests>true</failIfNoTests>
117
117
  <useFile>false</useFile>
@@ -128,6 +128,25 @@
128
128
  </properties>
129
129
  </configuration>
130
130
  </plugin>
131
+ <plugin>
132
+ <groupId>org.codehaus.mojo</groupId>
133
+ <artifactId>build-helper-maven-plugin</artifactId>
134
+ <version>3.6.1</version>
135
+ <executions>
136
+ <execution>
137
+ <id>add-test-sources</id>
138
+ <phase>generate-test-sources</phase>
139
+ <goals>
140
+ <goal>add-test-source</goal>
141
+ </goals>
142
+ <configuration>
143
+ <sources>
144
+ <source>${project.build.directory}/generated-test-sources</source>
145
+ </sources>
146
+ </configuration>
147
+ </execution>
148
+ </executions>
149
+ </plugin>
131
150
  </plugins>
132
151
  </build>
133
152
  </project>
package/package.json CHANGED
@@ -4,25 +4,30 @@
4
4
  "eoc": "./src/eoc.js"
5
5
  },
6
6
  "dependencies": {
7
+ "@langchain/core": "^0.3.55",
8
+ "@langchain/openai": "^0.5.10",
7
9
  "colors": "1.4.0",
8
10
  "commander": "12.1.0",
9
11
  "eo2js": "0.0.8",
10
- "fast-xml-parser": "4.5.1",
11
- "node": "23.5.0",
12
+ "fast-xml-parser": "5.2.3",
13
+ "node": "24.1.0",
12
14
  "relative": "3.0.2",
13
- "semver": "7.6.3",
15
+ "semver": "7.7.2",
14
16
  "sync-request": "6.1.0",
15
17
  "xmlhttprequest": "1.8.0"
16
18
  },
17
19
  "description": "A collection of command line tools for EOLANG: compiling, parsing, transpiling to other languages, optimizing, and analyzing",
18
20
  "devDependencies": {
19
- "eslint": "9.17.0",
21
+ "@eslint/js": "^9.27.0",
22
+ "eslint": "9.28.0",
20
23
  "eslint-config-google": "0.14.0",
24
+ "eslint-plugin-promise": "^7.2.1",
21
25
  "grunt": "1.6.1",
22
26
  "grunt-contrib-clean": "2.0.1",
23
- "grunt-eslint": "24.3.0",
24
- "grunt-mocha-cli": "^4.0.0",
25
- "mocha": "^10.8.2"
27
+ "grunt-eslint": "25.0.0",
28
+ "grunt-mocha-cli": "^7.0.0",
29
+ "mocha": "^11.5.0",
30
+ "patch-package": "^8.0.0"
26
31
  },
27
32
  "engines": {
28
33
  "node": ">6.0",
@@ -49,7 +54,8 @@
49
54
  ],
50
55
  "repository": "objectionary/eoc",
51
56
  "scripts": {
57
+ "postinstall": "patch-package",
52
58
  "test": "mocha --timeout 1200000"
53
59
  },
54
- "version": "0.29.0"
60
+ "version": "0.30.0"
55
61
  }
@@ -0,0 +1,25 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
2
+ # SPDX-License-Identifier: MIT
3
+ diff --git a/node_modules/grunt-mocha-cli/lib/index.js b/node_modules/grunt-mocha-cli/lib/index.js
4
+ index 59f7a07..4cc7182 100644
5
+ --- a/node_modules/grunt-mocha-cli/lib/index.js
6
+ +++ b/node_modules/grunt-mocha-cli/lib/index.js
7
+ @@ -2,6 +2,7 @@
8
+ const fs = require('fs')
9
+ const path = require('path')
10
+ const grunt = require('grunt')
11
+ +const os = require('os')
12
+
13
+ const BOOL_OPTIONS = [
14
+ 'allow-uncaught',
15
+ @@ -55,6 +56,10 @@ module.exports = function(options) {
16
+ spawnOptions.cmd = path.dirname(spawnOptions.cmd)
17
+ spawnOptions.cmd += '/../.bin/mocha'
18
+
19
+ + if (os.platform() === 'win32') {
20
+ + spawnOptions.opts.shell = true
21
+ + }
22
+ +
23
+ if (process.platform === 'win32') {
24
+ spawnOptions.cmd += '.cmd'
25
+ }
@@ -1,23 +1,3 @@
1
- // Copyright (c) 2022-2025 Objectionary.com
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included
11
- // in all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- // SOFTWARE.
20
-
21
1
  /*
22
2
  * SPDX-FileCopyrightText: Copyright (c) 2022-2025 Objectionary.com
23
3
  * SPDX-License-Identifier: MIT
@@ -35,10 +15,8 @@ const {elapsed} = require('../elapsed');
35
15
  */
36
16
  module.exports = function(opts) {
37
17
  const target = path.resolve(opts.target);
38
- return elapsed((tracked) => {
39
- return mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
40
- tracked.print('EO program assembled in %s', rel(target));
41
- return r;
42
- });
43
- });
18
+ return elapsed((tracked) => mvnw(['eo:assemble'].concat(flags(opts)), opts.target, opts.batch).then((r) => {
19
+ tracked.print('EO program assembled in %s', rel(target));
20
+ return r;
21
+ }));
44
22
  };
@@ -1,23 +1,3 @@
1
- // Copyright (c) 2022-2025 Objectionary.com
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included
11
- // in all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- // SOFTWARE.
20
-
21
1
  /*
22
2
  * SPDX-FileCopyrightText: Copyright (c) 2022-2025 Objectionary.com
23
3
  * SPDX-License-Identifier: MIT
@@ -1,23 +1,3 @@
1
- // Copyright (c) 2022-2025 Objectionary.com
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included
11
- // in all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- // SOFTWARE.
20
-
21
1
  /*
22
2
  * SPDX-FileCopyrightText: Copyright (c) 2022-2025 Objectionary.com
23
3
  * SPDX-License-Identifier: MIT
@@ -1,23 +1,3 @@
1
- // Copyright (c) 2022-2025 Objectionary.com
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included
11
- // in all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- // SOFTWARE.
20
-
21
1
  /*
22
2
  * SPDX-FileCopyrightText: Copyright (c) 2022-2025 Objectionary.com
23
3
  * SPDX-License-Identifier: MIT
@@ -27,10 +7,48 @@ const fs = require('fs');
27
7
  const path = require('path');
28
8
 
29
9
  /**
30
- * Command to create docs from .EO sources.
10
+ * Recursively reads all .xmir files from a directory.
11
+ * @param {string} dir - Directory path
12
+ * @return {string[]} Array of file paths
13
+ */
14
+ function readXmirsRecursively(dir) {
15
+ const files = [];
16
+ const entries = fs.readdirSync(dir, {withFileTypes: true});
17
+ for (const entry of entries) {
18
+ const full = path.join(dir, entry.name);
19
+ if (entry.isDirectory()) {
20
+ files.push(...readXmirsRecursively(full));
21
+ } else if (entry.name.endsWith('.xmir')) {
22
+ files.push(full);
23
+ }
24
+ }
25
+ return files;
26
+ }
27
+
28
+ /**
29
+ * Command to generate documentation.
31
30
  * @param {Hash} opts - All options
32
31
  */
33
32
  module.exports = function(opts) {
34
- const filePath = path.resolve('eodocs.html');
35
- fs.writeFileSync(filePath, '');
33
+ try {
34
+ const input = path.resolve(opts.target, '.eoc', '1-parse');
35
+ const output = path.resolve(opts.target, 'docs');
36
+ fs.mkdirSync(output, {recursive: true});
37
+ const xmirs = readXmirsRecursively(input);
38
+ for (const xmir of xmirs) {
39
+ const relative = path.relative(input, xmir);
40
+ const packages = path.dirname(relative).split(path.sep).join('.');
41
+ const html = path.join(output, `package_${packages}.html`);
42
+ fs.mkdirSync(path.dirname(html), {recursive: true});
43
+ fs.writeFileSync(html, '');
44
+ }
45
+ const packages = path.join(output, 'packages.html');
46
+ fs.writeFileSync(packages, '');
47
+ const css = path.join(output, 'styles.css');
48
+ fs.writeFileSync(css, '');
49
+ console.info('Documentation generation completed in %s directory', output);
50
+ } catch (error) {
51
+ console.error('Error generating documentation:', error);
52
+ throw error;
53
+ }
36
54
  };
@@ -1,23 +1,3 @@
1
- // Copyright (c) 2022-2025 Objectionary.com
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included
11
- // in all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- // SOFTWARE.
20
-
21
1
  /*
22
2
  * SPDX-FileCopyrightText: Copyright (c) 2022-2025 Objectionary.com
23
3
  * SPDX-License-Identifier: MIT
@@ -32,10 +12,10 @@ const fs = require('fs');
32
12
  * @param {Hash} opts - All options
33
13
  */
34
14
  module.exports = function(opts) {
35
- const file = path.resolve(opts.target, 'eo-foreign.json');
36
- const all = JSON.parse(fs.readFileSync(file, 'utf8'));
15
+ const file = path.resolve(opts.target, 'eo-foreign.json'),
16
+ all = JSON.parse(fs.readFileSync(file, 'utf8'));
37
17
  console.info('There are %d objects in %s:', all.length, rel(file));
38
18
  all.forEach((obj) => {
39
- console.info(' %s', obj['id']);
19
+ console.info(' %s', obj.id);
40
20
  });
41
21
  };