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

add @parcel/transformer-reason #3417

Conversation

abdullahtariq1171
Copy link
Contributor

↪️ Pull Request

This PR tries to add reason plugin for transforms. Fixes #3359

Todo:

  • Compiling Reason to JavaScript with bsb-js
  • Collecting dependencies as included files so Parcel watches them (Parcel 1 does not currently do this properly)

💻 Examples

🚨 Test instructions

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@abdullahtariq1171
Copy link
Contributor Author

I'm not exactly sure how gonna collect dependencies as included files, any help would be very useful.

@mischnic
Copy link
Member

I have no experience with bucklescript, but the bsb-js was last updated one year ago.
The official docs talk about bs-platform (https://bucklescript.github.io/docs/en/installation) and to not use an integration with a bundler 😕 (https://bucklescript.github.io/docs/en/interop-with-js-build-systems#popular-js-build-systems)

@abdullahtariq1171
Copy link
Contributor Author

abdullahtariq1171 commented Aug 19, 2019

yes, bsb-js is just a wrapper on top of bs-platform. here is source code of 'bsb-js'

I've thinking about this, we can detect the dependencies using regex but since we use bsb-js, and it doesn't return any information. So how are we going to actually collect these dependencies?

cc: @devongovett


Also here is previous discussion #342, might be helpful some questions.

@abdullahtariq1171 abdullahtariq1171 changed the title [WIP] add @parcel/transformer-reason add @parcel/transformer-reason Aug 30, 2019
@gugahoa
Copy link

gugahoa commented Nov 10, 2019

Hi all, maybe this PR could take inspiration from the new react-hooks template for bsb found here: https://github.com/BuckleScript/bucklescript/blob/3fe3e854f8a0d31691d396e5a41e728f58f2f6cd/jscomp/bsb/templates/react-hooks/watcher.js

It shows how to do a simply watcher.

@DeMoorJasper
Copy link
Member

@gugahoa it's more than just watching we need to know all the files that are being compiled/bundled for cache invalidation as well. Unless we simply disable cache for reason, but that's not really optimal.

@gugahoa
Copy link

gugahoa commented Nov 10, 2019

@DeMoorJasper What would be the impact of disabling cache for reason?

@DeMoorJasper
Copy link
Member

@gugahoa it would be a lot slower to build reason

Sent with GitHawk

@mischnic
Copy link
Member

bsb seems to generate a file listing all dependencies of a source file: https://bucklescript.github.io/docs/en/interop-with-js-build-systems#getting-projects-dependencies

But you need to explicitly specify source folders in the bsconfig.json file. bsb really doesn't want to be integrated into another build system.

@gugahoa
Copy link

gugahoa commented Nov 10, 2019

@mischnic @DeMoorJasper
So in simple terms, a good enough reason plugin would:

  • Run bsb in watch mode with websocket
  • Listen to websocket to be notified on change
  • On notifiy, (somehow) discover the changed file
  • Find the .mlast.d of that file and invalidate those files

Is that it?

@DeMoorJasper
Copy link
Member

@abdullahtariq1171 could you update this PR to be more complete as requested?

@abdullahtariq1171
Copy link
Contributor Author

hey guys I'm sorry I won't be able to work on this. Anyone want's to grab this from here would be welcomed.

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

Successfully merging this pull request may close these issues.

Parcel 2: Reason transformer
4 participants