1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00
denoland-deno/ext/node/polyfills/fs/promises.ts
Bartek Iwańczuk b40086fd7d
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.
2023-03-05 02:31:38 +00:00

33 lines
1.3 KiB
TypeScript

// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { promises as fsPromises } from "internal:deno_node/fs.ts";
export const access = fsPromises.access;
export const copyFile = fsPromises.copyFile;
export const open = fsPromises.open;
export const opendir = fsPromises.opendir;
export const rename = fsPromises.rename;
export const truncate = fsPromises.truncate;
export const rm = fsPromises.rm;
export const rmdir = fsPromises.rmdir;
export const mkdir = fsPromises.mkdir;
export const readdir = fsPromises.readdir;
export const readlink = fsPromises.readlink;
export const symlink = fsPromises.symlink;
export const lstat = fsPromises.lstat;
export const stat = fsPromises.stat;
export const link = fsPromises.link;
export const unlink = fsPromises.unlink;
export const chmod = fsPromises.chmod;
// export const lchmod = fs.lchmod;
// export const lchown = fs.lchown;
export const chown = fsPromises.chown;
export const utimes = fsPromises.utimes;
// export const lutimes = fs.lutimes;
export const realpath = fsPromises.realpath;
export const mkdtemp = fsPromises.mkdtemp;
export const writeFile = fsPromises.writeFile;
export const appendFile = fsPromises.appendFile;
export const readFile = fsPromises.readFile;
export const watch = fsPromises.watch;
export default fsPromises;