mirror of
https://github.com/denoland/deno.git
synced 2025-03-05 18:37:20 -05:00

This commits moves all `.d.ts` files from `ext/*` to `cli/tsc/dts`. Due to TSC snapshot removal, `cargo publish` is now erroring out, unable to find the declaration files. These files were moved to "cli/tsc/dts", because it's much easier than keeping them in extension directories, while still providing them compressed or uncompressed depending on the build type.
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
// @ts-check
|
|
/// <reference path="../webidl/internal.d.ts" />
|
|
/// <reference path="../web/internal.d.ts" />
|
|
/// <reference path="../url/internal.d.ts" />
|
|
/// <reference path="../../cli/tsc/dts/lib.deno_web.d.ts" />
|
|
/// <reference path="./internal.d.ts" />
|
|
/// <reference path="../web/06_streams_types.d.ts" />
|
|
/// <reference path="../../cli/tsc/dts/lib.deno_fetch.d.ts" />
|
|
/// <reference lib="esnext" />
|
|
|
|
import { core, primordials } from "ext:core/mod.js";
|
|
|
|
import { SymbolDispose } from "ext:deno_web/00_infra.js";
|
|
import { op_fetch_custom_client } from "ext:core/ops";
|
|
import { loadTlsKeyPair } from "ext:deno_net/02_tls.js";
|
|
|
|
const { internalRidSymbol } = core;
|
|
const { ObjectDefineProperty } = primordials;
|
|
|
|
/**
|
|
* @param {Deno.CreateHttpClientOptions} options
|
|
* @returns {HttpClient}
|
|
*/
|
|
function createHttpClient(options) {
|
|
options.caCerts ??= [];
|
|
const keyPair = loadTlsKeyPair("Deno.createHttpClient", options);
|
|
return new HttpClient(
|
|
op_fetch_custom_client(
|
|
options,
|
|
keyPair,
|
|
),
|
|
);
|
|
}
|
|
|
|
class HttpClient {
|
|
#rid;
|
|
|
|
/**
|
|
* @param {number} rid
|
|
*/
|
|
constructor(rid) {
|
|
ObjectDefineProperty(this, internalRidSymbol, {
|
|
__proto__: null,
|
|
enumerable: false,
|
|
value: rid,
|
|
});
|
|
this.#rid = rid;
|
|
}
|
|
|
|
close() {
|
|
core.close(this.#rid);
|
|
}
|
|
|
|
[SymbolDispose]() {
|
|
core.tryClose(this.#rid);
|
|
}
|
|
}
|
|
const HttpClientPrototype = HttpClient.prototype;
|
|
|
|
export { createHttpClient, HttpClient, HttpClientPrototype };
|