From 8eab2eece81609b4aeddd419dac37fe8dd487cf6 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 26 Nov 2020 14:47:55 -0800 Subject: [PATCH 1/4] remove redirecting modules --- std/node/buffer.ts | 4 ---- std/node/crypto.ts | 4 ---- std/node/fs.ts | 4 ---- std/node/os.ts | 4 ---- std/node/querystring.ts | 4 ---- std/node/string_decoder.ts | 4 ---- std/node/timers.ts | 4 ---- std/node/url.ts | 4 ---- std/node/util.ts | 4 ---- 9 files changed, 36 deletions(-) delete mode 100644 std/node/buffer.ts delete mode 100644 std/node/crypto.ts delete mode 100644 std/node/fs.ts delete mode 100644 std/node/os.ts delete mode 100644 std/node/querystring.ts delete mode 100644 std/node/string_decoder.ts delete mode 100644 std/node/timers.ts delete mode 100644 std/node/url.ts delete mode 100644 std/node/util.ts diff --git a/std/node/buffer.ts b/std/node/buffer.ts deleted file mode 100644 index 664c1ed25aef74..00000000000000 --- a/std/node/buffer.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_buffer.ts"; -import * as m from "./_buffer.ts"; -export default m; diff --git a/std/node/crypto.ts b/std/node/crypto.ts deleted file mode 100644 index d27cab67de4cb1..00000000000000 --- a/std/node/crypto.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_crypto.ts"; -import * as m from "./_crypto.ts"; -export default m; diff --git a/std/node/fs.ts b/std/node/fs.ts deleted file mode 100644 index 04adbf417e0d94..00000000000000 --- a/std/node/fs.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_fs.ts"; -import * as m from "./_fs.ts"; -export default m; diff --git a/std/node/os.ts b/std/node/os.ts deleted file mode 100644 index 1599fbeb37b49a..00000000000000 --- a/std/node/os.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_os.ts"; -import * as m from "./_os.ts"; -export default m; diff --git a/std/node/querystring.ts b/std/node/querystring.ts deleted file mode 100644 index ff68b2ae87c180..00000000000000 --- a/std/node/querystring.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_querystring.ts"; -import * as m from "./_querystring.ts"; -export default m; diff --git a/std/node/string_decoder.ts b/std/node/string_decoder.ts deleted file mode 100644 index cc6fb5186af537..00000000000000 --- a/std/node/string_decoder.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_string_decoder.ts"; -import * as m from "./_string_decoder.ts"; -export default m; diff --git a/std/node/timers.ts b/std/node/timers.ts deleted file mode 100644 index 095f6c5dc40542..00000000000000 --- a/std/node/timers.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_timers.ts"; -import * as m from "./_timers.ts"; -export default m; diff --git a/std/node/url.ts b/std/node/url.ts deleted file mode 100644 index 2aa2702aadcab9..00000000000000 --- a/std/node/url.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_url.ts"; -import * as m from "./_url.ts"; -export default m; diff --git a/std/node/util.ts b/std/node/util.ts deleted file mode 100644 index b9239ec5d29848..00000000000000 --- a/std/node/util.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_util.ts"; -import * as m from "./_util.ts"; -export default m; From bab263c8fb0ee215205097d0c098966d3c8f4252 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 26 Nov 2020 14:48:48 -0800 Subject: [PATCH 2/4] move wrapped modules back --- std/node/{_buffer.ts => buffer.ts} | 0 std/node/{_crypto.ts => crypto.ts} | 0 std/node/{_fs.ts => fs.ts} | 0 std/node/{_os.ts => os.ts} | 0 std/node/{_querystring.ts => querystring.ts} | 0 std/node/{_string_decoder.ts => string_decoder.ts} | 0 std/node/{_timers.ts => timers.ts} | 0 std/node/{_url.ts => url.ts} | 0 std/node/{_util.ts => util.ts} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename std/node/{_buffer.ts => buffer.ts} (100%) rename std/node/{_crypto.ts => crypto.ts} (100%) rename std/node/{_fs.ts => fs.ts} (100%) rename std/node/{_os.ts => os.ts} (100%) rename std/node/{_querystring.ts => querystring.ts} (100%) rename std/node/{_string_decoder.ts => string_decoder.ts} (100%) rename std/node/{_timers.ts => timers.ts} (100%) rename std/node/{_url.ts => url.ts} (100%) rename std/node/{_util.ts => util.ts} (100%) diff --git a/std/node/_buffer.ts b/std/node/buffer.ts similarity index 100% rename from std/node/_buffer.ts rename to std/node/buffer.ts diff --git a/std/node/_crypto.ts b/std/node/crypto.ts similarity index 100% rename from std/node/_crypto.ts rename to std/node/crypto.ts diff --git a/std/node/_fs.ts b/std/node/fs.ts similarity index 100% rename from std/node/_fs.ts rename to std/node/fs.ts diff --git a/std/node/_os.ts b/std/node/os.ts similarity index 100% rename from std/node/_os.ts rename to std/node/os.ts diff --git a/std/node/_querystring.ts b/std/node/querystring.ts similarity index 100% rename from std/node/_querystring.ts rename to std/node/querystring.ts diff --git a/std/node/_string_decoder.ts b/std/node/string_decoder.ts similarity index 100% rename from std/node/_string_decoder.ts rename to std/node/string_decoder.ts diff --git a/std/node/_timers.ts b/std/node/timers.ts similarity index 100% rename from std/node/_timers.ts rename to std/node/timers.ts diff --git a/std/node/_url.ts b/std/node/url.ts similarity index 100% rename from std/node/_url.ts rename to std/node/url.ts diff --git a/std/node/_util.ts b/std/node/util.ts similarity index 100% rename from std/node/_util.ts rename to std/node/util.ts From d350ab4501baad4cd2b06439e798ccdecbc2e472 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 26 Nov 2020 15:08:23 -0800 Subject: [PATCH 3/4] inline default definitions --- std/node/buffer.ts | 2 ++ std/node/crypto.ts | 7 ++++-- std/node/fs.ts | 44 ++++++++++++++++++++++++++++++++++++++ std/node/os.ts | 22 +++++++++++++++++++ std/node/querystring.ts | 11 ++++++++++ std/node/string_decoder.ts | 2 ++ std/node/timers.ts | 9 ++++++++ std/node/url.ts | 6 ++++++ std/node/util.ts | 21 ++++++++++++++++++ 9 files changed, 122 insertions(+), 2 deletions(-) diff --git a/std/node/buffer.ts b/std/node/buffer.ts index d7e8af6ee9f528..32ff824d4e2eb2 100644 --- a/std/node/buffer.ts +++ b/std/node/buffer.ts @@ -597,3 +597,5 @@ export class Buffer extends Uint8Array { return offset + 4; } } + +export default { Buffer }; diff --git a/std/node/crypto.ts b/std/node/crypto.ts index 86c2b772fa588d..0db8e2b13ec228 100644 --- a/std/node/crypto.ts +++ b/std/node/crypto.ts @@ -1,3 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export { default as randomBytes } from "./_crypto/randomBytes.ts"; -export { pbkdf2, pbkdf2Sync } from "./_crypto/pbkdf2.ts"; +import { default as randomBytes } from "./_crypto/randomBytes.ts"; +import { pbkdf2, pbkdf2Sync } from "./_crypto/pbkdf2.ts"; + +export default { randomBytes, pbkdf2, pbkdf2Sync }; +export { pbkdf2, pbkdf2Sync, randomBytes }; diff --git a/std/node/fs.ts b/std/node/fs.ts index 052394e21073d6..38682d3c4c4789 100644 --- a/std/node/fs.ts +++ b/std/node/fs.ts @@ -23,6 +23,50 @@ import { lstat, lstatSync } from "./_fs/_fs_lstat.ts"; import * as promises from "./_fs/promises/mod.ts"; +export default { + access, + accessSync, + appendFile, + appendFileSync, + chmod, + chmodSync, + chown, + chownSync, + close, + closeSync, + constants, + copyFile, + copyFileSync, + exists, + existsSync, + lstat, + lstatSync, + mkdir, + mkdirSync, + open, + openSync, + promises, + readdir, + readdirSync, + readFile, + readFileSync, + readlink, + readlinkSync, + realpath, + realpathSync, + rename, + renameSync, + rmdir, + rmdirSync, + stat, + statSync, + unlink, + unlinkSync, + watch, + writeFile, + writeFileSync, +}; + export { access, accessSync, diff --git a/std/node/os.ts b/std/node/os.ts index 14bf20abd2ad20..bec3de5ee16d8c 100644 --- a/std/node/os.ts +++ b/std/node/os.ts @@ -222,3 +222,25 @@ export const constants = { }; export const EOL = Deno.build.os == "windows" ? fsEOL.CRLF : fsEOL.LF; + +export default { + arch, + cpus, + endianness, + freemem, + getPriority, + homedir, + hostname, + loadavg, + networkInterfaces, + platform, + release, + setPriority, + tmpdir, + totalmem, + type, + uptime, + userInfo, + constants, + EOL, +}; diff --git a/std/node/querystring.ts b/std/node/querystring.ts index a49f55f5478e15..73e46c4241f65c 100644 --- a/std/node/querystring.ts +++ b/std/node/querystring.ts @@ -154,3 +154,14 @@ export const decode = parse; export const encode = stringify; export const unescape = decodeURIComponent; export const escape = encodeURIComponent; + +export default { + parse, + encodeStr, + stringify, + hexTable, + decode, + encode, + unescape, + escape, +}; diff --git a/std/node/string_decoder.ts b/std/node/string_decoder.ts index 623070f584cdc9..d5aba801814cb3 100644 --- a/std/node/string_decoder.ts +++ b/std/node/string_decoder.ts @@ -309,3 +309,5 @@ export class StringDecoder { this.write = decoder.write; } } + +export default { StringDecoder }; diff --git a/std/node/timers.ts b/std/node/timers.ts index 872e1f9ae069c9..fd040ca5ec286f 100644 --- a/std/node/timers.ts +++ b/std/node/timers.ts @@ -12,3 +12,12 @@ export const setImmediate = ( ...args: any[] ): number => window.setTimeout(cb, 0, ...args); export const clearImmediate = window.clearTimeout; + +export default { + setTimeout, + clearTimeout, + setInterval, + clearInterval, + setImmediate, + clearImmediate, +}; diff --git a/std/node/url.ts b/std/node/url.ts index f85286df237ea8..a0a3e5f33752e3 100644 --- a/std/node/url.ts +++ b/std/node/url.ts @@ -137,3 +137,9 @@ export function pathToFileURL(filepath: string): URL { outURL.pathname = resolved; return outURL; } + +export default { + fileURLToPath, + pathToFileURL, + URL, +}; diff --git a/std/node/util.ts b/std/node/util.ts index 78a9e1d8b1d580..c2419b86fccdf1 100644 --- a/std/node/util.ts +++ b/std/node/util.ts @@ -144,3 +144,24 @@ export const TextDecoder = _TextDecoder; /** The global TextEncoder */ export type TextEncoder = import("./_utils.ts")._TextEncoder; export const TextEncoder = _TextEncoder; + +export default { + inspect, + isArray, + isBoolean, + isNull, + isNullOrUndefined, + isNumber, + isString, + isSymbol, + isUndefined, + isObject, + isError, + isFunction, + isRegExp, + isPrimitive, + getSystemErrorName, + deprecate, + TextDecoder, + TextEncoder, +}; From 566a49d11fe0c656eceb8d8d7ed089db6de4061c Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 26 Nov 2020 15:30:31 -0800 Subject: [PATCH 4/4] fixup buffer reference --- std/node/global.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/node/global.ts b/std/node/global.ts index 0ef688e6319391..d72760089247d9 100644 --- a/std/node/global.ts +++ b/std/node/global.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. /// import { process as processModule } from "./process.ts"; -import { Buffer as bufferModule } from "./_buffer.ts"; +import { Buffer as bufferModule } from "./buffer.ts"; Object.defineProperty(globalThis, "global", { value: globalThis,