File tree Expand file tree Collapse file tree 4 files changed +17
-18
lines changed
Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Original file line number Diff line number Diff line change 11node_modules
2- out
2+ out
3+ * .tgz
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ Install by running `npm i -g source-map-unpacker`
99Usage: unmap [options]
1010
1111Options:
12- -p, --path <p> input map file
13- -f, --filter <f> string to filter out files
14- -o, --output <o> output folder
15- -h, --help output usage information
12+ -p, --path <p> input source map file
13+ -f, --filter <f> filter out file names
14+ -o, --output <o> output folder (default: "./")
15+ -h, --help display help for command
1616```
Original file line number Diff line number Diff line change 11{
22 "name" : " source-map-unpacker" ,
3- "version" : " 1.5.2 " ,
3+ "version" : " 1.5.3 " ,
44 "description" : " " ,
55 "main" : " unmap.js" ,
66 "bin" : {
77 "unpack" : " unmap.js"
88 },
9+ "engines" : {
10+ "node" : " >10"
11+ },
912 "scripts" : {
1013 "test" : " node . -p test/gistfile1.js.map -o out"
1114 },
Original file line number Diff line number Diff line change @@ -13,25 +13,20 @@ const opts = program
1313 . parse ( process . argv )
1414 . opts ( ) ;
1515
16- // stat output folder
17- fs . stat ( opts . output )
18- . then ( async ( ) => {
19- // if output folder exists continue
20- return fs . readFile ( opts . path ) ;
21- } )
16+ fs . readFile ( opts . path )
2217 . catch ( async ( e ) => {
23- // if output folder does not exist, make it.
24- await fs . mkdir ( opts . output ) ;
25- return fs . readFile ( opts . path ) ;
18+ console . log ( "Input file does not exists" ) ;
19+ process . exit ( 1 ) ;
2620 } )
2721 . then ( ( js ) => {
2822 js = JSON . parse ( js . toString ( ) ) ;
2923
3024 const files = js . sources
3125 . filter ( ( path ) => ( opts . filter ? path . includes ( opts . filter ) : true ) )
32- . map ( ( path , idx ) =>
33- fs . outputFile ( resolve ( opts . output , path ) , js . sourcesContent [ idx ] )
34- ) ;
26+ . map ( ( path , idx ) => {
27+ const outpath = resolve ( opts . output , path ) ;
28+ return fs . outputFile ( outpath , js . sourcesContent [ idx ] ) ;
29+ } ) ;
3530 return Promise . all ( files ) ;
3631 } )
3732 . then ( ( ) => console . log ( `${ opts . path } unpacked` ) ) ;
You can’t perform that action at this time.
0 commit comments