mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
Merge remote-tracking branch 'upstream/main' into lsp-jupyter-cell-continuity
This commit is contained in:
commit
13fd7a246c
55 changed files with 616 additions and 578 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1146,7 +1146,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno"
|
||||
version = "2.0.0-rc.1"
|
||||
version = "2.0.0-rc.2"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"async-trait",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[package]
|
||||
name = "deno"
|
||||
version = "2.0.0-rc.1"
|
||||
version = "2.0.0-rc.2"
|
||||
authors.workspace = true
|
||||
default-run = "deno"
|
||||
edition.workspace = true
|
||||
|
|
|
@ -364,13 +364,6 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> {
|
|||
"Run again with `--unstable-cron` flag to enable this API.",
|
||||
),
|
||||
];
|
||||
} else if msg.contains("createHttpClient is not a function") {
|
||||
return vec![
|
||||
FixSuggestion::info("Deno.createHttpClient() is an unstable API."),
|
||||
FixSuggestion::hint(
|
||||
"Run again with `--unstable-http` flag to enable this API.",
|
||||
),
|
||||
];
|
||||
} else if msg.contains("WebSocketStream is not defined") {
|
||||
return vec![
|
||||
FixSuggestion::info("new WebSocketStream() is an unstable API."),
|
||||
|
|
|
@ -32,9 +32,7 @@ delete Object.prototype.__proto__;
|
|||
/** @type {ReadonlySet<string>} */
|
||||
const unstableDenoProps = new Set([
|
||||
"AtomicOperation",
|
||||
"CreateHttpClientOptions",
|
||||
"DatagramConn",
|
||||
"HttpClient",
|
||||
"Kv",
|
||||
"KvListIterator",
|
||||
"KvU64",
|
||||
|
@ -44,7 +42,6 @@ delete Object.prototype.__proto__;
|
|||
"UnsafeFnPointer",
|
||||
"UnixConnectOptions",
|
||||
"UnixListenOptions",
|
||||
"createHttpClient",
|
||||
"dlopen",
|
||||
"listen",
|
||||
"listenDatagram",
|
||||
|
|
122
cli/tsc/dts/lib.deno.ns.d.ts
vendored
122
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -6087,4 +6087,126 @@ declare namespace Deno {
|
|||
filename: string | URL,
|
||||
symbols: S,
|
||||
): DynamicLibrary<S>;
|
||||
|
||||
/**
|
||||
* A custom `HttpClient` for use with {@linkcode fetch} function. This is
|
||||
* designed to allow custom certificates or proxies to be used with `fetch()`.
|
||||
*
|
||||
* @example ```ts
|
||||
* const caCert = await Deno.readTextFile("./ca.pem");
|
||||
* const client = Deno.createHttpClient({ caCerts: [ caCert ] });
|
||||
* const req = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @category Fetch
|
||||
*/
|
||||
export interface HttpClient extends Disposable {
|
||||
/** Close the HTTP client. */
|
||||
close(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options used when creating a {@linkcode Deno.HttpClient}.
|
||||
*
|
||||
* @category Fetch
|
||||
*/
|
||||
export interface CreateHttpClientOptions {
|
||||
/** A list of root certificates that will be used in addition to the
|
||||
* default root certificates to verify the peer's certificate.
|
||||
*
|
||||
* Must be in PEM format. */
|
||||
caCerts?: string[];
|
||||
/** A HTTP proxy to use for new connections. */
|
||||
proxy?: Proxy;
|
||||
/** Sets the maximum number of idle connections per host allowed in the pool. */
|
||||
poolMaxIdlePerHost?: number;
|
||||
/** Set an optional timeout for idle sockets being kept-alive.
|
||||
* Set to false to disable the timeout. */
|
||||
poolIdleTimeout?: number | false;
|
||||
/**
|
||||
* Whether HTTP/1.1 is allowed or not.
|
||||
*
|
||||
* @default {true}
|
||||
*/
|
||||
http1?: boolean;
|
||||
/** Whether HTTP/2 is allowed or not.
|
||||
*
|
||||
* @default {true}
|
||||
*/
|
||||
http2?: boolean;
|
||||
/** Whether setting the host header is allowed or not.
|
||||
*
|
||||
* @default {false}
|
||||
*/
|
||||
allowHost?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The definition of a proxy when specifying
|
||||
* {@linkcode Deno.CreateHttpClientOptions}.
|
||||
*
|
||||
* @category Fetch
|
||||
*/
|
||||
export interface Proxy {
|
||||
/** The string URL of the proxy server to use. */
|
||||
url: string;
|
||||
/** The basic auth credentials to be used against the proxy server. */
|
||||
basicAuth?: BasicAuth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic authentication credentials to be used with a {@linkcode Deno.Proxy}
|
||||
* server when specifying {@linkcode Deno.CreateHttpClientOptions}.
|
||||
*
|
||||
* @category Fetch
|
||||
*/
|
||||
export interface BasicAuth {
|
||||
/** The username to be used against the proxy server. */
|
||||
username: string;
|
||||
/** The password to be used against the proxy server. */
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** Create a custom HttpClient to use with {@linkcode fetch}. This is an
|
||||
* extension of the web platform Fetch API which allows Deno to use custom
|
||||
* TLS certificates and connect via a proxy while using `fetch()`.
|
||||
*
|
||||
* @example ```ts
|
||||
* const caCert = await Deno.readTextFile("./ca.pem");
|
||||
* const client = Deno.createHttpClient({ caCerts: [ caCert ] });
|
||||
* const response = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @example ```ts
|
||||
* const client = Deno.createHttpClient({
|
||||
* proxy: { url: "http://myproxy.com:8080" }
|
||||
* });
|
||||
* const response = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @category Fetch
|
||||
*/
|
||||
export function createHttpClient(
|
||||
options: CreateHttpClientOptions,
|
||||
): HttpClient;
|
||||
|
||||
/**
|
||||
* Create a custom HttpClient to use with {@linkcode fetch}. This is an
|
||||
* extension of the web platform Fetch API which allows Deno to use custom
|
||||
* TLS certificates and connect via a proxy while using `fetch()`.
|
||||
*
|
||||
* @example ```ts
|
||||
* const caCert = await Deno.readTextFile("./ca.pem");
|
||||
* // Load a client key and certificate that we'll use to connect
|
||||
* const key = await Deno.readTextFile("./key.key");
|
||||
* const cert = await Deno.readTextFile("./cert.crt");
|
||||
* const client = Deno.createHttpClient({ caCerts: [ caCert ], key, cert });
|
||||
* const response = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @category Fetch
|
||||
*/
|
||||
export function createHttpClient(
|
||||
options: CreateHttpClientOptions & TlsCertifiedKeyPem,
|
||||
): HttpClient;
|
||||
}
|
||||
|
|
135
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
135
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
|
@ -36,141 +36,6 @@ declare namespace Deno {
|
|||
present(): void;
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* A custom `HttpClient` for use with {@linkcode fetch} function. This is
|
||||
* designed to allow custom certificates or proxies to be used with `fetch()`.
|
||||
*
|
||||
* @example ```ts
|
||||
* const caCert = await Deno.readTextFile("./ca.pem");
|
||||
* const client = Deno.createHttpClient({ caCerts: [ caCert ] });
|
||||
* const req = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @category Fetch
|
||||
* @experimental
|
||||
*/
|
||||
export interface HttpClient extends Disposable {
|
||||
/** Close the HTTP client. */
|
||||
close(): void;
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* The options used when creating a {@linkcode Deno.HttpClient}.
|
||||
*
|
||||
* @category Fetch
|
||||
* @experimental
|
||||
*/
|
||||
export interface CreateHttpClientOptions {
|
||||
/** A list of root certificates that will be used in addition to the
|
||||
* default root certificates to verify the peer's certificate.
|
||||
*
|
||||
* Must be in PEM format. */
|
||||
caCerts?: string[];
|
||||
/** A HTTP proxy to use for new connections. */
|
||||
proxy?: Proxy;
|
||||
/** Sets the maximum number of idle connections per host allowed in the pool. */
|
||||
poolMaxIdlePerHost?: number;
|
||||
/** Set an optional timeout for idle sockets being kept-alive.
|
||||
* Set to false to disable the timeout. */
|
||||
poolIdleTimeout?: number | false;
|
||||
/**
|
||||
* Whether HTTP/1.1 is allowed or not.
|
||||
*
|
||||
* @default {true}
|
||||
*/
|
||||
http1?: boolean;
|
||||
/** Whether HTTP/2 is allowed or not.
|
||||
*
|
||||
* @default {true}
|
||||
*/
|
||||
http2?: boolean;
|
||||
/** Whether setting the host header is allowed or not.
|
||||
*
|
||||
* @default {false}
|
||||
*/
|
||||
allowHost?: boolean;
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* The definition of a proxy when specifying
|
||||
* {@linkcode Deno.CreateHttpClientOptions}.
|
||||
*
|
||||
* @category Fetch
|
||||
* @experimental
|
||||
*/
|
||||
export interface Proxy {
|
||||
/** The string URL of the proxy server to use. */
|
||||
url: string;
|
||||
/** The basic auth credentials to be used against the proxy server. */
|
||||
basicAuth?: BasicAuth;
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* Basic authentication credentials to be used with a {@linkcode Deno.Proxy}
|
||||
* server when specifying {@linkcode Deno.CreateHttpClientOptions}.
|
||||
*
|
||||
* @category Fetch
|
||||
* @experimental
|
||||
*/
|
||||
export interface BasicAuth {
|
||||
/** The username to be used against the proxy server. */
|
||||
username: string;
|
||||
/** The password to be used against the proxy server. */
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* Create a custom HttpClient to use with {@linkcode fetch}. This is an
|
||||
* extension of the web platform Fetch API which allows Deno to use custom
|
||||
* TLS certificates and connect via a proxy while using `fetch()`.
|
||||
*
|
||||
* @example ```ts
|
||||
* const caCert = await Deno.readTextFile("./ca.pem");
|
||||
* const client = Deno.createHttpClient({ caCerts: [ caCert ] });
|
||||
* const response = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @example ```ts
|
||||
* const client = Deno.createHttpClient({
|
||||
* proxy: { url: "http://myproxy.com:8080" }
|
||||
* });
|
||||
* const response = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @category Fetch
|
||||
* @experimental
|
||||
*/
|
||||
export function createHttpClient(
|
||||
options: CreateHttpClientOptions,
|
||||
): HttpClient;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* Create a custom HttpClient to use with {@linkcode fetch}. This is an
|
||||
* extension of the web platform Fetch API which allows Deno to use custom
|
||||
* TLS certificates and connect via a proxy while using `fetch()`.
|
||||
*
|
||||
* @example ```ts
|
||||
* const caCert = await Deno.readTextFile("./ca.pem");
|
||||
* // Load a client key and certificate that we'll use to connect
|
||||
* const key = await Deno.readTextFile("./key.key");
|
||||
* const cert = await Deno.readTextFile("./cert.crt");
|
||||
* const client = Deno.createHttpClient({ caCerts: [ caCert ], key, cert });
|
||||
* const response = await fetch("https://myserver.com", { client });
|
||||
* ```
|
||||
*
|
||||
* @category Fetch
|
||||
* @experimental
|
||||
*/
|
||||
export function createHttpClient(
|
||||
options: CreateHttpClientOptions & TlsCertifiedKeyPem,
|
||||
): HttpClient;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* Represents membership of a IPv4 multicast group.
|
||||
|
|
15
cli/tsc/dts/lib.deno_webgpu.d.ts
vendored
15
cli/tsc/dts/lib.deno_webgpu.d.ts
vendored
|
@ -600,16 +600,10 @@ declare interface GPUPipelineErrorInit {
|
|||
reason: GPUPipelineErrorReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @category GPU
|
||||
* @
|
||||
*/
|
||||
/** @category GPU */
|
||||
declare type GPUPipelineErrorReason = "validation" | "internal";
|
||||
|
||||
/**
|
||||
* @category GPU
|
||||
* @
|
||||
*/
|
||||
/** @category GPU */
|
||||
declare class GPUShaderModule implements GPUObjectBase {
|
||||
label: string;
|
||||
}
|
||||
|
@ -1150,10 +1144,7 @@ declare interface GPURenderPassColorAttachment {
|
|||
storeOp: GPUStoreOp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @category GPU
|
||||
* @
|
||||
*/
|
||||
/** @category GPU */
|
||||
declare interface GPURenderPassDepthStencilAttachment {
|
||||
view: GPUTextureView;
|
||||
|
||||
|
|
|
@ -90,13 +90,6 @@ static USE_WRITEV: Lazy<bool> = Lazy::new(|| {
|
|||
false
|
||||
});
|
||||
|
||||
// NOTE(bartlomieju): currently we don't have any unstable HTTP features,
|
||||
// but let's keep this const here, because:
|
||||
// a) we still need to support `--unstable-http` flag to not break user's CLI;
|
||||
// b) we might add more unstable features in the future.
|
||||
#[allow(dead_code)]
|
||||
pub const UNSTABLE_FEATURE_NAME: &str = "http";
|
||||
|
||||
/// All HTTP/2 connections start with this byte string.
|
||||
///
|
||||
/// In HTTP/2, each endpoint is required to send a connection preface as a final confirmation
|
||||
|
|
|
@ -442,17 +442,12 @@ deno_core::extension!(deno_node,
|
|||
"_fs/_fs_write.mjs",
|
||||
"_fs/_fs_writeFile.ts",
|
||||
"_fs/_fs_writev.mjs",
|
||||
"_http_agent.mjs",
|
||||
"_http_common.ts",
|
||||
"_http_outgoing.ts",
|
||||
"_next_tick.ts",
|
||||
"_process/exiting.ts",
|
||||
"_process/process.ts",
|
||||
"_process/streams.mjs",
|
||||
"_readline.mjs",
|
||||
"_stream.mjs",
|
||||
"_tls_common.ts",
|
||||
"_tls_wrap.ts",
|
||||
"_util/_util_callbackify.js",
|
||||
"_util/asserts.ts",
|
||||
"_util/async.ts",
|
||||
|
@ -547,15 +542,10 @@ deno_core::extension!(deno_node,
|
|||
"internal/streams/add-abort-signal.mjs",
|
||||
"internal/streams/buffer_list.mjs",
|
||||
"internal/streams/destroy.mjs",
|
||||
"internal/streams/duplex.mjs",
|
||||
"internal/streams/end-of-stream.mjs",
|
||||
"internal/streams/lazy_transform.mjs",
|
||||
"internal/streams/passthrough.mjs",
|
||||
"internal/streams/readable.mjs",
|
||||
"internal/streams/state.mjs",
|
||||
"internal/streams/transform.mjs",
|
||||
"internal/streams/utils.mjs",
|
||||
"internal/streams/writable.mjs",
|
||||
"internal/test/binding.ts",
|
||||
"internal/timers.mjs",
|
||||
"internal/url.ts",
|
||||
|
@ -576,6 +566,17 @@ deno_core::extension!(deno_node,
|
|||
"path/mod.ts",
|
||||
"path/separator.ts",
|
||||
"readline/promises.ts",
|
||||
"node:_http_agent" = "_http_agent.mjs",
|
||||
"node:_http_common" = "_http_common.ts",
|
||||
"node:_http_outgoing" = "_http_outgoing.ts",
|
||||
"node:_http_server" = "_http_server.ts",
|
||||
"node:_stream_duplex" = "internal/streams/duplex.mjs",
|
||||
"node:_stream_passthrough" = "internal/streams/passthrough.mjs",
|
||||
"node:_stream_readable" = "internal/streams/readable.mjs",
|
||||
"node:_stream_transform" = "internal/streams/transform.mjs",
|
||||
"node:_stream_writable" = "internal/streams/writable.mjs",
|
||||
"node:_tls_common" = "_tls_common.ts",
|
||||
"node:_tls_wrap" = "_tls_wrap.ts",
|
||||
"node:assert" = "assert.ts",
|
||||
"node:assert/strict" = "assert/strict.ts",
|
||||
"node:async_hooks" = "async_hooks.ts",
|
||||
|
|
|
@ -67,13 +67,17 @@ const {
|
|||
|
||||
import { nodeGlobals } from "ext:deno_node/00_globals.js";
|
||||
|
||||
import _httpAgent from "ext:deno_node/_http_agent.mjs";
|
||||
import _httpOutgoing from "ext:deno_node/_http_outgoing.ts";
|
||||
import _streamDuplex from "ext:deno_node/internal/streams/duplex.mjs";
|
||||
import _streamPassthrough from "ext:deno_node/internal/streams/passthrough.mjs";
|
||||
import _streamReadable from "ext:deno_node/internal/streams/readable.mjs";
|
||||
import _streamTransform from "ext:deno_node/internal/streams/transform.mjs";
|
||||
import _streamWritable from "ext:deno_node/internal/streams/writable.mjs";
|
||||
import _httpAgent from "node:_http_agent";
|
||||
import _httpCommon from "node:_http_common";
|
||||
import _httpOutgoing from "node:_http_outgoing";
|
||||
import _httpServer from "node:_http_server";
|
||||
import _streamDuplex from "node:_stream_duplex";
|
||||
import _streamPassthrough from "node:_stream_passthrough";
|
||||
import _streamReadable from "node:_stream_readable";
|
||||
import _streamTransform from "node:_stream_transform";
|
||||
import _streamWritable from "node:_stream_writable";
|
||||
import _tlsCommon from "node:_tls_common";
|
||||
import _tlsWrap from "node:_tls_wrap";
|
||||
import assert from "node:assert";
|
||||
import assertStrict from "node:assert/strict";
|
||||
import asyncHooks from "node:async_hooks";
|
||||
|
@ -163,12 +167,16 @@ const builtinModules = [];
|
|||
function setupBuiltinModules() {
|
||||
const nodeModules = {
|
||||
"_http_agent": _httpAgent,
|
||||
"_http_common": _httpCommon,
|
||||
"_http_outgoing": _httpOutgoing,
|
||||
"_http_server": _httpServer,
|
||||
"_stream_duplex": _streamDuplex,
|
||||
"_stream_passthrough": _streamPassthrough,
|
||||
"_stream_readable": _streamReadable,
|
||||
"_stream_transform": _streamTransform,
|
||||
"_stream_writable": _streamWritable,
|
||||
"_tls_common": _tlsCommon,
|
||||
"_tls_wrap": _tlsWrap,
|
||||
assert,
|
||||
"assert/strict": assertStrict,
|
||||
"async_hooks": asyncHooks,
|
||||
|
|
|
@ -2,8 +2,53 @@
|
|||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
|
||||
import { primordials } from "ext:core/mod.js";
|
||||
const { RegExpPrototypeTest, SafeRegExp } = primordials;
|
||||
const {
|
||||
RegExpPrototypeTest,
|
||||
SafeRegExp,
|
||||
Symbol,
|
||||
} = primordials;
|
||||
|
||||
export const CRLF = "\r\n";
|
||||
export const kIncomingMessage = Symbol("IncomingMessage");
|
||||
const tokenRegExp = new SafeRegExp(/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/);
|
||||
|
||||
export const methods = [
|
||||
"ACL",
|
||||
"BIND",
|
||||
"CHECKOUT",
|
||||
"CONNECT",
|
||||
"COPY",
|
||||
"DELETE",
|
||||
"GET",
|
||||
"HEAD",
|
||||
"LINK",
|
||||
"LOCK",
|
||||
"M-SEARCH",
|
||||
"MERGE",
|
||||
"MKACTIVITY",
|
||||
"MKCALENDAR",
|
||||
"MKCOL",
|
||||
"MOVE",
|
||||
"NOTIFY",
|
||||
"OPTIONS",
|
||||
"PATCH",
|
||||
"POST",
|
||||
"PROPFIND",
|
||||
"PROPPATCH",
|
||||
"PURGE",
|
||||
"PUT",
|
||||
"REBIND",
|
||||
"REPORT",
|
||||
"SEARCH",
|
||||
"SOURCE",
|
||||
"SUBSCRIBE",
|
||||
"TRACE",
|
||||
"UNBIND",
|
||||
"UNLINK",
|
||||
"UNLOCK",
|
||||
"UNSUBSCRIBE",
|
||||
];
|
||||
|
||||
/**
|
||||
* Verifies that the given val is a valid HTTP token
|
||||
* per the rules defined in RFC 7230
|
||||
|
@ -25,7 +70,21 @@ function checkInvalidHeaderChar(val: string) {
|
|||
}
|
||||
|
||||
export const chunkExpression = new SafeRegExp(/(?:^|\W)chunked(?:$|\W)/i);
|
||||
export const continueExpression = new SafeRegExp(
|
||||
/(?:^|\W)100-continue(?:$|\W)/i,
|
||||
);
|
||||
|
||||
export {
|
||||
checkInvalidHeaderChar as _checkInvalidHeaderChar,
|
||||
checkIsHttpToken as _checkIsHttpToken,
|
||||
};
|
||||
|
||||
export default {
|
||||
_checkInvalidHeaderChar: checkInvalidHeaderChar,
|
||||
_checkIsHttpToken: checkIsHttpToken,
|
||||
chunkExpression,
|
||||
CRLF,
|
||||
continueExpression,
|
||||
kIncomingMessage,
|
||||
methods,
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
_checkInvalidHeaderChar as checkInvalidHeaderChar,
|
||||
_checkIsHttpToken as checkIsHttpToken,
|
||||
chunkExpression as RE_TE_CHUNKED,
|
||||
} from "ext:deno_node/_http_common.ts";
|
||||
} from "node:_http_common";
|
||||
import {
|
||||
defaultTriggerAsyncIdScope,
|
||||
symbols,
|
||||
|
@ -54,6 +54,8 @@ let debug = debuglog("http", (fn) => {
|
|||
|
||||
const HIGH_WATER_MARK = getDefaultHighWaterMark();
|
||||
|
||||
export const kUniqueHeaders = Symbol("kUniqueHeaders");
|
||||
export const kHighWaterMark = Symbol("kHighWaterMark");
|
||||
const kCorked = Symbol("corked");
|
||||
|
||||
const nop = () => {};
|
||||
|
@ -891,6 +893,8 @@ function _onFinish(outmsg: any) {
|
|||
}
|
||||
|
||||
export default {
|
||||
kUniqueHeaders,
|
||||
kHighWaterMark,
|
||||
validateHeaderName,
|
||||
validateHeaderValue,
|
||||
parseUniqueHeadersOption,
|
||||
|
|
136
ext/node/polyfills/_http_server.ts
Normal file
136
ext/node/polyfills/_http_server.ts
Normal file
|
@ -0,0 +1,136 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
export enum STATUS_CODES {
|
||||
/** RFC 7231, 6.2.1 */
|
||||
Continue = 100,
|
||||
/** RFC 7231, 6.2.2 */
|
||||
SwitchingProtocols = 101,
|
||||
/** RFC 2518, 10.1 */
|
||||
Processing = 102,
|
||||
/** RFC 8297 **/
|
||||
EarlyHints = 103,
|
||||
|
||||
/** RFC 7231, 6.3.1 */
|
||||
OK = 200,
|
||||
/** RFC 7231, 6.3.2 */
|
||||
Created = 201,
|
||||
/** RFC 7231, 6.3.3 */
|
||||
Accepted = 202,
|
||||
/** RFC 7231, 6.3.4 */
|
||||
NonAuthoritativeInfo = 203,
|
||||
/** RFC 7231, 6.3.5 */
|
||||
NoContent = 204,
|
||||
/** RFC 7231, 6.3.6 */
|
||||
ResetContent = 205,
|
||||
/** RFC 7233, 4.1 */
|
||||
PartialContent = 206,
|
||||
/** RFC 4918, 11.1 */
|
||||
MultiStatus = 207,
|
||||
/** RFC 5842, 7.1 */
|
||||
AlreadyReported = 208,
|
||||
/** RFC 3229, 10.4.1 */
|
||||
IMUsed = 226,
|
||||
|
||||
/** RFC 7231, 6.4.1 */
|
||||
MultipleChoices = 300,
|
||||
/** RFC 7231, 6.4.2 */
|
||||
MovedPermanently = 301,
|
||||
/** RFC 7231, 6.4.3 */
|
||||
Found = 302,
|
||||
/** RFC 7231, 6.4.4 */
|
||||
SeeOther = 303,
|
||||
/** RFC 7232, 4.1 */
|
||||
NotModified = 304,
|
||||
/** RFC 7231, 6.4.5 */
|
||||
UseProxy = 305,
|
||||
/** RFC 7231, 6.4.7 */
|
||||
TemporaryRedirect = 307,
|
||||
/** RFC 7538, 3 */
|
||||
PermanentRedirect = 308,
|
||||
|
||||
/** RFC 7231, 6.5.1 */
|
||||
BadRequest = 400,
|
||||
/** RFC 7235, 3.1 */
|
||||
Unauthorized = 401,
|
||||
/** RFC 7231, 6.5.2 */
|
||||
PaymentRequired = 402,
|
||||
/** RFC 7231, 6.5.3 */
|
||||
Forbidden = 403,
|
||||
/** RFC 7231, 6.5.4 */
|
||||
NotFound = 404,
|
||||
/** RFC 7231, 6.5.5 */
|
||||
MethodNotAllowed = 405,
|
||||
/** RFC 7231, 6.5.6 */
|
||||
NotAcceptable = 406,
|
||||
/** RFC 7235, 3.2 */
|
||||
ProxyAuthRequired = 407,
|
||||
/** RFC 7231, 6.5.7 */
|
||||
RequestTimeout = 408,
|
||||
/** RFC 7231, 6.5.8 */
|
||||
Conflict = 409,
|
||||
/** RFC 7231, 6.5.9 */
|
||||
Gone = 410,
|
||||
/** RFC 7231, 6.5.10 */
|
||||
LengthRequired = 411,
|
||||
/** RFC 7232, 4.2 */
|
||||
PreconditionFailed = 412,
|
||||
/** RFC 7231, 6.5.11 */
|
||||
RequestEntityTooLarge = 413,
|
||||
/** RFC 7231, 6.5.12 */
|
||||
RequestURITooLong = 414,
|
||||
/** RFC 7231, 6.5.13 */
|
||||
UnsupportedMediaType = 415,
|
||||
/** RFC 7233, 4.4 */
|
||||
RequestedRangeNotSatisfiable = 416,
|
||||
/** RFC 7231, 6.5.14 */
|
||||
ExpectationFailed = 417,
|
||||
/** RFC 7168, 2.3.3 */
|
||||
Teapot = 418,
|
||||
/** RFC 7540, 9.1.2 */
|
||||
MisdirectedRequest = 421,
|
||||
/** RFC 4918, 11.2 */
|
||||
UnprocessableEntity = 422,
|
||||
/** RFC 4918, 11.3 */
|
||||
Locked = 423,
|
||||
/** RFC 4918, 11.4 */
|
||||
FailedDependency = 424,
|
||||
/** RFC 8470, 5.2 */
|
||||
TooEarly = 425,
|
||||
/** RFC 7231, 6.5.15 */
|
||||
UpgradeRequired = 426,
|
||||
/** RFC 6585, 3 */
|
||||
PreconditionRequired = 428,
|
||||
/** RFC 6585, 4 */
|
||||
TooManyRequests = 429,
|
||||
/** RFC 6585, 5 */
|
||||
RequestHeaderFieldsTooLarge = 431,
|
||||
/** RFC 7725, 3 */
|
||||
UnavailableForLegalReasons = 451,
|
||||
|
||||
/** RFC 7231, 6.6.1 */
|
||||
InternalServerError = 500,
|
||||
/** RFC 7231, 6.6.2 */
|
||||
NotImplemented = 501,
|
||||
/** RFC 7231, 6.6.3 */
|
||||
BadGateway = 502,
|
||||
/** RFC 7231, 6.6.4 */
|
||||
ServiceUnavailable = 503,
|
||||
/** RFC 7231, 6.6.5 */
|
||||
GatewayTimeout = 504,
|
||||
/** RFC 7231, 6.6.6 */
|
||||
HTTPVersionNotSupported = 505,
|
||||
/** RFC 2295, 8.1 */
|
||||
VariantAlsoNegotiates = 506,
|
||||
/** RFC 4918, 11.5 */
|
||||
InsufficientStorage = 507,
|
||||
/** RFC 5842, 7.2 */
|
||||
LoopDetected = 508,
|
||||
/** RFC 2774, 7 */
|
||||
NotExtended = 510,
|
||||
/** RFC 6585, 6 */
|
||||
NetworkAuthenticationRequired = 511,
|
||||
}
|
||||
|
||||
export default {
|
||||
STATUS_CODES,
|
||||
};
|
|
@ -5277,6 +5277,7 @@ var require_stream = __commonJS({
|
|||
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
|
||||
return Buffer2.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
||||
};
|
||||
Stream._isArrayBufferView = isArrayBufferView;
|
||||
},
|
||||
});
|
||||
/* End esm.sh bundle */
|
||||
|
@ -5311,11 +5312,15 @@ export const Duplex = CustomStream.Duplex;
|
|||
export const PassThrough = CustomStream.PassThrough;
|
||||
export const Stream = CustomStream.Stream;
|
||||
export const Transform = CustomStream.Transform;
|
||||
export const _isArrayBufferView = isArrayBufferView;
|
||||
export const _isUint8Array = CustomStream._isUint8Array;
|
||||
export const _uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
|
||||
export const addAbortSignal = CustomStream.addAbortSignal;
|
||||
export const pipeline = CustomStream.pipeline;
|
||||
export { finished };
|
||||
export const isDisturbed = CustomStream.isDisturbed;
|
||||
export const isErrored = CustomStream.isErrored;
|
||||
export const compose = CustomStream.compose;
|
||||
export { destroy, finished, isDestroyed, isReadable, isWritable };
|
||||
|
||||
function isWritableStream(object) {
|
||||
return object instanceof WritableStream;
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
} from "ext:deno_node/internal/primordials.mjs";
|
||||
import assert from "ext:deno_node/internal/assert.mjs";
|
||||
import * as net from "node:net";
|
||||
import { createSecureContext } from "ext:deno_node/_tls_common.ts";
|
||||
import { createSecureContext } from "node:_tls_common";
|
||||
import { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts";
|
||||
import { connResetException } from "ext:deno_node/internal/errors.ts";
|
||||
import { emitWarning } from "node:process";
|
||||
|
|
|
@ -157,7 +157,72 @@ export function executionAsyncResource() {
|
|||
return {};
|
||||
}
|
||||
|
||||
export const asyncWrapProviders = ObjectFreeze({ __proto__: null });
|
||||
export const asyncWrapProviders = ObjectFreeze({
|
||||
__proto__: null,
|
||||
NONE: 0,
|
||||
DIRHANDLE: 1,
|
||||
DNSCHANNEL: 2,
|
||||
ELDHISTOGRAM: 3,
|
||||
FILEHANDLE: 4,
|
||||
FILEHANDLECLOSEREQ: 5,
|
||||
BLOBREADER: 6,
|
||||
FSEVENTWRAP: 7,
|
||||
FSREQCALLBACK: 8,
|
||||
FSREQPROMISE: 9,
|
||||
GETADDRINFOREQWRAP: 10,
|
||||
GETNAMEINFOREQWRAP: 11,
|
||||
HEAPSNAPSHOT: 12,
|
||||
HTTP2SESSION: 13,
|
||||
HTTP2STREAM: 14,
|
||||
HTTP2PING: 15,
|
||||
HTTP2SETTINGS: 16,
|
||||
HTTPINCOMINGMESSAGE: 17,
|
||||
HTTPCLIENTREQUEST: 18,
|
||||
JSSTREAM: 19,
|
||||
JSUDPWRAP: 20,
|
||||
MESSAGEPORT: 21,
|
||||
PIPECONNECTWRAP: 22,
|
||||
PIPESERVERWRAP: 23,
|
||||
PIPEWRAP: 24,
|
||||
PROCESSWRAP: 25,
|
||||
PROMISE: 26,
|
||||
QUERYWRAP: 27,
|
||||
QUIC_ENDPOINT: 28,
|
||||
QUIC_LOGSTREAM: 29,
|
||||
QUIC_PACKET: 30,
|
||||
QUIC_SESSION: 31,
|
||||
QUIC_STREAM: 32,
|
||||
QUIC_UDP: 33,
|
||||
SHUTDOWNWRAP: 34,
|
||||
SIGNALWRAP: 35,
|
||||
STATWATCHER: 36,
|
||||
STREAMPIPE: 37,
|
||||
TCPCONNECTWRAP: 38,
|
||||
TCPSERVERWRAP: 39,
|
||||
TCPWRAP: 40,
|
||||
TTYWRAP: 41,
|
||||
UDPSENDWRAP: 42,
|
||||
UDPWRAP: 43,
|
||||
SIGINTWATCHDOG: 44,
|
||||
WORKER: 45,
|
||||
WORKERHEAPSNAPSHOT: 46,
|
||||
WRITEWRAP: 47,
|
||||
ZLIB: 48,
|
||||
CHECKPRIMEREQUEST: 49,
|
||||
PBKDF2REQUEST: 50,
|
||||
KEYPAIRGENREQUEST: 51,
|
||||
KEYGENREQUEST: 52,
|
||||
KEYEXPORTREQUEST: 53,
|
||||
CIPHERREQUEST: 54,
|
||||
DERIVEBITSREQUEST: 55,
|
||||
HASHREQUEST: 56,
|
||||
RANDOMBYTESREQUEST: 57,
|
||||
RANDOMPRIMEREQUEST: 58,
|
||||
SCRYPTREQUEST: 59,
|
||||
SIGNREQUEST: 60,
|
||||
TLSWRAP: 61,
|
||||
VERIFYREQUEST: 62,
|
||||
});
|
||||
|
||||
class AsyncHook {
|
||||
enable() {
|
||||
|
|
|
@ -7,6 +7,7 @@ export {
|
|||
Buffer,
|
||||
constants,
|
||||
default,
|
||||
INSPECT_MAX_BYTES,
|
||||
isAscii,
|
||||
isUtf8,
|
||||
kMaxLength,
|
||||
|
|
|
@ -15,9 +15,20 @@ function emitError(e) {
|
|||
this.emit("error", e);
|
||||
}
|
||||
|
||||
// TODO(bartlomieju): maybe use this one
|
||||
// deno-lint-ignore prefer-const
|
||||
let stack = [];
|
||||
export const _stack = stack;
|
||||
export const active = null;
|
||||
|
||||
export function create() {
|
||||
return new Domain();
|
||||
}
|
||||
|
||||
export function createDomain() {
|
||||
return new Domain();
|
||||
}
|
||||
|
||||
export class Domain extends EventEmitter {
|
||||
#handler;
|
||||
|
||||
|
@ -85,6 +96,9 @@ export class Domain extends EventEmitter {
|
|||
}
|
||||
}
|
||||
export default {
|
||||
_stack,
|
||||
create,
|
||||
active,
|
||||
createDomain,
|
||||
Domain,
|
||||
};
|
||||
|
|
|
@ -36,16 +36,16 @@ import {
|
|||
Writable as NodeWritable,
|
||||
} from "node:stream";
|
||||
import {
|
||||
kUniqueHeaders,
|
||||
OutgoingMessage,
|
||||
parseUniqueHeadersOption,
|
||||
validateHeaderName,
|
||||
validateHeaderValue,
|
||||
} from "ext:deno_node/_http_outgoing.ts";
|
||||
} from "node:_http_outgoing";
|
||||
import { ok as assert } from "node:assert";
|
||||
import { kOutHeaders } from "ext:deno_node/internal/http.ts";
|
||||
import { _checkIsHttpToken as checkIsHttpToken } from "ext:deno_node/_http_common.ts";
|
||||
import { Agent, globalAgent } from "ext:deno_node/_http_agent.mjs";
|
||||
// import { chunkExpression as RE_TE_CHUNKED } from "ext:deno_node/_http_common.ts";
|
||||
import { _checkIsHttpToken as checkIsHttpToken } from "node:_http_common";
|
||||
import { Agent, globalAgent } from "node:_http_agent";
|
||||
import { urlToHttpOptions } from "ext:deno_node/internal/url.ts";
|
||||
import { kEmptyObject } from "ext:deno_node/internal/util.mjs";
|
||||
import { constants, TCP } from "ext:deno_node/internal_binding/tcp_wrap.ts";
|
||||
|
@ -67,178 +67,12 @@ import { timerId } from "ext:deno_web/03_abort_signal.js";
|
|||
import { clearTimeout as webClearTimeout } from "ext:deno_web/02_timers.js";
|
||||
import { resourceForReadableStream } from "ext:deno_web/06_streams.js";
|
||||
import { TcpConn } from "ext:deno_net/01_net.js";
|
||||
import { STATUS_CODES } from "node:_http_server";
|
||||
import { methods as METHODS } from "node:_http_common";
|
||||
|
||||
const { internalRidSymbol } = core;
|
||||
const { ArrayIsArray } = primordials;
|
||||
|
||||
enum STATUS_CODES {
|
||||
/** RFC 7231, 6.2.1 */
|
||||
Continue = 100,
|
||||
/** RFC 7231, 6.2.2 */
|
||||
SwitchingProtocols = 101,
|
||||
/** RFC 2518, 10.1 */
|
||||
Processing = 102,
|
||||
/** RFC 8297 **/
|
||||
EarlyHints = 103,
|
||||
|
||||
/** RFC 7231, 6.3.1 */
|
||||
OK = 200,
|
||||
/** RFC 7231, 6.3.2 */
|
||||
Created = 201,
|
||||
/** RFC 7231, 6.3.3 */
|
||||
Accepted = 202,
|
||||
/** RFC 7231, 6.3.4 */
|
||||
NonAuthoritativeInfo = 203,
|
||||
/** RFC 7231, 6.3.5 */
|
||||
NoContent = 204,
|
||||
/** RFC 7231, 6.3.6 */
|
||||
ResetContent = 205,
|
||||
/** RFC 7233, 4.1 */
|
||||
PartialContent = 206,
|
||||
/** RFC 4918, 11.1 */
|
||||
MultiStatus = 207,
|
||||
/** RFC 5842, 7.1 */
|
||||
AlreadyReported = 208,
|
||||
/** RFC 3229, 10.4.1 */
|
||||
IMUsed = 226,
|
||||
|
||||
/** RFC 7231, 6.4.1 */
|
||||
MultipleChoices = 300,
|
||||
/** RFC 7231, 6.4.2 */
|
||||
MovedPermanently = 301,
|
||||
/** RFC 7231, 6.4.3 */
|
||||
Found = 302,
|
||||
/** RFC 7231, 6.4.4 */
|
||||
SeeOther = 303,
|
||||
/** RFC 7232, 4.1 */
|
||||
NotModified = 304,
|
||||
/** RFC 7231, 6.4.5 */
|
||||
UseProxy = 305,
|
||||
/** RFC 7231, 6.4.7 */
|
||||
TemporaryRedirect = 307,
|
||||
/** RFC 7538, 3 */
|
||||
PermanentRedirect = 308,
|
||||
|
||||
/** RFC 7231, 6.5.1 */
|
||||
BadRequest = 400,
|
||||
/** RFC 7235, 3.1 */
|
||||
Unauthorized = 401,
|
||||
/** RFC 7231, 6.5.2 */
|
||||
PaymentRequired = 402,
|
||||
/** RFC 7231, 6.5.3 */
|
||||
Forbidden = 403,
|
||||
/** RFC 7231, 6.5.4 */
|
||||
NotFound = 404,
|
||||
/** RFC 7231, 6.5.5 */
|
||||
MethodNotAllowed = 405,
|
||||
/** RFC 7231, 6.5.6 */
|
||||
NotAcceptable = 406,
|
||||
/** RFC 7235, 3.2 */
|
||||
ProxyAuthRequired = 407,
|
||||
/** RFC 7231, 6.5.7 */
|
||||
RequestTimeout = 408,
|
||||
/** RFC 7231, 6.5.8 */
|
||||
Conflict = 409,
|
||||
/** RFC 7231, 6.5.9 */
|
||||
Gone = 410,
|
||||
/** RFC 7231, 6.5.10 */
|
||||
LengthRequired = 411,
|
||||
/** RFC 7232, 4.2 */
|
||||
PreconditionFailed = 412,
|
||||
/** RFC 7231, 6.5.11 */
|
||||
RequestEntityTooLarge = 413,
|
||||
/** RFC 7231, 6.5.12 */
|
||||
RequestURITooLong = 414,
|
||||
/** RFC 7231, 6.5.13 */
|
||||
UnsupportedMediaType = 415,
|
||||
/** RFC 7233, 4.4 */
|
||||
RequestedRangeNotSatisfiable = 416,
|
||||
/** RFC 7231, 6.5.14 */
|
||||
ExpectationFailed = 417,
|
||||
/** RFC 7168, 2.3.3 */
|
||||
Teapot = 418,
|
||||
/** RFC 7540, 9.1.2 */
|
||||
MisdirectedRequest = 421,
|
||||
/** RFC 4918, 11.2 */
|
||||
UnprocessableEntity = 422,
|
||||
/** RFC 4918, 11.3 */
|
||||
Locked = 423,
|
||||
/** RFC 4918, 11.4 */
|
||||
FailedDependency = 424,
|
||||
/** RFC 8470, 5.2 */
|
||||
TooEarly = 425,
|
||||
/** RFC 7231, 6.5.15 */
|
||||
UpgradeRequired = 426,
|
||||
/** RFC 6585, 3 */
|
||||
PreconditionRequired = 428,
|
||||
/** RFC 6585, 4 */
|
||||
TooManyRequests = 429,
|
||||
/** RFC 6585, 5 */
|
||||
RequestHeaderFieldsTooLarge = 431,
|
||||
/** RFC 7725, 3 */
|
||||
UnavailableForLegalReasons = 451,
|
||||
|
||||
/** RFC 7231, 6.6.1 */
|
||||
InternalServerError = 500,
|
||||
/** RFC 7231, 6.6.2 */
|
||||
NotImplemented = 501,
|
||||
/** RFC 7231, 6.6.3 */
|
||||
BadGateway = 502,
|
||||
/** RFC 7231, 6.6.4 */
|
||||
ServiceUnavailable = 503,
|
||||
/** RFC 7231, 6.6.5 */
|
||||
GatewayTimeout = 504,
|
||||
/** RFC 7231, 6.6.6 */
|
||||
HTTPVersionNotSupported = 505,
|
||||
/** RFC 2295, 8.1 */
|
||||
VariantAlsoNegotiates = 506,
|
||||
/** RFC 4918, 11.5 */
|
||||
InsufficientStorage = 507,
|
||||
/** RFC 5842, 7.2 */
|
||||
LoopDetected = 508,
|
||||
/** RFC 2774, 7 */
|
||||
NotExtended = 510,
|
||||
/** RFC 6585, 6 */
|
||||
NetworkAuthenticationRequired = 511,
|
||||
}
|
||||
|
||||
const METHODS = [
|
||||
"ACL",
|
||||
"BIND",
|
||||
"CHECKOUT",
|
||||
"CONNECT",
|
||||
"COPY",
|
||||
"DELETE",
|
||||
"GET",
|
||||
"HEAD",
|
||||
"LINK",
|
||||
"LOCK",
|
||||
"M-SEARCH",
|
||||
"MERGE",
|
||||
"MKACTIVITY",
|
||||
"MKCALENDAR",
|
||||
"MKCOL",
|
||||
"MOVE",
|
||||
"NOTIFY",
|
||||
"OPTIONS",
|
||||
"PATCH",
|
||||
"POST",
|
||||
"PROPFIND",
|
||||
"PROPPATCH",
|
||||
"PURGE",
|
||||
"PUT",
|
||||
"REBIND",
|
||||
"REPORT",
|
||||
"SEARCH",
|
||||
"SOURCE",
|
||||
"SUBSCRIBE",
|
||||
"TRACE",
|
||||
"UNBIND",
|
||||
"UNLINK",
|
||||
"UNLOCK",
|
||||
"UNSUBSCRIBE",
|
||||
];
|
||||
|
||||
type Chunk = string | Buffer | Uint8Array;
|
||||
|
||||
const ENCODER = new TextEncoder();
|
||||
|
@ -283,8 +117,6 @@ function validateHost(host, name) {
|
|||
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
|
||||
const kError = Symbol("kError");
|
||||
|
||||
const kUniqueHeaders = Symbol("kUniqueHeaders");
|
||||
|
||||
class FakeSocket extends EventEmitter {
|
||||
constructor(
|
||||
opts: {
|
||||
|
|
|
@ -67,7 +67,7 @@ import {
|
|||
ERR_SOCKET_CLOSED,
|
||||
ERR_STREAM_WRITE_AFTER_END,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { _checkIsHttpToken } from "ext:deno_node/_http_common.ts";
|
||||
import { _checkIsHttpToken } from "node:_http_common";
|
||||
const {
|
||||
StringPrototypeTrim,
|
||||
FunctionPrototypeBind,
|
||||
|
@ -2295,7 +2295,7 @@ function onStreamTimeout(kind) {
|
|||
};
|
||||
}
|
||||
|
||||
class Http2ServerRequest extends Readable {
|
||||
export class Http2ServerRequest extends Readable {
|
||||
readableEnded = false;
|
||||
|
||||
constructor(stream, headers, options, rawHeaders) {
|
||||
|
@ -2523,7 +2523,7 @@ function isConnectionHeaderAllowed(name, value) {
|
|||
value === "trailers";
|
||||
}
|
||||
|
||||
class Http2ServerResponse extends Stream {
|
||||
export class Http2ServerResponse extends Stream {
|
||||
writable = false;
|
||||
req = null;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
IncomingMessageForClient as IncomingMessage,
|
||||
type RequestOptions,
|
||||
} from "node:http";
|
||||
import { Agent as HttpAgent } from "ext:deno_node/_http_agent.mjs";
|
||||
import { Agent as HttpAgent } from "node:_http_agent";
|
||||
import { createHttpClient } from "ext:deno_fetch/22_http_client.js";
|
||||
import { type ServerHandler, ServerImpl as HttpServer } from "node:http";
|
||||
import { validateObject } from "ext:deno_node/internal/validators.mjs";
|
||||
|
|
|
@ -65,7 +65,7 @@ const customInspectSymbol =
|
|||
? Symbol["for"]("nodejs.util.inspect.custom")
|
||||
: null;
|
||||
|
||||
const INSPECT_MAX_BYTES = 50;
|
||||
export const INSPECT_MAX_BYTES = 50;
|
||||
|
||||
export const constants = {
|
||||
MAX_LENGTH: kMaxLength,
|
||||
|
@ -2606,6 +2606,7 @@ export default {
|
|||
constants,
|
||||
isAscii,
|
||||
isUtf8,
|
||||
INSPECT_MAX_BYTES,
|
||||
kMaxLength,
|
||||
kStringMaxLength,
|
||||
SlowBuffer,
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { Buffer } from "node:buffer";
|
||||
import type { WritableOptions } from "ext:deno_node/_stream.d.ts";
|
||||
import Writable from "ext:deno_node/internal/streams/writable.mjs";
|
||||
import Writable from "node:_stream_writable";
|
||||
import type {
|
||||
BinaryLike,
|
||||
BinaryToTextEncoding,
|
||||
|
|
|
@ -2,9 +2,24 @@
|
|||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// TODO(bartlomieju): this should be 64?
|
||||
let defaultHighWaterMarkBytes = 16 * 1024;
|
||||
let defaultHighWaterMarkObjectMode = 16;
|
||||
|
||||
function getDefaultHighWaterMark(objectMode) {
|
||||
return objectMode ? 16 : 16 * 1024;
|
||||
return objectMode
|
||||
? defaultHighWaterMarkObjectMode
|
||||
: defaultHighWaterMarkBytes;
|
||||
}
|
||||
|
||||
export default { getDefaultHighWaterMark };
|
||||
export { getDefaultHighWaterMark };
|
||||
function setDefaultHighWaterMark(objectMode, value) {
|
||||
validateInteger(value, "value", 0);
|
||||
if (objectMode) {
|
||||
defaultHighWaterMarkObjectMode = value;
|
||||
} else {
|
||||
defaultHighWaterMarkBytes = value;
|
||||
}
|
||||
}
|
||||
|
||||
export default { getDefaultHighWaterMark, setDefaultHighWaterMark };
|
||||
export { getDefaultHighWaterMark, setDefaultHighWaterMark };
|
||||
|
|
|
@ -11,6 +11,8 @@ import { deprecate } from "node:util";
|
|||
|
||||
import { ucs2 } from "ext:deno_node/internal/idna.ts";
|
||||
|
||||
const version = "2.1.0";
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
function punyDeprecated(fn: any) {
|
||||
return deprecate(
|
||||
|
@ -37,7 +39,7 @@ function encode(domain) {
|
|||
return punyDeprecated(op_node_idna_punycode_encode)(domain);
|
||||
}
|
||||
|
||||
export { decode, encode, toASCII, toUnicode, ucs2 };
|
||||
export { decode, encode, toASCII, toUnicode, ucs2, version };
|
||||
|
||||
export default {
|
||||
decode,
|
||||
|
@ -45,4 +47,5 @@ export default {
|
|||
toASCII,
|
||||
toUnicode,
|
||||
ucs2,
|
||||
version,
|
||||
};
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
|
||||
import { primordials } from "ext:core/mod.js";
|
||||
import { notImplemented } from "ext:deno_node/_utils.ts";
|
||||
const { Symbol } = primordials;
|
||||
|
||||
export const REPL_MODE_SLOPPY = Symbol("repl-sloppy");
|
||||
export const REPL_MODE_STRICT = Symbol("repl-strict");
|
||||
|
||||
export class REPLServer {
|
||||
constructor() {
|
||||
|
@ -61,4 +66,6 @@ export default {
|
|||
builtinModules,
|
||||
_builtinLibs,
|
||||
start,
|
||||
REPL_MODE_SLOPPY,
|
||||
REPL_MODE_STRICT,
|
||||
};
|
||||
|
|
|
@ -4,14 +4,19 @@
|
|||
|
||||
// @deno-types="./_stream.d.ts"
|
||||
import {
|
||||
_isArrayBufferView,
|
||||
_isUint8Array,
|
||||
_uint8ArrayToBuffer,
|
||||
addAbortSignal,
|
||||
// compose,
|
||||
// destroy,
|
||||
compose,
|
||||
destroy,
|
||||
Duplex,
|
||||
finished,
|
||||
// isDisturbed,
|
||||
isDestroyed,
|
||||
isDisturbed,
|
||||
isErrored,
|
||||
isReadable,
|
||||
isWritable,
|
||||
PassThrough,
|
||||
pipeline,
|
||||
Readable,
|
||||
|
@ -21,18 +26,28 @@ import {
|
|||
} from "ext:deno_node/_stream.mjs";
|
||||
import {
|
||||
getDefaultHighWaterMark,
|
||||
setDefaultHighWaterMark,
|
||||
} from "ext:deno_node/internal/streams/state.mjs";
|
||||
|
||||
export {
|
||||
_isArrayBufferView,
|
||||
_isUint8Array,
|
||||
_uint8ArrayToBuffer,
|
||||
addAbortSignal,
|
||||
compose,
|
||||
destroy,
|
||||
Duplex,
|
||||
finished,
|
||||
getDefaultHighWaterMark,
|
||||
isDestroyed,
|
||||
isDisturbed,
|
||||
isErrored,
|
||||
isReadable,
|
||||
isWritable,
|
||||
PassThrough,
|
||||
pipeline,
|
||||
Readable,
|
||||
setDefaultHighWaterMark,
|
||||
Stream,
|
||||
Transform,
|
||||
Writable,
|
||||
|
|
|
@ -19,10 +19,16 @@ import {
|
|||
TextDecoderStream,
|
||||
TextEncoderStream,
|
||||
} from "ext:deno_web/08_text_encoding.js";
|
||||
import {
|
||||
CompressionStream,
|
||||
DecompressionStream,
|
||||
} from "ext:deno_web/14_compression.js";
|
||||
|
||||
export {
|
||||
ByteLengthQueuingStrategy,
|
||||
CompressionStream,
|
||||
CountQueuingStrategy,
|
||||
DecompressionStream,
|
||||
ReadableByteStreamController,
|
||||
ReadableStream,
|
||||
ReadableStreamBYOBReader,
|
||||
|
@ -39,19 +45,21 @@ export {
|
|||
};
|
||||
|
||||
export default {
|
||||
ByteLengthQueuingStrategy,
|
||||
CompressionStream,
|
||||
CountQueuingStrategy,
|
||||
DecompressionStream,
|
||||
ReadableByteStreamController,
|
||||
ReadableStream,
|
||||
ReadableStreamBYOBReader,
|
||||
ReadableStreamBYOBRequest,
|
||||
ReadableStreamDefaultReader,
|
||||
ReadableByteStreamController,
|
||||
ReadableStreamDefaultController,
|
||||
ReadableStreamDefaultReader,
|
||||
TextDecoderStream,
|
||||
TextEncoderStream,
|
||||
TransformStream,
|
||||
TransformStreamDefaultController,
|
||||
WritableStream,
|
||||
WritableStreamDefaultWriter,
|
||||
WritableStreamDefaultController,
|
||||
ByteLengthQueuingStrategy,
|
||||
CountQueuingStrategy,
|
||||
TextEncoderStream,
|
||||
TextDecoderStream,
|
||||
WritableStreamDefaultWriter,
|
||||
};
|
||||
|
|
|
@ -17,4 +17,5 @@ export default {
|
|||
setTimeout,
|
||||
setImmediate,
|
||||
setInterval,
|
||||
scheduler,
|
||||
};
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { notImplemented } from "ext:deno_node/_utils.ts";
|
||||
import tlsCommon from "ext:deno_node/_tls_common.ts";
|
||||
import tlsWrap from "ext:deno_node/_tls_wrap.ts";
|
||||
import tlsCommon from "node:_tls_common";
|
||||
import tlsWrap from "node:_tls_wrap";
|
||||
|
||||
// openssl -> rustls
|
||||
const cipherMap = {
|
||||
|
@ -34,6 +34,8 @@ export const rootCertificates = undefined;
|
|||
export const DEFAULT_ECDH_CURVE = "auto";
|
||||
export const DEFAULT_MAX_VERSION = "TLSv1.3";
|
||||
export const DEFAULT_MIN_VERSION = "TLSv1.2";
|
||||
export const CLIENT_RENEG_LIMIT = 3;
|
||||
export const CLIENT_RENEG_WINDOW = 600;
|
||||
|
||||
export class CryptoStream {}
|
||||
export class SecurePair {}
|
||||
|
@ -58,6 +60,8 @@ export default {
|
|||
DEFAULT_ECDH_CURVE,
|
||||
DEFAULT_MAX_VERSION,
|
||||
DEFAULT_MIN_VERSION,
|
||||
CLIENT_RENEG_LIMIT,
|
||||
CLIENT_RENEG_WINDOW,
|
||||
};
|
||||
|
||||
export const checkServerIdentity = tlsWrap.checkServerIdentity;
|
||||
|
|
|
@ -78,20 +78,15 @@ export class ZlibBase {
|
|||
export { constants };
|
||||
|
||||
export default {
|
||||
Options,
|
||||
BrotliOptions,
|
||||
brotliCompress,
|
||||
BrotliCompress,
|
||||
brotliCompressSync,
|
||||
brotliDecompress,
|
||||
BrotliDecompress,
|
||||
Deflate,
|
||||
DeflateRaw,
|
||||
Gunzip,
|
||||
Gzip,
|
||||
Inflate,
|
||||
InflateRaw,
|
||||
Unzip,
|
||||
ZlibBase,
|
||||
constants,
|
||||
brotliDecompressSync,
|
||||
BrotliOptions,
|
||||
codes,
|
||||
constants,
|
||||
createBrotliCompress,
|
||||
createBrotliDecompress,
|
||||
createDeflate,
|
||||
|
@ -101,24 +96,73 @@ export default {
|
|||
createInflate,
|
||||
createInflateRaw,
|
||||
createUnzip,
|
||||
brotliCompress,
|
||||
brotliCompressSync,
|
||||
brotliDecompress,
|
||||
brotliDecompressSync,
|
||||
deflate,
|
||||
deflateSync,
|
||||
Deflate,
|
||||
DEFLATE: constants.DEFLATE,
|
||||
deflateRaw,
|
||||
DeflateRaw,
|
||||
DEFLATERAW: constants.DEFLATERAW,
|
||||
deflateRawSync,
|
||||
deflateSync,
|
||||
gunzip,
|
||||
Gunzip,
|
||||
GUNZIP: constants.GUNZIP,
|
||||
gunzipSync,
|
||||
gzip,
|
||||
Gzip,
|
||||
GZIP: constants.GZIP,
|
||||
gzipSync,
|
||||
inflate,
|
||||
inflateSync,
|
||||
Inflate,
|
||||
INFLATE: constants.INFLATE,
|
||||
inflateRaw,
|
||||
InflateRaw,
|
||||
INFLATERAW: constants.INFLATERAW,
|
||||
inflateRawSync,
|
||||
inflateSync,
|
||||
Options,
|
||||
unzip,
|
||||
Unzip,
|
||||
UNZIP: constants.UNZIP,
|
||||
unzipSync,
|
||||
Z_BEST_COMPRESSION: constants.Z_BEST_COMPRESSION,
|
||||
Z_BEST_SPEED: constants.Z_BEST_SPEED,
|
||||
Z_BLOCK: constants.Z_BLOCK,
|
||||
Z_BUF_ERROR: constants.Z_BUF_ERROR,
|
||||
Z_DATA_ERROR: constants.Z_DATA_ERROR,
|
||||
Z_DEFAULT_CHUNK: constants.Z_DEFAULT_CHUNK,
|
||||
Z_DEFAULT_COMPRESSION: constants.Z_DEFAULT_COMPRESSION,
|
||||
Z_DEFAULT_LEVEL: constants.Z_DEFAULT_LEVEL,
|
||||
Z_DEFAULT_MEMLEVEL: constants.Z_DEFAULT_MEMLEVEL,
|
||||
Z_DEFAULT_STRATEGY: constants.Z_DEFAULT_STRATEGY,
|
||||
Z_DEFAULT_WINDOWBITS: constants.Z_DEFAULT_WINDOWBITS,
|
||||
Z_ERRNO: constants.Z_ERRNO,
|
||||
Z_FILTERED: constants.Z_FILTERED,
|
||||
Z_FINISH: constants.Z_FINISH,
|
||||
Z_FIXED: constants.Z_FIXED,
|
||||
Z_FULL_FLUSH: constants.Z_FULL_FLUSH,
|
||||
Z_HUFFMAN_ONLY: constants.Z_HUFFMAN_ONLY,
|
||||
Z_MAX_CHUNK: constants.Z_MAX_CHUNK,
|
||||
Z_MAX_LEVEL: constants.Z_MAX_LEVEL,
|
||||
Z_MAX_MEMLEVEL: constants.Z_MAX_MEMLEVEL,
|
||||
Z_MAX_WINDOWBITS: constants.Z_MAX_WINDOWBITS,
|
||||
Z_MEM_ERROR: constants.Z_MEM_ERROR,
|
||||
Z_MIN_CHUNK: constants.Z_MIN_CHUNK,
|
||||
Z_MIN_LEVEL: constants.Z_MIN_LEVEL,
|
||||
Z_MIN_MEMLEVEL: constants.Z_MIN_MEMLEVEL,
|
||||
Z_MIN_WINDOWBITS: constants.Z_MIN_WINDOWBITS,
|
||||
Z_NEED_DICT: constants.Z_NEED_DICT,
|
||||
Z_NO_COMPRESSION: constants.Z_NO_COMPRESSION,
|
||||
Z_NO_FLUSH: constants.Z_NO_FLUSH,
|
||||
Z_OK: constants.Z_OK,
|
||||
Z_PARTIAL_FLUSH: constants.Z_PARTIAL_FLUSH,
|
||||
Z_RLE: constants.Z_RLE,
|
||||
Z_STREAM_END: constants.Z_STREAM_END,
|
||||
Z_STREAM_ERROR: constants.Z_STREAM_ERROR,
|
||||
Z_SYNC_FLUSH: constants.Z_SYNC_FLUSH,
|
||||
Z_VERSION_ERROR: constants.Z_VERSION_ERROR,
|
||||
ZLIB_VERNUM: constants.ZLIB_VERNUM,
|
||||
ZlibBase,
|
||||
};
|
||||
|
||||
export {
|
||||
|
|
|
@ -126,6 +126,8 @@ const denoNs = {
|
|||
uid: os.uid,
|
||||
Command: process.Command,
|
||||
ChildProcess: process.ChildProcess,
|
||||
httpClient: httpClient.httpClient,
|
||||
createHttpClient: httpClient.createHttpClient,
|
||||
};
|
||||
|
||||
// NOTE(bartlomieju): keep IDs in sync with `cli/main.rs`
|
||||
|
|
|
@ -83,7 +83,7 @@ pub static UNSTABLE_GRANULAR_FLAGS: &[UnstableGranularFlag] = &[
|
|||
UnstableGranularFlag {
|
||||
name: ops::http::UNSTABLE_FEATURE_NAME,
|
||||
help_text: "Enable unstable HTTP APIs",
|
||||
show_in_help: true,
|
||||
show_in_help: false,
|
||||
id: 5,
|
||||
},
|
||||
UnstableGranularFlag {
|
||||
|
|
|
@ -57,8 +57,6 @@ fn op_http_start(
|
|||
.resource_table
|
||||
.take::<deno_net::io::UnixStreamResource>(tcp_stream_rid)
|
||||
{
|
||||
super::check_unstable(state, UNSTABLE_FEATURE_NAME, "Deno.serveHttp");
|
||||
|
||||
// This UNIX socket might be used somewhere else. If it's the case, we cannot proceed with the
|
||||
// process of starting a HTTP server on top of this UNIX socket, so we just return a bad
|
||||
// resource error. See also: https://github.com/denoland/deno/pull/16242
|
||||
|
|
|
@ -122,9 +122,8 @@ fn js_unit_test(test: String) {
|
|||
.arg("--no-lock")
|
||||
// TODO(bartlomieju): would be better if we could apply this unstable
|
||||
// flag to particular files, but there's many of them that rely on unstable
|
||||
// net APIs (`reusePort` in `listen` and `listenTls`; `listenDatagram`, `createHttpClient`)
|
||||
// net APIs (`reusePort` in `listen` and `listenTls`; `listenDatagram`)
|
||||
.arg("--unstable-net")
|
||||
.arg("--unstable-http")
|
||||
.arg("--location=http://127.0.0.1:4545/")
|
||||
.arg("--no-prompt");
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ fn node_unit_test(test: String) {
|
|||
.arg(deno_config_path())
|
||||
.arg("--no-lock")
|
||||
.arg("--unstable-broadcast-channel")
|
||||
.arg("--unstable-http")
|
||||
.arg("--unstable-net")
|
||||
// TODO(kt3k): This option is required to pass tls_test.ts,
|
||||
// but this shouldn't be necessary. tls.connect currently doesn't
|
||||
|
|
|
@ -1829,17 +1829,6 @@ itest!(unstable_cron_enabled {
|
|||
output: "run/unstable_cron.enabled.out",
|
||||
});
|
||||
|
||||
itest!(unstable_http_disabled {
|
||||
args: "run --quiet --reload --allow-read run/unstable_http.js",
|
||||
output: "run/unstable_http.disabled.out",
|
||||
});
|
||||
|
||||
itest!(unstable_http_enabled {
|
||||
args:
|
||||
"run --quiet --reload --allow-read --unstable-http run/unstable_http.js",
|
||||
output: "run/unstable_http.enabled.out",
|
||||
});
|
||||
|
||||
itest!(unstable_net_disabled {
|
||||
args: "run --quiet --reload --allow-read run/unstable_net.js",
|
||||
output: "run/unstable_net.disabled.out",
|
||||
|
|
|
@ -108,7 +108,6 @@ async function testFetchProgrammaticProxy() {
|
|||
"--quiet",
|
||||
"--reload",
|
||||
"--allow-net=localhost:4545,localhost:4555",
|
||||
"--unstable-http",
|
||||
"programmatic_proxy_client.ts",
|
||||
],
|
||||
}).output();
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
"exitCode": 1,
|
||||
"output": "cron.out"
|
||||
},
|
||||
"http": {
|
||||
"args": "run http.ts",
|
||||
"exitCode": 1,
|
||||
"output": "http.out"
|
||||
},
|
||||
"http_wss": {
|
||||
"args": "run http_wss.ts",
|
||||
"exitCode": 1,
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
error: Uncaught (in promise) TypeError: Deno.createHttpClient is not a function
|
||||
Deno.createHttpClient();
|
||||
^
|
||||
at [WILDCARD]http.ts:1:6
|
||||
|
||||
info: Deno.createHttpClient() is an unstable API.
|
||||
hint: Run again with `--unstable-http` flag to enable this API.
|
|
@ -1 +0,0 @@
|
|||
Deno.createHttpClient();
|
|
@ -1,4 +0,0 @@
|
|||
main undefined
|
||||
main undefined
|
||||
worker undefined
|
||||
worker undefined
|
4
tests/testdata/run/unstable_http.enabled.out
vendored
4
tests/testdata/run/unstable_http.enabled.out
vendored
|
@ -1,4 +0,0 @@
|
|||
main [class HttpClient]
|
||||
main [Function: createHttpClient]
|
||||
worker [class HttpClient]
|
||||
worker [Function: createHttpClient]
|
11
tests/testdata/run/unstable_http.js
vendored
11
tests/testdata/run/unstable_http.js
vendored
|
@ -1,11 +0,0 @@
|
|||
const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
|
||||
|
||||
console.log(scope, Deno.HttpClient);
|
||||
console.log(scope, Deno.createHttpClient);
|
||||
|
||||
if (scope === "worker") {
|
||||
postMessage("done");
|
||||
} else {
|
||||
const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
|
||||
worker.onmessage = () => Deno.exit(0);
|
||||
}
|
|
@ -9,7 +9,6 @@ import {
|
|||
assertStringIncludes,
|
||||
assertThrows,
|
||||
delay,
|
||||
DENO_FUTURE,
|
||||
fail,
|
||||
unimplemented,
|
||||
} from "./test_util.ts";
|
||||
|
@ -1359,7 +1358,7 @@ Deno.test(
|
|||
);
|
||||
|
||||
Deno.test(
|
||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
||||
{ permissions: { read: true, net: true } },
|
||||
async function fetchCustomClientPrivateKey(): Promise<
|
||||
void
|
||||
> {
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
assertEquals,
|
||||
assertRejects,
|
||||
assertThrows,
|
||||
DENO_FUTURE,
|
||||
} from "./test_util.ts";
|
||||
import { copy } from "@std/io/copy";
|
||||
|
||||
|
@ -21,7 +20,7 @@ Deno.test(function filesStdioFileDescriptors() {
|
|||
});
|
||||
|
||||
Deno.test(
|
||||
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
||||
{ permissions: { read: true } },
|
||||
async function filesCopyToStdout() {
|
||||
const filename = "tests/testdata/assets/fixture.json";
|
||||
using file = await Deno.open(filename);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file no-window-prefix no-window
|
||||
import {
|
||||
assert,
|
||||
assertEquals,
|
||||
assertRejects,
|
||||
assertThrows,
|
||||
DENO_FUTURE,
|
||||
} from "./test_util.ts";
|
||||
|
||||
Deno.test(function globalThisExists() {
|
||||
|
@ -20,34 +18,18 @@ Deno.test(function noInternalGlobals() {
|
|||
}
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function windowExists() {
|
||||
assert(window != null);
|
||||
});
|
||||
|
||||
Deno.test(function selfExists() {
|
||||
assert(self != null);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function windowWindowExists() {
|
||||
assert(window.window === window);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function windowSelfExists() {
|
||||
assert(window.self === window);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisEqualsWindow() {
|
||||
assert(globalThis === window);
|
||||
Deno.test(function globalThisWindowEqualsUndefined() {
|
||||
assert(globalThis.window === undefined);
|
||||
});
|
||||
|
||||
Deno.test(function globalThisEqualsSelf() {
|
||||
assert(globalThis === self);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisInstanceofWindow() {
|
||||
assert(globalThis instanceof Window);
|
||||
});
|
||||
|
||||
Deno.test(function globalThisConstructorLength() {
|
||||
assert(globalThis.constructor.length === 0);
|
||||
});
|
||||
|
@ -66,10 +48,6 @@ Deno.test(function DenoNamespaceExists() {
|
|||
assert(Deno != null);
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, function DenoNamespaceEqualsWindowDeno() {
|
||||
assert(Deno === window.Deno);
|
||||
});
|
||||
|
||||
Deno.test(function DenoNamespaceIsNotFrozen() {
|
||||
assert(!Object.isFrozen(Deno));
|
||||
});
|
||||
|
@ -120,11 +98,7 @@ Deno.test(async function windowQueueMicrotask() {
|
|||
res();
|
||||
};
|
||||
});
|
||||
if (DENO_FUTURE) {
|
||||
globalThis.queueMicrotask(resolve1!);
|
||||
} else {
|
||||
window.queueMicrotask(resolve1!);
|
||||
}
|
||||
setTimeout(resolve2!, 0);
|
||||
await p1;
|
||||
await p2;
|
||||
|
@ -143,18 +117,9 @@ Deno.test(function webApiGlobalThis() {
|
|||
Deno.test(function windowNameIsDefined() {
|
||||
assertEquals(typeof globalThis.name, "string");
|
||||
assertEquals(name, "");
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(window.name, name);
|
||||
}
|
||||
name = "foobar";
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(window.name, "foobar");
|
||||
}
|
||||
assertEquals(name, "foobar");
|
||||
name = "";
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(window.name, "");
|
||||
}
|
||||
assertEquals(name, "");
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
assertThrows,
|
||||
curlRequest,
|
||||
curlRequestWithStdErr,
|
||||
DENO_FUTURE,
|
||||
execCode,
|
||||
execCode3,
|
||||
fail,
|
||||
|
@ -20,7 +19,7 @@ import {
|
|||
} from "./test_util.ts";
|
||||
|
||||
// Since these tests may run in parallel, ensure this port is unique to this file
|
||||
const servePort = DENO_FUTURE ? 4511 : 4502;
|
||||
const servePort = 4511;
|
||||
|
||||
const {
|
||||
upgradeHttpRaw,
|
||||
|
|
|
@ -25,9 +25,6 @@ export { delay } from "@std/async/delay";
|
|||
export { readLines } from "@std/io/read-lines";
|
||||
export { parseArgs } from "@std/cli/parse-args";
|
||||
|
||||
// TODO(2.0): remove this and all the tests that depend on it.
|
||||
export const DENO_FUTURE = true;
|
||||
|
||||
export function pathToAbsoluteFileUrl(path: string): URL {
|
||||
path = resolve(path);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import {
|
|||
assertEquals,
|
||||
assertNotEquals,
|
||||
delay,
|
||||
DENO_FUTURE,
|
||||
execCode,
|
||||
unreachable,
|
||||
} from "./test_util.ts";
|
||||
|
@ -312,62 +311,10 @@ Deno.test(async function timeoutCallbackThis() {
|
|||
};
|
||||
setTimeout(obj.foo, 1);
|
||||
await promise;
|
||||
if (!DENO_FUTURE) {
|
||||
assertEquals(capturedThis, window);
|
||||
} else {
|
||||
assertEquals(capturedThis, globalThis);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test({ ignore: DENO_FUTURE }, async function timeoutBindThis() {
|
||||
const thisCheckPassed = [null, undefined, globalThis, window];
|
||||
|
||||
const thisCheckFailed = [
|
||||
0,
|
||||
"",
|
||||
true,
|
||||
false,
|
||||
{},
|
||||
[],
|
||||
"foo",
|
||||
() => {},
|
||||
Object.prototype,
|
||||
];
|
||||
|
||||
for (const thisArg of thisCheckPassed) {
|
||||
const { promise, resolve } = Promise.withResolvers<void>();
|
||||
let hasThrown = 0;
|
||||
try {
|
||||
setTimeout.call(thisArg, () => resolve(), 1);
|
||||
hasThrown = 1;
|
||||
} catch (err) {
|
||||
if (err instanceof TypeError) {
|
||||
hasThrown = 2;
|
||||
} else {
|
||||
hasThrown = 3;
|
||||
}
|
||||
}
|
||||
await promise;
|
||||
assertEquals(hasThrown, 1);
|
||||
}
|
||||
|
||||
for (const thisArg of thisCheckFailed) {
|
||||
let hasThrown = 0;
|
||||
try {
|
||||
setTimeout.call(thisArg, () => {}, 1);
|
||||
hasThrown = 1;
|
||||
} catch (err) {
|
||||
if (err instanceof TypeError) {
|
||||
hasThrown = 2;
|
||||
} else {
|
||||
hasThrown = 3;
|
||||
}
|
||||
}
|
||||
assertEquals(hasThrown, 2);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test({ ignore: !DENO_FUTURE }, async function timeoutBindThis() {
|
||||
Deno.test(async function timeoutBindThis() {
|
||||
const thisCheckPassed = [null, undefined, globalThis];
|
||||
|
||||
const thisCheckFailed = [
|
||||
|
|
|
@ -6,7 +6,6 @@ import {
|
|||
assertRejects,
|
||||
assertStrictEquals,
|
||||
assertThrows,
|
||||
DENO_FUTURE,
|
||||
} from "./test_util.ts";
|
||||
import { BufReader, BufWriter } from "@std/io";
|
||||
import { readAll } from "@std/io/read-all";
|
||||
|
@ -1042,7 +1041,7 @@ Deno.test(
|
|||
);
|
||||
|
||||
Deno.test(
|
||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
||||
{ permissions: { read: true, net: true } },
|
||||
async function connectTLSBadCertKey(): Promise<void> {
|
||||
await assertRejects(async () => {
|
||||
await Deno.connectTls({
|
||||
|
@ -1074,7 +1073,7 @@ Deno.test(
|
|||
);
|
||||
|
||||
Deno.test(
|
||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
||||
{ permissions: { read: true, net: true } },
|
||||
async function connectTLSNotKey(): Promise<void> {
|
||||
await assertRejects(async () => {
|
||||
await Deno.connectTls({
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// deno-lint-ignore-file no-deprecated-deno-api
|
||||
|
||||
import { assert, DENO_FUTURE } from "./test_util.ts";
|
||||
import { assert } from "./test_util.ts";
|
||||
|
||||
// Note tests for Deno.stdin.setRaw is in integration tests.
|
||||
|
||||
|
@ -15,17 +15,6 @@ Deno.test(function consoleSize() {
|
|||
assert(typeof result.rows !== "undefined");
|
||||
});
|
||||
|
||||
Deno.test(
|
||||
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
||||
function isatty() {
|
||||
// CI not under TTY, so cannot test stdin/stdout/stderr.
|
||||
const f = Deno.openSync("tests/testdata/assets/hello.txt");
|
||||
// @ts-ignore `Deno.isatty()` was soft-removed in Deno 2.
|
||||
assert(!Deno.isatty(f.rid));
|
||||
f.close();
|
||||
},
|
||||
);
|
||||
|
||||
Deno.test(function isattyError() {
|
||||
let caught = false;
|
||||
try {
|
||||
|
|
|
@ -378,3 +378,8 @@ Deno.test("[node/http2 client] connection states", async () => {
|
|||
|
||||
assertEquals(actual, expected);
|
||||
});
|
||||
|
||||
Deno.test("request and response exports", () => {
|
||||
assert(http2.Http2ServerRequest);
|
||||
assert(http2.Http2ServerResponse);
|
||||
});
|
||||
|
|
|
@ -40,9 +40,10 @@
|
|||
"ext:deno_node/_fs/_fs_write.mjs": "../ext/node/polyfills/_fs/_fs_write.mjs",
|
||||
"ext:deno_node/_fs/_fs_writev.mjs": "../ext/node/polyfills/_fs/_fs_writev.mjs",
|
||||
"ext:deno_node/_global.d.ts": "../ext/node/polyfills/_global.d.ts",
|
||||
"ext:deno_node/_http_agent.mjs": "../ext/node/polyfills/_http_agent.mjs",
|
||||
"ext:deno_node/_http_common.ts": "../ext/node/polyfills/_http_common.ts",
|
||||
"ext:deno_node/_http_outgoing.ts": "../ext/node/polyfills/_http_outgoing.ts",
|
||||
"node:_http_agent": "../ext/node/polyfills/_http_agent.mjs",
|
||||
"node:_http_common": "../ext/node/polyfills/_http_common.ts",
|
||||
"node:_http_outgoing": "../ext/node/polyfills/_http_outgoing.ts",
|
||||
"node:_http_server": "../ext/node/polyfills/_http_server.ts",
|
||||
"ext:deno_node/_next_tick.ts": "../ext/node/polyfills/_next_tick.ts",
|
||||
"ext:deno_node/_process/exiting.ts": "../ext/node/polyfills/_process/exiting.ts",
|
||||
"ext:deno_node/_process/process.ts": "../ext/node/polyfills/_process/process.ts",
|
||||
|
@ -50,7 +51,7 @@
|
|||
"ext:deno_node/_readline_shared_types.d.ts": "../ext/node/polyfills/_readline_shared_types.d.ts",
|
||||
"ext:deno_node/_stream.d.ts": "../ext/node/polyfills/_stream.d.ts",
|
||||
"ext:deno_node/_stream.mjs": "../ext/node/polyfills/_stream.mjs",
|
||||
"ext:deno_node/_tls_common.ts": "../ext/node/polyfills/_tls_common.ts",
|
||||
"node:_tls_common": "../ext/node/polyfills/_tls_common.ts",
|
||||
"ext:deno_node/_util/asserts.ts": "../ext/node/polyfills/_util/asserts.ts",
|
||||
"ext:deno_node/_util/async.ts": "../ext/node/polyfills/_util/async.ts",
|
||||
"ext:deno_node/_util/os.ts": "../ext/node/polyfills/_util/os.ts",
|
||||
|
@ -154,15 +155,15 @@
|
|||
"ext:deno_node/internal/streams/add-abort-signal.mjs": "../ext/node/polyfills/internal/streams/add-abort-signal.mjs",
|
||||
"ext:deno_node/internal/streams/buffer_list.mjs": "../ext/node/polyfills/internal/streams/buffer_list.mjs",
|
||||
"ext:deno_node/internal/streams/destroy.mjs": "../ext/node/polyfills/internal/streams/destroy.mjs",
|
||||
"ext:deno_node/internal/streams/duplex.mjs": "../ext/node/polyfills/internal/streams/duplex.mjs",
|
||||
"node:_stream_duplex": "../ext/node/polyfills/internal/streams/duplex.mjs",
|
||||
"ext:deno_node/internal/streams/end-of-stream.mjs": "../ext/node/polyfills/internal/streams/end-of-stream.mjs",
|
||||
"ext:deno_node/internal/streams/lazy_transform.mjs": "../ext/node/polyfills/internal/streams/lazy_transform.mjs",
|
||||
"ext:deno_node/internal/streams/passthrough.mjs": "../ext/node/polyfills/internal/streams/passthrough.mjs",
|
||||
"ext:deno_node/internal/streams/readable.mjs": "../ext/node/polyfills/internal/streams/readable.mjs",
|
||||
"node:_stream_readable": "../ext/node/polyfills/internal/streams/readable.mjs",
|
||||
"node:_stream_passthrough": "../ext/node/polyfills/internal/streams/passthrough.mjs",
|
||||
"ext:deno_node/internal/streams/state.mjs": "../ext/node/polyfills/internal/streams/state.mjs",
|
||||
"ext:deno_node/internal/streams/transform.mjs": "../ext/node/polyfills/internal/streams/transform.mjs",
|
||||
"ext:deno_node/internal/streams/utils.mjs": "../ext/node/polyfills/internal/streams/utils.mjs",
|
||||
"ext:deno_node/internal/streams/writable.mjs": "../ext/node/polyfills/internal/streams/writable.mjs",
|
||||
"node:_stream_transform": "../ext/node/polyfills/internal/streams/transform.mjs",
|
||||
"node:_stream_writable": "../ext/node/polyfills/internal/streams/writable.mjs",
|
||||
"ext:deno_node/internal/test/binding.ts": "../ext/node/polyfills/internal/test/binding.ts",
|
||||
"ext:deno_node/internal/timers.mjs": "../ext/node/polyfills/internal/timers.mjs",
|
||||
"ext:deno_node/internal/url.ts": "../ext/node/polyfills/internal/url.ts",
|
||||
|
|
|
@ -220,7 +220,7 @@ async function ensureNoNewITests() {
|
|||
"pm_tests.rs": 0,
|
||||
"publish_tests.rs": 0,
|
||||
"repl_tests.rs": 0,
|
||||
"run_tests.rs": 338,
|
||||
"run_tests.rs": 336,
|
||||
"shared_library_tests.rs": 0,
|
||||
"task_tests.rs": 4,
|
||||
"test_tests.rs": 74,
|
||||
|
|
Loading…
Reference in a new issue