diff --git a/stubs/yt-dlp/@tests/stubtest_allowlist.txt b/stubs/yt-dlp/@tests/stubtest_allowlist.txt index 293acf692899..bc3da9768778 100644 --- a/stubs/yt-dlp/@tests/stubtest_allowlist.txt +++ b/stubs/yt-dlp/@tests/stubtest_allowlist.txt @@ -26,3 +26,5 @@ yt_dlp.utils.(_utils.)?prepend_extension yt_dlp.utils.(_utils.)?replace_extension # Unsure why this is here. yt_dlp.utils.jslib.devalue.TYPE_CHECKING +# internal API: +yt_dlp.utils._jsruntime.runtime_version_tuple diff --git a/stubs/yt-dlp/METADATA.toml b/stubs/yt-dlp/METADATA.toml index a9fa3438effa..b96eae00d1ee 100644 --- a/stubs/yt-dlp/METADATA.toml +++ b/stubs/yt-dlp/METADATA.toml @@ -1,3 +1,3 @@ -version = "2025.10.22" +version = "2025.11.12" upstream_repository = "https://github.com/yt-dlp/yt-dlp" requires = ["websockets"] diff --git a/stubs/yt-dlp/yt_dlp/__init__.pyi b/stubs/yt-dlp/yt_dlp/__init__.pyi index e5dd1a12a4fc..f9bd170afd91 100644 --- a/stubs/yt-dlp/yt_dlp/__init__.pyi +++ b/stubs/yt-dlp/yt_dlp/__init__.pyi @@ -189,6 +189,8 @@ class _Params(TypedDict, total=False): default_search: str | None dynamic_mpd: bool | None extractor_args: Mapping[str, Mapping[str, Any]] | None + js_runtimes: dict[str, dict[str, str] | None] + remote_components: set[Literal["ejs:npm", "ejs:github"]] encoding: str | None extract_flat: bool | Literal["in_playlist", "discard", "discard_in_playlist"] | None live_from_start: bool | None diff --git a/stubs/yt-dlp/yt_dlp/globals.pyi b/stubs/yt-dlp/yt_dlp/globals.pyi index cb97371d901f..817c8a5f5e8b 100644 --- a/stubs/yt-dlp/yt_dlp/globals.pyi +++ b/stubs/yt-dlp/yt_dlp/globals.pyi @@ -1,5 +1,14 @@ from collections import defaultdict -from typing import Any, Generic, Literal, TypeVar +from typing import Any, Generic, Literal, TypedDict, TypeVar, type_check_only + +from yt_dlp.utils._jsruntime import BunJsRuntime, DenoJsRuntime, NodeJsRuntime, QuickJsRuntime + +@type_check_only +class _SupportedJSRuntimes(TypedDict): + deno: type[DenoJsRuntime] + node: type[NodeJsRuntime] + bun: type[BunJsRuntime] + quickjs: type[QuickJsRuntime] _T = TypeVar("_T") @@ -18,3 +27,5 @@ plugin_ies_overrides: Indirect[defaultdict[str, Any]] IN_CLI: Indirect[bool] LAZY_EXTRACTORS: Indirect[bool | None] WINDOWS_VT_MODE: Indirect[Literal[False] | None] # Code takes into account that only False here +supported_js_runtimes: Indirect[_SupportedJSRuntimes] +supported_remote_components: Indirect[list[Literal["ejs:github", "ejs:npm"]]] diff --git a/stubs/yt-dlp/yt_dlp/utils/_jsruntime.pyi b/stubs/yt-dlp/yt_dlp/utils/_jsruntime.pyi new file mode 100644 index 000000000000..3b66663a6e0b --- /dev/null +++ b/stubs/yt-dlp/yt_dlp/utils/_jsruntime.pyi @@ -0,0 +1,38 @@ +import abc +from dataclasses import dataclass +from functools import cached_property +from typing import Final + +@dataclass(frozen=True) +class JsRuntimeInfo: + name: str + path: str + version: str + version_tuple: tuple[int, ...] + supported: bool = True + +class JsRuntime(abc.ABC): + def __init__(self, path: str | None = None) -> None: ... + @cached_property + @abc.abstractmethod + def info(self) -> JsRuntimeInfo | None: ... + +class DenoJsRuntime(JsRuntime): + MIN_SUPPORTED_VERSION: Final[tuple[int, int, int]] + @cached_property + def info(self) -> JsRuntimeInfo | None: ... + +class BunJsRuntime(JsRuntime): + MIN_SUPPORTED_VERSION: Final[tuple[int, int, int]] + @cached_property + def info(self) -> JsRuntimeInfo | None: ... + +class NodeJsRuntime(JsRuntime): + MIN_SUPPORTED_VERSION: Final[tuple[int, int, int]] + @cached_property + def info(self) -> JsRuntimeInfo | None: ... + +class QuickJsRuntime(JsRuntime): + MIN_SUPPORTED_VERSION: Final[tuple[int, int, int]] + @cached_property + def info(self) -> JsRuntimeInfo | None: ...