Commit Graph

313 Commits

Author SHA1 Message Date
张超杰
917423af20 doc(fs): README.md (denoland/deno#4913) 2021-02-01 10:46:57 +00:00
Luca Casonato
94e6c3d329 Unstable methods should not appear in runtime or d.ts (denoland/deno#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-02-01 10:46:57 +00:00
Ali Hasani
7f8abe0786 fix: use fromFileUrl (denoland/deno#5005) 2021-02-01 10:46:57 +00:00
Ryan Dahl
975115fb15 make camel case readDir, readLink, realPath (denoland/deno#4995) 2021-02-01 10:46:57 +00:00
Bert Belder
5cc4e45d69 BREAKING: Include limited metadata in 'DirEntry' objects (denoland/deno#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.
2021-02-01 10:46:57 +00:00
Ryan Dahl
bdac502f84 BREAKING: Use LLVM target triple for Deno.build (denoland/deno#4948)
Deno.build.os values have changed to correspond to standard LLVM target triples
"win" -> "windows"
"mac" -> "darwin"
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
4facff44f2 BREAKING: remove overload of Deno.test() (denoland/deno#4951)
This commit removes overload of Deno.test() that accepted named
function.
2021-02-01 10:46:57 +00:00
Bert Belder
14ff9a84b4 Rename FileInfo time fields and represent them as Date objects (denoland/deno#4932)
This patch also increases the resolution of reported file times to
sub-millisecond precision.
2021-02-01 10:46:57 +00:00
张超杰
2821c52196 fix: typo fs readme.md (denoland/deno#4903) 2021-02-01 10:46:57 +00:00
张超杰
72ed873ed4 fix(fs): move dest if not exists and overwrite (denoland/deno#4910) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
5f53c9808c BREAKING CHANGE: remove Deno.OpenMode (denoland/deno#4884)
This commit removes Deno.OpenMode along with overloaded variants
of Deno.open() and Deno.openSync() that used OpenMode.
2021-02-01 10:46:57 +00:00
Nayeem Rahman
b10a0edb43 refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (denoland/deno#4763) 2021-02-01 10:46:57 +00:00
dubiousjim
a6627d8926 fix erroneous assert (denoland/deno#4608) 2021-02-01 10:46:57 +00:00
Ryan Dahl
1f1818d379 Move encode, decode helpers to /encoding/utf8.ts, delete /strings/ (denoland/deno#4565)
also removes encoding/mod.ts and archive/mod.ts which are useless.
2021-02-01 10:46:57 +00:00
Nayeem Rahman
e7c907bc7b refactor(cli/js/testing): Reduce testing interfaces (denoland/deno#4451)
* Reduce "testing" interfaces
* Use a callback instead of a generator for Deno.runTests()
* Default RunTestsOptions::reportToConsole to true
* Compose TestMessage into a single interface
2021-02-01 10:46:57 +00:00
Kitson Kelly
7914eae5f0 Update to Prettier 2 and use ES Private Fields (denoland/deno#4498) 2021-02-01 10:46:57 +00:00
Akshat Agarwal
fc96083668 BREAKING CHANGE Rename Deno.run's args to cmd (denoland/deno#4444)
This is to avoid confusion with Deno.args which does not include the 
executable to be run.
2021-02-01 10:46:57 +00:00
dubiousjim
4d1a39493e use prebuilt "not implemented" error (denoland/deno#4442) 2021-02-01 10:46:57 +00:00
Samrith Shankar
204ebc523d Add require-await lint rule (denoland/deno#4401) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
03d7177ca3 refactor: rename Deno.TestDefinition.skip to ignore (denoland/deno#4400) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
a19e660a30 feat: Deno.test() sanitizes ops and resources (denoland/deno#4399)
This PR brings assertOps and assertResources sanitizers to Deno.test() API.

assertOps checks that test doesn't leak async ops, ie. there are no unresolved
promises originating from Deno APIs. Enabled by default, can be disabled using 
Deno.TestDefinition.disableOpSanitizer.

assertResources checks that test doesn't leak resources, ie. all resources used
in test are closed. For example; if a file is opened during a test case it must be
explicitly closed before test case finishes. It's most useful for asynchronous
generators. Enabled by default, can be disabled using 
Deno.TestDefinition.disableResourceSanitizer.

We've used those sanitizers in internal runtime tests and it proved very useful in
surfacing incorrect tests which resulted in interference between the tests.

All tests have been sanitized.

Closes denoland/deno#4208
2021-02-01 10:46:57 +00:00
Nayeem Rahman
19ca3f53c4 refactor: Uncomment disabled tests, use skip option (denoland/deno#4378) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
c8d15ec7b2 refactor: Cleanup options object parameters (denoland/deno#4296) 2021-02-01 10:46:57 +00:00
dubiousjim
28eb11d848 Rename readDir -> readdir (denoland/deno#4225) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
589ac5af6f reduce unnecessary output on tests (denoland/deno#4148) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
8bd4c5ed4d rename Deno.Err -> Deno.errors (denoland/deno#4093) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
f5cbcf287e refactor: remove unneeded ErrorKinds (denoland/deno#3936) 2021-02-01 10:46:57 +00:00
Maximilien Mellen
623a601fd5 Enable TS strict mode by default (denoland/deno#3899)
Fixes denoland/deno#3324 

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
82a523639a refactor: rewrite tests in to use Deno.test (denoland/deno#3930) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
7534d8390a remove non-null assertion operator from std (part2) (denoland/deno#3927) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
ee8ec4b053 remove non-null assertion operator from std (part1) (denoland/deno#3900) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
6b46758ef7 dx: descriptive permission errors (denoland/deno#3808)
Before:
```
▶ target/debug/deno https://deno.land/examples/echo_server.ts
error: Uncaught PermissionDenied: run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```

After:
```
▶ target/debug/deno https://deno.land/examples/echo_server.ts
error: Uncaught PermissionDenied: network access to "0.0.0.0:8080", run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: read access to "/etc/passwd", run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```
2021-02-01 10:46:56 +00:00
Kevin (Kun) "Kassimo" Qian
bce291ef41 http: allow response body to be string (denoland/deno#3705) 2021-02-01 10:46:56 +00:00
Ry Dahl
06059e0f22 Revert "feat(flags): script arguments come after '--'" (denoland/deno#3681)
Due to complaints about ergonomics and because it breaks shebang on
linux.

This reverts commit 2d5457df15d8c4a81362bb2d185b5c6013faa1d8.

BREAKING CHANGE
2021-02-01 10:46:56 +00:00
Ry Dahl
51658155cf feat: Deno.args now does not include script (denoland/deno#3628)
Previously Deno.args was ["script.js", "arg1", "arg2"]
Now it is just ["arg1", "arg2"]
BREAKING CHANGE
2021-02-01 10:46:56 +00:00
Ry Dahl
ccf4c766d0 feat(flags): script arguments come after '--' (denoland/deno#3621) 2021-02-01 10:46:56 +00:00
Ry Dahl
8c250d5668 fix: Deno.mkdir should conform to style guide (denoland/deno#3617) 2021-02-01 10:46:56 +00:00
Ry Dahl
3a9eb92372 Happy new year! (denoland/deno#3578) 2021-02-01 10:46:56 +00:00
Axetroy
e24c39a7f0 fix permission errors are swallowed by fs.copy() (denoland/deno#3504) 2021-02-01 10:46:56 +00:00
Axetroy
81c208e641 fix permission errors are swallowed by fs.emptyDir (denoland/deno#3501) 2021-02-01 10:46:56 +00:00
Axetroy
3bd58c2d3d fix permission errors are swallowed by fs.exists (denoland/deno#3493) 2021-02-01 10:46:56 +00:00
Nayeem Rahman
d568a6814e fix: Only swallow NotFound errors in fs/expandGlob() (denoland/deno#3479) 2021-02-01 10:46:56 +00:00
Nayeem Rahman
0a92976bb0 fix: error handling in fs/walk() (denoland/deno#3318)
- Make assertThrows() return the Error
- Remove WalkOptions::onError()
2021-02-01 10:46:56 +00:00
Kitson Kelly
1c5db631f7 Update to TypeScript 3.7 (denoland/deno#3275)
and update to prettier 1.19

Also, update `assert()` and remove not null assertions where possibly
in `cli`.

Closes denoland/deno#3273
2021-02-01 10:46:56 +00:00
Nayeem Rahman
5b2aec7a62 std: Move fs/path to the top-level (denoland/deno#3100) 2021-02-01 10:46:56 +00:00
Ryan Dahl
d491d2e747 Run deno_std tests in github actions 2021-02-01 10:46:56 +00:00
Yoshiya Hinosawa
c3fe858f98 Update eslint and @typescript-eslint (#621) 2019-10-05 12:02:34 -04:00
Nayeem Rahman
8c90bd9d0b Implement expandGlob() and expandGlobSync() (#617)
fs/glob.ts:
- Improve prototypes for expandGlob() and expandGlobSync() from #604.
- Rename glob() to globToRegExp().
- Add normalizeGlob() and joinGlobs().
- Extract GlobToRegExpOptions from GlobOptions, remove the strict
  and filepath options.

fs/globrex.ts:
- Add GlobrexOptions.

fs/path/constants.ts:
- Add SEP_PATTERN.

fs/walk.ts:
- Add WalkOptions::includeFiles
- Default WalkOptions::includeDirs to true.
- Don't traverse directories matching a skip pattern.
- Remove walkSync()'s default root value.

prettier:
- Refactor to use expandGlob().

testing:
- Make findTestModules() an async generator.
2019-10-02 13:59:27 -04:00
Nayeem Rahman
17a214bbd5 Test runner v2 (#604) 2019-09-28 09:33:17 -04:00
Ryan Dahl
a8f6cf7b4f
v0.18.0 (#600)
Several tests were disabled in order to land this update.
2019-09-18 13:17:03 -04:00
Nayeem Rahman
de8d0ab4a1 Add includeDirs to WalkOptions (#601) 2019-09-18 11:37:37 -04:00
Axetroy
06958a4ada bump prettier to 1.18.2 (#592) 2019-09-11 23:31:23 -04:00
Yoshiya Hinosawa
0e6f163ac6 fix: replace Deno.platform usages (#590) 2019-09-09 13:58:36 -04:00
Bartek Iwańczuk
c44e5367bf feat: test runner (#516) 2019-08-14 20:04:56 -04:00
Vincent LE GOFF
67641b8ea5 fix emptydir on windows (#531) 2019-07-08 11:09:23 -04:00
Yoshiya Hinosawa
3ea90d54f6 Upgrade to v0.11.0 (update Reader interface) (#527) 2019-07-07 15:20:41 -04:00
Axetroy
b04fda30c8 lint: add max line length rules (#507) 2019-06-18 21:22:01 -07:00
Sam Reghenzi
3ec3a8b4f1 fix wrong field name in example code (#490) 2019-06-14 07:57:30 -07:00
Vincent LE GOFF
9b72d580ca deactivate flaky copy assertion (#467) 2019-05-30 09:49:33 -04:00
Bartek Iwańczuk
be24677d15 chore: Implement strict mode (#453) 2019-05-30 08:59:30 -04:00
Shubhadeep Das
94dcb2779b Added isGlob function (#433) 2019-05-23 10:23:31 +03:00
Ryan Dahl
47134db9f2
Bump v0.6.0 (#423) 2019-05-21 02:44:36 -04:00
Axetroy
ab5b0887cc feat(fs): add copy/copySync (#278) 2019-05-16 12:19:17 -04:00
Ryan Dahl
07ca4f9629
walk() should not use deprecated FileInfo.path (#398)
The walk() interface is change to return a WalkInfo object which
contains both the resolved filename and FileInfo object from stat.

The followSymlinks feature is disabled for now.
2019-05-14 17:14:08 -04:00
Axetroy
d097e319e8 fs: Remove completed todo item (#406) 2019-05-14 15:11:57 -04:00
Axetroy
b6a7b78535 Move posix and win implementations in fs/path/mod.ts to separate file (#397) 2019-05-13 12:32:33 -04:00
Alvaro
aa94463902 docs(fs): fix async iterator (#366) 2019-05-01 17:45:30 -04:00
Axetroy
d9a64c0a14 fs: fix ensureLink broken (#360)
Fixes #358
2019-04-27 10:14:56 -07:00
Vincent LE GOFF
4543b563a9 Eslint fixes (#356)
Make warnings fail
2019-04-24 07:41:22 -04:00
Axetroy
0a61800163 fs utils getFileInfoType() return undefined when not found (#341) 2019-04-23 17:42:02 -04:00
Axetroy
45eebed3bf fs: add ensureLink/ensureLinkSync (#353) 2019-04-22 11:35:14 -04:00
Axetroy
d2a558fcbd expose ensureSymlink in fs/mod.ts (#354) 2019-04-22 08:18:45 -04:00
Axetroy
8d1b01cfcf feat: add ensureSymlink/ensureSymlinkSync for fs modules (#268) 2019-04-21 15:23:44 -04:00
Axetroy
191e53a78b add writeFileStr and update documentation (#340) 2019-04-14 16:14:57 -04:00
Vincent LE GOFF
95ab4e2a3c Fix eslint warnings and small clean ups (#339) 2019-04-14 10:53:19 -04:00
Vincent LE GOFF
4d25cc1e35 doc: Add missing documentation (#336) 2019-04-13 15:30:56 -04:00
Vincent LE GOFF
b462ad2530 Added read file str (#276) 2019-04-13 15:26:09 -04:00
Vincent LE GOFF
bb92c44c64 EOL add mixed detection (#325) 2019-04-13 15:24:36 -04:00
Axetroy
290cbcb9da feat: add entry point file for fs modules (#272) 2019-04-08 09:29:44 -04:00
Vincent LE GOFF
1d53fb4d79 Added EOL detect / format (#289) 2019-04-07 04:06:07 +03:00
Axetroy
24f41f67bd fix: ensure exists file/dir must be the same type or it will throw error (#294) 2019-04-07 04:01:23 +03:00
Vincent LE GOFF
a0ff487a12 Fixing jsdoc example padding (#322) 2019-04-04 05:58:16 -04:00
Axetroy
a00c51b05b remove unnecessary path.resolve in move/readJson/writeJson (#292) 2019-03-19 13:23:22 -04:00
Axetroy
59adafe867 fix: wrong usage of assertThrowsAsync which without await keyword (#295) 2019-03-19 13:22:33 -04:00
Vincent LE GOFF
0bb040e8d4 Test reorganization (#290) 2019-03-18 12:49:54 -04:00
Axetroy
264a51c093 fix: fs.exists not work for symlink (#291) 2019-03-18 12:34:54 -04:00
Vincent LE GOFF
b699fa67be Documentation clean up (#288) 2019-03-18 11:08:01 -04:00
Axetroy
da4abcd9a3 extract internal method isSubdir to fs/utils.ts (#285) 2019-03-17 12:34:55 -04:00
Axetroy
e9d104a424 feat: add writeJson/writeJsonSync for fs modules (#271) 2019-03-14 10:26:12 -04:00
Vincent LE GOFF
1805c18ac7 Improve jsdoc (#277) 2019-03-14 10:24:54 -04:00
Axetroy
e4485d722a feat: add readJson/readJsonSync for fs modules (#269) 2019-03-13 12:06:40 -04:00
Axetroy
a1fcfb2744 feat: add move/moveSync for fs modules (#266) 2019-03-12 05:11:30 -04:00
Axetroy
9ae941338a feat: add ensureDir/ensureFile for fs modules (#264) 2019-03-12 01:52:43 -04:00
Yoshiya Hinosawa
61af419bbc fix: eslint errors (#265) 2019-03-12 01:51:51 -04:00
Axetroy
64d6bfca56 feat: add emptyDir for fs modules (#263) 2019-03-11 14:19:52 -04:00
Axetroy
142a1c6cf8 add fs/exists (#260) 2019-03-11 13:14:26 -04:00
Yoshiya Hinosawa
395392912d Use Deno global var instead of built-in "deno" module (#247) 2019-03-07 19:25:16 -05:00
Yoshiya Hinosawa
c67751659c Bump CI to v0.3.2 (#245)
replace Deno.platform with Deno.build
2019-03-07 09:07:12 -05:00
Ryan Dahl
4cf39d4a14
Rename assertEq to assertEquals (#242)
After some discussion it was found that assertEquals is more common
in JS (vs assertEqual, assertEq) and sounds better in the negated form:
assertNotEquals vs assertNE.
2019-03-06 19:42:24 -05:00
Vincent LE GOFF
e1d5c00279 Testing refactor (#240) 2019-03-06 16:39:50 -05:00
Andy Hayden
0fc13fffbd Replace deno.land/x/ with deno.land/std/ (#239) 2019-03-06 10:24:53 -05:00
Vincent LE GOFF
e2fd507cfd Refactoring + Enhance UTs + Enhance doc (#230) 2019-03-04 13:06:05 -05:00
Vincent LE GOFF
ccb452f775 fs.walk performance improvement (#221) 2019-03-02 14:57:37 -05:00
Vincent LE GOFF
0c3ba838fa Glob integration for the FS walker (#219) 2019-03-02 14:56:19 -05:00
Bert Belder
6063378a92 Change import { x } from "deno" to const { x } = Deno (#218) 2019-02-26 00:35:50 -05:00
Andy Hayden
3be908facd Add fs.walk (#192) 2019-02-15 11:20:59 -05:00
Dmitry Sharshakov
f2d23f8fcd Clean up tests (#176) 2019-02-08 12:23:51 -05:00
Dmitry Sharshakov
5440377495 Add missiong copyright headers (#177) 2019-02-07 11:45:47 -05:00
Yoshiya Hinosawa
b792fe8c72 Port prettier (#156) 2019-01-26 23:19:56 -05:00
Max Graey
47e6fc775a Clean up path module (#149) 2019-01-24 14:06:24 -05:00
Ryan Dahl
4283c26b89
Remove mkdirp - deno.mkdir is already recursive (#118) 2019-01-17 13:14:48 -05:00
木杉
41312ad39f refactor(mkdirp): reorg (#103) 2019-01-12 13:07:18 -05:00
木杉
5be16ba599 refactor(path): reorg (#101) 2019-01-10 17:11:44 -05:00