purus 0.11.0 → 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/README-ja.md +13 -13
- package/README.md +13 -13
- package/package.json +4 -5
- package/pkg/lib/create.js +30 -18
- package/pkg/lib/init.js +3 -1
- package/pkg/lib/pm.js +103 -0
- package/pkg/lib/purus-compiler.js +2867 -2553
- package/pkg/lib/purus-core.js +13 -6
package/pkg/lib/purus-core.js
CHANGED
|
@@ -39,11 +39,17 @@ function compile(source, options = {}) {
|
|
|
39
39
|
args.push("--type", "commonjs");
|
|
40
40
|
}
|
|
41
41
|
args.push(tmpFile);
|
|
42
|
-
let result
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
let result;
|
|
43
|
+
try {
|
|
44
|
+
result = execFileSync(process.execPath, [COMPILER_JS, ...args], {
|
|
45
|
+
encoding: "utf8",
|
|
46
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
47
|
+
timeout: 30000,
|
|
48
|
+
});
|
|
49
|
+
} catch (err) {
|
|
50
|
+
const detail = `${err.stdout || ""}${err.stderr || ""}`.trim();
|
|
51
|
+
throw new Error(detail || `Compile error: ${err.message}`);
|
|
52
|
+
}
|
|
47
53
|
result = stdlib.postProcess(result);
|
|
48
54
|
if (header) {
|
|
49
55
|
return `// Generated by Purus ${VERSION}\n${result}`;
|
|
@@ -80,7 +86,8 @@ function check(source) {
|
|
|
80
86
|
});
|
|
81
87
|
return true;
|
|
82
88
|
} catch (err) {
|
|
83
|
-
|
|
89
|
+
const detail = `${err.stdout || ""}${err.stderr || ""}`.trim();
|
|
90
|
+
throw new Error(`Syntax error: ${detail || err.message}`);
|
|
84
91
|
} finally {
|
|
85
92
|
try {
|
|
86
93
|
fs.unlinkSync(tmpFile);
|