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

BREAKING: refactor(std): Prepend underscores to private modules #5087

Merged
merged 8 commits into from
May 9, 2020

Conversation

nayeemrmn
Copy link
Collaborator

@nayeemrmn nayeemrmn commented May 5, 2020

  • Move std/util/async.ts to std/async/*.ts.
  • Move std/util/sha*.ts to std/hash/sha*.ts.
  • Move flags example to std/examples.
  • Remove isWindows and EOL from std/path. They don't belong there and shouldn't really require a dependency.
  • Remove collectUint8Arrays() from std/util/async.ts. It would be a misuse of Deno.iter()'s result.

@uki00a
Copy link
Contributor

uki00a commented May 5, 2020

@nayeemrmn
As far as I know, std/util/async.ts is used by deno-redis and deno-postgres.
Shouldn't this file be treated as a public module?

@nayeemrmn nayeemrmn changed the title BREAKING: refactor(std): Prepend underscores to private modules WIP: BREAKING: refactor(std): Prepend underscores to private modules May 5, 2020
@nayeemrmn nayeemrmn changed the title WIP: BREAKING: refactor(std): Prepend underscores to private modules BREAKING: refactor(std): Prepend underscores to private modules May 5, 2020
@nayeemrmn
Copy link
Collaborator Author

@ry Please review.

@bartlomieju bartlomieju requested a review from ry May 9, 2020 11:40
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - sorry for the delay @nayeemrmn - Bartek Bert and I had a discussion yesterday about std and stability. We decided to decouple the version from cli and not make stability guarantees yet (#5158). That discussion was holding up landing this patch.

std/examples/ws/server.ts Outdated Show resolved Hide resolved
@ry ry merged commit f184332 into denoland:master May 9, 2020
@nayeemrmn nayeemrmn deleted the std-underscore branch May 9, 2020 13:22
@keroxp
Copy link
Contributor

keroxp commented May 10, 2020

@ry @nayeemrmn I found some files were made underscored on this PR. What does it mean?
Should we consider them as internal module and prevent developer to use? Those files are still downloadable🤔

About http/io.ts, when I created this, it was designed to be public module for who creates their own http server implementation.

@ry
Copy link
Member

ry commented May 10, 2020

underscore means the module should be considered private
https://github.com/denoland/deno/blob/master/docs/contributing/style_guide.md#if-a-filename-starts-with-an-underscore-_foots-do-not-link-to-it

I think http/io.ts was erroneously marked as private, we can make it public again.

@nayeemrmn
Copy link
Collaborator Author

nayeemrmn commented May 10, 2020

Should we consider them as internal module and prevent developer to use? Those files are still downloadable🤔

Yes. There's no way of making them not downloadable which is why we use the underscore convention to indicate that the exports aren't stable / can be restructured by us at will -- so shouldn't be imported directly.

About http/io.ts, when I created this, it was designed to be public module for who creates their own http server implementation.

The exports of that module have no rhyme or reason at the moment and are definitely tailored to internal usage. For example, emptyReader() doesn't belong there. readRequest() has this weird behaviour where a reader is passed as input, but the writer is assigned externally. It's certainly not ready to be part of any public API.

If anyone is interested, they can make a public io.ts and slowly move over exports refactored to make independent sense.

@keroxp
Copy link
Contributor

keroxp commented May 10, 2020

@nayeemrmn I agree that current readRequest and ServerRequest implementation is not good, but It is not tailored just for internal usage. Some functionalities in io.ts were originally ported from my project (servest) and currently depends on them (readTrailer, writeTrailer, bodyReader, chunkedBodyReader ) . They can be useful in some situations because they're designed to be pure function as possible. I know few people are using them, but I'll have a trouble if they become not available😓.

I think emptyReader() is very useful for testing so it should be moved into io/readers.ts.

caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 21, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move std/_util/async.ts to std/async
* Move std/util/sha*.ts to std/hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Feb 1, 2021
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
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.

Discussion : path.isWindows
4 participants