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

ESM+webpackification of the engine code #262

Merged
merged 189 commits into from
Sep 14, 2023

Conversation

pkgw
Copy link
Contributor

@pkgw pkgw commented Jul 13, 2023

This pull request builds on #261. It switches the engine module to build with Webpack, allowing us to more conveniently break the code into individual files using ES6 imports and exports (while compiling down to code that's compatible with the ScriptSharp implementation). As a sample I've extracted one of the first modules.

This transition unfortunately involves another large batch of code churn to set things up, but the later commits in this pull request ought to be readable. (Note that, as long as #261 is unmerged, the diffs and commit list for this PR will include the ones in that PR as well.)

Also, we're not importing comments from the astrocalc C# code since it's already awkward code that was auto-translated from C++ in the Microsoft days, and these routines are about as locked-in as code can get.

@pkgw pkgw marked this pull request as draft July 13, 2023 02:39
@pkgw pkgw closed this Jul 27, 2023
@pkgw pkgw reopened this Jul 27, 2023
@pkgw
Copy link
Contributor Author

pkgw commented Jul 27, 2023

@Carifio24 @imbasimba OK, I think we have a workable approach here. The combination of ESLint and ESBuild seems to work to help ensure that there aren't any mistakes in the code rearrangements. At the moment I've gone through and rearranged code in the astrocalc/ subtree, which adds up to about 6500 lines, and then another 5500 lines in the toplevel. I'm feeling good about how this migration process is going.

pkgw added 25 commits September 14, 2023 14:11
This includes deleting some debug code from with MainView.cs.
Here, we delete the outermost pieces of `js/transpiled.js` to dedent the
entire file. This breaks the build and the functionality of the code. It
will take us a few commits to get things back into working order.
To move over to the new build framework, we're going to need a few extra
interface points with the ScriptSharp infrastructure.
These will make it a bit more convenient for newer code to interact
with the ScriptSharp type system.

Eventually we'd like to drop that type system altogether, but the
`ss.canCast` functionality is something that we don't want to futz with
just yet.
Use ES6 imports and exports, building on our typesystem helpers.
Things should be functional again. The big win here is that now we can
gradually break `transpiled.js` into separate source files, using
`import` and `export` statements to modularize the code.
…mation

It turns out that we have to get a lot of stuff into place for
`astrocalc/elliptical.js` to work, but it's all pretty mechanical.
@pkgw pkgw changed the title Prototype webpackification of the engine code ESM+webpackification of the engine code Sep 14, 2023
@pkgw pkgw marked this pull request as ready for review September 14, 2023 18:17
@pkgw
Copy link
Contributor Author

pkgw commented Sep 14, 2023

I have tested as much downstream functionality as I could (web client, pywwt, apps) and I believe this is ready to merge.

@pkgw pkgw merged commit 35b985d into WorldWideTelescope:master Sep 14, 2023
9 checks passed
@pkgw pkgw deleted the engine-webpack branch September 14, 2023 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant