@harmoniclabs/pebble 0.1.0-dev3 → 0.1.0-dev5
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.
|
@@ -91,9 +91,19 @@ export class AstCompiler extends DiagnosticEmitter {
|
|
|
91
91
|
this.error(DiagnosticCode.File_0_not_found, undefined, this.cfg.entry);
|
|
92
92
|
throw new Error("entry file not found");
|
|
93
93
|
}
|
|
94
|
+
if (!this.io.exsistSync(filePath))
|
|
95
|
+
throw new Error("AstCompiler.compile: entry file does not exist: " + filePath);
|
|
94
96
|
const entrySrc = await this.compileFile(filePath, true);
|
|
95
|
-
if (this.diagnostics.length > 0 || !entrySrc)
|
|
96
|
-
|
|
97
|
+
if (this.diagnostics.length > 0 || !entrySrc) {
|
|
98
|
+
let msg;
|
|
99
|
+
globalThis.console && console.log(this.diagnostics);
|
|
100
|
+
const fstErrorMsg = this.diagnostics[0].toString();
|
|
101
|
+
const nDiags = this.diagnostics.length;
|
|
102
|
+
while (msg = this.diagnostics.shift()) {
|
|
103
|
+
this.io.stdout.write(msg.toString() + "\n");
|
|
104
|
+
}
|
|
105
|
+
throw new Error("AstCompiler.compile: failed with " + nDiags + " diagnostic messages; first message: " + fstErrorMsg);
|
|
106
|
+
}
|
|
97
107
|
const mainFuncExpr = this.program.functions.get(this.program.contractTirFuncName);
|
|
98
108
|
if (this.program.contractTirFuncName === "" || !mainFuncExpr) {
|
|
99
109
|
this.error(DiagnosticCode.Main_function_is_missing, undefined);
|
|
@@ -51,10 +51,15 @@ function addExtension(path, endsWithSlash) {
|
|
|
51
51
|
// Otherwise just add the extension
|
|
52
52
|
return path + extension;
|
|
53
53
|
}
|
|
54
|
+
export function isAbsolutePath(path) {
|
|
55
|
+
return path.startsWith(PATH_DELIMITER);
|
|
56
|
+
}
|
|
54
57
|
export function getEnvRelativePath(filePath, projectRoot) {
|
|
55
58
|
if (!(typeof filePath === 'string' &&
|
|
56
59
|
typeof projectRoot === 'string'))
|
|
57
60
|
return undefined;
|
|
61
|
+
if (isAbsolutePath(filePath))
|
|
62
|
+
return filePath;
|
|
58
63
|
projectRoot = projectRoot.trim();
|
|
59
64
|
filePath = getAbsolutePath(filePath.trim(), projectRoot);
|
|
60
65
|
if (!filePath)
|
package/package.json
CHANGED