Handle Syntax Error
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- developer-experience
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện SyntaxError của tệp được tạo và kiểm tra cách node-source-map-support hiện xử lý error.stack đối với các ngoại lệ thông thường. Truy vết dòng stack đầu tiên chứa vị trí được tạo, sau đó xác minh rằng các vị trí SyntaxError được phân giải về mã nguồn ban đầu mà không thay đổi cách xử lý ngoại lệ hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
First of all thank you for providing this project! It's a great help for my current project.
Regarding this issue: I would like to request that a special case be added that handles syntax errors so that the place of the original source is displayed when there is a syntax error in the generated file.
This is not very useful for projects like coffescript, typescript… which feature their own parsers (and thus do their own syntax error reporting); however it is useful for a use case like mine in which I just copy/past js source from one file into another where the input is not strictly tested for validity.
(I am building a tool that extracts examples from documentation and executes them as tests).
E.g. my errors are correctly resolved for normal exceptions, however when an (induced) syntax error happened, the output pasted below was the output. In there you can see the syntax error indicating the location in the generated file.
This could be solved by adding a special handler for syntax errors; extracting the generated location from the first line of error.stack…
/tmp/ferrum.doctest-ferrum.doctest-6d12dfba-331b-478f-94bf-862f4569da6/examples.test.js:10 [158/14653]
const foo = 42;
^^^^^
SyntaxError: Unexpected token 'const'
at wrapSafe (internal/modules/cjs/loader.js:1050:16)
at Module._compile (internal/modules/cjs/loader.js:1098:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/lib/mocha.js:334:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/lib/mocha.js:331:14)
at Mocha.run (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/lib/mocha.js:809:10)
at Object.exports.singleRun (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/lib/cli/run-helpers.js:108:16)
at exports.runMocha (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/lib/cli/run-helpers.js:142:13)
at Object.exports.handler (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/lib/cli/run.js:292:3)
at Object.runCommand (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/node_modules/yargs/lib/command.js:242:26)
at Object.parseArgs [as _parseArgs] (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/node_modules/yargs/yargs.js:1087:28)
at Object.parse (/home/karo/pr0j/adobe/ferrum.doctest/node_modules/mocha/node_modules/yargs/yargs.js:566:25)
- Ngôn ngữ chính
- JavaScript
- Star
- 2.2k
- Fork
- 221
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của evanw/node-source-map-support
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
evanw/node-source-map-support#344 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
evanw/node-source-map-support#343 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
evanw/node-source-map-support#337 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
evanw/node-source-map-support#333 ·
-
Provide esm versionĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
evanw/node-source-map-support#330 · 2 bình luận · 9 reaction ·
Tất cả issue của evanw/node-source-map-support
Issue tương tự
-
🐞 bug pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
CircuitVerse/CircuitVerse#8025 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
schmayterling/hibi#245 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
vercel/ai#23304 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug package:vitest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
cloudflare/workers-sdk#16255 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Proxy and MCP URLs with an empty authority parse as a different hostCó thể đã có người làm @ericcaiwx-star đã nhận hôm nay. Đang mởclawsweeper:bulk-filed clawsweeper:linked-pr-open clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
openclaw/openclaw-enterprise#2384 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày