-
Notifications
You must be signed in to change notification settings - Fork 125
convert lib/resources/script.js to Dart #3016
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
Conversation
Hmm, it looks like the |
OK, the sig on windows is incorrect, even after removing line endings. I don't think there are any path char issues - not sure why the platform difference.
|
It wouldn't be bad if the signature stuff just wasn't run on Windows in CI. It would sort of limit our abilities to accept PRs from a person using Windows, maybe... |
I think I fixed it; the file listing was in a different order :) I normalize it by sorting the list of files. |
@srawlins - I believe this is fully functional for what's been converted over, and I've removed the JS code that's been converted. I.e., the functionality is consistent, just some is now in Dart. Do you want to review the PR now, or, wait until the search stuff is converted? |
I think if it's sound, even if in-progress, that sounds great. I can review. |
I think it's ready for review now (I was able to convert over the search code as well). |
Do we know that this is runnable at pub.dev? Meaning if I cut a release with this PR, and pub.dev used it, the Dart web app is all good to go and run on pub.dev? I don't have a specific reason why it wouldn't. Since we're already serving up a bit of JS at pub.dev. |
Actually, the other question might be the more important one: Are dartdocs still visible locally? I am unfamiliar with the sidenav navigation JS. |
I would say we're good to go, as long as the pub.dev server doesn't depend on specific JS resources existing in specific places. cc'ing in @jonasfj and @isoos to comment on whether these changes are compatible w/ pub docs serving. The TLDR from the POV of serving the docs is that the file |
Yup, the docs are visible and working locally. There's no real functionality change with this PR (modulo removing the code to save and restore the scroll positions). |
This is OK from |
The size increase from 14kb to 444kb makes me a bit sad. I guess it's not a huge concern. It might make loading the page slower especially on low powered devices. It might be worth checking the lighthouse score before/after.. |
It is also worth to take a look what makes the size to blow up. We've removed |
We could compile with some minification, and or look into library or code changes to reduce the JS size. But overall I'm not too worried about it - it's a fixed size increase. I think there are much bigger issues here, and this change is a step towards addressing them (loading in the left nav programmatically, and, improving the search UI). See #2995 for some serious output size issues w/ dartdoc, and, #3018 for a potential solution (and if we don't land that, we'd get the same benefits from moving to a dynamically generated left nav). |
The implementation for the web frontend itself is pretty simple: https://github.com/dart-lang/dartdoc/tree/master/web (but still worth looking to see if there are areas contributing to compiled code size). |
Compiling with most optimizations enabled is pretty low hanging fruit: #3028 |
Convert lib/resources/script.js to Dart; this PR:
cc @srawlins
This is more a less a straight 1:1 conversion from the JS code. Some follow up work would be to make the code follow more of a Dart style; later work may change the behavior (improvements to the search box? programmatically building the left nav?).