eyereasoner 18.14.2 → 18.14.4
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/dist/bin/main.d.ts +2 -0
- package/dist/bin/main.js +25 -2
- package/dist/eye.d.ts +1 -1
- package/dist/eye.js +1 -1
- package/dist/lingua.d.ts +1 -1
- package/dist/lingua.js +1 -1
- package/package.json +3 -2
package/dist/bin/main.d.ts
CHANGED
package/dist/bin/main.js
CHANGED
|
@@ -3,25 +3,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.convertToPosixPath = convertToPosixPath;
|
|
6
7
|
exports.mainFunc = mainFunc;
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const readline_1 = __importDefault(require("readline"));
|
|
10
11
|
const __1 = require("..");
|
|
11
12
|
const query_1 = require("../query");
|
|
13
|
+
function convertToPosixPath(filePath, pathLib = path_1.default) {
|
|
14
|
+
// For the Emscripten FS, we need to ensure posix separators
|
|
15
|
+
// for any relative sub-path that may have been typed in
|
|
16
|
+
// on w32 as subdir\socrates.n3
|
|
17
|
+
// First normalize the path to handle any path oddities
|
|
18
|
+
const normalizedPath = pathLib.normalize(filePath);
|
|
19
|
+
// Then split by platform-specific separator and join with POSIX separator
|
|
20
|
+
return normalizedPath.split(pathLib.sep).join(pathLib.posix.sep);
|
|
21
|
+
}
|
|
12
22
|
async function mainFunc(proc) {
|
|
13
23
|
const rl = readline_1.default.promises.createInterface({
|
|
14
24
|
input: proc.stdin,
|
|
15
25
|
output: proc.stdout,
|
|
16
26
|
});
|
|
17
27
|
const Module = await (0, __1.SwiplEye)();
|
|
28
|
+
const posixArgv = [];
|
|
18
29
|
// Make any local files available to the reasoner
|
|
19
30
|
for (const arg of proc.argv.slice(2)) {
|
|
20
31
|
const p = path_1.default.join(proc.cwd(), arg);
|
|
21
32
|
if (fs_1.default.existsSync(p)) {
|
|
22
|
-
|
|
33
|
+
const posixPath = convertToPosixPath(arg);
|
|
34
|
+
posixArgv.push(posixPath);
|
|
35
|
+
// Create any subdirectories needed for this file path
|
|
36
|
+
const dirname = path_1.default.dirname(posixPath);
|
|
37
|
+
// @ts-ignore: mkdirTree exists in Emscripten FS but is not typed.
|
|
38
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/72434
|
|
39
|
+
Module.FS.mkdirTree(dirname);
|
|
40
|
+
// Now write the file to the correct path
|
|
41
|
+
Module.FS.writeFile(posixPath, fs_1.default.readFileSync(p));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// For non-filepath arguments, keep them as-is
|
|
45
|
+
posixArgv.push(arg);
|
|
23
46
|
}
|
|
24
47
|
}
|
|
25
|
-
await (0, query_1.qaQuery)(Module, 'main',
|
|
48
|
+
await (0, query_1.qaQuery)(Module, 'main', posixArgv, (q) => rl.question(`${q}\n|: `));
|
|
26
49
|
rl.close();
|
|
27
50
|
}
|