-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
fix: Resolve webpack dependencies #251
Changes from 6 commits
cf82edb
b8eaedf
97fac94
48c3bd9
b1252f6
5ed3994
230621b
e1b5cc9
0606ecf
c919bcd
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 |
---|---|---|
|
@@ -4,54 +4,27 @@ | |
*/ | ||
"use strict"; | ||
|
||
const loaderFlag = "LOADER_EXECUTION"; | ||
|
||
const webpackOptionsFlag = "WEBPACK_OPTIONS"; | ||
|
||
exports.cutOffByFlag = (stack, flag) => { | ||
stack = stack.split("\n"); | ||
for (let i = 0; i < stack.length; i++) | ||
if (stack[i].indexOf(flag) >= 0) stack.length = i; | ||
if (stack[i].indexOf(flag) >= 0) | ||
stack.length = i; | ||
return stack.join("\n"); | ||
}; | ||
|
||
exports.cutOffLoaderExecution = stack => | ||
exports.cutOffByFlag(stack, loaderFlag); | ||
|
||
exports.cutOffWebpackOptinos = stack => | ||
exports.cutOffByFlag(stack, webpackOptionsFlag); | ||
exports.cutOffWebpackOptions = (stack) => exports.cutOffByFlag(stack, webpackOptionsFlag); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you tell me what these things are doing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ev1stensberg the file name change is slightly confused things here. I guess, this was the old errorhelpers content, I think I have to take the latest from the bin/errorhelpers.js right ? correct me if I am wrong There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, that would be prefered, thought you did that, so that's why I'm asking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where did the old errorHelper come from? Tobias? Maybe he improved/fixed some things there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, the old errorhelper was from Tobias, but the current master errorHelper was having all the methods what was there and new methods were added on top of it. So I decided to have this version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if I understand: You've looked at Tobias's PR, that is where this implementation of ErrorHelper is from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah... But when I merged with the master I saw yours (current master) which has more methods. Tobias PR : There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep what Tobias refactored, see if there's any old calls using the old code in the CLI, I'll re-review after |
||
|
||
exports.cutOffMultilineMessage = (stack, message) => { | ||
stack = stack.split("\n"); | ||
message = message.split("\n"); | ||
|
||
return stack | ||
.reduce( | ||
(acc, line, idx) => | ||
line.indexOf(message[idx]) < 0 ? acc.concat(line) : acc, | ||
[] | ||
) | ||
.join("\n"); | ||
}; | ||
|
||
exports.cutOffMessage = (stack, message) => { | ||
const nextLine = stack.indexOf("\n"); | ||
if (nextLine === -1) { | ||
return stack === message ? "" : stack; | ||
} else { | ||
const firstLine = stack.substr(0, nextLine); | ||
return firstLine === message ? stack.substr(nextLine + 1) : stack; | ||
} | ||
}; | ||
|
||
exports.cleanUp = (stack, message) => { | ||
stack = exports.cutOffLoaderExecution(stack); | ||
stack = exports.cutOffMessage(stack, message); | ||
return stack; | ||
return stack.reduce((acc, line, idx) => line === message[idx] || line === `Error: ${message[idx]}` ? acc : acc.concat(line), []).join("\n"); | ||
}; | ||
|
||
exports.cleanUpWebpackOptions = (stack, message) => { | ||
stack = exports.cutOffWebpackOptinos(stack); | ||
stack = exports.cutOffWebpackOptions(stack); | ||
stack = exports.cutOffMultilineMessage(stack, message); | ||
return stack; | ||
}; |
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.
Would you mind to change
var
s intoconst
andlet
where possible? We already have a PR that aims to this kind of refactor, this change could avoid some conflictsThere 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.
Rebase from master first
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.
good point both of you 👍 rebased and changed