-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat: deno_std node addition #3319
Conversation
std/node/README.md
Outdated
# Deno Node compatibility | ||
|
||
This module is meant to have a compatibility layer for the | ||
[nodeJS standard library](https://nodejs.org/docs/latest-v11.x/api/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be TLS version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*LTS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no link directly pointing to LTS version, updated it to aim v12 as it's LTS: https://nodejs.org/en/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a good time to merge it into deno.
At least, there is no relative discussion.
@axetroy Actually there was some basic discussion in Gitter chatroom. |
std/node/util.ts
Outdated
isObject, | ||
isError, | ||
isFunction | ||
} from "./util/main.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this from main.ts
to mod.ts
.
I am not quite sure if we should reexpose mod as std/node/util.ts
or just leave as std/node/util/mod.ts
. The latter follows our recommendation better, while the former might seem more familiar to node users...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mod.ts
seems better yes.
Regarding the exposure it's more like a taste, you have 2 solutions
import { fs } from 'std/node'
or import { readfile } from 'std/node/fs'
i'm ok with both
std/node/README.md
Outdated
This module is meant to have a compatibility layer for the | ||
[nodeJS standard library](https://nodejs.org/docs/latest-v11.x/api/). | ||
|
||
**Warning** : Any function of this module do not have to be refered anywhere in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is "should not" instead of "do not have to"?
std/node should be able to import utilities from other std modules, but not the other way around IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: referred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is "should not" instead of "do not have to"?
std/node should be able to import utilities from other std modules, but not the other way around IMO.
that's what i was meaning. Sorry for my engrish
Ref: https://gitter.im/denolife/Lobby?at=5dbda5dbe1c5e915081e2729 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good ...
std/node/fs.ts
Outdated
@@ -0,0 +1 @@ | |||
export { readFile, readFileSync } from "./fs/read_file.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just merge read_file.ts into this one - it will make for better docs on Deno.land and also I prefer to keep the number of files small until it becomes unwieldy to have so many functions in a single file - at that point we can break it out. So just fs.ts and fs_test.ts please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was just a direct port but i get your point.
std/node/util/main_test.ts
Outdated
@@ -0,0 +1,122 @@ | |||
import { test } from "../../testing/mod.ts"; | |||
import { assert } from "../../testing/asserts.ts"; | |||
import * as util from "./main.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main.ts ? I don’t think we should use the file name main.ts in std/node ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, direct port, i'll change this as mentionned in the other comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks - hopefully this gets more attention in std. I kinda want to add std/node/require.ts now.
Moving the https://github.com/denolib/node to deno_std.
ref #2644