Skip to content

Commit

Permalink
fixed stack overflow bug in nomnoml-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
skanaar committed Apr 26, 2020
1 parent 5c3e61e commit f6dce89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/nomnoml.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var nomnoml;
var source = fs.readFileSync(filepath, { encoding: 'utf8' });
var directory = path.dirname(filepath);
return source.replace(/#import: *(.*)/g, function (a, file) {
return compileFile(path.join(directory, file), depth + 1);
return compileFile(path.join(directory, file), maxImportDepth, depth + 1);
});
}
nomnoml.compileFile = compileFile;
Expand Down
4 changes: 2 additions & 2 deletions src/node-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace nomnoml {
}
}

export function compileFile(filepath: string, maxImportDepth: number, depth?: number): string {
export function compileFile(filepath: string, maxImportDepth: number, depth: number): string {
var fs = require('fs')
var path = require('path')

Expand All @@ -18,7 +18,7 @@ namespace nomnoml {
var directory = path.dirname(filepath)

return source.replace(/#import: *(.*)/g, function (a: any, file: string) {
return compileFile(path.join(directory, file), depth+1)
return compileFile(path.join(directory, file), maxImportDepth, depth+1)
})
}

Expand Down

0 comments on commit f6dce89

Please sign in to comment.