a fork of buble with some vue-specific hacks, used in vue-template-es2015-compiler
by yyx990803JavaScript
Last 12 weeks · 0 commits
2 of 6 standards met
The yyx990803/buble fork of Bublé exists mostly for Vue template compilers to call it over generated source code. When it emits an error, that error includes .loc : the location in the generated source .snippet : a snippet of the generated source However, because the user doesn't have a copy of the generated code, .loc is useless to them, and if .snippet doesn't quite give the context that they need to identify the problem, then they are out of luck. Sure, we could have the caller (vue-template-es2015-compiler, or its callers: vue-loader/vueify/rollup-plugin-vue) catch the error, inject it with .source (since it has the source passed to buble), and then throw it again. But let's solve it closer to the root, and reduce the possibility of a mixup. This also allows callers to do things like wrap our errors, replacing our generated with a -generated . is OK, but on generated code (which is particularly gross), just "OK" often isn't good enough. Let's give callers a chance to try to improve it. babel-code-frame offers syntax highlighting, which makes things like missing quotes way easier to spot. It doesn't have to be for quality reasons either; if all other error code snippets are formatted one way, let's give the caller a chance to format ours the same way, for UI consistency.
Repository: yyx990803/buble. Description: a fork of buble with some vue-specific hacks, used in vue-template-es2015-compiler Stars: 59, Forks: 17. Primary language: JavaScript. Languages: JavaScript (99.9%), Shell (0.1%). License: MIT. Open PRs: 5, open issues: 3. Last activity: 4y ago. Community health: 42%. Top contributors: Rich-Harris, adrianheine, kzc, yyx990803, TrySound, marijnh, nathancahill, trueadm, trusktr, maranomynet and others.