Commit graph

92 commits

Author SHA1 Message Date
blairzhao111 6c21ba0575
fix(std/node): emitter.removeAllListeners (#5583)
When given a non-registered eventName to 
emitter.removeAllListeners(eventName), current code 
would remove all listeners instead of silently skip, 
which is not ideal.
2020-06-09 15:07:25 +02:00
Marcos Casagrande 0bf952bb49
feat(std/node) - Add util.promisify (#5540) 2020-06-08 19:26:52 +02:00
Peter Evers 7b597c82fc
feat(std/node) add util.types (#6159) 2020-06-07 09:21:49 -04:00
Chris Knight 3ef94c5473
refactor(std): remove testing dependencies from non-test code (#5838) 2020-06-07 09:20:33 -04:00
Nikolai Vavilov 09ee9a8280
feat(std/node): Buffer (#5925) 2020-06-06 15:56:49 -04:00
Marcos Casagrande 26287ef87b
fix: use queueMicrotask instead of setTimeout (#6112) 2020-06-06 15:32:17 -04:00
Casper Beyer ed5aedc6b4
Rename abbreviated assertions in std/testing (#6118) 2020-06-05 23:43:00 -04:00
Kitson Kelly 3fe6bc1b82
fix: Better use of @ts-expect-error (#6038) 2020-06-02 00:24:44 -04:00
Peter Evers 6b0d286a3d
feat(std/node): add util.type.isDate (#6029) 2020-06-01 18:43:43 -04:00
Chris Knight fadd93b454
feat(std/node): add link/linkSync polyfill (#5930) 2020-05-28 19:39:02 -04:00
Kitson Kelly 228f9c207f
Use ts-expect-error instead of ts-ignore. (#5869) 2020-05-26 10:02:16 -04:00
Rares Folea aef9f22462
Fix typo (#5834) 2020-05-25 09:35:11 -04:00
Ali Hasani 3b86552d66
refactor: remove duplicated code in std/node/module (#5778) 2020-05-23 12:55:15 +02:00
Marcos Casagrande 7f81f02ce7
std/node: fs.writeFile/sync path can now be an URL (#5652) 2020-05-22 22:11:10 -04:00
Ali Hasani 1a6c541327
re-enable symlink tests on windows (#5746) 2020-05-22 13:37:25 -04:00
Marcos Casagrande 11e3d70c85
Remove duplicate test (#5687) 2020-05-20 21:40:43 -04:00
Ali Hasani 22da75b8e5
feat(std/node): first pass at url module (#4700) 2020-05-20 10:37:30 -04:00
Garrone Joseph 7630326b4c
feat(std/node) Export TextDecoder and TextEncoder from util (#5663) 2020-05-20 10:35:51 -04:00
Evan Hahn f5c0188b5e
std/node: add util.callbackify (#5415)
This adds [Node's `util.callbackify`][0] to `std/node/util.ts`.

I lifted most of this from the [original Node source code][1] (and [its
tests][2]). I tried to make minimal modifications to the source.

I made a few arbitrary decisions:

- I was unable to do the function's types elegantly. I made overloads
  for functions that have 0 to 5 (inclusive) arguments, excluding the
  callback. I would love to know a better way to do this. (It seems that
  the folks at DefinitelyTyped [were also stumped][3], though maybe
  their solution is deliberate.)
- There are a few edge cases that cause custom Node errors to be
  produced. Instead of re-implementing those errors completely, I
  created simplified classes. These are mostly correct but are not
  identical to the real Node errors.
- The tests implement a possibly-arcane `TestQueue` class. I originally
  used a lot of inline promises but found it too repetitive.

Closes [#5366][4].

[0]: https://nodejs.org/api/util.html#util_util_callbackify_original
[1]: 4780493301/lib/util.js (L183-L226)
[2]: 4780493301/test/parallel/test-util-callbackify.js
[3]: 7d24857ddb/types/node/util.d.ts (L61-L84)
[4]: https://github.com/denoland/deno/issues/5366
2020-05-20 10:29:05 -04:00
Marcos Casagrande eb5acb39d5
feat(std/node): Add fs.promises.readFile (#5656) 2020-05-20 02:50:48 -04:00
Marcos Casagrande 62c34bc21e
fix(std/node) improve fs.close compatibility (#5649) 2020-05-19 19:01:06 -04:00
Bert Belder 76a6a1ff46
Fix a bunch of spelling errors (#5314) 2020-05-16 00:36:49 +02:00
Tomasz Gałkowski 8440d765d5
fix: setTimeout and friends have too strict types (#5412) 2020-05-15 09:51:49 -04:00
Marcos Casagrande ce57a1824d
feat(std/node): fs.writeFileSync polyfill (#5414) 2020-05-15 09:50:27 -04:00
Evan Hahn 6f7e74d694
[std/node]: remove execute permissions from fs.ts (#5363) 2020-05-14 11:57:12 -04:00
Marcos Casagrande 524b1547b7
std/node fs.readFile should take string as option (#5316) 2020-05-14 07:04:07 -04:00
Dante Calderón c3a205bae8
Fix typos across the repo (#5295)
Corrections made:
* cli/js/tests/README.md:44:7: corrected "discoveres" to "discovers"
* cli/js/tests/chown_test.ts:111:37: corrected "priviledge" to "privilege"
* cli/worker.rs:231:56: corrected "decendants" to "descendants"
* deno_typescript/lib.rs:136:50: corrected "emmited" to "emitted"
* core/es_isolate.rs:492:67: corrected "registerd" to "registered"
* core/isolate.rs:103:28: corrected "initalize" to "initialize"
* docs/runtime.md:29:14: corrected "ect" to "etc"
* docs/tools/debugger.md:122:16: corrected "implementes" to "implements"
* std/encoding/_yaml/dumper/dumper_state.ts:57:63: corrected "everwhere" to "everywhere"
* std/encoding/csv.ts:37:43: corrected "referal" to "referral"
* std/fmt/sprintf.ts:209:20: corrected "unusuable" to "unusable"
* std/fmt/README.md:21:40: corrected "Alternativly" to "Alternatively"
* std/fmt/README.md:35:68: corrected "seperated" to "separated"
* std/fmt/README.md:179:59: corrected "provded" to "provided"
* std/mime/multipart.ts:581:46: corrected "writen" to "written"
* std/path/_globrex.ts:19:52: corrected "equivelant" to "equivalent"
* std/node/events_test.ts:447:9: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:475:9: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:500:29: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:530:40: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:555:9: corrected "asyncronous" to "asynchronous"
* tools/deno_tcp_proxy.ts:1:42: corrected "perfromance" to "performance"
* std/node/module.ts:1003:18: corrected "existend" to "existed"
2020-05-14 06:38:42 +02:00
Edward Elric b2da8f3d4e
doc: fix typo in std/node/README.md (#4819) 2020-05-11 15:13:06 +02:00
Nayeem Rahman f184332c09
BREAKING(std): reorganization (#5087)
* 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
2020-05-09 08:34:47 -04:00
Ryan Dahl 846c049c9b
Remove flaky and useless tests (#5116) 2020-05-06 17:04:52 -04:00
Marcos Casagrande f0aea98c85
feat(std/node): fs.writefile / fs.promises.writeFile (#5054) 2020-05-04 18:59:37 -04:00
Ali Hasani 5cc0f056d1
[std/node] add the ability to path argument to be URL type (#5055) 2020-05-03 15:14:38 -04:00
Nikolai Vavilov 898773d3f8
std/node: toString for globals (#5013) 2020-04-30 13:58:40 -04:00
Nikolai Vavilov 84d687e958
std/node: make process global (#4985) 2020-04-30 10:00:02 -04:00
Marcos Casagrande 12c6055855
Cleanup std/node/fs functions (#5000) 2020-04-29 21:36:44 -04:00
Ryan Dahl bc792c0267
make camel case readDir, readLink, realPath (#4995) 2020-04-29 16:39:37 -04:00
Bert Belder 3e6ea62841
BREAKING: Include limited metadata in 'DirEntry' objects (#4941)
This change is to prevent needed a separate stat syscall for each file
when using readdir.

For consistency, this PR also modifies std's `WalkEntry` interface to
extend `DirEntry` with an additional `path` field.
2020-04-29 16:00:31 -04:00
Valentin Anger 721a4ad59d
BREAKING: Map-like interface for Deno.env (#4942) 2020-04-29 14:48:19 -04:00
Ryan Dahl e0ca60e770
BREAKING: Use LLVM target triple for Deno.build (#4948)
Deno.build.os values have changed to correspond to standard LLVM target triples
"win" -> "windows"
"mac" -> "darwin"
2020-04-28 12:35:23 -04:00
Bartek Iwańczuk 8feb30e325
BREAKING: remove overload of Deno.test() (#4951)
This commit removes overload of Deno.test() that accepted named
function.
2020-04-28 12:33:09 +02:00
Bert Belder ee4e6a1ef9
Rename FileInfo time fields and represent them as Date objects (#4932)
This patch also increases the resolution of reported file times to
sub-millisecond precision.
2020-04-27 21:13:32 +02:00
Ali Hasani 516d970fd3
bug fix and tests for std/node/fs/mkdir (#4917) 2020-04-27 08:48:54 -04:00
Nikolai Vavilov f72f045de5
std/node: require_ -> require (#4828) 2020-04-20 14:30:52 -04:00
Ali Hasani 437e35ca52
Add no-async-promise-executor lint rule (#4809) 2020-04-20 11:29:37 +02:00
Bartek Iwańczuk e2fd729a0b
fix(std): existsFile test 2020-04-18 22:29:39 +02:00
Chris Knight 1cd1f7de70
refactor: proper Node polyfill directory iteration now that Deno supports this (#4783) 2020-04-16 15:45:30 -04:00
Nayeem Rahman 5ac728a5f1
refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (#4763) 2020-04-16 01:40:30 -04:00
Ali Hasani e23f33de7b
add copyFile & copyFileSync to std/node/fs (#4726) 2020-04-12 14:34:16 -04:00
Ryan Dahl ac215a2461
Fix build - 2becae broke CI (#4686) 2020-04-09 13:45:10 -04:00
Ali Hasani 90d6831271
feat(std/node): add isPrimitive (#4673) 2020-04-08 18:44:39 -04:00