Skip to content

πŸŽ₯ Make videos programmatically with React

better choice of characters for code frame - print all code blocks from user code

Jonny Burgerefd3c4a72917
diff --git a/packages/cli/src/code-frame.ts b/packages/cli/src/code-frame.ts
index 3bd13afc13..00f555dfdd 100644
--- a/packages/cli/src/code-frame.ts
+++ b/packages/cli/src/code-frame.ts
@@ -37,12 +37,13 @@ const printCodeFrame = (frame: SymbolicatedStackFrame) => {
Log.info(
`${frame.originalScriptCode
.map((c) => {
- const content = `${String(c.lineNumber).padStart(
- longestLineNumber,
- ' '
- )} | ${c.content.substring(alignLeftAmount)}`;
+ const left = String(c.lineNumber).padStart(longestLineNumber, ' ');
+ const right = c.content.substring(alignLeftAmount);
+ if (c.highlight) {
+ return `${left} β”‚ ${right}`;
+ }
- return c.highlight ? content : chalk.gray(content);
+ return `${chalk.gray(left)} β”‚ ${chalk.gray(right)}`;
})
.join('\n')}`
);
@@ -81,7 +82,14 @@ export const printCodeFrameAndStack = (err: ErrorWithStackFrame) => {
continue;
}
- logLine(frame);
+ const isUserCode =
+ !frame.originalFileName?.includes('node_modules') &&
+ !frame.originalFileName?.startsWith('webpack/');
+ if (isUserCode) {
+ printCodeFrame(frame);
+ } else {
+ logLine(frame);
+ }
}
if (err.delayRenderCall) {