create-yeow 0.2.25 → 0.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-yeow",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -200,7 +200,6 @@ async function printFormattedError(err) {
200
200
  const c = { r: '\x1b[0m', R: '\x1b[31m', Y: '\x1b[33m', C: '\x1b[36m', B: '\x1b[1m', D: '\x1b[2m' };
201
201
  console.log(`\n${c.R}${c.B} ⛔ JS Error [${err.plugin}]${c.r}`);
202
202
  console.log(` ${c.Y}${err.message}${c.r}`);
203
- console.log(` ${c.D}at ${err.fileName}:${err.lineNumber}:${err.columnNumber}${c.r}`);
204
203
 
205
204
  // Try source-map resolution
206
205
  if (err.fileName === 'main.js' || err.stack) {
@@ -209,25 +208,20 @@ async function printFormattedError(err) {
209
208
  if (err.lineNumber > 0) {
210
209
  const orig = consumer.originalPositionFor({ line: err.lineNumber, column: err.columnNumber || 0 });
211
210
  if (orig.source && orig.line) {
212
- console.log(` ${c.C}→ ${orig.source}:${orig.line}:${orig.column}${c.r}`);
213
- // Print source context
214
- const sources = consumer.sources;
215
- const idx = sources.indexOf(orig.source);
216
- if (idx >= 0) {
217
- const content = consumer.sourceContentFor(orig.source);
218
- if (content) {
219
- const lines = content.split('\n');
220
- const start = Math.max(0, orig.line - 3);
221
- const end = Math.min(lines.length, orig.line + 2);
222
- for (let i = start; i < end; i++) {
223
- const prefix = i === orig.line - 1 ? c.R + ' →' : ' ';
224
- console.log(` ${prefix} ${c.D}${String(i + 1).padStart(4)}|${c.r} ${lines[i]}`);
225
- }
211
+ const srcPath = orig.source.replace(/^\.\.\/\.\.\//, '');
212
+ console.log(` ${c.C}at ${srcPath}:${orig.line}:${orig.column}${c.r}`);
213
+ const content = consumer.sourceContentFor(orig.source);
214
+ if (content) {
215
+ const lines = content.split('\n');
216
+ const start = Math.max(0, orig.line - 3);
217
+ const end = Math.min(lines.length, orig.line + 2);
218
+ for (let i = start; i < end; i++) {
219
+ const prefix = i === orig.line - 1 ? c.R + ' →' : ' ';
220
+ console.log(` ${prefix} ${c.D}${String(i + 1).padStart(4)}|${c.r} ${lines[i]}`);
226
221
  }
227
222
  }
228
223
  }
229
224
  }
230
- // Also resolve stack trace lines if present
231
225
  if (err.stack) {
232
226
  const stackLines = err.stack.split('\n');
233
227
  for (let i = 0; i < Math.min(stackLines.length, 8); i++) {
@@ -236,8 +230,8 @@ async function printFormattedError(err) {
236
230
  if (m) {
237
231
  const orig = consumer.originalPositionFor({ line: parseInt(m[1]), column: parseInt(m[2]) });
238
232
  if (orig.source) {
239
- const mapped = ` at ${orig.source}:${orig.line}:${orig.column}`;
240
- console.log(` ${c.D}${mapped}${c.r}`);
233
+ const srcPath = orig.source.replace(/^\.\.\/\.\.\//, '');
234
+ console.log(` ${c.D} at ${srcPath}:${orig.line}:${orig.column}${c.r}`);
241
235
  continue;
242
236
  }
243
237
  }