@zenithbuild/compiler 0.6.17 → 0.7.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 (2) hide show
  1. package/dist/index.js +12 -2
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -83,10 +83,20 @@ function compile(entryPathOrSource, filePathOrOptions = {}) {
83
83
  if (result.error) {
84
84
  throw new Error(result.error.message);
85
85
  }
86
+ const stdout = typeof result.stdout === "string" ? result.stdout.trim() : "";
87
+ if (stdout) {
88
+ try {
89
+ return JSON.parse(stdout);
90
+ } catch (error) {
91
+ if (result.status === 0) {
92
+ throw error;
93
+ }
94
+ }
95
+ }
86
96
  if (result.status !== 0) {
87
- throw new Error(result.stderr || "Compiler execution failed");
97
+ throw new Error(result.stderr || result.stdout || "Compiler execution failed");
88
98
  }
89
- return JSON.parse(result.stdout);
99
+ return {};
90
100
  }
91
101
  export {
92
102
  resolveCompilerBin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/compiler",
3
- "version": "0.6.17",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -28,10 +28,10 @@
28
28
  "prepublishOnly": "npm run build"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@zenithbuild/compiler-darwin-arm64": "0.6.17",
32
- "@zenithbuild/compiler-darwin-x64": "0.6.17",
33
- "@zenithbuild/compiler-linux-x64": "0.6.17",
34
- "@zenithbuild/compiler-win32-x64": "0.6.17"
31
+ "@zenithbuild/compiler-darwin-arm64": "0.7.1",
32
+ "@zenithbuild/compiler-darwin-x64": "0.7.1",
33
+ "@zenithbuild/compiler-linux-x64": "0.7.1",
34
+ "@zenithbuild/compiler-win32-x64": "0.7.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "latest",