summaryrefslogtreecommitdiff
path: root/std/node/_fs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-07-08 19:26:39 +1000
committerGitHub <noreply@github.com>2020-07-08 11:26:39 +0200
commit82aabb657a8fbaf107e58214490fdd129db3ae6b (patch)
tree1b92a346f546c5e69c3abd879abdc7728adbc11c /std/node/_fs
parent862bc2ecae3d9c3f880201d2302ca869d911eb69 (diff)
feat: add --no-check option (#6456)
This commit adds a "--no-check" option to following subcommands: - "deno cache" - "deno info" - "deno run" - "deno test" The "--no-check" options allows to skip type checking step and instead directly transpiles TS sources to JS sources. This solution uses `ts.transpileModule()` API and is just an interim solution before implementing it fully in Rust.
Diffstat (limited to 'std/node/_fs')
-rw-r--r--std/node/_fs/_fs_access.ts2
-rw-r--r--std/node/_fs/_fs_chmod.ts2
-rw-r--r--std/node/_fs/_fs_chown.ts2
-rw-r--r--std/node/_fs/_fs_close.ts2
-rw-r--r--std/node/_fs/_fs_copy.ts2
-rw-r--r--std/node/_fs/_fs_dir_test.ts2
-rw-r--r--std/node/_fs/_fs_link.ts2
-rw-r--r--std/node/_fs/_fs_mkdir.ts8
-rw-r--r--std/node/_fs/_fs_writeFile_test.ts2
-rw-r--r--std/node/_fs/promises/_fs_readFile.ts5
-rw-r--r--std/node/_fs/promises/_fs_writeFile.ts2
-rw-r--r--std/node/_fs/promises/_fs_writeFile_test.ts2
12 files changed, 18 insertions, 15 deletions
diff --git a/std/node/_fs/_fs_access.ts b/std/node/_fs/_fs_access.ts
index ee93c4c7f..79e4ca96d 100644
--- a/std/node/_fs/_fs_access.ts
+++ b/std/node/_fs/_fs_access.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
import { notImplemented } from "../_utils.ts";
/** Revist once https://github.com/denoland/deno/issues/4017 lands */
diff --git a/std/node/_fs/_fs_chmod.ts b/std/node/_fs/_fs_chmod.ts
index b1079e0a1..844afd21d 100644
--- a/std/node/_fs/_fs_chmod.ts
+++ b/std/node/_fs/_fs_chmod.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
import { fromFileUrl } from "../path.ts";
const allowedModes = /^[0-7]{3}/;
diff --git a/std/node/_fs/_fs_chown.ts b/std/node/_fs/_fs_chown.ts
index cd1973b1f..56068ef73 100644
--- a/std/node/_fs/_fs_chown.ts
+++ b/std/node/_fs/_fs_chown.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
import { fromFileUrl } from "../path.ts";
/**
diff --git a/std/node/_fs/_fs_close.ts b/std/node/_fs/_fs_close.ts
index cdd815ad9..add6f6663 100644
--- a/std/node/_fs/_fs_close.ts
+++ b/std/node/_fs/_fs_close.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
export function close(fd: number, callback: CallbackWithError): void {
queueMicrotask(() => {
diff --git a/std/node/_fs/_fs_copy.ts b/std/node/_fs/_fs_copy.ts
index 26d9a8c9a..72f43d18f 100644
--- a/std/node/_fs/_fs_copy.ts
+++ b/std/node/_fs/_fs_copy.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
import { fromFileUrl } from "../path.ts";
export function copyFile(
diff --git a/std/node/_fs/_fs_dir_test.ts b/std/node/_fs/_fs_dir_test.ts
index e89912772..2d2d5f585 100644
--- a/std/node/_fs/_fs_dir_test.ts
+++ b/std/node/_fs/_fs_dir_test.ts
@@ -1,6 +1,6 @@
import { assert, assertEquals, fail } from "../../testing/asserts.ts";
import Dir from "./_fs_dir.ts";
-import Dirent from "./_fs_dirent.ts";
+import type Dirent from "./_fs_dirent.ts";
Deno.test({
name: "Closing current directory with callback is successful",
diff --git a/std/node/_fs/_fs_link.ts b/std/node/_fs/_fs_link.ts
index 50916a7ba..df08e13b1 100644
--- a/std/node/_fs/_fs_link.ts
+++ b/std/node/_fs/_fs_link.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
import { fromFileUrl } from "../path.ts";
/**
diff --git a/std/node/_fs/_fs_mkdir.ts b/std/node/_fs/_fs_mkdir.ts
index a65db8dba..8578f4653 100644
--- a/std/node/_fs/_fs_mkdir.ts
+++ b/std/node/_fs/_fs_mkdir.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { CallbackWithError } from "./_fs_common.ts";
+import type { CallbackWithError } from "./_fs_common.ts";
import { fromFileUrl } from "../path.ts";
/**
@@ -31,10 +31,11 @@ export function mkdir(
if (options.recursive !== undefined) recursive = options.recursive;
if (options.mode !== undefined) mode = options.mode;
}
- if (typeof recursive !== "boolean")
+ if (typeof recursive !== "boolean") {
throw new Deno.errors.InvalidData(
"invalid recursive option , must be a boolean"
);
+ }
Deno.mkdir(path, { recursive, mode })
.then(() => {
if (typeof callback === "function") {
@@ -61,10 +62,11 @@ export function mkdirSync(path: string | URL, options?: MkdirOptions): void {
if (options.recursive !== undefined) recursive = options.recursive;
if (options.mode !== undefined) mode = options.mode;
}
- if (typeof recursive !== "boolean")
+ if (typeof recursive !== "boolean") {
throw new Deno.errors.InvalidData(
"invalid recursive option , must be a boolean"
);
+ }
Deno.mkdirSync(path, { recursive, mode });
}
diff --git a/std/node/_fs/_fs_writeFile_test.ts b/std/node/_fs/_fs_writeFile_test.ts
index 3959ad219..015ed6553 100644
--- a/std/node/_fs/_fs_writeFile_test.ts
+++ b/std/node/_fs/_fs_writeFile_test.ts
@@ -6,7 +6,7 @@ import {
assertThrows,
} from "../../testing/asserts.ts";
import { writeFile, writeFileSync } from "./_fs_writeFile.ts";
-import { TextEncodings } from "./_fs_common.ts";
+import type { TextEncodings } from "./_fs_common.ts";
import * as path from "../../path/mod.ts";
const testDataDir = path.resolve(path.join("node", "_fs", "testdata"));
diff --git a/std/node/_fs/promises/_fs_readFile.ts b/std/node/_fs/promises/_fs_readFile.ts
index 83ef9ac50..8677e05cd 100644
--- a/std/node/_fs/promises/_fs_readFile.ts
+++ b/std/node/_fs/promises/_fs_readFile.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import {
+import type {
FileOptionsArgument,
BinaryOptionsArgument,
TextOptionsArgument,
@@ -21,8 +21,9 @@ export function readFile(
return new Promise((resolve, reject) => {
readFileCallback(path, options, (err, data): void => {
if (err) return reject(err);
- if (data == null)
+ if (data == null) {
return reject(new Error("Invalid state: data missing, but no error"));
+ }
resolve(data);
});
});
diff --git a/std/node/_fs/promises/_fs_writeFile.ts b/std/node/_fs/promises/_fs_writeFile.ts
index 4f7c39a6a..48b9bf0ea 100644
--- a/std/node/_fs/promises/_fs_writeFile.ts
+++ b/std/node/_fs/promises/_fs_writeFile.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { Encodings, WriteFileOptions } from "../_fs_common.ts";
+import type { Encodings, WriteFileOptions } from "../_fs_common.ts";
import { writeFile as writeFileCallback } from "../_fs_writeFile.ts";
diff --git a/std/node/_fs/promises/_fs_writeFile_test.ts b/std/node/_fs/promises/_fs_writeFile_test.ts
index 8f6ef0842..6901fff22 100644
--- a/std/node/_fs/promises/_fs_writeFile_test.ts
+++ b/std/node/_fs/promises/_fs_writeFile_test.ts
@@ -6,7 +6,7 @@ import {
assertThrowsAsync,
} from "../../../testing/asserts.ts";
import { writeFile } from "./_fs_writeFile.ts";
-import { TextEncodings } from "../_fs_common.ts";
+import type { TextEncodings } from "../_fs_common.ts";
const decoder = new TextDecoder("utf-8");