Conversation
It's not _really_ a new dependency as prettier already depends on it, but let's bring it in. I suspect that users are running into weird encoding issues in #694 (and maybe #698). Rather than spending too much time on this, I'm just taking a shortcut: users confirm that they cannot reproduce the issue in `prettier`, so let's read stdin the same `prettier` does :)
The current state of affairs in prettierd are a bit too tricky when it comes to modules: it deeply depends on commonjs to dynamically resolve which prettier to import, and that isn't supported out of the box with esmodules. It turns out that get-stdin doesn't support cjs, and typescript is being annoying here, compiling `import` into `require`. To be honest, migrating to esmodules wouldn't be super tricky (famous last words): we'd need to implement some of the filesystem navigation to find the files and then import those with `import()`. The thing is, I'm not 100% sure that that's trivial, and I allotted some time to work on prettierd today and that time is running out, and I want to make sure I fix at least one bug without getting nerdsnipped. So, rather than trying to migrate everything to esmodules, let's keep it simple and just vendor `get-stdin`. Another option I considered was bypassing TS to still use `import()` with commonjs (some options here: TypeStrong/ts-node#1290), but that sounds too painful.
Owner
Author
|
Will merge this if #698 is green, then release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's not really a new dependency as prettier already depends on it, but let's bring it in.
I suspect that users are running into weird encoding issues in #694 (and maybe #698).
Rather than spending too much time on this, I'm just taking a shortcut: users confirm that they cannot reproduce the issue in
prettier, so let's read stdin the sameprettierdoes :)