mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
feat(runtime): stabilize Deno.symlink and Deno.symlinkSync (#9226)
This commit is contained in:
parent
e516e4d1d5
commit
2ac7798a20
5 changed files with 40 additions and 47 deletions
|
@ -56,8 +56,6 @@ const UNSTABLE_DENO_PROPS: &[&str] = &[
|
|||
"signal",
|
||||
"signals",
|
||||
"startTls",
|
||||
"symlink",
|
||||
"symlinkSync",
|
||||
"systemMemoryInfo",
|
||||
"systemCpuInfo",
|
||||
"umask",
|
||||
|
|
38
cli/dts/lib.deno.ns.d.ts
vendored
38
cli/dts/lib.deno.ns.d.ts
vendored
|
@ -2273,4 +2273,42 @@ declare namespace Deno {
|
|||
|
||||
/** The URL of the entrypoint module entered from the command-line. */
|
||||
export const mainModule: string;
|
||||
|
||||
export type SymlinkOptions = {
|
||||
type: "file" | "dir";
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates `newpath` as a symbolic link to `oldpath`.
|
||||
*
|
||||
* The options.type parameter can be set to `file` or `dir`. This argument is only
|
||||
* available on Windows and ignored on other platforms.
|
||||
*
|
||||
* ```ts
|
||||
* Deno.symlinkSync("old/name", "new/name");
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-write` permission. */
|
||||
export function symlinkSync(
|
||||
oldpath: string,
|
||||
newpath: string,
|
||||
options?: SymlinkOptions,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Creates `newpath` as a symbolic link to `oldpath`.
|
||||
*
|
||||
* The options.type parameter can be set to `file` or `dir`. This argument is only
|
||||
* available on Windows and ignored on other platforms.
|
||||
*
|
||||
* ```ts
|
||||
* await Deno.symlink("old/name", "new/name");
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-write` permission. */
|
||||
export function symlink(
|
||||
oldpath: string,
|
||||
newpath: string,
|
||||
options?: SymlinkOptions,
|
||||
): Promise<void>;
|
||||
}
|
||||
|
|
40
cli/dts/lib.deno.unstable.d.ts
vendored
40
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -36,46 +36,6 @@ declare namespace Deno {
|
|||
rows: number;
|
||||
};
|
||||
|
||||
export type SymlinkOptions = {
|
||||
type: "file" | "dir";
|
||||
};
|
||||
|
||||
/** **UNSTABLE**: This API needs a security review.
|
||||
*
|
||||
* Creates `newpath` as a symbolic link to `oldpath`.
|
||||
*
|
||||
* The options.type parameter can be set to `file` or `dir`. This argument is only
|
||||
* available on Windows and ignored on other platforms.
|
||||
*
|
||||
* ```ts
|
||||
* Deno.symlinkSync("old/name", "new/name");
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-write` permission. */
|
||||
export function symlinkSync(
|
||||
oldpath: string,
|
||||
newpath: string,
|
||||
options?: SymlinkOptions,
|
||||
): void;
|
||||
|
||||
/** **UNSTABLE**: This API needs a security review.
|
||||
*
|
||||
* Creates `newpath` as a symbolic link to `oldpath`.
|
||||
*
|
||||
* The options.type parameter can be set to `file` or `dir`. This argument is only
|
||||
* available on Windows and ignored on other platforms.
|
||||
*
|
||||
* ```ts
|
||||
* await Deno.symlink("old/name", "new/name");
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-write` permission. */
|
||||
export function symlink(
|
||||
oldpath: string,
|
||||
newpath: string,
|
||||
options?: SymlinkOptions,
|
||||
): Promise<void>;
|
||||
|
||||
/** **Unstable** There are questions around which permission this needs. And
|
||||
* maybe should be renamed (loadAverage?)
|
||||
*
|
||||
|
|
|
@ -88,6 +88,8 @@
|
|||
fsync: __bootstrap.fs.fsync,
|
||||
fdatasyncSync: __bootstrap.fs.fdatasyncSync,
|
||||
fdatasync: __bootstrap.fs.fdatasync,
|
||||
symlink: __bootstrap.fs.symlink,
|
||||
symlinkSync: __bootstrap.fs.symlinkSync,
|
||||
link: __bootstrap.fs.link,
|
||||
linkSync: __bootstrap.fs.linkSync,
|
||||
permissions: __bootstrap.permissions.permissions,
|
||||
|
@ -128,8 +130,6 @@
|
|||
futimeSync: __bootstrap.fs.futimeSync,
|
||||
utime: __bootstrap.fs.utime,
|
||||
utimeSync: __bootstrap.fs.utimeSync,
|
||||
symlink: __bootstrap.fs.symlink,
|
||||
symlinkSync: __bootstrap.fs.symlinkSync,
|
||||
HttpClient: __bootstrap.fetch.HttpClient,
|
||||
createHttpClient: __bootstrap.fetch.createHttpClient,
|
||||
};
|
||||
|
|
|
@ -1203,7 +1203,6 @@ fn op_symlink_sync(
|
|||
args: Value,
|
||||
_zero_copy: &mut [ZeroCopyBuf],
|
||||
) -> Result<Value, AnyError> {
|
||||
super::check_unstable(state, "Deno.symlink");
|
||||
let args: SymlinkArgs = serde_json::from_value(args)?;
|
||||
let oldpath = PathBuf::from(&args.oldpath);
|
||||
let newpath = PathBuf::from(&args.newpath);
|
||||
|
@ -1254,8 +1253,6 @@ async fn op_symlink_async(
|
|||
args: Value,
|
||||
_zero_copy: BufVec,
|
||||
) -> Result<Value, AnyError> {
|
||||
super::check_unstable2(&state, "Deno.symlink");
|
||||
|
||||
let args: SymlinkArgs = serde_json::from_value(args)?;
|
||||
let oldpath = PathBuf::from(&args.oldpath);
|
||||
let newpath = PathBuf::from(&args.newpath);
|
||||
|
|
Loading…
Reference in a new issue