-
Notifications
You must be signed in to change notification settings - Fork 143
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
Project roadmap and ways others can contribute #161
Comments
|
Unfortunately I think this is too hard for Sucrase to do. I'm not 100% sure about flow declarations, but .d.ts generation is definitely out of scope. As one example, d.ts generation relies on TypeScript's type inference algorithm, so this code: export function foo() {
return 3;
} gets this type definition: export declare function foo(): number; Determining that Sucrase is simple and fast because it just removes types and doesn't need to know the whole type system, so any features requiring type system knowledge or cross-file resolution are out of scope. The TypeScript support in Babel has the same limitations. Also, the main intended use case for Sucrase is development builds where iteration speed is important, and my understanding is the main use case for .d.ts files is production builds when shipping a library. TypeScript recently added a new
What's the use case for path resolution? Sucrase just takes |
Path aliasing needed to avoid relative paths |
@zerkalica I see, thanks for explaining. At my work, we have webpack and node set up to accept absolute paths, so it's not needed at transpile time. In webpack, it's the I want to keep the project focused and avoid feature creep, so I'd rather hold off on the feature for now, but if there's more demand for it, I could see it being added in the future. Some more thoughts/concerns:
Possibly a way to get this working at transpile time would be a two-phase step where you run Sucrase and then a separate import-rewriting step. I've thought about pulling the Sucrase parser into its own package so that anyone could make a separate transform with a fast parser. It would be a little less efficient than ideal, though, since you'd need to re-parse after the first transform is done. In this case, though, I bet you could get away with more superficial parsing than Sucrase needs, like just using regexes or something. |
Yes, @alangpierce , these are the features I consider important for TypeScrip support. I do not yet know if this is possible with sucrase. |
Also you should try prepack #269 |
I'll try to implement stuff around reports |
Mobile support: #451 |
Implemented in #509 |
I've had a few requests from others about how they can help out. I've been keeping a checklist of possible future tasks, and figured it would be good to make that public to make it easier for others to contribute.
Feel free to stop by and chat in the gitter room, which I just created. Generally my thought is that this can be a big checklist of possible things to do, and as work starts on them, they can be "promoted" to real issues with individual discussions/assignees/etc. I'm sure there's plenty of context to be shared about most of these issues, so feel free to chat if you want to take one of them on.
Currently, I'm focused on performance, and want to see how high I can get the N in "Sucrase is N times faster than Babel". But there's certainly lots of other stuff to do as well.
Stability
Bugs
export let x; [x] = arr;
. Babel and TypeScript are both incomplete here, and ideally we just mimic one or the other.import
statements should be hoisted to the top of the file, but they aren't right now.import
andexport
. Ideally we exactly copy either Babel or TypeScript, based on the config.export default
React class. We could add a filename arg to the Sucrase API to support this, although it's maybe obscure enough that the API change isn't worth it.Tooling
noImplicitThis
in the TypeScript config. Implicitany
forthis
has bit me a few times, but there are enough pre-existing errors that it's hard to enable.self-build
task, but we still use TypeScript for the real build.Website (sucrase.io)
Profiling/benchmarking
Features
Figure out if we need source maps, and implement them if so. The output line numbers are the same as the input line numbers, so theoretically they shouldn't be necessary at least for things like stack traces.(Spun off as Generate source maps #223.)Add a transform for object rest/spread. I was hoping to avoid this, but it looks like Webpack uses a parser that doesn't support it, so it may be necessary to implement for practical reasons. Also, MDN says it's not supported at all in Edge or Safari. (Note that webpack-object-rest-spread-plugin makes this work in Webpack, and object will probably be very hard to implement in nested cases, so probably this transform should be called out of scope.)I'm calling this out of scope.Configuration
Integrations
Performance
+
.The text was updated successfully, but these errors were encountered: