Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Export inner modules as objects #253

Closed
cristianoc opened this issue Sep 20, 2019 · 11 comments
Closed

Export inner modules as objects #253

cristianoc opened this issue Sep 20, 2019 · 11 comments

Comments

@cristianoc
Copy link
Collaborator

cristianoc commented Sep 20, 2019

This implements a feature request from @sync, to give more idiomatic access to inner modules from JS.

When an inner module (i.e. a module declared within a file) contains values exported to JS, also generate an object with the name of the module and the exported values.

So for example:

module Inner = {
  [@genType]
  let x = 34;
}

should generate some additional code:

export const Inner : { x : number } = { x : Inner_x };

If the new representation of inner modules is available, this is optimized to:

export const Inner : { x : number } = ThisFileBS.Inner;
@cristianoc
Copy link
Collaborator Author

@sync there's some of it, but happy to let you complete

@sync
Copy link
Contributor

sync commented Sep 20, 2019

yes i just ran the branch and could not see a difference so i think i'll be able to have a play around :-)

@cristianoc
Copy link
Collaborator Author

@sync
Just one more commit. Sent.

@cristianoc
Copy link
Collaborator Author

The commit message contains a few TODOs.
733a6db

@sync
Copy link
Contributor

sync commented Sep 20, 2019

thank you so much

@sync
Copy link
Contributor

sync commented Sep 20, 2019

Ok will have a look at this first thing in the morning tomorrow (in about 8 hours)

@sync
Copy link
Contributor

sync commented Sep 21, 2019

I am slowly making progress here: #255 still have plenty to do :-)

@cristianoc
Copy link
Collaborator Author

@sync thanks a lot -- that's great.
I'll make little comments along the way from time to time.

@sync
Copy link
Contributor

sync commented Sep 21, 2019

Please do and also around code style etc... like i not in love with the StringHelper :-(

@cristianoc
Copy link
Collaborator Author

Thanks a lot @sync for suggesting the feature, and even implementing a good chunk of it!

@cristianoc
Copy link
Collaborator Author

Closing as nearly ready to merge the PR.

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

No branches or pull requests

2 participants