-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
132 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ coverage | |
.eslintrc.js | ||
babel.config.js | ||
jest.config.js | ||
__tests__ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
import * as clipboardy from "clipboardy"; | ||
import { Stats } from "fs"; | ||
import * as fs from "fs/promises"; | ||
import { StackConverter } from "../lib/stack-converter"; | ||
import * as clipboardy from 'clipboardy'; | ||
import { Stats } from 'fs'; | ||
import * as fs from 'fs/promises'; | ||
import { StackConverter } from '../lib/stack-converter'; | ||
|
||
const helpAndExit = () => { | ||
const help = ` | ||
@bugsplat/stack-converter contains a command line utility and set of libraries to help you demangle JavaScript stack frames. | ||
stack-converter command line usage: | ||
stack-converter [ [ "/source-map-directory" OR "/source.map.js" ] [ "/stack-trace.txt" ] ] | ||
* Optionally provide either a path to a directory containing source maps or a .map.js file - Defaults to current directory | ||
* Optionally provide a path to a .txt file containing a JavaScript Error stack trace - Defaults to value in clipboard | ||
❤️ [email protected] | ||
`; | ||
|
||
console.log(help); | ||
process.exit(1); | ||
}; | ||
|
||
(async () => { | ||
try { | ||
|
@@ -16,12 +34,12 @@ import { StackConverter } from "../lib/stack-converter"; | |
|
||
let sourceMapPath = process.argv[2]; | ||
if (!sourceMapPath) { | ||
sourceMapPath = "."; | ||
sourceMapPath = '.'; | ||
} | ||
|
||
let sourceMapStat: Stats; | ||
try { | ||
sourceMapStat = await fs.lstat(sourceMapPath) | ||
sourceMapStat = await fs.lstat(sourceMapPath); | ||
} catch { | ||
throw new Error(`Source map path ${sourceMapPath} does not exist`); | ||
} | ||
|
@@ -32,7 +50,7 @@ import { StackConverter } from "../lib/stack-converter"; | |
stackFileContents = await clipboardy.read(); | ||
} else { | ||
try { | ||
await fs.lstat(stackFilePath) | ||
await fs.lstat(stackFilePath); | ||
} catch { | ||
throw new Error(`Stack file path ${stackFilePath} does not exist`); | ||
} | ||
|
@@ -58,22 +76,3 @@ import { StackConverter } from "../lib/stack-converter"; | |
process.exit(1); | ||
} | ||
})(); | ||
|
||
|
||
function helpAndExit() { | ||
const help = ` | ||
@bugsplat/stack-converter contains a command line utility and set of libraries to help you demangle JavaScript stack frames. | ||
stack-converter command line usage: | ||
stack-converter [ [ "/source-map-directory" OR "/source.map.js" ] [ "/stack-trace.txt" ] ] | ||
* Optionally provide either a path to a directory containing source maps or a .map.js file - Defaults to current directory | ||
* Optionally provide a path to a .txt file containing a JavaScript Error stack trace - Defaults to value in clipboard | ||
❤️ [email protected] | ||
`; | ||
|
||
console.log(help); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.