mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -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",
|
"signal",
|
||||||
"signals",
|
"signals",
|
||||||
"startTls",
|
"startTls",
|
||||||
"symlink",
|
|
||||||
"symlinkSync",
|
|
||||||
"systemMemoryInfo",
|
"systemMemoryInfo",
|
||||||
"systemCpuInfo",
|
"systemCpuInfo",
|
||||||
"umask",
|
"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. */
|
/** The URL of the entrypoint module entered from the command-line. */
|
||||||
export const mainModule: string;
|
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;
|
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
|
/** **Unstable** There are questions around which permission this needs. And
|
||||||
* maybe should be renamed (loadAverage?)
|
* maybe should be renamed (loadAverage?)
|
||||||
*
|
*
|
||||||
|
|
|
@ -88,6 +88,8 @@
|
||||||
fsync: __bootstrap.fs.fsync,
|
fsync: __bootstrap.fs.fsync,
|
||||||
fdatasyncSync: __bootstrap.fs.fdatasyncSync,
|
fdatasyncSync: __bootstrap.fs.fdatasyncSync,
|
||||||
fdatasync: __bootstrap.fs.fdatasync,
|
fdatasync: __bootstrap.fs.fdatasync,
|
||||||
|
symlink: __bootstrap.fs.symlink,
|
||||||
|
symlinkSync: __bootstrap.fs.symlinkSync,
|
||||||
link: __bootstrap.fs.link,
|
link: __bootstrap.fs.link,
|
||||||
linkSync: __bootstrap.fs.linkSync,
|
linkSync: __bootstrap.fs.linkSync,
|
||||||
permissions: __bootstrap.permissions.permissions,
|
permissions: __bootstrap.permissions.permissions,
|
||||||
|
@ -128,8 +130,6 @@
|
||||||
futimeSync: __bootstrap.fs.futimeSync,
|
futimeSync: __bootstrap.fs.futimeSync,
|
||||||
utime: __bootstrap.fs.utime,
|
utime: __bootstrap.fs.utime,
|
||||||
utimeSync: __bootstrap.fs.utimeSync,
|
utimeSync: __bootstrap.fs.utimeSync,
|
||||||
symlink: __bootstrap.fs.symlink,
|
|
||||||
symlinkSync: __bootstrap.fs.symlinkSync,
|
|
||||||
HttpClient: __bootstrap.fetch.HttpClient,
|
HttpClient: __bootstrap.fetch.HttpClient,
|
||||||
createHttpClient: __bootstrap.fetch.createHttpClient,
|
createHttpClient: __bootstrap.fetch.createHttpClient,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1203,7 +1203,6 @@ fn op_symlink_sync(
|
||||||
args: Value,
|
args: Value,
|
||||||
_zero_copy: &mut [ZeroCopyBuf],
|
_zero_copy: &mut [ZeroCopyBuf],
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
super::check_unstable(state, "Deno.symlink");
|
|
||||||
let args: SymlinkArgs = serde_json::from_value(args)?;
|
let args: SymlinkArgs = serde_json::from_value(args)?;
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1254,8 +1253,6 @@ async fn op_symlink_async(
|
||||||
args: Value,
|
args: Value,
|
||||||
_zero_copy: BufVec,
|
_zero_copy: BufVec,
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
super::check_unstable2(&state, "Deno.symlink");
|
|
||||||
|
|
||||||
let args: SymlinkArgs = serde_json::from_value(args)?;
|
let args: SymlinkArgs = serde_json::from_value(args)?;
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
|
Loading…
Reference in a new issue