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]]
|
[[package]]
|
||||||
name = "deno"
|
name = "deno"
|
||||||
version = "2.0.0-rc.1"
|
version = "2.0.0-rc.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "deno"
|
name = "deno"
|
||||||
version = "2.0.0-rc.1"
|
version = "2.0.0-rc.2"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
default-run = "deno"
|
default-run = "deno"
|
||||||
edition.workspace = true
|
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.",
|
"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") {
|
} else if msg.contains("WebSocketStream is not defined") {
|
||||||
return vec![
|
return vec![
|
||||||
FixSuggestion::info("new WebSocketStream() is an unstable API."),
|
FixSuggestion::info("new WebSocketStream() is an unstable API."),
|
||||||
|
|
|
@ -32,9 +32,7 @@ delete Object.prototype.__proto__;
|
||||||
/** @type {ReadonlySet<string>} */
|
/** @type {ReadonlySet<string>} */
|
||||||
const unstableDenoProps = new Set([
|
const unstableDenoProps = new Set([
|
||||||
"AtomicOperation",
|
"AtomicOperation",
|
||||||
"CreateHttpClientOptions",
|
|
||||||
"DatagramConn",
|
"DatagramConn",
|
||||||
"HttpClient",
|
|
||||||
"Kv",
|
"Kv",
|
||||||
"KvListIterator",
|
"KvListIterator",
|
||||||
"KvU64",
|
"KvU64",
|
||||||
|
@ -44,7 +42,6 @@ delete Object.prototype.__proto__;
|
||||||
"UnsafeFnPointer",
|
"UnsafeFnPointer",
|
||||||
"UnixConnectOptions",
|
"UnixConnectOptions",
|
||||||
"UnixListenOptions",
|
"UnixListenOptions",
|
||||||
"createHttpClient",
|
|
||||||
"dlopen",
|
"dlopen",
|
||||||
"listen",
|
"listen",
|
||||||
"listenDatagram",
|
"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,
|
filename: string | URL,
|
||||||
symbols: S,
|
symbols: S,
|
||||||
): DynamicLibrary<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;
|
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.
|
/** **UNSTABLE**: New API, yet to be vetted.
|
||||||
*
|
*
|
||||||
* Represents membership of a IPv4 multicast group.
|
* 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;
|
reason: GPUPipelineErrorReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @category GPU */
|
||||||
* @category GPU
|
|
||||||
* @
|
|
||||||
*/
|
|
||||||
declare type GPUPipelineErrorReason = "validation" | "internal";
|
declare type GPUPipelineErrorReason = "validation" | "internal";
|
||||||
|
|
||||||
/**
|
/** @category GPU */
|
||||||
* @category GPU
|
|
||||||
* @
|
|
||||||
*/
|
|
||||||
declare class GPUShaderModule implements GPUObjectBase {
|
declare class GPUShaderModule implements GPUObjectBase {
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
@ -1150,10 +1144,7 @@ declare interface GPURenderPassColorAttachment {
|
||||||
storeOp: GPUStoreOp;
|
storeOp: GPUStoreOp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @category GPU */
|
||||||
* @category GPU
|
|
||||||
* @
|
|
||||||
*/
|
|
||||||
declare interface GPURenderPassDepthStencilAttachment {
|
declare interface GPURenderPassDepthStencilAttachment {
|
||||||
view: GPUTextureView;
|
view: GPUTextureView;
|
||||||
|
|
||||||
|
|
|
@ -90,13 +90,6 @@ static USE_WRITEV: Lazy<bool> = Lazy::new(|| {
|
||||||
false
|
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.
|
/// 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
|
/// 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_write.mjs",
|
||||||
"_fs/_fs_writeFile.ts",
|
"_fs/_fs_writeFile.ts",
|
||||||
"_fs/_fs_writev.mjs",
|
"_fs/_fs_writev.mjs",
|
||||||
"_http_agent.mjs",
|
|
||||||
"_http_common.ts",
|
|
||||||
"_http_outgoing.ts",
|
|
||||||
"_next_tick.ts",
|
"_next_tick.ts",
|
||||||
"_process/exiting.ts",
|
"_process/exiting.ts",
|
||||||
"_process/process.ts",
|
"_process/process.ts",
|
||||||
"_process/streams.mjs",
|
"_process/streams.mjs",
|
||||||
"_readline.mjs",
|
"_readline.mjs",
|
||||||
"_stream.mjs",
|
"_stream.mjs",
|
||||||
"_tls_common.ts",
|
|
||||||
"_tls_wrap.ts",
|
|
||||||
"_util/_util_callbackify.js",
|
"_util/_util_callbackify.js",
|
||||||
"_util/asserts.ts",
|
"_util/asserts.ts",
|
||||||
"_util/async.ts",
|
"_util/async.ts",
|
||||||
|
@ -547,15 +542,10 @@ deno_core::extension!(deno_node,
|
||||||
"internal/streams/add-abort-signal.mjs",
|
"internal/streams/add-abort-signal.mjs",
|
||||||
"internal/streams/buffer_list.mjs",
|
"internal/streams/buffer_list.mjs",
|
||||||
"internal/streams/destroy.mjs",
|
"internal/streams/destroy.mjs",
|
||||||
"internal/streams/duplex.mjs",
|
|
||||||
"internal/streams/end-of-stream.mjs",
|
"internal/streams/end-of-stream.mjs",
|
||||||
"internal/streams/lazy_transform.mjs",
|
"internal/streams/lazy_transform.mjs",
|
||||||
"internal/streams/passthrough.mjs",
|
|
||||||
"internal/streams/readable.mjs",
|
|
||||||
"internal/streams/state.mjs",
|
"internal/streams/state.mjs",
|
||||||
"internal/streams/transform.mjs",
|
|
||||||
"internal/streams/utils.mjs",
|
"internal/streams/utils.mjs",
|
||||||
"internal/streams/writable.mjs",
|
|
||||||
"internal/test/binding.ts",
|
"internal/test/binding.ts",
|
||||||
"internal/timers.mjs",
|
"internal/timers.mjs",
|
||||||
"internal/url.ts",
|
"internal/url.ts",
|
||||||
|
@ -576,6 +566,17 @@ deno_core::extension!(deno_node,
|
||||||
"path/mod.ts",
|
"path/mod.ts",
|
||||||
"path/separator.ts",
|
"path/separator.ts",
|
||||||
"readline/promises.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" = "assert.ts",
|
||||||
"node:assert/strict" = "assert/strict.ts",
|
"node:assert/strict" = "assert/strict.ts",
|
||||||
"node:async_hooks" = "async_hooks.ts",
|
"node:async_hooks" = "async_hooks.ts",
|
||||||
|
|
|
@ -67,13 +67,17 @@ const {
|
||||||
|
|
||||||
import { nodeGlobals } from "ext:deno_node/00_globals.js";
|
import { nodeGlobals } from "ext:deno_node/00_globals.js";
|
||||||
|
|
||||||
import _httpAgent from "ext:deno_node/_http_agent.mjs";
|
import _httpAgent from "node:_http_agent";
|
||||||
import _httpOutgoing from "ext:deno_node/_http_outgoing.ts";
|
import _httpCommon from "node:_http_common";
|
||||||
import _streamDuplex from "ext:deno_node/internal/streams/duplex.mjs";
|
import _httpOutgoing from "node:_http_outgoing";
|
||||||
import _streamPassthrough from "ext:deno_node/internal/streams/passthrough.mjs";
|
import _httpServer from "node:_http_server";
|
||||||
import _streamReadable from "ext:deno_node/internal/streams/readable.mjs";
|
import _streamDuplex from "node:_stream_duplex";
|
||||||
import _streamTransform from "ext:deno_node/internal/streams/transform.mjs";
|
import _streamPassthrough from "node:_stream_passthrough";
|
||||||
import _streamWritable from "ext:deno_node/internal/streams/writable.mjs";
|
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 assert from "node:assert";
|
||||||
import assertStrict from "node:assert/strict";
|
import assertStrict from "node:assert/strict";
|
||||||
import asyncHooks from "node:async_hooks";
|
import asyncHooks from "node:async_hooks";
|
||||||
|
@ -163,12 +167,16 @@ const builtinModules = [];
|
||||||
function setupBuiltinModules() {
|
function setupBuiltinModules() {
|
||||||
const nodeModules = {
|
const nodeModules = {
|
||||||
"_http_agent": _httpAgent,
|
"_http_agent": _httpAgent,
|
||||||
|
"_http_common": _httpCommon,
|
||||||
"_http_outgoing": _httpOutgoing,
|
"_http_outgoing": _httpOutgoing,
|
||||||
|
"_http_server": _httpServer,
|
||||||
"_stream_duplex": _streamDuplex,
|
"_stream_duplex": _streamDuplex,
|
||||||
"_stream_passthrough": _streamPassthrough,
|
"_stream_passthrough": _streamPassthrough,
|
||||||
"_stream_readable": _streamReadable,
|
"_stream_readable": _streamReadable,
|
||||||
"_stream_transform": _streamTransform,
|
"_stream_transform": _streamTransform,
|
||||||
"_stream_writable": _streamWritable,
|
"_stream_writable": _streamWritable,
|
||||||
|
"_tls_common": _tlsCommon,
|
||||||
|
"_tls_wrap": _tlsWrap,
|
||||||
assert,
|
assert,
|
||||||
"assert/strict": assertStrict,
|
"assert/strict": assertStrict,
|
||||||
"async_hooks": asyncHooks,
|
"async_hooks": asyncHooks,
|
||||||
|
|
|
@ -2,8 +2,53 @@
|
||||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { primordials } from "ext:core/mod.js";
|
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!#$%&'*+.|~]+$/);
|
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
|
* Verifies that the given val is a valid HTTP token
|
||||||
* per the rules defined in RFC 7230
|
* 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 chunkExpression = new SafeRegExp(/(?:^|\W)chunked(?:$|\W)/i);
|
||||||
|
export const continueExpression = new SafeRegExp(
|
||||||
|
/(?:^|\W)100-continue(?:$|\W)/i,
|
||||||
|
);
|
||||||
|
|
||||||
export {
|
export {
|
||||||
checkInvalidHeaderChar as _checkInvalidHeaderChar,
|
checkInvalidHeaderChar as _checkInvalidHeaderChar,
|
||||||
checkIsHttpToken as _checkIsHttpToken,
|
checkIsHttpToken as _checkIsHttpToken,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
_checkInvalidHeaderChar: checkInvalidHeaderChar,
|
||||||
|
_checkIsHttpToken: checkIsHttpToken,
|
||||||
|
chunkExpression,
|
||||||
|
CRLF,
|
||||||
|
continueExpression,
|
||||||
|
kIncomingMessage,
|
||||||
|
methods,
|
||||||
|
};
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
_checkInvalidHeaderChar as checkInvalidHeaderChar,
|
_checkInvalidHeaderChar as checkInvalidHeaderChar,
|
||||||
_checkIsHttpToken as checkIsHttpToken,
|
_checkIsHttpToken as checkIsHttpToken,
|
||||||
chunkExpression as RE_TE_CHUNKED,
|
chunkExpression as RE_TE_CHUNKED,
|
||||||
} from "ext:deno_node/_http_common.ts";
|
} from "node:_http_common";
|
||||||
import {
|
import {
|
||||||
defaultTriggerAsyncIdScope,
|
defaultTriggerAsyncIdScope,
|
||||||
symbols,
|
symbols,
|
||||||
|
@ -54,6 +54,8 @@ let debug = debuglog("http", (fn) => {
|
||||||
|
|
||||||
const HIGH_WATER_MARK = getDefaultHighWaterMark();
|
const HIGH_WATER_MARK = getDefaultHighWaterMark();
|
||||||
|
|
||||||
|
export const kUniqueHeaders = Symbol("kUniqueHeaders");
|
||||||
|
export const kHighWaterMark = Symbol("kHighWaterMark");
|
||||||
const kCorked = Symbol("corked");
|
const kCorked = Symbol("corked");
|
||||||
|
|
||||||
const nop = () => {};
|
const nop = () => {};
|
||||||
|
@ -891,6 +893,8 @@ function _onFinish(outmsg: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
kUniqueHeaders,
|
||||||
|
kHighWaterMark,
|
||||||
validateHeaderName,
|
validateHeaderName,
|
||||||
validateHeaderValue,
|
validateHeaderValue,
|
||||||
parseUniqueHeadersOption,
|
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) {
|
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
|
||||||
return Buffer2.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
return Buffer2.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
||||||
};
|
};
|
||||||
|
Stream._isArrayBufferView = isArrayBufferView;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
/* End esm.sh bundle */
|
/* End esm.sh bundle */
|
||||||
|
@ -5311,11 +5312,15 @@ export const Duplex = CustomStream.Duplex;
|
||||||
export const PassThrough = CustomStream.PassThrough;
|
export const PassThrough = CustomStream.PassThrough;
|
||||||
export const Stream = CustomStream.Stream;
|
export const Stream = CustomStream.Stream;
|
||||||
export const Transform = CustomStream.Transform;
|
export const Transform = CustomStream.Transform;
|
||||||
|
export const _isArrayBufferView = isArrayBufferView;
|
||||||
export const _isUint8Array = CustomStream._isUint8Array;
|
export const _isUint8Array = CustomStream._isUint8Array;
|
||||||
export const _uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
|
export const _uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
|
||||||
export const addAbortSignal = CustomStream.addAbortSignal;
|
export const addAbortSignal = CustomStream.addAbortSignal;
|
||||||
export const pipeline = CustomStream.pipeline;
|
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) {
|
function isWritableStream(object) {
|
||||||
return object instanceof WritableStream;
|
return object instanceof WritableStream;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from "ext:deno_node/internal/primordials.mjs";
|
} from "ext:deno_node/internal/primordials.mjs";
|
||||||
import assert from "ext:deno_node/internal/assert.mjs";
|
import assert from "ext:deno_node/internal/assert.mjs";
|
||||||
import * as net from "node:net";
|
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 { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts";
|
||||||
import { connResetException } from "ext:deno_node/internal/errors.ts";
|
import { connResetException } from "ext:deno_node/internal/errors.ts";
|
||||||
import { emitWarning } from "node:process";
|
import { emitWarning } from "node:process";
|
||||||
|
|
|
@ -157,7 +157,72 @@ export function executionAsyncResource() {
|
||||||
return {};
|
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 {
|
class AsyncHook {
|
||||||
enable() {
|
enable() {
|
||||||
|
|
|
@ -7,6 +7,7 @@ export {
|
||||||
Buffer,
|
Buffer,
|
||||||
constants,
|
constants,
|
||||||
default,
|
default,
|
||||||
|
INSPECT_MAX_BYTES,
|
||||||
isAscii,
|
isAscii,
|
||||||
isUtf8,
|
isUtf8,
|
||||||
kMaxLength,
|
kMaxLength,
|
||||||
|
|
|
@ -15,9 +15,20 @@ function emitError(e) {
|
||||||
this.emit("error", 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() {
|
export function create() {
|
||||||
return new Domain();
|
return new Domain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createDomain() {
|
||||||
|
return new Domain();
|
||||||
|
}
|
||||||
|
|
||||||
export class Domain extends EventEmitter {
|
export class Domain extends EventEmitter {
|
||||||
#handler;
|
#handler;
|
||||||
|
|
||||||
|
@ -85,6 +96,9 @@ export class Domain extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
|
_stack,
|
||||||
create,
|
create,
|
||||||
|
active,
|
||||||
|
createDomain,
|
||||||
Domain,
|
Domain,
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,16 +36,16 @@ import {
|
||||||
Writable as NodeWritable,
|
Writable as NodeWritable,
|
||||||
} from "node:stream";
|
} from "node:stream";
|
||||||
import {
|
import {
|
||||||
|
kUniqueHeaders,
|
||||||
OutgoingMessage,
|
OutgoingMessage,
|
||||||
parseUniqueHeadersOption,
|
parseUniqueHeadersOption,
|
||||||
validateHeaderName,
|
validateHeaderName,
|
||||||
validateHeaderValue,
|
validateHeaderValue,
|
||||||
} from "ext:deno_node/_http_outgoing.ts";
|
} from "node:_http_outgoing";
|
||||||
import { ok as assert } from "node:assert";
|
import { ok as assert } from "node:assert";
|
||||||
import { kOutHeaders } from "ext:deno_node/internal/http.ts";
|
import { kOutHeaders } from "ext:deno_node/internal/http.ts";
|
||||||
import { _checkIsHttpToken as checkIsHttpToken } from "ext:deno_node/_http_common.ts";
|
import { _checkIsHttpToken as checkIsHttpToken } from "node:_http_common";
|
||||||
import { Agent, globalAgent } from "ext:deno_node/_http_agent.mjs";
|
import { Agent, globalAgent } from "node:_http_agent";
|
||||||
// import { chunkExpression as RE_TE_CHUNKED } from "ext:deno_node/_http_common.ts";
|
|
||||||
import { urlToHttpOptions } from "ext:deno_node/internal/url.ts";
|
import { urlToHttpOptions } from "ext:deno_node/internal/url.ts";
|
||||||
import { kEmptyObject } from "ext:deno_node/internal/util.mjs";
|
import { kEmptyObject } from "ext:deno_node/internal/util.mjs";
|
||||||
import { constants, TCP } from "ext:deno_node/internal_binding/tcp_wrap.ts";
|
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 { clearTimeout as webClearTimeout } from "ext:deno_web/02_timers.js";
|
||||||
import { resourceForReadableStream } from "ext:deno_web/06_streams.js";
|
import { resourceForReadableStream } from "ext:deno_web/06_streams.js";
|
||||||
import { TcpConn } from "ext:deno_net/01_net.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 { internalRidSymbol } = core;
|
||||||
const { ArrayIsArray } = primordials;
|
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;
|
type Chunk = string | Buffer | Uint8Array;
|
||||||
|
|
||||||
const ENCODER = new TextEncoder();
|
const ENCODER = new TextEncoder();
|
||||||
|
@ -283,8 +117,6 @@ function validateHost(host, name) {
|
||||||
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
|
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
|
||||||
const kError = Symbol("kError");
|
const kError = Symbol("kError");
|
||||||
|
|
||||||
const kUniqueHeaders = Symbol("kUniqueHeaders");
|
|
||||||
|
|
||||||
class FakeSocket extends EventEmitter {
|
class FakeSocket extends EventEmitter {
|
||||||
constructor(
|
constructor(
|
||||||
opts: {
|
opts: {
|
||||||
|
|
|
@ -67,7 +67,7 @@ import {
|
||||||
ERR_SOCKET_CLOSED,
|
ERR_SOCKET_CLOSED,
|
||||||
ERR_STREAM_WRITE_AFTER_END,
|
ERR_STREAM_WRITE_AFTER_END,
|
||||||
} from "ext:deno_node/internal/errors.ts";
|
} from "ext:deno_node/internal/errors.ts";
|
||||||
import { _checkIsHttpToken } from "ext:deno_node/_http_common.ts";
|
import { _checkIsHttpToken } from "node:_http_common";
|
||||||
const {
|
const {
|
||||||
StringPrototypeTrim,
|
StringPrototypeTrim,
|
||||||
FunctionPrototypeBind,
|
FunctionPrototypeBind,
|
||||||
|
@ -2295,7 +2295,7 @@ function onStreamTimeout(kind) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class Http2ServerRequest extends Readable {
|
export class Http2ServerRequest extends Readable {
|
||||||
readableEnded = false;
|
readableEnded = false;
|
||||||
|
|
||||||
constructor(stream, headers, options, rawHeaders) {
|
constructor(stream, headers, options, rawHeaders) {
|
||||||
|
@ -2523,7 +2523,7 @@ function isConnectionHeaderAllowed(name, value) {
|
||||||
value === "trailers";
|
value === "trailers";
|
||||||
}
|
}
|
||||||
|
|
||||||
class Http2ServerResponse extends Stream {
|
export class Http2ServerResponse extends Stream {
|
||||||
writable = false;
|
writable = false;
|
||||||
req = null;
|
req = null;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
IncomingMessageForClient as IncomingMessage,
|
IncomingMessageForClient as IncomingMessage,
|
||||||
type RequestOptions,
|
type RequestOptions,
|
||||||
} from "node:http";
|
} 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 { createHttpClient } from "ext:deno_fetch/22_http_client.js";
|
||||||
import { type ServerHandler, ServerImpl as HttpServer } from "node:http";
|
import { type ServerHandler, ServerImpl as HttpServer } from "node:http";
|
||||||
import { validateObject } from "ext:deno_node/internal/validators.mjs";
|
import { validateObject } from "ext:deno_node/internal/validators.mjs";
|
||||||
|
|
|
@ -65,7 +65,7 @@ const customInspectSymbol =
|
||||||
? Symbol["for"]("nodejs.util.inspect.custom")
|
? Symbol["for"]("nodejs.util.inspect.custom")
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const INSPECT_MAX_BYTES = 50;
|
export const INSPECT_MAX_BYTES = 50;
|
||||||
|
|
||||||
export const constants = {
|
export const constants = {
|
||||||
MAX_LENGTH: kMaxLength,
|
MAX_LENGTH: kMaxLength,
|
||||||
|
@ -2606,6 +2606,7 @@ export default {
|
||||||
constants,
|
constants,
|
||||||
isAscii,
|
isAscii,
|
||||||
isUtf8,
|
isUtf8,
|
||||||
|
INSPECT_MAX_BYTES,
|
||||||
kMaxLength,
|
kMaxLength,
|
||||||
kStringMaxLength,
|
kStringMaxLength,
|
||||||
SlowBuffer,
|
SlowBuffer,
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {
|
||||||
} from "ext:deno_node/internal/validators.mjs";
|
} from "ext:deno_node/internal/validators.mjs";
|
||||||
import { Buffer } from "node:buffer";
|
import { Buffer } from "node:buffer";
|
||||||
import type { WritableOptions } from "ext:deno_node/_stream.d.ts";
|
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 {
|
import type {
|
||||||
BinaryLike,
|
BinaryLike,
|
||||||
BinaryToTextEncoding,
|
BinaryToTextEncoding,
|
||||||
|
|
|
@ -2,9 +2,24 @@
|
||||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||||
// deno-lint-ignore-file
|
// deno-lint-ignore-file
|
||||||
|
|
||||||
|
// TODO(bartlomieju): this should be 64?
|
||||||
|
let defaultHighWaterMarkBytes = 16 * 1024;
|
||||||
|
let defaultHighWaterMarkObjectMode = 16;
|
||||||
|
|
||||||
function getDefaultHighWaterMark(objectMode) {
|
function getDefaultHighWaterMark(objectMode) {
|
||||||
return objectMode ? 16 : 16 * 1024;
|
return objectMode
|
||||||
|
? defaultHighWaterMarkObjectMode
|
||||||
|
: defaultHighWaterMarkBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { getDefaultHighWaterMark };
|
function setDefaultHighWaterMark(objectMode, value) {
|
||||||
export { getDefaultHighWaterMark };
|
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";
|
import { ucs2 } from "ext:deno_node/internal/idna.ts";
|
||||||
|
|
||||||
|
const version = "2.1.0";
|
||||||
|
|
||||||
// deno-lint-ignore no-explicit-any
|
// deno-lint-ignore no-explicit-any
|
||||||
function punyDeprecated(fn: any) {
|
function punyDeprecated(fn: any) {
|
||||||
return deprecate(
|
return deprecate(
|
||||||
|
@ -37,7 +39,7 @@ function encode(domain) {
|
||||||
return punyDeprecated(op_node_idna_punycode_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 {
|
export default {
|
||||||
decode,
|
decode,
|
||||||
|
@ -45,4 +47,5 @@ export default {
|
||||||
toASCII,
|
toASCII,
|
||||||
toUnicode,
|
toUnicode,
|
||||||
ucs2,
|
ucs2,
|
||||||
|
version,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
// Copyright Joyent and Node contributors. 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";
|
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 {
|
export class REPLServer {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -61,4 +66,6 @@ export default {
|
||||||
builtinModules,
|
builtinModules,
|
||||||
_builtinLibs,
|
_builtinLibs,
|
||||||
start,
|
start,
|
||||||
|
REPL_MODE_SLOPPY,
|
||||||
|
REPL_MODE_STRICT,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,14 +4,19 @@
|
||||||
|
|
||||||
// @deno-types="./_stream.d.ts"
|
// @deno-types="./_stream.d.ts"
|
||||||
import {
|
import {
|
||||||
|
_isArrayBufferView,
|
||||||
_isUint8Array,
|
_isUint8Array,
|
||||||
_uint8ArrayToBuffer,
|
_uint8ArrayToBuffer,
|
||||||
addAbortSignal,
|
addAbortSignal,
|
||||||
// compose,
|
compose,
|
||||||
// destroy,
|
destroy,
|
||||||
Duplex,
|
Duplex,
|
||||||
finished,
|
finished,
|
||||||
// isDisturbed,
|
isDestroyed,
|
||||||
|
isDisturbed,
|
||||||
|
isErrored,
|
||||||
|
isReadable,
|
||||||
|
isWritable,
|
||||||
PassThrough,
|
PassThrough,
|
||||||
pipeline,
|
pipeline,
|
||||||
Readable,
|
Readable,
|
||||||
|
@ -21,18 +26,28 @@ import {
|
||||||
} from "ext:deno_node/_stream.mjs";
|
} from "ext:deno_node/_stream.mjs";
|
||||||
import {
|
import {
|
||||||
getDefaultHighWaterMark,
|
getDefaultHighWaterMark,
|
||||||
|
setDefaultHighWaterMark,
|
||||||
} from "ext:deno_node/internal/streams/state.mjs";
|
} from "ext:deno_node/internal/streams/state.mjs";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
_isArrayBufferView,
|
||||||
_isUint8Array,
|
_isUint8Array,
|
||||||
_uint8ArrayToBuffer,
|
_uint8ArrayToBuffer,
|
||||||
addAbortSignal,
|
addAbortSignal,
|
||||||
|
compose,
|
||||||
|
destroy,
|
||||||
Duplex,
|
Duplex,
|
||||||
finished,
|
finished,
|
||||||
getDefaultHighWaterMark,
|
getDefaultHighWaterMark,
|
||||||
|
isDestroyed,
|
||||||
|
isDisturbed,
|
||||||
|
isErrored,
|
||||||
|
isReadable,
|
||||||
|
isWritable,
|
||||||
PassThrough,
|
PassThrough,
|
||||||
pipeline,
|
pipeline,
|
||||||
Readable,
|
Readable,
|
||||||
|
setDefaultHighWaterMark,
|
||||||
Stream,
|
Stream,
|
||||||
Transform,
|
Transform,
|
||||||
Writable,
|
Writable,
|
||||||
|
|
|
@ -19,10 +19,16 @@ import {
|
||||||
TextDecoderStream,
|
TextDecoderStream,
|
||||||
TextEncoderStream,
|
TextEncoderStream,
|
||||||
} from "ext:deno_web/08_text_encoding.js";
|
} from "ext:deno_web/08_text_encoding.js";
|
||||||
|
import {
|
||||||
|
CompressionStream,
|
||||||
|
DecompressionStream,
|
||||||
|
} from "ext:deno_web/14_compression.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
ByteLengthQueuingStrategy,
|
ByteLengthQueuingStrategy,
|
||||||
|
CompressionStream,
|
||||||
CountQueuingStrategy,
|
CountQueuingStrategy,
|
||||||
|
DecompressionStream,
|
||||||
ReadableByteStreamController,
|
ReadableByteStreamController,
|
||||||
ReadableStream,
|
ReadableStream,
|
||||||
ReadableStreamBYOBReader,
|
ReadableStreamBYOBReader,
|
||||||
|
@ -39,19 +45,21 @@ export {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
ByteLengthQueuingStrategy,
|
||||||
|
CompressionStream,
|
||||||
|
CountQueuingStrategy,
|
||||||
|
DecompressionStream,
|
||||||
|
ReadableByteStreamController,
|
||||||
ReadableStream,
|
ReadableStream,
|
||||||
ReadableStreamBYOBReader,
|
ReadableStreamBYOBReader,
|
||||||
ReadableStreamBYOBRequest,
|
ReadableStreamBYOBRequest,
|
||||||
ReadableStreamDefaultReader,
|
|
||||||
ReadableByteStreamController,
|
|
||||||
ReadableStreamDefaultController,
|
ReadableStreamDefaultController,
|
||||||
|
ReadableStreamDefaultReader,
|
||||||
|
TextDecoderStream,
|
||||||
|
TextEncoderStream,
|
||||||
TransformStream,
|
TransformStream,
|
||||||
TransformStreamDefaultController,
|
TransformStreamDefaultController,
|
||||||
WritableStream,
|
WritableStream,
|
||||||
WritableStreamDefaultWriter,
|
|
||||||
WritableStreamDefaultController,
|
WritableStreamDefaultController,
|
||||||
ByteLengthQueuingStrategy,
|
WritableStreamDefaultWriter,
|
||||||
CountQueuingStrategy,
|
|
||||||
TextEncoderStream,
|
|
||||||
TextDecoderStream,
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,4 +17,5 @@ export default {
|
||||||
setTimeout,
|
setTimeout,
|
||||||
setImmediate,
|
setImmediate,
|
||||||
setInterval,
|
setInterval,
|
||||||
|
scheduler,
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
// deno-lint-ignore-file prefer-primordials
|
// deno-lint-ignore-file prefer-primordials
|
||||||
|
|
||||||
import { notImplemented } from "ext:deno_node/_utils.ts";
|
import { notImplemented } from "ext:deno_node/_utils.ts";
|
||||||
import tlsCommon from "ext:deno_node/_tls_common.ts";
|
import tlsCommon from "node:_tls_common";
|
||||||
import tlsWrap from "ext:deno_node/_tls_wrap.ts";
|
import tlsWrap from "node:_tls_wrap";
|
||||||
|
|
||||||
// openssl -> rustls
|
// openssl -> rustls
|
||||||
const cipherMap = {
|
const cipherMap = {
|
||||||
|
@ -34,6 +34,8 @@ export const rootCertificates = undefined;
|
||||||
export const DEFAULT_ECDH_CURVE = "auto";
|
export const DEFAULT_ECDH_CURVE = "auto";
|
||||||
export const DEFAULT_MAX_VERSION = "TLSv1.3";
|
export const DEFAULT_MAX_VERSION = "TLSv1.3";
|
||||||
export const DEFAULT_MIN_VERSION = "TLSv1.2";
|
export const DEFAULT_MIN_VERSION = "TLSv1.2";
|
||||||
|
export const CLIENT_RENEG_LIMIT = 3;
|
||||||
|
export const CLIENT_RENEG_WINDOW = 600;
|
||||||
|
|
||||||
export class CryptoStream {}
|
export class CryptoStream {}
|
||||||
export class SecurePair {}
|
export class SecurePair {}
|
||||||
|
@ -58,6 +60,8 @@ export default {
|
||||||
DEFAULT_ECDH_CURVE,
|
DEFAULT_ECDH_CURVE,
|
||||||
DEFAULT_MAX_VERSION,
|
DEFAULT_MAX_VERSION,
|
||||||
DEFAULT_MIN_VERSION,
|
DEFAULT_MIN_VERSION,
|
||||||
|
CLIENT_RENEG_LIMIT,
|
||||||
|
CLIENT_RENEG_WINDOW,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkServerIdentity = tlsWrap.checkServerIdentity;
|
export const checkServerIdentity = tlsWrap.checkServerIdentity;
|
||||||
|
|
|
@ -78,20 +78,15 @@ export class ZlibBase {
|
||||||
export { constants };
|
export { constants };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Options,
|
brotliCompress,
|
||||||
BrotliOptions,
|
|
||||||
BrotliCompress,
|
BrotliCompress,
|
||||||
|
brotliCompressSync,
|
||||||
|
brotliDecompress,
|
||||||
BrotliDecompress,
|
BrotliDecompress,
|
||||||
Deflate,
|
brotliDecompressSync,
|
||||||
DeflateRaw,
|
BrotliOptions,
|
||||||
Gunzip,
|
|
||||||
Gzip,
|
|
||||||
Inflate,
|
|
||||||
InflateRaw,
|
|
||||||
Unzip,
|
|
||||||
ZlibBase,
|
|
||||||
constants,
|
|
||||||
codes,
|
codes,
|
||||||
|
constants,
|
||||||
createBrotliCompress,
|
createBrotliCompress,
|
||||||
createBrotliDecompress,
|
createBrotliDecompress,
|
||||||
createDeflate,
|
createDeflate,
|
||||||
|
@ -101,24 +96,73 @@ export default {
|
||||||
createInflate,
|
createInflate,
|
||||||
createInflateRaw,
|
createInflateRaw,
|
||||||
createUnzip,
|
createUnzip,
|
||||||
brotliCompress,
|
|
||||||
brotliCompressSync,
|
|
||||||
brotliDecompress,
|
|
||||||
brotliDecompressSync,
|
|
||||||
deflate,
|
deflate,
|
||||||
deflateSync,
|
Deflate,
|
||||||
|
DEFLATE: constants.DEFLATE,
|
||||||
deflateRaw,
|
deflateRaw,
|
||||||
|
DeflateRaw,
|
||||||
|
DEFLATERAW: constants.DEFLATERAW,
|
||||||
deflateRawSync,
|
deflateRawSync,
|
||||||
|
deflateSync,
|
||||||
gunzip,
|
gunzip,
|
||||||
|
Gunzip,
|
||||||
|
GUNZIP: constants.GUNZIP,
|
||||||
gunzipSync,
|
gunzipSync,
|
||||||
gzip,
|
gzip,
|
||||||
|
Gzip,
|
||||||
|
GZIP: constants.GZIP,
|
||||||
gzipSync,
|
gzipSync,
|
||||||
inflate,
|
inflate,
|
||||||
inflateSync,
|
Inflate,
|
||||||
|
INFLATE: constants.INFLATE,
|
||||||
inflateRaw,
|
inflateRaw,
|
||||||
|
InflateRaw,
|
||||||
|
INFLATERAW: constants.INFLATERAW,
|
||||||
inflateRawSync,
|
inflateRawSync,
|
||||||
|
inflateSync,
|
||||||
|
Options,
|
||||||
unzip,
|
unzip,
|
||||||
|
Unzip,
|
||||||
|
UNZIP: constants.UNZIP,
|
||||||
unzipSync,
|
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 {
|
export {
|
||||||
|
|
|
@ -126,6 +126,8 @@ const denoNs = {
|
||||||
uid: os.uid,
|
uid: os.uid,
|
||||||
Command: process.Command,
|
Command: process.Command,
|
||||||
ChildProcess: process.ChildProcess,
|
ChildProcess: process.ChildProcess,
|
||||||
|
httpClient: httpClient.httpClient,
|
||||||
|
createHttpClient: httpClient.createHttpClient,
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE(bartlomieju): keep IDs in sync with `cli/main.rs`
|
// NOTE(bartlomieju): keep IDs in sync with `cli/main.rs`
|
||||||
|
|
|
@ -83,7 +83,7 @@ pub static UNSTABLE_GRANULAR_FLAGS: &[UnstableGranularFlag] = &[
|
||||||
UnstableGranularFlag {
|
UnstableGranularFlag {
|
||||||
name: ops::http::UNSTABLE_FEATURE_NAME,
|
name: ops::http::UNSTABLE_FEATURE_NAME,
|
||||||
help_text: "Enable unstable HTTP APIs",
|
help_text: "Enable unstable HTTP APIs",
|
||||||
show_in_help: true,
|
show_in_help: false,
|
||||||
id: 5,
|
id: 5,
|
||||||
},
|
},
|
||||||
UnstableGranularFlag {
|
UnstableGranularFlag {
|
||||||
|
|
|
@ -57,8 +57,6 @@ fn op_http_start(
|
||||||
.resource_table
|
.resource_table
|
||||||
.take::<deno_net::io::UnixStreamResource>(tcp_stream_rid)
|
.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
|
// 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
|
// 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
|
// resource error. See also: https://github.com/denoland/deno/pull/16242
|
||||||
|
|
|
@ -122,9 +122,8 @@ fn js_unit_test(test: String) {
|
||||||
.arg("--no-lock")
|
.arg("--no-lock")
|
||||||
// TODO(bartlomieju): would be better if we could apply this unstable
|
// 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
|
// 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-net")
|
||||||
.arg("--unstable-http")
|
|
||||||
.arg("--location=http://127.0.0.1:4545/")
|
.arg("--location=http://127.0.0.1:4545/")
|
||||||
.arg("--no-prompt");
|
.arg("--no-prompt");
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,6 @@ fn node_unit_test(test: String) {
|
||||||
.arg(deno_config_path())
|
.arg(deno_config_path())
|
||||||
.arg("--no-lock")
|
.arg("--no-lock")
|
||||||
.arg("--unstable-broadcast-channel")
|
.arg("--unstable-broadcast-channel")
|
||||||
.arg("--unstable-http")
|
|
||||||
.arg("--unstable-net")
|
.arg("--unstable-net")
|
||||||
// TODO(kt3k): This option is required to pass tls_test.ts,
|
// TODO(kt3k): This option is required to pass tls_test.ts,
|
||||||
// but this shouldn't be necessary. tls.connect currently doesn't
|
// 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",
|
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 {
|
itest!(unstable_net_disabled {
|
||||||
args: "run --quiet --reload --allow-read run/unstable_net.js",
|
args: "run --quiet --reload --allow-read run/unstable_net.js",
|
||||||
output: "run/unstable_net.disabled.out",
|
output: "run/unstable_net.disabled.out",
|
||||||
|
|
|
@ -108,7 +108,6 @@ async function testFetchProgrammaticProxy() {
|
||||||
"--quiet",
|
"--quiet",
|
||||||
"--reload",
|
"--reload",
|
||||||
"--allow-net=localhost:4545,localhost:4555",
|
"--allow-net=localhost:4545,localhost:4555",
|
||||||
"--unstable-http",
|
|
||||||
"programmatic_proxy_client.ts",
|
"programmatic_proxy_client.ts",
|
||||||
],
|
],
|
||||||
}).output();
|
}).output();
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
"exitCode": 1,
|
"exitCode": 1,
|
||||||
"output": "cron.out"
|
"output": "cron.out"
|
||||||
},
|
},
|
||||||
"http": {
|
|
||||||
"args": "run http.ts",
|
|
||||||
"exitCode": 1,
|
|
||||||
"output": "http.out"
|
|
||||||
},
|
|
||||||
"http_wss": {
|
"http_wss": {
|
||||||
"args": "run http_wss.ts",
|
"args": "run http_wss.ts",
|
||||||
"exitCode": 1,
|
"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,
|
assertStringIncludes,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
delay,
|
delay,
|
||||||
DENO_FUTURE,
|
|
||||||
fail,
|
fail,
|
||||||
unimplemented,
|
unimplemented,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
@ -1359,7 +1358,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
{ permissions: { read: true, net: true } },
|
||||||
async function fetchCustomClientPrivateKey(): Promise<
|
async function fetchCustomClientPrivateKey(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
DENO_FUTURE,
|
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
import { copy } from "@std/io/copy";
|
import { copy } from "@std/io/copy";
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ Deno.test(function filesStdioFileDescriptors() {
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function filesCopyToStdout() {
|
async function filesCopyToStdout() {
|
||||||
const filename = "tests/testdata/assets/fixture.json";
|
const filename = "tests/testdata/assets/fixture.json";
|
||||||
using file = await Deno.open(filename);
|
using file = await Deno.open(filename);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// deno-lint-ignore-file no-window-prefix no-window
|
|
||||||
import {
|
import {
|
||||||
assert,
|
assert,
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
DENO_FUTURE,
|
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
Deno.test(function globalThisExists() {
|
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() {
|
Deno.test(function selfExists() {
|
||||||
assert(self != null);
|
assert(self != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function windowWindowExists() {
|
Deno.test(function globalThisWindowEqualsUndefined() {
|
||||||
assert(window.window === window);
|
assert(globalThis.window === undefined);
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function windowSelfExists() {
|
|
||||||
assert(window.self === window);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisEqualsWindow() {
|
|
||||||
assert(globalThis === window);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(function globalThisEqualsSelf() {
|
Deno.test(function globalThisEqualsSelf() {
|
||||||
assert(globalThis === self);
|
assert(globalThis === self);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function globalThisInstanceofWindow() {
|
|
||||||
assert(globalThis instanceof Window);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test(function globalThisConstructorLength() {
|
Deno.test(function globalThisConstructorLength() {
|
||||||
assert(globalThis.constructor.length === 0);
|
assert(globalThis.constructor.length === 0);
|
||||||
});
|
});
|
||||||
|
@ -66,10 +48,6 @@ Deno.test(function DenoNamespaceExists() {
|
||||||
assert(Deno != null);
|
assert(Deno != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, function DenoNamespaceEqualsWindowDeno() {
|
|
||||||
assert(Deno === window.Deno);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test(function DenoNamespaceIsNotFrozen() {
|
Deno.test(function DenoNamespaceIsNotFrozen() {
|
||||||
assert(!Object.isFrozen(Deno));
|
assert(!Object.isFrozen(Deno));
|
||||||
});
|
});
|
||||||
|
@ -120,11 +98,7 @@ Deno.test(async function windowQueueMicrotask() {
|
||||||
res();
|
res();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (DENO_FUTURE) {
|
globalThis.queueMicrotask(resolve1!);
|
||||||
globalThis.queueMicrotask(resolve1!);
|
|
||||||
} else {
|
|
||||||
window.queueMicrotask(resolve1!);
|
|
||||||
}
|
|
||||||
setTimeout(resolve2!, 0);
|
setTimeout(resolve2!, 0);
|
||||||
await p1;
|
await p1;
|
||||||
await p2;
|
await p2;
|
||||||
|
@ -143,18 +117,9 @@ Deno.test(function webApiGlobalThis() {
|
||||||
Deno.test(function windowNameIsDefined() {
|
Deno.test(function windowNameIsDefined() {
|
||||||
assertEquals(typeof globalThis.name, "string");
|
assertEquals(typeof globalThis.name, "string");
|
||||||
assertEquals(name, "");
|
assertEquals(name, "");
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertEquals(window.name, name);
|
|
||||||
}
|
|
||||||
name = "foobar";
|
name = "foobar";
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertEquals(window.name, "foobar");
|
|
||||||
}
|
|
||||||
assertEquals(name, "foobar");
|
assertEquals(name, "foobar");
|
||||||
name = "";
|
name = "";
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertEquals(window.name, "");
|
|
||||||
}
|
|
||||||
assertEquals(name, "");
|
assertEquals(name, "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {
|
||||||
assertThrows,
|
assertThrows,
|
||||||
curlRequest,
|
curlRequest,
|
||||||
curlRequestWithStdErr,
|
curlRequestWithStdErr,
|
||||||
DENO_FUTURE,
|
|
||||||
execCode,
|
execCode,
|
||||||
execCode3,
|
execCode3,
|
||||||
fail,
|
fail,
|
||||||
|
@ -20,7 +19,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
// Since these tests may run in parallel, ensure this port is unique to this file
|
// 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 {
|
const {
|
||||||
upgradeHttpRaw,
|
upgradeHttpRaw,
|
||||||
|
|
|
@ -25,9 +25,6 @@ export { delay } from "@std/async/delay";
|
||||||
export { readLines } from "@std/io/read-lines";
|
export { readLines } from "@std/io/read-lines";
|
||||||
export { parseArgs } from "@std/cli/parse-args";
|
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 {
|
export function pathToAbsoluteFileUrl(path: string): URL {
|
||||||
path = resolve(path);
|
path = resolve(path);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertNotEquals,
|
assertNotEquals,
|
||||||
delay,
|
delay,
|
||||||
DENO_FUTURE,
|
|
||||||
execCode,
|
execCode,
|
||||||
unreachable,
|
unreachable,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
@ -312,62 +311,10 @@ Deno.test(async function timeoutCallbackThis() {
|
||||||
};
|
};
|
||||||
setTimeout(obj.foo, 1);
|
setTimeout(obj.foo, 1);
|
||||||
await promise;
|
await promise;
|
||||||
if (!DENO_FUTURE) {
|
assertEquals(capturedThis, globalThis);
|
||||||
assertEquals(capturedThis, window);
|
|
||||||
} else {
|
|
||||||
assertEquals(capturedThis, globalThis);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({ ignore: DENO_FUTURE }, async function timeoutBindThis() {
|
Deno.test(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() {
|
|
||||||
const thisCheckPassed = [null, undefined, globalThis];
|
const thisCheckPassed = [null, undefined, globalThis];
|
||||||
|
|
||||||
const thisCheckFailed = [
|
const thisCheckFailed = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertStrictEquals,
|
assertStrictEquals,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
DENO_FUTURE,
|
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
import { BufReader, BufWriter } from "@std/io";
|
import { BufReader, BufWriter } from "@std/io";
|
||||||
import { readAll } from "@std/io/read-all";
|
import { readAll } from "@std/io/read-all";
|
||||||
|
@ -1042,7 +1041,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSBadCertKey(): Promise<void> {
|
async function connectTLSBadCertKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
@ -1074,7 +1073,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: true, net: true }, ignore: DENO_FUTURE },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSNotKey(): Promise<void> {
|
async function connectTLSNotKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// deno-lint-ignore-file no-deprecated-deno-api
|
// 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.
|
// Note tests for Deno.stdin.setRaw is in integration tests.
|
||||||
|
|
||||||
|
@ -15,17 +15,6 @@ Deno.test(function consoleSize() {
|
||||||
assert(typeof result.rows !== "undefined");
|
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() {
|
Deno.test(function isattyError() {
|
||||||
let caught = false;
|
let caught = false;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -378,3 +378,8 @@ Deno.test("[node/http2 client] connection states", async () => {
|
||||||
|
|
||||||
assertEquals(actual, expected);
|
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_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/_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/_global.d.ts": "../ext/node/polyfills/_global.d.ts",
|
||||||
"ext:deno_node/_http_agent.mjs": "../ext/node/polyfills/_http_agent.mjs",
|
"node:_http_agent": "../ext/node/polyfills/_http_agent.mjs",
|
||||||
"ext:deno_node/_http_common.ts": "../ext/node/polyfills/_http_common.ts",
|
"node:_http_common": "../ext/node/polyfills/_http_common.ts",
|
||||||
"ext:deno_node/_http_outgoing.ts": "../ext/node/polyfills/_http_outgoing.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/_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/exiting.ts": "../ext/node/polyfills/_process/exiting.ts",
|
||||||
"ext:deno_node/_process/process.ts": "../ext/node/polyfills/_process/process.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/_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.d.ts": "../ext/node/polyfills/_stream.d.ts",
|
||||||
"ext:deno_node/_stream.mjs": "../ext/node/polyfills/_stream.mjs",
|
"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/asserts.ts": "../ext/node/polyfills/_util/asserts.ts",
|
||||||
"ext:deno_node/_util/async.ts": "../ext/node/polyfills/_util/async.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",
|
"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/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/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/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/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/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",
|
"node:_stream_readable": "../ext/node/polyfills/internal/streams/readable.mjs",
|
||||||
"ext:deno_node/internal/streams/readable.mjs": "../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/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/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/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/timers.mjs": "../ext/node/polyfills/internal/timers.mjs",
|
||||||
"ext:deno_node/internal/url.ts": "../ext/node/polyfills/internal/url.ts",
|
"ext:deno_node/internal/url.ts": "../ext/node/polyfills/internal/url.ts",
|
||||||
|
|
|
@ -220,7 +220,7 @@ async function ensureNoNewITests() {
|
||||||
"pm_tests.rs": 0,
|
"pm_tests.rs": 0,
|
||||||
"publish_tests.rs": 0,
|
"publish_tests.rs": 0,
|
||||||
"repl_tests.rs": 0,
|
"repl_tests.rs": 0,
|
||||||
"run_tests.rs": 338,
|
"run_tests.rs": 336,
|
||||||
"shared_library_tests.rs": 0,
|
"shared_library_tests.rs": 0,
|
||||||
"task_tests.rs": 4,
|
"task_tests.rs": 4,
|
||||||
"test_tests.rs": 74,
|
"test_tests.rs": 74,
|
||||||
|
|
Loading…
Reference in a new issue