mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
chore: remove _deno_unstable.ts
(#2600)
This commit is contained in:
parent
788720f53f
commit
e0e851053a
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,4 @@ package-lock.json
|
||||
**/cov/
|
||||
/_wasm_crypto/target
|
||||
/_wasm_varint/target
|
||||
# TODO(nayeemrmn): Remove (https://github.com/denoland/deno_std/pull/1819#issuecomment-1011136991).
|
||||
/_deno_unstable_checked.ts
|
||||
/hash/_wasm/target
|
||||
|
@ -1,228 +0,0 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// @ts-nocheck Bypass static errors for missing --unstable.
|
||||
|
||||
export type HttpClient = Deno.HttpClient;
|
||||
export type UnixConnectOptions = Deno.UnixConnectOptions;
|
||||
export type UnixListenOptions = Deno.UnixListenOptions;
|
||||
export type DatagramConn = Deno.DatagramConn;
|
||||
export type ServeHandler = Deno.ServeHandler;
|
||||
|
||||
export function serve(
|
||||
...args: Parameters<typeof Deno.serve>
|
||||
): ReturnType<typeof Deno.serve> {
|
||||
if (typeof Deno.serve == "function") {
|
||||
return Deno.serve(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function upgradeHttpRaw(
|
||||
...args: Parameters<typeof Deno.upgradeHttpRaw>
|
||||
): ReturnType<typeof Deno.upgradeHttpRaw> {
|
||||
if (typeof Deno.upgradeHttpRaw == "function") {
|
||||
return Deno.upgradeHttpRaw(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function addSignalListener(
|
||||
...args: Parameters<typeof Deno.addSignalListener>
|
||||
): ReturnType<typeof Deno.addSignalListener> {
|
||||
if (typeof Deno.addSignalListener == "function") {
|
||||
return Deno.addSignalListener(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function createHttpClient(
|
||||
...args: Parameters<typeof Deno.createHttpClient>
|
||||
): ReturnType<typeof Deno.createHttpClient> {
|
||||
if (typeof Deno.createHttpClient == "function") {
|
||||
return Deno.createHttpClient(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function consoleSize(
|
||||
...args: Parameters<typeof Deno.consoleSize>
|
||||
): ReturnType<typeof Deno.consoleSize> {
|
||||
if (typeof Deno.consoleSize == "function") {
|
||||
return Deno.consoleSize(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function futime(
|
||||
...args: Parameters<typeof Deno.futime>
|
||||
): ReturnType<typeof Deno.futime> {
|
||||
if (typeof Deno.futime == "function") {
|
||||
return Deno.futime(...args);
|
||||
} else {
|
||||
return Promise.reject(new TypeError("Requires --unstable"));
|
||||
}
|
||||
}
|
||||
|
||||
export function futimeSync(
|
||||
...args: Parameters<typeof Deno.futimeSync>
|
||||
): ReturnType<typeof Deno.futimeSync> {
|
||||
if (typeof Deno.futimeSync == "function") {
|
||||
return Deno.futimeSync(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function getUid(
|
||||
...args: Parameters<typeof Deno.getUid>
|
||||
): ReturnType<typeof Deno.getUid> {
|
||||
if (typeof Deno.getUid == "function") {
|
||||
return Deno.getUid(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function hostname(
|
||||
...args: Parameters<typeof Deno.hostname>
|
||||
): ReturnType<typeof Deno.hostname> {
|
||||
if (typeof Deno.hostname == "function") {
|
||||
return Deno.hostname(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function loadavg(
|
||||
...args: Parameters<typeof Deno.loadavg>
|
||||
): ReturnType<typeof Deno.loadavg> {
|
||||
if (typeof Deno.loadavg == "function") {
|
||||
return Deno.loadavg(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function osRelease(
|
||||
...args: Parameters<typeof Deno.osRelease>
|
||||
): ReturnType<typeof Deno.osRelease> {
|
||||
if (typeof Deno.osRelease == "function") {
|
||||
return Deno.osRelease(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function removeSignalListener(
|
||||
...args: Parameters<typeof Deno.removeSignalListener>
|
||||
): ReturnType<typeof Deno.removeSignalListener> {
|
||||
if (typeof Deno.removeSignalListener == "function") {
|
||||
return Deno.removeSignalListener(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function setRaw(
|
||||
...args: Parameters<typeof Deno.setRaw>
|
||||
): ReturnType<typeof Deno.setRaw> {
|
||||
if (typeof Deno.setRaw == "function") {
|
||||
return Deno.setRaw(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function systemMemoryInfo(
|
||||
...args: Parameters<typeof Deno.systemMemoryInfo>
|
||||
): ReturnType<typeof Deno.systemMemoryInfo> {
|
||||
if (typeof Deno.systemMemoryInfo == "function") {
|
||||
return Deno.systemMemoryInfo(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function utime(
|
||||
...args: Parameters<typeof Deno.utime>
|
||||
): ReturnType<typeof Deno.utime> {
|
||||
if (typeof Deno.utime == "function") {
|
||||
return Deno.utime(...args);
|
||||
} else {
|
||||
return Promise.reject(new TypeError("Requires --unstable"));
|
||||
}
|
||||
}
|
||||
|
||||
export function utimeSync(
|
||||
...args: Parameters<typeof Deno.utimeSync>
|
||||
): ReturnType<typeof Deno.utimeSync> {
|
||||
if (typeof Deno.utimeSync == "function") {
|
||||
return Deno.utimeSync(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function networkInterfaces(
|
||||
...args: Parameters<typeof Deno.networkInterfaces>
|
||||
): ReturnType<typeof Deno.networkInterfaces> {
|
||||
if (typeof Deno.networkInterfaces == "function") {
|
||||
return Deno.networkInterfaces(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export async function connect(
|
||||
options: UnixConnectOptions,
|
||||
): Promise<Deno.UnixConn> {
|
||||
return await Deno.connect(options);
|
||||
}
|
||||
|
||||
export function listen(
|
||||
options: UnixListenOptions & { transport: "unix" },
|
||||
): ReturnType<typeof Deno.listen> {
|
||||
return Deno.listen(options);
|
||||
}
|
||||
|
||||
export function listenDatagram(
|
||||
options: Deno.ListenOptions & { transport: "udp" },
|
||||
): ReturnType<typeof Deno.listenDatagram> {
|
||||
return Deno.listenDatagram(options);
|
||||
}
|
||||
|
||||
export function ListenerRef(
|
||||
listener: Deno.Listener,
|
||||
...args: Parameters<Deno.Listener["ref"]>
|
||||
): ReturnType<Deno.Listener["ref"]> {
|
||||
if (typeof listener.ref == "function") {
|
||||
return listener.ref(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function ListenerUnref(
|
||||
listener: Deno.Listener,
|
||||
...args: Parameters<Deno.Listener["unref"]>
|
||||
): ReturnType<Deno.Listener["unref"]> {
|
||||
if (typeof listener.unref == "function") {
|
||||
return listener.unref(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
||||
|
||||
export function unrefTimer(
|
||||
...args: Parameters<typeof Deno.unrefTimer>
|
||||
): ReturnType<typeof Deno.unrefTimer> {
|
||||
if (typeof Deno.unrefTimer == "function") {
|
||||
return Deno.unrefTimer(...args);
|
||||
} else {
|
||||
throw new TypeError("Requires --unstable");
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import { assertEquals } from "./testing/asserts.ts";
|
||||
|
||||
Deno.test({
|
||||
name: "_deno_unstable.ts complies with --unstable if type checked",
|
||||
async fn() {
|
||||
const denoUnstableUrl = new URL("_deno_unstable.ts", import.meta.url);
|
||||
const denoUnstableCheckedUrl = new URL(
|
||||
"_deno_unstable_checked.ts",
|
||||
import.meta.url,
|
||||
);
|
||||
const code = await Deno.readTextFile(denoUnstableUrl);
|
||||
const checkedCode = `// AUTOGENERATED\n${code.replace("@ts-nocheck ", "")}`;
|
||||
try {
|
||||
await Deno.writeTextFile(denoUnstableCheckedUrl, checkedCode);
|
||||
const { code } = await Deno.spawn(Deno.execPath(), {
|
||||
args: [
|
||||
"run",
|
||||
"--quiet",
|
||||
"--unstable",
|
||||
denoUnstableCheckedUrl.href,
|
||||
],
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
});
|
||||
assertEquals(code, 0);
|
||||
} finally {
|
||||
// TODO(nayeemrmn): Uncomment (https://github.com/denoland/deno_std/pull/1819#issuecomment-1011136991).
|
||||
// await Deno.remove(denoUnstableCheckedUrl, {}).catch(() => {});
|
||||
}
|
||||
},
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// @ts-nocheck Bypass static errors for missing --unstable.
|
||||
// This module is browser compatible.
|
||||
import { unrefTimer } from "../_deno_unstable.ts";
|
||||
|
||||
export interface DelayOptions {
|
||||
signal?: AbortSignal;
|
||||
@ -26,7 +26,7 @@ export function delay(ms: number, options: DelayOptions = {}): Promise<void> {
|
||||
const i = setTimeout(done, ms);
|
||||
signal?.addEventListener("abort", abort, { once: true });
|
||||
if (persistent === false) {
|
||||
unrefTimer(i);
|
||||
Deno.unrefTimer(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
15
fs/copy.ts
15
fs/copy.ts
@ -1,5 +1,6 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
// @ts-nocheck Bypass static errors for missing --unstable.
|
||||
|
||||
import * as path from "../path/mod.ts";
|
||||
import { ensureDir, ensureDirSync } from "./ensure_dir.ts";
|
||||
import { getFileInfoType, isSubdir, toPathString } from "./_util.ts";
|
||||
@ -94,7 +95,7 @@ async function copyFile(
|
||||
const statInfo = await Deno.stat(src);
|
||||
assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
|
||||
assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
|
||||
await DenoUnstable.utime(dest, statInfo.atime, statInfo.mtime);
|
||||
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
|
||||
}
|
||||
}
|
||||
/* copy file to dest synchronously */
|
||||
@ -109,7 +110,7 @@ function copyFileSync(
|
||||
const statInfo = Deno.statSync(src);
|
||||
assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
|
||||
assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
|
||||
DenoUnstable.utimeSync(dest, statInfo.atime, statInfo.mtime);
|
||||
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +134,7 @@ async function copySymLink(
|
||||
const statInfo = await Deno.lstat(src);
|
||||
assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
|
||||
assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
|
||||
await DenoUnstable.utime(dest, statInfo.atime, statInfo.mtime);
|
||||
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,7 +159,7 @@ function copySymlinkSync(
|
||||
const statInfo = Deno.lstatSync(src);
|
||||
assert(statInfo.atime instanceof Date, `statInfo.atime is unavailable`);
|
||||
assert(statInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
|
||||
DenoUnstable.utimeSync(dest, statInfo.atime, statInfo.mtime);
|
||||
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +182,7 @@ async function copyDir(
|
||||
const srcStatInfo = await Deno.stat(src);
|
||||
assert(srcStatInfo.atime instanceof Date, `statInfo.atime is unavailable`);
|
||||
assert(srcStatInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
|
||||
await DenoUnstable.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
|
||||
await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
|
||||
}
|
||||
|
||||
src = toPathString(src);
|
||||
@ -219,7 +220,7 @@ function copyDirSync(
|
||||
const srcStatInfo = Deno.statSync(src);
|
||||
assert(srcStatInfo.atime instanceof Date, `statInfo.atime is unavailable`);
|
||||
assert(srcStatInfo.mtime instanceof Date, `statInfo.mtime is unavailable`);
|
||||
DenoUnstable.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
|
||||
Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
|
||||
}
|
||||
|
||||
src = toPathString(src);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
import { type CallbackWithError, makeCallback } from "./_fs_common.ts";
|
||||
import { fs, os } from "../internal_binding/constants.ts";
|
||||
import { getValidatedPath, getValidMode } from "../internal/fs/utils.mjs";
|
||||
@ -23,7 +23,7 @@ export function access(
|
||||
Deno.lstat(path).then((info) => {
|
||||
const m = +mode || 0;
|
||||
let fileMode = +info.mode! || 0;
|
||||
if (Deno.build.os !== "windows" && info.uid === DenoUnstable.getUid()) {
|
||||
if (Deno.build.os !== "windows" && info.uid === Deno.getUid()) {
|
||||
// If the user is the owner of the file, then use the owner bits of
|
||||
// the file permission
|
||||
fileMode >>= 6;
|
||||
@ -72,7 +72,7 @@ export function accessSync(path: string | Buffer | URL, mode?: number) {
|
||||
const info = Deno.lstatSync(path.toString());
|
||||
const m = +mode! || 0;
|
||||
let fileMode = +info.mode! || 0;
|
||||
if (Deno.build.os !== "windows" && info.uid === DenoUnstable.getUid()) {
|
||||
if (Deno.build.os !== "windows" && info.uid === Deno.getUid()) {
|
||||
// If the user is the owner of the file, then use the owner bits of
|
||||
// the file permission
|
||||
fileMode >>= 6;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
import type { CallbackWithError } from "./_fs_common.ts";
|
||||
|
||||
function getValidTime(
|
||||
@ -35,7 +35,7 @@ export function futimes(
|
||||
atime = getValidTime(atime, "atime");
|
||||
mtime = getValidTime(mtime, "mtime");
|
||||
|
||||
DenoUnstable.futime(fd, atime, mtime).then(() => callback(null), callback);
|
||||
Deno.futime(fd, atime, mtime).then(() => callback(null), callback);
|
||||
}
|
||||
|
||||
export function futimesSync(
|
||||
@ -46,5 +46,5 @@ export function futimesSync(
|
||||
atime = getValidTime(atime, "atime");
|
||||
mtime = getValidTime(mtime, "mtime");
|
||||
|
||||
DenoUnstable.futimeSync(fd, atime, mtime);
|
||||
Deno.futimeSync(fd, atime, mtime);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
import type { CallbackWithError } from "./_fs_common.ts";
|
||||
import { fromFileUrl } from "../path.ts";
|
||||
import { promisify } from "../internal/util.mjs";
|
||||
@ -39,7 +39,7 @@ export function utimes(
|
||||
atime = getValidTime(atime, "atime");
|
||||
mtime = getValidTime(mtime, "mtime");
|
||||
|
||||
DenoUnstable.utime(path, atime, mtime).then(() => callback(null), callback);
|
||||
Deno.utime(path, atime, mtime).then(() => callback(null), callback);
|
||||
}
|
||||
|
||||
export const utimesPromise = promisify(utimes) as (
|
||||
@ -57,5 +57,5 @@ export function utimesSync(
|
||||
atime = getValidTime(atime, "atime");
|
||||
mtime = getValidTime(mtime, "mtime");
|
||||
|
||||
DenoUnstable.utimeSync(path, atime, mtime);
|
||||
Deno.utimeSync(path, atime, mtime);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
import { Buffer } from "../buffer.ts";
|
||||
import {
|
||||
clearLine,
|
||||
@ -138,7 +138,7 @@ Object.defineProperty(stdin, "isTTY", {
|
||||
});
|
||||
stdin._isRawMode = false;
|
||||
stdin.setRawMode = (enable) => {
|
||||
DenoUnstable.setRaw?.(Deno.stdin?.rid, enable);
|
||||
Deno.setRaw?.(Deno.stdin?.rid, enable);
|
||||
stdin._isRawMode = enable;
|
||||
return stdin;
|
||||
};
|
||||
|
@ -21,13 +21,12 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
import { inspect } from "./util.ts";
|
||||
import { stripColor as removeColors } from "../fmt/colors.ts";
|
||||
|
||||
function getConsoleWidth(): number {
|
||||
try {
|
||||
return DenoUnstable.consoleSize(Deno.stderr.rid).columns;
|
||||
return Deno.consoleSize(Deno.stderr.rid).columns;
|
||||
} catch {
|
||||
return 80;
|
||||
}
|
||||
|
10
node/http.ts
10
node/http.ts
@ -1,5 +1,5 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
|
||||
import { type Deferred, deferred } from "../async/deferred.ts";
|
||||
import { core } from "./_core.ts";
|
||||
import { _normalizeArgs, ListenOptions, Socket } from "./net.ts";
|
||||
@ -152,7 +152,7 @@ class ClientRequest extends NodeWritable {
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
_createCustomClient(): Promise<DenoUnstable.HttpClient | undefined> {
|
||||
_createCustomClient(): Promise<Deno.HttpClient | undefined> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@ -553,7 +553,7 @@ class ServerImpl extends EventEmitter {
|
||||
const handler = (request: Request) => {
|
||||
const req = new IncomingMessageForServer(request);
|
||||
if (req.upgrade && this.listenerCount("upgrade") > 0) {
|
||||
const [conn, head] = DenoUnstable.upgradeHttpRaw(request) as [
|
||||
const [conn, head] = Deno.upgradeHttpRaw(request) as [
|
||||
Deno.Conn,
|
||||
Uint8Array,
|
||||
];
|
||||
@ -573,9 +573,9 @@ class ServerImpl extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
this.#ac = ac;
|
||||
DenoUnstable.serve(
|
||||
Deno.serve(
|
||||
{
|
||||
handler: handler as DenoUnstable.ServeHandler,
|
||||
handler: handler as Deno.ServeHandler,
|
||||
...this.#addr,
|
||||
signal: ac.signal,
|
||||
// @ts-ignore Might be any without `--unstable` flag
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
import { notImplemented } from "./_utils.ts";
|
||||
import { urlToHttpOptions } from "./internal/url.ts";
|
||||
import {
|
||||
@ -59,13 +58,13 @@ export const globalAgent = undefined;
|
||||
class HttpsClientRequest extends ClientRequest {
|
||||
override defaultProtocol = "https:";
|
||||
override async _createCustomClient(): Promise<
|
||||
DenoUnstable.HttpClient | undefined
|
||||
Deno.HttpClient | undefined
|
||||
> {
|
||||
if (caCerts === null) {
|
||||
return undefined;
|
||||
}
|
||||
if (caCerts !== undefined) {
|
||||
return DenoUnstable.createHttpClient({ caCerts });
|
||||
return Deno.createHttpClient({ caCerts });
|
||||
}
|
||||
const status = await Deno.permissions.query({
|
||||
name: "env",
|
||||
@ -82,7 +81,7 @@ class HttpsClientRequest extends ClientRequest {
|
||||
}
|
||||
const caCert = await Deno.readTextFile(certFilename);
|
||||
caCerts = [caCert];
|
||||
return DenoUnstable.createHttpClient({ caCerts });
|
||||
return Deno.createHttpClient({ caCerts });
|
||||
}
|
||||
|
||||
override _createSocket(): Socket {
|
||||
|
@ -39,7 +39,6 @@ import {
|
||||
} from "./_listen.ts";
|
||||
import { isWindows } from "../../_util/os.ts";
|
||||
import { fs } from "./constants.ts";
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
export enum socketType {
|
||||
SOCKET,
|
||||
@ -133,12 +132,12 @@ export class Pipe extends ConnectionWrap {
|
||||
notImplemented("Pipe.prototype.connect - Windows");
|
||||
}
|
||||
|
||||
const connectOptions: DenoUnstable.UnixConnectOptions = {
|
||||
const connectOptions: Deno.UnixConnectOptions = {
|
||||
path: address,
|
||||
transport: "unix",
|
||||
};
|
||||
|
||||
DenoUnstable.connect(connectOptions).then(
|
||||
Deno.connect(connectOptions).then(
|
||||
(conn: Deno.UnixConn) => {
|
||||
const localAddr = conn.localAddr as Deno.UnixAddr;
|
||||
|
||||
@ -197,7 +196,7 @@ export class Pipe extends ConnectionWrap {
|
||||
let listener;
|
||||
|
||||
try {
|
||||
listener = DenoUnstable.listen(listenOptions);
|
||||
listener = Deno.listen(listenOptions);
|
||||
} catch (e) {
|
||||
if (e instanceof Deno.errors.AddrInUse) {
|
||||
return codeMap.get("EADDRINUSE")!;
|
||||
@ -220,13 +219,13 @@ export class Pipe extends ConnectionWrap {
|
||||
|
||||
override ref() {
|
||||
if (this.#listener) {
|
||||
DenoUnstable.ListenerRef(this.#listener);
|
||||
this.#listener.ref();
|
||||
}
|
||||
}
|
||||
|
||||
override unref() {
|
||||
if (this.#listener) {
|
||||
DenoUnstable.ListenerUnref(this.#listener);
|
||||
this.#listener.unref();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ import {
|
||||
INITIAL_ACCEPT_BACKOFF_DELAY,
|
||||
MAX_ACCEPT_BACKOFF_DELAY,
|
||||
} from "./_listen.ts";
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
/** The type of TCP socket. */
|
||||
enum socketType {
|
||||
@ -228,13 +227,13 @@ export class TCP extends ConnectionWrap {
|
||||
|
||||
override ref() {
|
||||
if (this.#listener) {
|
||||
DenoUnstable.ListenerRef(this.#listener);
|
||||
this.#listener.ref();
|
||||
}
|
||||
}
|
||||
|
||||
override unref() {
|
||||
if (this.#listener) {
|
||||
DenoUnstable.ListenerUnref(this.#listener);
|
||||
this.#listener.unref();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ import { notImplemented } from "../_utils.ts";
|
||||
import { Buffer } from "../buffer.ts";
|
||||
import type { ErrnoException } from "../internal/errors.ts";
|
||||
import { isIP } from "../internal/net.ts";
|
||||
import * as DenoUnstable from "../../_deno_unstable.ts";
|
||||
|
||||
import { isLinux, isWindows } from "../../_util/os.ts";
|
||||
|
||||
type MessageType = string | Uint8Array | Buffer | DataView;
|
||||
@ -63,7 +63,7 @@ export class UDP extends HandleWrap {
|
||||
#remoteFamily?: string;
|
||||
#remotePort?: number;
|
||||
|
||||
#listener?: DenoUnstable.DatagramConn;
|
||||
#listener?: Deno.DatagramConn;
|
||||
#receiving = false;
|
||||
|
||||
#recvBufferSize = UDP_DGRAM_MAXSIZE;
|
||||
@ -316,7 +316,7 @@ export class UDP extends HandleWrap {
|
||||
let listener;
|
||||
|
||||
try {
|
||||
listener = DenoUnstable.listenDatagram(listenOptions);
|
||||
listener = Deno.listenDatagram(listenOptions);
|
||||
} catch (e) {
|
||||
if (e instanceof Deno.errors.AddrInUse) {
|
||||
return codeMap.get("EADDRINUSE")!;
|
||||
|
14
node/os.ts
14
node/os.ts
@ -19,7 +19,7 @@
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
|
||||
import { notImplemented } from "./_utils.ts";
|
||||
import { validateIntegerRange } from "./_utils.ts";
|
||||
import { EOL as fsEOL } from "../fs/eol.ts";
|
||||
@ -148,7 +148,7 @@ export function endianness(): "BE" | "LE" {
|
||||
|
||||
/** Return free memory amount */
|
||||
export function freemem(): number {
|
||||
return DenoUnstable.systemMemoryInfo().free;
|
||||
return Deno.systemMemoryInfo().free;
|
||||
}
|
||||
|
||||
/** Not yet implemented */
|
||||
@ -175,7 +175,7 @@ export function homedir(): string | null {
|
||||
|
||||
/** Returns the host name of the operating system as a string. */
|
||||
export function hostname(): string {
|
||||
return DenoUnstable.hostname();
|
||||
return Deno.hostname();
|
||||
}
|
||||
|
||||
/** Returns an array containing the 1, 5, and 15 minute load averages */
|
||||
@ -183,7 +183,7 @@ export function loadavg(): number[] {
|
||||
if (isWindows) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
return DenoUnstable.loadavg();
|
||||
return Deno.loadavg();
|
||||
}
|
||||
|
||||
/** Returns an object containing network interfaces that have been assigned a network address.
|
||||
@ -191,7 +191,7 @@ export function loadavg(): number[] {
|
||||
export function networkInterfaces(): NetworkInterfaces {
|
||||
const interfaces: NetworkInterfaces = {};
|
||||
for (
|
||||
const { name, address, netmask, family, mac, scopeid, cidr } of DenoUnstable
|
||||
const { name, address, netmask, family, mac, scopeid, cidr } of Deno
|
||||
.networkInterfaces()
|
||||
) {
|
||||
const addresses = interfaces[name] ||= [];
|
||||
@ -227,7 +227,7 @@ export function platform(): string {
|
||||
|
||||
/** Returns the operating system as a string */
|
||||
export function release(): string {
|
||||
return DenoUnstable.osRelease();
|
||||
return Deno.osRelease();
|
||||
}
|
||||
|
||||
/** Not yet implemented */
|
||||
@ -273,7 +273,7 @@ export function tmpdir(): string | null {
|
||||
|
||||
/** Return total physical memory amount */
|
||||
export function totalmem(): number {
|
||||
return DenoUnstable.systemMemoryInfo().total;
|
||||
return Deno.systemMemoryInfo().total;
|
||||
}
|
||||
|
||||
/** Returns operating system type (i.e. 'Windows_NT', 'Linux', 'Darwin') */
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
|
||||
import { warnNotImplemented } from "./_utils.ts";
|
||||
import { EventEmitter } from "./events.ts";
|
||||
import { validateString } from "./internal/validators.mjs";
|
||||
@ -384,7 +384,7 @@ class Process extends EventEmitter {
|
||||
if (event === "SIGBREAK" && Deno.build.os !== "windows") {
|
||||
// Ignores SIGBREAK if the platform is not windows.
|
||||
} else {
|
||||
DenoUnstable.addSignalListener(event as Deno.Signal, listener);
|
||||
Deno.addSignalListener(event as Deno.Signal, listener);
|
||||
}
|
||||
} else {
|
||||
super.on(event, listener);
|
||||
@ -408,7 +408,7 @@ class Process extends EventEmitter {
|
||||
if (event === "SIGBREAK" && Deno.build.os !== "windows") {
|
||||
// Ignores SIGBREAK if the platform is not windows.
|
||||
} else {
|
||||
DenoUnstable.removeSignalListener(event as Deno.Signal, listener);
|
||||
Deno.removeSignalListener(event as Deno.Signal, listener);
|
||||
}
|
||||
} else {
|
||||
super.off(event, listener);
|
||||
@ -453,7 +453,7 @@ class Process extends EventEmitter {
|
||||
if (event === "SIGBREAK" && Deno.build.os !== "windows") {
|
||||
// Ignores SIGBREAK if the platform is not windows.
|
||||
} else {
|
||||
DenoUnstable.addSignalListener(event as Deno.Signal, listener);
|
||||
Deno.addSignalListener(event as Deno.Signal, listener);
|
||||
}
|
||||
} else {
|
||||
super.prependListener(event, listener);
|
||||
|
@ -27,7 +27,6 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import * as DenoUnstable from "../_deno_unstable.ts";
|
||||
import { relative, resolve } from "../path/mod.ts";
|
||||
|
||||
const CLOCKID_REALTIME = 0;
|
||||
@ -753,7 +752,7 @@ export default class Context {
|
||||
mtim = BigInt(Date.now() * 1e6);
|
||||
}
|
||||
|
||||
DenoUnstable.utimeSync(entry.path!, Number(atim), Number(mtim));
|
||||
Deno.utimeSync(entry.path!, Number(atim), Number(mtim));
|
||||
|
||||
return ERRNO_SUCCESS;
|
||||
}),
|
||||
@ -1247,7 +1246,7 @@ export default class Context {
|
||||
mtim = BigInt(Date.now()) * BigInt(1e6);
|
||||
}
|
||||
|
||||
DenoUnstable.utimeSync(path, Number(atim), Number(mtim));
|
||||
Deno.utimeSync(path, Number(atim), Number(mtim));
|
||||
|
||||
return ERRNO_SUCCESS;
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user