Skip to content
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

generate jsdoc/typescript/flow #58

Closed
mxab opened this issue Nov 30, 2016 · 7 comments
Closed

generate jsdoc/typescript/flow #58

mxab opened this issue Nov 30, 2016 · 7 comments

Comments

@mxab
Copy link

mxab commented Nov 30, 2016

Hi,
would it be possible to produce jsdoc on the generated code so it could be minified with closure compilers advanced mode?

@Rich-Harris
Copy link
Member

That's an interesting idea. I don't see any reason in principle why that couldn't happen, though it's not something I'm particularly familiar with

@mxab
Copy link
Author

mxab commented Nov 30, 2016

I extended a simple output:
https://github.com/mxab/svelte-sample/blob/master/bundle.js

with jsdocs
https://github.com/mxab/svelte-sample/blob/master/bundle_withdocs.js

the first one (bundle.js) can be compile with the SIMPLE mode
the second (bundle_withdocs.js) can be compiled with ADVANCE
https://closure-compiler.appspot.com

Simple:
Compiled Size: 694 bytes gzipped (1.38KB uncompressed)
Advanced:
Compiled Size: 646 bytes gzipped (1.18KB uncompressed)

as you can see a tremendous slim down ;)
but I guess it can be tuned better, I'm not an expert on the cc

@PaulBGD
Copy link
Member

PaulBGD commented Dec 1, 2016

+1 for making this work better on closure compiler, thanks for putting in the work @mxab

@mxab
Copy link
Author

mxab commented Dec 1, 2016

an maybe very experimental thought would be that if it contains proper jsdocs closure compiler's refasterJS feature could refactor the code and put in some short methods for common not minifiable calls

let's say for all x.appendChild(y) (in the todomvc part 48 times) to something like

function aC(x,y){
 x.appendChild(y)
}

aC(i,l) ... aC(a,b) ... aC(foo,bar) //all 48 times

@Rich-Harris
Copy link
Member

@mxab thanks for the sample code, it's very helpful. It's likely that the internals will change a bit due to e.g. #9, so it's probably best for us to hold off on adding jsdoc stuff for the moment, but I'm definitely keen to explore this in future (maybe adding e.g. TypeScript annotations or Flow types would be another option – annotations: 'jsdoc'/annotations: 'flow' etc, though it's not an area I'm particularly familiar with). Adding the 'one day' milestone 😀

For things like repeated appendChild calls, we do plan to add helper functions (see e.g. #50).

@Rich-Harris Rich-Harris added this to the one day milestone Dec 10, 2016
@Rich-Harris Rich-Harris changed the title generate jsdoc generate jsdoc/typescript/flow Dec 18, 2016
@fjorgemota fjorgemota mentioned this issue Oct 29, 2018
3 tasks
@stale
Copy link

stale bot commented Jun 27, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale-bot label Jun 27, 2021
@benmccann
Copy link
Member

We have TypeScript types now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants