-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adds --all functionality #158
Changes from all commits
4ffb5c7
99a6601
38199f1
674be8f
9b5763e
65a5453
2156f19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
.nyc_output | ||
coverage | ||
tmp | ||
.idea |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { isAbsolute, join, dirname } = require('path') | ||
const { readFileSync } = require('fs') | ||
/** | ||
* Extract the sourcemap url from a source file | ||
* reference: https://sourcemaps.info/spec.html | ||
* @param {String} file - compilation target file | ||
* @returns {String} full path to source map file | ||
* @private | ||
*/ | ||
function getSourceMapFromFile (file) { | ||
const fileBody = readFileSync(file).toString() | ||
const sourceMapLineRE = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/mg | ||
const results = fileBody.match(sourceMapLineRE) | ||
if (results !== null) { | ||
const sourceMap = results[results.length - 1].split('=')[1] | ||
if (isAbsolute(sourceMap)) { | ||
return sourceMap | ||
} else { | ||
const base = dirname(file) | ||
return join(base, sourceMap) | ||
} | ||
} | ||
} | ||
|
||
module.exports = getSourceMapFromFile |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,4 @@ | |
"bin", | ||
"LICENSE" | ||
] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function Unloaded(){ | ||
return 'Never loaded :(' | ||
} | ||
|
||
console.log("This file shouldn't have been evaluated") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default function getString(i){ | ||
if (typeof i === 'number'){ | ||
if (isNaN(i)){ | ||
return 'NaN' | ||
} | ||
else if (i === 0){ | ||
return 'zero' | ||
} | ||
else if (i > 0){ | ||
return 'positive' | ||
} | ||
else { | ||
return 'negative' | ||
} | ||
} | ||
else { | ||
return 'wat?' | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import getString from "./loaded" | ||
console.log(getString(0)) | ||
console.log(getString(1)) | ||
console.log(getString(-1)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function Unloaded(){ | ||
return 'Never loaded :(' | ||
} | ||
|
||
console.log("This file shouldn't have been evaluated") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default function getString(i){ | ||
if (typeof i === 'number'){ | ||
if (isNaN(i)){ | ||
return 'NaN' | ||
} | ||
else if (i === 0){ | ||
return 'zero' | ||
} | ||
else if (i > 0){ | ||
return 'positive' | ||
} | ||
else { | ||
return 'negative' | ||
} | ||
} | ||
else { | ||
return 'wat?' | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import getString from "./loaded" | ||
console.log(getString(0)) | ||
console.log(getString(1)) | ||
console.log(getString(-1)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = function Unloaded(){ | ||
return 'Never loaded :(' | ||
} | ||
|
||
console.log("This file shouldn't have been evaluated") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = function getString(i){ | ||
if (typeof i === 'number'){ | ||
if (isNaN(i)){ | ||
return 'NaN' | ||
} | ||
else if (i === 0){ | ||
return 'zero' | ||
bcoe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
else if (i > 0){ | ||
return 'positive' | ||
} | ||
else { | ||
return 'negative' | ||
} | ||
} | ||
else { | ||
return 'wat?' | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const loaded = require('./loaded.js'); | ||
console.log(loaded(0)) | ||
console.log(loaded(1)) | ||
console.log(loaded(-1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lost the
{}
here. Not sure if that is an issue.