summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/fs.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-04 22:31:38 -0400
committerGitHub <noreply@github.com>2023-03-05 02:31:38 +0000
commitb40086fd7da3729d1d59b312c89ee57747fc66a9 (patch)
tree991583010635feab13fae77e7c8a35fef0a09095 /ext/node/polyfills/fs.ts
parent01028fcdf4f379a7285cc15079306e3ac31edcc1 (diff)
refactor(core): include_js_files! 'dir' option doesn't change specifiers (#18019)
This commit changes "include_js_files!" macro from "deno_core" in a way that "dir" option doesn't cause specifiers to be rewritten to include it. Example: ``` include_js_files! { dir "js", "hello.js", } ``` The above definition required embedders to use: `import ... from "internal:<ext_name>/js/hello.js"`. But with this change, the "js" directory in which the files are stored is an implementation detail, which for embedders results in: `import ... from "internal:<ext_name>/hello.js"`. The directory the files are stored in, is an implementation detail and in some cases might result in a significant size difference for the snapshot. As an example, in "deno_node" extension, we store the source code in "polyfills" directory; which resulted in each specifier to look like "internal:deno_node/polyfills/<module_name>", but with this change it's "internal:deno_node/<module_name>". Given that "deno_node" has over 100 files, many of them having several import specifiers to the same extension, this change removes 10 characters from each import specifier.
Diffstat (limited to 'ext/node/polyfills/fs.ts')
-rw-r--r--ext/node/polyfills/fs.ts105
1 files changed, 40 insertions, 65 deletions
diff --git a/ext/node/polyfills/fs.ts b/ext/node/polyfills/fs.ts
index b67d2facd..a029d2b8c 100644
--- a/ext/node/polyfills/fs.ts
+++ b/ext/node/polyfills/fs.ts
@@ -3,178 +3,153 @@ import {
access,
accessPromise,
accessSync,
-} from "internal:deno_node/polyfills/_fs/_fs_access.ts";
+} from "internal:deno_node/_fs/_fs_access.ts";
import {
appendFile,
appendFilePromise,
appendFileSync,
-} from "internal:deno_node/polyfills/_fs/_fs_appendFile.ts";
+} from "internal:deno_node/_fs/_fs_appendFile.ts";
import {
chmod,
chmodPromise,
chmodSync,
-} from "internal:deno_node/polyfills/_fs/_fs_chmod.ts";
+} from "internal:deno_node/_fs/_fs_chmod.ts";
import {
chown,
chownPromise,
chownSync,
-} from "internal:deno_node/polyfills/_fs/_fs_chown.ts";
-import {
- close,
- closeSync,
-} from "internal:deno_node/polyfills/_fs/_fs_close.ts";
-import * as constants from "internal:deno_node/polyfills/_fs/_fs_constants.ts";
+} from "internal:deno_node/_fs/_fs_chown.ts";
+import { close, closeSync } from "internal:deno_node/_fs/_fs_close.ts";
+import * as constants from "internal:deno_node/_fs/_fs_constants.ts";
import {
copyFile,
copyFilePromise,
copyFileSync,
-} from "internal:deno_node/polyfills/_fs/_fs_copy.ts";
-import Dir from "internal:deno_node/polyfills/_fs/_fs_dir.ts";
-import Dirent from "internal:deno_node/polyfills/_fs/_fs_dirent.ts";
-import {
- exists,
- existsSync,
-} from "internal:deno_node/polyfills/_fs/_fs_exists.ts";
+} from "internal:deno_node/_fs/_fs_copy.ts";
+import Dir from "internal:deno_node/_fs/_fs_dir.ts";
+import Dirent from "internal:deno_node/_fs/_fs_dirent.ts";
+import { exists, existsSync } from "internal:deno_node/_fs/_fs_exists.ts";
import {
fdatasync,
fdatasyncSync,
-} from "internal:deno_node/polyfills/_fs/_fs_fdatasync.ts";
-import {
- fstat,
- fstatSync,
-} from "internal:deno_node/polyfills/_fs/_fs_fstat.ts";
-import {
- fsync,
- fsyncSync,
-} from "internal:deno_node/polyfills/_fs/_fs_fsync.ts";
+} from "internal:deno_node/_fs/_fs_fdatasync.ts";
+import { fstat, fstatSync } from "internal:deno_node/_fs/_fs_fstat.ts";
+import { fsync, fsyncSync } from "internal:deno_node/_fs/_fs_fsync.ts";
import {
ftruncate,
ftruncateSync,
-} from "internal:deno_node/polyfills/_fs/_fs_ftruncate.ts";
-import {
- futimes,
- futimesSync,
-} from "internal:deno_node/polyfills/_fs/_fs_futimes.ts";
+} from "internal:deno_node/_fs/_fs_ftruncate.ts";
+import { futimes, futimesSync } from "internal:deno_node/_fs/_fs_futimes.ts";
import {
link,
linkPromise,
linkSync,
-} from "internal:deno_node/polyfills/_fs/_fs_link.ts";
+} from "internal:deno_node/_fs/_fs_link.ts";
import {
lstat,
lstatPromise,
lstatSync,
-} from "internal:deno_node/polyfills/_fs/_fs_lstat.ts";
+} from "internal:deno_node/_fs/_fs_lstat.ts";
import {
mkdir,
mkdirPromise,
mkdirSync,
-} from "internal:deno_node/polyfills/_fs/_fs_mkdir.ts";
+} from "internal:deno_node/_fs/_fs_mkdir.ts";
import {
mkdtemp,
mkdtempPromise,
mkdtempSync,
-} from "internal:deno_node/polyfills/_fs/_fs_mkdtemp.ts";
+} from "internal:deno_node/_fs/_fs_mkdtemp.ts";
import {
open,
openPromise,
openSync,
-} from "internal:deno_node/polyfills/_fs/_fs_open.ts";
+} from "internal:deno_node/_fs/_fs_open.ts";
import {
opendir,
opendirPromise,
opendirSync,
-} from "internal:deno_node/polyfills/_fs/_fs_opendir.ts";
-import { read, readSync } from "internal:deno_node/polyfills/_fs/_fs_read.ts";
+} from "internal:deno_node/_fs/_fs_opendir.ts";
+import { read, readSync } from "internal:deno_node/_fs/_fs_read.ts";
import {
readdir,
readdirPromise,
readdirSync,
-} from "internal:deno_node/polyfills/_fs/_fs_readdir.ts";
+} from "internal:deno_node/_fs/_fs_readdir.ts";
import {
readFile,
readFilePromise,
readFileSync,
-} from "internal:deno_node/polyfills/_fs/_fs_readFile.ts";
+} from "internal:deno_node/_fs/_fs_readFile.ts";
import {
readlink,
readlinkPromise,
readlinkSync,
-} from "internal:deno_node/polyfills/_fs/_fs_readlink.ts";
+} from "internal:deno_node/_fs/_fs_readlink.ts";
import {
realpath,
realpathPromise,
realpathSync,
-} from "internal:deno_node/polyfills/_fs/_fs_realpath.ts";
+} from "internal:deno_node/_fs/_fs_realpath.ts";
import {
rename,
renamePromise,
renameSync,
-} from "internal:deno_node/polyfills/_fs/_fs_rename.ts";
+} from "internal:deno_node/_fs/_fs_rename.ts";
import {
rmdir,
rmdirPromise,
rmdirSync,
-} from "internal:deno_node/polyfills/_fs/_fs_rmdir.ts";
-import {
- rm,
- rmPromise,
- rmSync,
-} from "internal:deno_node/polyfills/_fs/_fs_rm.ts";
+} from "internal:deno_node/_fs/_fs_rmdir.ts";
+import { rm, rmPromise, rmSync } from "internal:deno_node/_fs/_fs_rm.ts";
import {
stat,
statPromise,
statSync,
-} from "internal:deno_node/polyfills/_fs/_fs_stat.ts";
+} from "internal:deno_node/_fs/_fs_stat.ts";
import {
symlink,
symlinkPromise,
symlinkSync,
-} from "internal:deno_node/polyfills/_fs/_fs_symlink.ts";
+} from "internal:deno_node/_fs/_fs_symlink.ts";
import {
truncate,
truncatePromise,
truncateSync,
-} from "internal:deno_node/polyfills/_fs/_fs_truncate.ts";
+} from "internal:deno_node/_fs/_fs_truncate.ts";
import {
unlink,
unlinkPromise,
unlinkSync,
-} from "internal:deno_node/polyfills/_fs/_fs_unlink.ts";
+} from "internal:deno_node/_fs/_fs_unlink.ts";
import {
utimes,
utimesPromise,
utimesSync,
-} from "internal:deno_node/polyfills/_fs/_fs_utimes.ts";
+} from "internal:deno_node/_fs/_fs_utimes.ts";
import {
unwatchFile,
watch,
watchFile,
watchPromise,
-} from "internal:deno_node/polyfills/_fs/_fs_watch.ts";
+} from "internal:deno_node/_fs/_fs_watch.ts";
// @deno-types="./_fs/_fs_write.d.ts"
-import {
- write,
- writeSync,
-} from "internal:deno_node/polyfills/_fs/_fs_write.mjs";
+import { write, writeSync } from "internal:deno_node/_fs/_fs_write.mjs";
// @deno-types="./_fs/_fs_writev.d.ts"
-import {
- writev,
- writevSync,
-} from "internal:deno_node/polyfills/_fs/_fs_writev.mjs";
+import { writev, writevSync } from "internal:deno_node/_fs/_fs_writev.mjs";
import {
writeFile,
writeFilePromise,
writeFileSync,
-} from "internal:deno_node/polyfills/_fs/_fs_writeFile.ts";
-import { Stats } from "internal:deno_node/polyfills/internal/fs/utils.mjs";
+} from "internal:deno_node/_fs/_fs_writeFile.ts";
+import { Stats } from "internal:deno_node/internal/fs/utils.mjs";
// @deno-types="./internal/fs/streams.d.ts"
import {
createReadStream,
createWriteStream,
ReadStream,
WriteStream,
-} from "internal:deno_node/polyfills/internal/fs/streams.mjs";
+} from "internal:deno_node/internal/fs/streams.mjs";
const {
F_OK,