Compare commits

..

No commits in common. "forge_1_20_1" and "neo_26_1_2" have entirely different histories.

3111 changed files with 88348 additions and 18170 deletions

5
.gitattributes vendored
View File

@ -1,5 +0,0 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf

View File

@ -1,207 +0,0 @@
name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Prepare release files
run: |
mkdir -p release-files
cp build/libs/*.jar release-files/ 2>/dev/null || true
echo "准备发布的文件:"
ls -la release-files/
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: release-files
path: release-files/
retention-days: 7
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout with full history
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-files
path: ./dist
- name: Generate CZ-compliant changelog
id: generate_changelog
run: |
CURRENT_TAG="${{ github.ref_name }}"
PREV_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "")
# 创建临时文件
TEMP_FILE=$(mktemp)
echo "# 🚀 版本 $CURRENT_TAG 发布" > $TEMP_FILE
echo "" >> $TEMP_FILE
echo "## 📋 变更摘要" >> $TEMP_FILE
echo "" >> $TEMP_FILE
if [ -z "$PREV_TAG" ]; then
echo "### 初始版本发布" >> $TEMP_FILE
echo "" >> $TEMP_FILE
echo "这是项目的第一个正式版本。" >> $TEMP_FILE
echo "" >> $TEMP_FILE
# 获取所有提交并按类型分组
git log --pretty=format:"%s" --reverse | while read -r line; do
echo "- $line" >> $TEMP_FILE
done
else
echo "### 从 $PREV_TAG 到 $CURRENT_TAG 的变更" >> $TEMP_FILE
echo "" >> $TEMP_FILE
# 定义符合CZ规范的提交类型映射
declare -A commit_types
commit_types=(
["✨ 新功能"]="^(feat|feature)(\(.*\))?:"
["🐛 修复"]="^(fix|bugfix)(\(.*\))?:"
["📝 文档"]="^(docs|documentation)(\(.*\))?:"
["🎨 样式"]="^(style)(\(.*\))?:"
["🔨 重构"]="^(refactor)(\(.*\))?:"
["⚡️ 性能"]="^(perf|performance)(\(.*\))?:"
["✅ 测试"]="^(test)(\(.*\))?:"
["🔧 构建"]="^(build)(\(.*\))?:"
["👷 CI"]="^(ci)(\(.*\))?:"
["📦 依赖"]="^(chore|deps)(\(.*\))?:"
["⏪ 回退"]="^(revert)(\(.*\))?:"
)
# 获取所有提交
COMMITS=$(git log --pretty=format:"%s" $PREV_TAG..HEAD)
# 处理每种类型的提交
for type_name in "${!commit_types[@]}"; do
pattern="${commit_types[$type_name]}"
# 提取匹配的提交
matched_commits=$(echo "$COMMITS" | grep -E "$pattern" || true)
if [ -n "$matched_commits" ]; then
echo "#### $type_name" >> $TEMP_FILE
echo "" >> $TEMP_FILE
# 处理每条提交提取scope和subject
echo "$matched_commits" | while read -r commit; do
# 解析scope和subject
if [[ $commit =~ ^[a-z]+\((.*)\):\ (.*) ]]; then
scope="${BASH_REMATCH[1]}"
subject="${BASH_REMATCH[2]}"
echo "- **$scope**: $subject" >> $TEMP_FILE
elif [[ $commit =~ ^[a-z]+:\ (.*) ]]; then
subject="${BASH_REMATCH[1]}"
echo "- $subject" >> $TEMP_FILE
else
echo "- $commit" >> $TEMP_FILE
fi
done
echo "" >> $TEMP_FILE
fi
done
# 处理破坏性变更BREAKING CHANGE
breaking_changes=$(git log --pretty=format:"%b" $PREV_TAG..HEAD | grep -i "BREAKING CHANGE" || true)
if [ -n "$breaking_changes" ]; then
echo "#### ⚠️ 破坏性变更" >> $TEMP_FILE
echo "" >> $TEMP_FILE
echo "$breaking_changes" | while read -r line; do
echo "- $line" >> $TEMP_FILE
done
echo "" >> $TEMP_FILE
fi
# 处理未分类的提交
uncategorized="$COMMITS"
for pattern in "${commit_types[@]}"; do
uncategorized=$(echo "$uncategorized" | grep -v -E "$pattern" || true)
done
if [ -n "$uncategorized" ]; then
echo "#### 📝 其他更改" >> $TEMP_FILE
echo "" >> $TEMP_FILE
echo "$uncategorized" | while read -r commit; do
echo "- $commit" >> $TEMP_FILE
done
echo "" >> $TEMP_FILE
fi
fi
echo "## 📊 统计信息" >> $TEMP_FILE
echo "" >> $TEMP_FILE
if [ -z "$PREV_TAG" ]; then
TOTAL_COMMITS=$(git rev-list --count HEAD)
echo "- 总提交数: $TOTAL_COMMITS" >> $TEMP_FILE
echo "- 首次发布" >> $TEMP_FILE
else
COMMITS=$(git rev-list --count $PREV_TAG..HEAD)
echo "- 本次发布提交数: $COMMITS" >> $TEMP_FILE
echo "- 上一个版本: $PREV_TAG" >> $TEMP_FILE
fi
echo "- 发布日期: $(date '+%Y年%m月%d日')" >> $TEMP_FILE
echo "- 当前版本: $CURRENT_TAG" >> $TEMP_FILE
echo "" >> $TEMP_FILE
echo "---" >> $TEMP_FILE
echo "" >> $TEMP_FILE
echo "### 📜 详细提交历史" >> $TEMP_FILE
echo "" >> $TEMP_FILE
# 显示所有提交的详细列表包含scope信息
if [ -z "$PREV_TAG" ]; then
git log --pretty=format:"- **%h** %s - %an (%ad)" --date=short --reverse | head -100 >> $TEMP_FILE
else
git log --pretty=format:"- **%h** %s - %an (%ad)" --date=short $PREV_TAG..HEAD | head -100 >> $TEMP_FILE
fi
# 将文件内容输出到变量
CHANGELOG_CONTENT=$(cat $TEMP_FILE)
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.jar"
tag: ${{ github.ref_name }}
name: "版本 ${{ github.ref_name }}"
body: ${{ steps.generate_changelog.outputs.changelog }}
draft: false
prerelease: false

39
.gitignore vendored
View File

@ -1,26 +1,21 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# MacOS DS_Store files
.DS_Store
# idea
out
*.ipr
*.iws
*.iml
.idea
# gradle
build
# Gradle cache folder
.gradle
# other
eclipse
run
runs
run-data
# Gradle build folder
build
repo
# IntelliJ
out/
.idea
*.iml
# mpeltonen/sbt-idea plugin
.idea_modules/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Common working directory
run

View File

@ -1,68 +0,0 @@
# Camellia License
**Version: 1.0**
---
## Article 1: Definitions
1. This license applies to all individuals or organizations using, modifying, or distributing this project and its derivative works.
2. **"Original Author"** refers to the developer who initially created this project.
3. **"User"** refers to any individual or organization using, modifying, or distributing this project under this license.
4. **"Notify the Original Author"** means the user must send a notice to the publicly available contact provided by the original author:
- The notice must clearly specify the user's planned actions and related details.
- If no objection is received within 7 days after the notice is sent, the user may proceed with their plan.
---
## Article 2: Scope of Authorization
1. Users may freely copy, modify, and distribute this project in non-commercial environments.
2. Commercial use is prohibited without prior authorization, including but not limited to:
- Directly selling this project or its derivative works;
- Authorizing third parties to sell this project or its derivative works;
- Bundling this project or its derivative works as part of paid software or services.
3. To engage in commercial use, the user must contact the original author or an explicitly authorized representative to obtain permission:
- If multiple forks exist, the user should contact the nearest authorized fork developer unless otherwise stated by the original author.
---
## Article 3: Platform Incentives
1. Users may upload this project to platforms (e.g., CurseForge) to earn platform incentives but must **"notify the original author"**.
2. Platform incentives belong entirely to the uploader, and no profit sharing with the original author is required.
---
## Article 4: Code Open-Sourcing and Attribution Requirements
1. Users who modify and distribute this project must meet the following requirements:
- Retain a visible link to the original project in the project code;
- Use the same or a newer version of this license (Camellia License);
- Open-source the modified code on the same code hosting platform as the original author:
- If the user wishes to use additional code hosting platforms, they must **"notify the original author"**.
2. When distributing, users must retain visible attribution to the original author in the project code.
---
## Article 5: Disclaimer
1. This project is provided "as is" without any express or implied warranties, including but not limited to merchantability, fitness for a particular purpose, or non-infringement.
2. The original author is not responsible for any direct or indirect losses resulting from the use or modification of this project.
---
## Article 6: Violation Handling
1. Users who violate this license must immediately cease the violation and take necessary remedial actions.
2. If a user engages in commercial use in violation of this license, the original author has the right to claim all profits gained from the violation.
3. Any disputes are governed by the laws of the jurisdiction where the original author resides.
---
## Article 7: License Revisions
1. Each version of this license is fixed and cannot be altered.
2. Revised versions of this license will be released as new versions, and users may choose to comply with either the current version or any newer version.
---
## Article 8: Other Provisions
1. This license does not restrict users from engaging in other lawful activities permitted by this license.
---
**Copyright © 2024 [Author]**

View File

@ -1,25 +0,0 @@
Installation information
=======
This template repository can be directly cloned to get you started with a new
mod. Simply create a new repository cloned from this one, by following the
instructions provided by [GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
Once you have your clone, simply open the repository in the IDE of your choice. The usual recommendation for an IDE is either IntelliJ IDEA or Eclipse.
If at any point you are missing libraries in your IDE, or you've run into problems you can
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
{this does not affect your code} and then start the process again.
Mapping Names:
============
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
license. For the latest license text, refer to the mapping file itself, or the reference copy here:
https://github.com/NeoForged/NeoForm/blob/main/Mojang.md
Additional Resources:
==========
Community Documentation: https://docs.neoforged.net/
NeoForged Discord: https://discord.neoforged.net/

View File

@ -1,93 +1,97 @@
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'java'
id 'idea'
id 'java-library'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'net.neoforged.moddev.legacyforge' version '2.0.103'
id 'com.dorongold.task-tree' version '2.1.1'
id 'idea'
id 'net.neoforged.moddev' version '2.0.141'
}
apply from: 'gradle/jni-heads.gradle'
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}
version = "${minecraft_version}-${mod_version}"
version = mod_version
group = mod_group_id
repositories {
mavenLocal()
maven { url = "https://libraries.minecraft.net/" }
maven { url = "https://neoforged.forgecdn.net/releases" }
maven { url = "https://neoforged.forgecdn.net/mojang-meta" }
maven { url = "https://maven.neoforged.net/releases" }
maven {
name = "LTD Maven"
url = "https://nexus.bot.leisuretimedock.top/repository/maven-public/"
}
flatDir {
dir "libs"
}
}
base {
archivesName = mod_id
}
// Mojang ships Java 17 to end users in 1.20.1, so mods should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
legacyForge {
// Specify the version of MinecraftForge to use.
version = project.minecraft_version + '-' + project.forge_version
neoForge {
// Specify the version of NeoForge to use.
version = project.neo_version
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}
// This line is optional. Access Transformers are automatically detected
// accessTransformers.add('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
client()
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
clientAuth{
devLogin = true
clientAuth {
client()
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
devLogin = true
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
server {
server()
programArgument '--nogui'
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
type = "gameTestServer"
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
data {
data()
clientData()
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// gameDirectory = project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
// applies to all the run configs above
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
logLevel = org.slf4j.event.Level.DEBUG
}
}
mods {
// define mod <-> source bindings
// these are used to tell the game which sources are for which mod
// mostly optional in a single mod project
// but multi mod projects should define one per mod
"${mod_id}" {
sourceSet(sourceSets.main)
}
@ -97,306 +101,74 @@ legacyForge {
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
configurations {
runtimeClasspath.extendsFrom localRuntime
}
obfuscation {
createRemappingConfiguration(configurations.localRuntime)
}
dependencies {
// Example mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
// compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}"
// runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}"
}
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
// Example mod dependency using a file as dependency
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
test {
useJUnitPlatform()
// Example project dependency using a sister or child project:
// implementation project(":myproject")
//
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
}
//
classpath = sourceSets.test.runtimeClasspath
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range : minecraft_version_range,
forge_version : forge_version,
forge_version_range : forge_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description,
mod_credits : mod_credits
]
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
var replaceProperties = [minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
// Include the output of "generateModMetadata" as an input directory for the build
// this works with both building through Gradle and the IDE.
sourceSets.main.resources.srcDir generateModMetadata
legacyForge.ideSyncTask generateModMetadata
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
neoForge.ideSyncTask generateModMetadata
// ==================== Javadoc ====================
javadoc {
options {
encoding = 'UTF-8'
charSet = 'UTF-8'
author = true
version = true
windowTitle = "RedEnvelope ${project.mod_version}"
docTitle = "RedEnvelope ${project.mod_version}"
memberLevel = JavadocMemberLevel.PROTECTED
links = [
'https://docs.oracle.com/javase/8/docs/api/'
]
addBooleanOption('Xdoclint:none', true)
addBooleanOption('html5', true)
}
//
if (sourceSets.main.allJava.files.any { it.exists() }) {
source = sourceSets.main.allJava
}
classpath = configurations.compileClasspath
exclude '**/test/**'
exclude '**/internal/**'
//
doFirst {
destinationDir.mkdirs()
}
}
tasks.register('javadocJar', Jar) {
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-javadoc.jar"
archiveClassifier.set("javadoc")
from tasks.javadoc
dependsOn tasks.javadoc
}
tasks.register('sourceJar', Jar) {
from(sourceSets.main.allSource) // java
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-sources.jar"
archiveClassifier.set("sources")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1',
'Implementation-Title' : project.name,
'Implementation-Version' : archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'MixinConfigs' : "${mod_id}.mixins.json"
])
}
dependsOn classes
}
tasks.named('publish') {
dependsOn build
}
// ==================== ====================
// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = mod_id
artifact reobfJar
artifact sourceJar
artifact javadocJar
pom {
name = 'RedEnvelope'
description = 'A mod allows you to send red envelopes (also hongbao) to other players.'
url = 'https://github.com/3944Realms/lib39'
properties = [
'minecraft.version': project.minecraft_version,
'mod.version': project.mod_version,
'forge.version': project.forge_version,
'java.version': '17'
]
licenses {
license {
name = 'Camellia License'
url = 'https://raw.githubusercontent.com/LeisureTimeDock/RedEnvelope/refs/heads/master/LICENSE.md'
distribution = 'repo'
}
}
developers {
developer {
id = 'R3944Realms'
name = "${mod_authors}"
email = 'f256198830@hotmail.com'
}
}
scm {
connection = 'scm:git:https://github.com/3944Realms/lib39.git'
developerConnection = 'scm:git:ssh://git@github.com:3944Realms/lib39.git'
url = 'https://github.com/3944Realms/lib39'
tag = 'main'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/3944Realms/lib39/issues'
}
}
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
//
maven {
name = 'local'
url = layout.buildDirectory.dir("repo")
}
// Nexus
maven {
name = 'LTDNexus'
url = 'https://nexus.bot.leisuretimedock.top/repository/maven-releases/'
credentials {
username = System.getenv('LTDNexusUsername') ?: ''
password = System.getenv('LTDNexusPassword') ?: ''
}
}
}
}
// ==================== ====================
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
}
// Javadoc JAR - 使 javadoc
tasks.named('javadocJar') {
from javadoc.destinationDir
}
// ==================== ====================
tasks.register('verifyNexusCredentials') {
doLast {
def username = System.getenv('LTDNexusUsername')
def password = System.getenv('LTDNexusPassword')
//
def displayUsername = username ? "***${username.length() > 2 ? username.substring(username.length() - 2) : '**'}" : 'NOT SET'
def displayPassword = password ? "***${password.length() > 2 ? password.substring(password.length() - 2) : '**'}" : 'NOT SET'
println "Nexus Username: ${displayUsername}"
println "Nexus Password: ${displayPassword}"
if (!username || !password) {
throw new GradleException('LTDNexusUsername or LTDNexusPassword environment variables are not set')
url "file://${project.projectDir}/repo"
}
}
}
tasks.register('checkPublicationContents') {
doLast {
def publication = publishing.publications.mavenJava
println "=== Publication Details ==="
println "Group: ${publication.groupId}"
println "Artifact: ${publication.artifactId}"
println "Version: ${publication.version}"
println "Artifacts:"
publication.artifacts.each { artifact ->
def file = artifact.file
def exists = file.exists()
println " - ${file.name} (${artifact.classifier ?: 'main'}) - Exists: ${exists}"
if (!exists) {
throw new GradleException("Publication artifact missing: ${file.absolutePath}")
}
}
}
}
// ==================== ====================
tasks.named('publishMavenJavaPublicationToLTDNexusRepository') {
dependsOn verifyNexusCredentials
dependsOn checkPublicationContents
}
tasks.withType(PublishToMavenRepository) {
dependsOn assemble
dependsOn javadocJar
}
// ==================== 便 ====================
tasks.register('publishToNexus') {
group = 'publishing'
description = 'Publishes all publications to LTD Nexus'
dependsOn 'publishMavenJavaPublicationToLTDNexusRepository'
}
tasks.named('build') {
dependsOn javadocJar, sourceJar
}
tasks.register('publishLocal') {
group = 'publishing'
description = 'Publishes all publications to the local Maven repository'
dependsOn 'publishToMavenLocal'
}
tasks.register('cleanRepo', Delete) {
delete layout.buildDirectory.dir("repo")
}
tasks.named('clean') {
dependsOn cleanRepo
}
// ==================== IDEA ====================
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
//
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
tasks.register('showTaskTree') {
doLast {
def showTaskDeps
showTaskDeps = { task, prefix = '' ->
println "${prefix}${task.name}"
task.getTaskDependencies().getDependencies(task).each { dep ->
showTaskDeps(dep, prefix + ' ')
}
}
def targetTask = tasks.findByName('build')
if (targetTask) {
println "构建任务依赖树:"
showTaskDeps(targetTask)
} else {
println "未找到 build 任务"
}
}
}

View File

@ -1,29 +1,25 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.parallel=false
org.gradle.caching=false
org.gradle.configuration-cache=false
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
parchment_minecraft_version=1.20.1
parchment_mappings_version=2023.09.03
# Environment Properties
# You can find the latest versions here: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20.1
org.gradle.jvmargs=-Xmx2G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
## Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=26.1.2
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.1, 1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=47.1.3
# The Forge version range can use any version of Forge as bounds
forge_version_range=[47.1.3,)
minecraft_version_range=[26.1.2,27)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=26.1.2.36-beta
# The Neo version range can use any version of Neo as bounds
neo_version_range=[26,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[47,)
loader_version_range=[4,)
parchment_minecraft_version=1.21.11
parchment_mappings_version=2025.12.21-nightly-SNAPSHOT
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
@ -31,16 +27,14 @@ mod_id=redenvelope
# The human-readable display name for the mod.
mod_name=Red Envelope
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=Camellia License
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=1.0.0
mod_version=0.0.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=top.leisuretimedock
mod_group_id=top.r3944realms.redenvelope
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=R3944Realms, HiedaCamellia, Houraisan Kaguya
mod_authors=R3944Realms
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=A mod allows you to send red envelopes (also hongbao) to other players.
mod_credits=
mod_description=Lib39

View File

@ -1,21 +0,0 @@
ext.jniConfig = {
//
outputDir = project.file("native/include")
//
configFile = project.file("jni/jni-classes.txt")
//
autoGenerateOnBuild = true
//
verbose = true
//
defaultPatterns = [
'.*Native.*',
'.*JNI.*',
'.*native.*',
'com\\.mymod\\..*Impl' //
]
}

View File

@ -1,458 +0,0 @@
//
def outputDir = project.file("cpp/header")
def configFile = project.file("config/jni-classes.txt")
//
def log(msg) {
println "[JNI] $msg"
}
def logError(msg) {
println "[JNI ERROR] $msg"
}
def logWarn(msg) {
println "[JNI WARN] $msg"
}
//
tasks.register('createJniConfig') {
group = 'jni'
description = '创建 JNI 配置文件模板'
doLast {
configFile.parentFile.mkdirs()
if (!configFile.exists()) {
configFile.text = """# JNI
#
# com.example.MyNativeClass
# com.example.NativeUtils
# 使
# #auto:.*Native.*
"""
log "配置文件已创建: ${configFile.absolutePath}"
log "请编辑此文件并添加包含 native 方法的类"
}
}
}
//
tasks.register('generateJniHeaders') {
group = 'jni'
description = '生成 JNI 头文件'
dependsOn 'compileJava'
doLast {
//
outputDir.mkdirs()
//
def targetClasses = []
if (configFile.exists()) {
configFile.eachLine { line ->
def trimmed = line.trim()
if (trimmed && !trimmed.startsWith('#')) {
targetClasses.add(trimmed)
}
}
}
if (targetClasses.isEmpty()) {
logError "没有配置任何 JNI 类"
logError "请先运行: ./gradlew createJniConfig"
logError "然后编辑 ${configFile.absolutePath} 添加类名"
return
}
log "开始生成 JNI 头文件..."
log "目标类 (${targetClasses.size()} 个):"
targetClasses.eachWithIndex { className, i ->
log " ${i + 1}. $className"
}
//
def classesDir = project.sourceSets.main.output.classesDirs.singleFile
def classpath = project.configurations.runtimeClasspath.asPath +
File.pathSeparator +
classesDir.absolutePath
// Java
def sourceFiles = []
def sourceDirs = project.sourceSets.main.java.srcDirs
targetClasses.each { className ->
def found = false
def relativePath = className.replace('.', '/') + '.java'
sourceDirs.each { srcDir ->
def sourceFile = new File(srcDir, relativePath)
if (sourceFile.exists()) {
sourceFiles.add(sourceFile)
found = true
log "找到源文件: ${sourceFile.absolutePath}"
}
}
if (!found) {
logWarn "警告: 未找到类 $className 的源文件"
}
}
if (sourceFiles.isEmpty()) {
logError "错误: 未找到任何源文件"
logError "请确保源文件存在于 src/main/java/ 目录中"
return
}
// 使 javac -h
def javaHome = System.getProperty('java.home')
def javacPath = "${javaHome}/bin/javac"
if (!new File(javacPath).exists()) {
javacPath = "${javaHome}/bin/javac"
}
log "使用 javac -h 生成头文件..."
//
def tempOutputDir = new File(project.buildDir, "tmp/jni-headers")
tempOutputDir.mkdirs()
try {
// 1
def successCount = 0
def failCount = 0
sourceFiles.each { sourceFile ->
try {
// javac
def processArgs = [
javacPath,
'-h', outputDir.absolutePath, //
'-cp', classpath, //
'-d', tempOutputDir.absolutePath, //
sourceFile.absolutePath //
]
log "处理: ${sourceFile.name}"
def process = processArgs.execute()
def stdout = new StringBuilder()
def stderr = new StringBuilder()
process.consumeProcessOutput(stdout, stderr)
def exitCode = process.waitFor()
if (exitCode == 0) {
successCount++
if (stdout.length() > 0) {
log " 输出: ${stdout.toString().trim()}"
}
} else {
failCount++
logError " 处理失败: ${sourceFile.name}"
if (stderr.length() > 0) {
logError " 错误: ${stderr.toString().trim()}"
}
}
} catch (Exception e) {
failCount++
logError " 处理异常: ${e.message}"
}
}
log "处理完成: 成功 ${successCount} 个, 失败 ${failCount} 个"
if (successCount > 0) {
//
def headerFiles = outputDir.listFiles({ dir, name -> name.endsWith('.h') } as FilenameFilter)
if (headerFiles && headerFiles.size() > 0) {
log "=" * 60
log "JNI 头文件生成成功!"
log "=" * 60
log "输出目录: ${outputDir.absolutePath}"
log "生成的头文件 (${headerFiles.size()} 个):"
headerFiles.sort { it.name }.each { file ->
def size = file.length()
def sizeStr = size < 1024 ? "${size} B" : "${String.format("%.1f", size / 1024.0)} KB"
log " ✓ ${file.name} ($sizeStr)"
//
try {
def lines = file.readLines()
if (lines.size() > 0) {
def headerGuard = lines.find { it.contains('#ifndef') }
if (headerGuard) {
log " 头文件保护: ${headerGuard.trim()}"
}
}
} catch (Exception e) {
//
}
}
log "=" * 60
log "🎉 头文件已成功生成!"
log ""
log "使用建议:"
log " 1. 将生成的头文件复制到你的 C/C++ 项目中"
log " 2. 在 C/C++ 源文件中包含这些头文件"
log " 3. 实现头文件中声明的 JNI 函数"
log ""
log "示例 C++ 代码:"
log " #include \"${headerFiles[0].name}\""
log " JNIEXPORT void JNICALL Java_com_example_MyClass_nativeMethod(JNIEnv* env, jobject obj) {"
log " // 你的实现代码"
log " }"
} else {
logWarn "警告: 未生成任何 .h 头文件"
logWarn "可能的原因:"
logWarn " 1. 源文件中没有 native 方法声明"
logWarn " 2. javac 版本不支持 -h 选项"
logWarn " 3. 类路径配置不正确"
}
} else {
logError "所有处理都失败,未生成任何头文件"
}
} finally {
//
tempOutputDir.deleteDir()
}
}
}
// 使 javah javac -h
tasks.register('generateJniHeadersLegacy') {
group = 'jni'
description = '使用传统 javah 生成 JNI 头文件'
dependsOn 'compileJava'
doLast {
outputDir.mkdirs()
def targetClasses = []
if (configFile.exists()) {
configFile.eachLine { line ->
def trimmed = line.trim()
if (trimmed && !trimmed.startsWith('#')) {
targetClasses.add(trimmed)
}
}
}
if (targetClasses.isEmpty()) {
logError "没有配置任何 JNI 类"
return
}
log "使用传统 javah 生成头文件..."
def classesDir = project.sourceSets.main.output.classesDirs.singleFile
def classpath = project.configurations.runtimeClasspath.asPath +
File.pathSeparator +
classesDir.absolutePath
def javaHome = System.getProperty('java.home')
def javahPath = "${javaHome}/bin/javah"
if (!new File(javahPath).exists()) {
javahPath = "${javaHome}/../bin/javah"
}
if (!new File(javahPath).exists()) {
logError "找不到 javah 工具"
logError "请使用 Java 8-9 或使用 generateJniHeaders 任务"
return
}
def processArgs = [javahPath, '-classpath', classpath, '-d', outputDir.absolutePath]
processArgs.addAll(targetClasses)
log "执行命令: ${processArgs.join(' ')}"
def process = processArgs.execute()
def exitCode = process.waitFor()
if (exitCode == 0) {
def files = outputDir.listFiles({ dir, name -> name.endsWith('.h') } as FilenameFilter)
log "生成成功!创建了 ${files?.size() ?: 0} 个头文件"
if (files) {
files.each { log " - ${it.name}" }
}
} else {
logError "生成失败"
}
}
}
// native
tasks.register('scanForNativeMethods') {
group = 'jni'
description = '扫描项目中的 native 方法'
doLast {
log "扫描项目中可能包含 native 方法的类..."
def sourceDirs = project.sourceSets.main.java.srcDirs
def foundClasses = []
sourceDirs.each { srcDir ->
if (srcDir.exists()) {
srcDir.eachFileRecurse(groovy.io.FileType.FILES) { file ->
if (file.name.endsWith('.java')) {
def content = file.text
if (content.contains('native ') || content.contains(' native')) {
//
def packageMatch = content =~ /package\s+([\w.]+)\s*;/
def classMatch = content =~ /class\s+(\w+)/
if (packageMatch.find() && classMatch.find()) {
def packageName = packageMatch.group(1)
def className = classMatch.group(1)
def fullClassName = "${packageName}.${className}"
if (!foundClasses.contains(fullClassName)) {
foundClasses.add(fullClassName)
log "发现: $fullClassName"
}
}
}
}
}
}
}
if (foundClasses.isEmpty()) {
log "未发现包含 native 方法的类"
} else {
log "=" * 60
log "发现 ${foundClasses.size()} 个可能包含 native 方法的类:"
foundClasses.sort().eachWithIndex { cls, i ->
log " ${i + 1}. $cls"
}
log ""
log "你可以将这些类添加到 ${configFile.name} 中"
}
}
}
//
tasks.register('cleanJniHeaders', Delete) {
group = 'jni'
description = '清理 JNI 头文件'
delete outputDir
doLast {
log "已清理 JNI 头文件目录: ${outputDir.absolutePath}"
}
}
//
tasks.register('verifyJniSetup') {
group = 'jni'
description = '验证 JNI 配置'
doLast {
log "验证 JNI 配置..."
log "Java 版本: ${System.getProperty('java.version')}"
log "Java Home: ${System.getProperty('java.home')}"
// javac
def javaHome = System.getProperty('java.home')
def javacPath = "${javaHome}/bin/javac"
def javacExists = new File(javacPath).exists() || new File("${javaHome}/../bin/javac").exists()
log "javac 工具: ${javacExists ? '找到 ✓' : '未找到 ✗'}"
// javah
def javahPath = "${javaHome}/bin/javah"
def javahExists = new File(javahPath).exists() || new File("${javaHome}/../bin/javah").exists()
log "javah 工具: ${javahExists ? '找到 ✓' : '未找到 ✗'}"
//
if (configFile.exists()) {
def classes = configFile.readLines()
.findAll { it.trim() && !it.trim().startsWith('#') }
log "配置文件: 已找到 (${classes.size()} 个类)"
if (classes.size() > 0) {
classes.each { log " - $it" }
}
} else {
log "配置文件: 未找到 ✗"
}
//
log "输出目录: ${outputDir.absolutePath}"
}
}
//
tasks.register('jniHelp') {
group = 'help'
description = 'JNI 帮助'
doLast {
println """
${'=' * 70}
JNI
${'=' * 70}
📋 :
native Java C/C++
🚀 :
1. ./gradlew createJniConfig #
2. config/jni-classes.txt # JNI
3. ./gradlew generateJniHeaders #
4. : cpp/header/
🔧 :
jniHelp -
createJniConfig -
generateJniHeaders -
generateJniHeadersLegacy - Java 8-9
scanForNativeMethods - native
verifyJniSetup -
cleanJniHeaders -
📝 (config/jni-classes.txt):
#
com.example.MyNativeClass #
#auto:.*Native.* # #auto:
:
native
Java 10+ 使 generateJniHeaders
Java 8-9 使 generateJniHeadersLegacy
🔍 :
verifyJniSetup
scanForNativeMethods native
native
${'=' * 70}
"""
}
}
//
// tasks.named('build') {
// dependsOn tasks.named('generateJniHeaders')
// }
// JNI
tasks.named('clean') {
dependsOn tasks.named('cleanJniHeaders')
}
log "JNI 模块已加载"
log "输出目录: ${outputDir.absolutePath}"
log "配置文件: ${configFile.absolutePath}"
log "使用 ./gradlew jniHelp 查看详细帮助"

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

12
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -115,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@ -173,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@ -206,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.

3
gradlew.bat vendored
View File

@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell

165
node_modules/.package-lock.json generated vendored
View File

@ -1,5 +1,5 @@
{
"name": "RedEnvelope",
"name": "LendAndRegret",
"lockfileVersion": 3,
"requires": true,
"packages": {
@ -31,14 +31,14 @@
}
},
"node_modules/@commitlint/config-validator": {
"version": "20.4.0",
"resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-20.4.0.tgz",
"integrity": "sha512-zShmKTF+sqyNOfAE0vKcqnpvVpG0YX8F9G/ZIQHI2CoKyK+PSdladXMSns400aZ5/QZs+0fN75B//3Q5CHw++w==",
"version": "20.5.0",
"resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-20.5.0.tgz",
"integrity": "sha512-T/Uh6iJUzyx7j35GmHWdIiGRQB+ouZDk0pwAaYq4SXgB54KZhFdJ0vYmxiW6AMYICTIWuyMxDBl1jK74oFp/Gw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@commitlint/types": "^20.4.0",
"@commitlint/types": "^20.5.0",
"ajv": "^8.11.0"
},
"engines": {
@ -57,21 +57,21 @@
}
},
"node_modules/@commitlint/load": {
"version": "20.4.0",
"resolved": "https://registry.npmjs.org/@commitlint/load/-/load-20.4.0.tgz",
"integrity": "sha512-Dauup/GfjwffBXRJUdlX/YRKfSVXsXZLnINXKz0VZkXdKDcaEILAi9oflHGbfydonJnJAbXEbF3nXPm9rm3G6A==",
"version": "20.5.3",
"resolved": "https://registry.npmjs.org/@commitlint/load/-/load-20.5.3.tgz",
"integrity": "sha512-1FDZWuKyu98Myb8i7Tp31jPU2rZpOwAdYRyJcy2KoGg7Xk2A+bgHN8smhMaaNSNkmE8fwt53BokywZq8Gv/5XQ==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@commitlint/config-validator": "^20.4.0",
"@commitlint/config-validator": "^20.5.0",
"@commitlint/execute-rule": "^20.0.0",
"@commitlint/resolve-extends": "^20.4.0",
"@commitlint/types": "^20.4.0",
"cosmiconfig": "^9.0.0",
"@commitlint/resolve-extends": "^20.5.3",
"@commitlint/types": "^20.5.0",
"cosmiconfig": "^9.0.1",
"cosmiconfig-typescript-loader": "^6.1.0",
"es-toolkit": "^1.46.0",
"is-plain-obj": "^4.1.0",
"lodash.mergewith": "^4.6.2",
"picocolors": "^1.1.1"
},
"engines": {
@ -79,18 +79,18 @@
}
},
"node_modules/@commitlint/resolve-extends": {
"version": "20.4.0",
"resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-20.4.0.tgz",
"integrity": "sha512-ay1KM8q0t+/OnlpqXJ+7gEFQNlUtSU5Gxr8GEwnVf2TPN3+ywc5DzL3JCxmpucqxfHBTFwfRMXxPRRnR5Ki20g==",
"version": "20.5.3",
"resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-20.5.3.tgz",
"integrity": "sha512-+ogW9v/u9JqpvAgTrLra/YTFo0KkjU6iNblF89pPsj4NebNc+DAWctsludwezI8YnsjBmfHpApSwcXprN/f/ew==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@commitlint/config-validator": "^20.4.0",
"@commitlint/types": "^20.4.0",
"global-directory": "^4.0.1",
"@commitlint/config-validator": "^20.5.0",
"@commitlint/types": "^20.5.0",
"es-toolkit": "^1.46.0",
"global-directory": "^5.0.0",
"import-meta-resolve": "^4.0.0",
"lodash.mergewith": "^4.6.2",
"resolve-from": "^5.0.0"
},
"engines": {
@ -98,36 +98,50 @@
}
},
"node_modules/@commitlint/types": {
"version": "20.4.0",
"resolved": "https://registry.npmjs.org/@commitlint/types/-/types-20.4.0.tgz",
"integrity": "sha512-aO5l99BQJ0X34ft8b0h7QFkQlqxC6e7ZPVmBKz13xM9O8obDaM1Cld4sQlJDXXU/VFuUzQ30mVtHjVz74TuStw==",
"version": "20.5.0",
"resolved": "https://registry.npmjs.org/@commitlint/types/-/types-20.5.0.tgz",
"integrity": "sha512-ZJoS8oSq2CAZEpc/YI9SulLrdiIyXeHb/OGqGrkUP6Q7YV+0ouNAa7GjqRdXeQPncHQIDz/jbCTlHScvYvO/gA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"conventional-commits-parser": "^6.2.1",
"conventional-commits-parser": "^6.3.0",
"picocolors": "^1.1.1"
},
"engines": {
"node": ">=v18"
}
},
"node_modules/@simple-libs/stream-utils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@simple-libs/stream-utils/-/stream-utils-1.2.0.tgz",
"integrity": "sha512-KxXvfapcixpz6rVEB6HPjOUZT22yN6v0vI0urQSk1L8MlEWPDFCZkhw2xmkyoTGYeFw7tWTZd7e3lVzRZRN/EA==",
"dev": true,
"license": "MIT",
"optional": true,
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://ko-fi.com/dangreen"
}
},
"node_modules/@types/node": {
"version": "25.3.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.3.tgz",
"integrity": "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==",
"version": "25.6.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz",
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"undici-types": "~7.18.0"
"undici-types": "~7.19.0"
}
},
"node_modules/ajv": {
"version": "8.18.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
"integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
"integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
"dev": true,
"license": "MIT",
"optional": true,
@ -240,9 +254,9 @@
}
},
"node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
"integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -440,13 +454,14 @@
"license": "ISC"
},
"node_modules/conventional-commits-parser": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.2.1.tgz",
"integrity": "sha512-20pyHgnO40rvfI0NGF/xiEoFMkXDtkF8FwHvk5BokoFoCuTQRI8vrNCNFWUOfuolKJMm1tPCHc8GgYEtr1XRNA==",
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.4.0.tgz",
"integrity": "sha512-tvRg7FIBNlyPzjdG8wWRlPHQJJHI7DylhtRGeU9Lq+JuoPh5BKpPRX83ZdLrvXuOSu5Eo/e7SzOQhU4Hd2Miuw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@simple-libs/stream-utils": "^1.2.0",
"meow": "^13.0.0"
},
"bin": {
@ -457,9 +472,9 @@
}
},
"node_modules/cosmiconfig": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz",
"integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.1.tgz",
"integrity": "sha512-hr4ihw+DBqcvrsEDioRO31Z17x71pUYoNe/4h6Z0wB72p7MU7/9gH8Q3s12NFhHPfYBBOV3qyfUxmr/Yn3shnQ==",
"dev": true,
"license": "MIT",
"optional": true,
@ -485,14 +500,14 @@
}
},
"node_modules/cosmiconfig-typescript-loader": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-6.2.0.tgz",
"integrity": "sha512-GEN39v7TgdxgIoNcdkRE3uiAzQt3UXLyHbRHD6YoL048XAeOomyxaP+Hh/+2C6C2wYjxJ2onhJcsQp+L4YEkVQ==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-6.3.0.tgz",
"integrity": "sha512-Akr82WH1Wfqatyiqpj8HDkO2o2KmJRu1FhKfSNJP3K4IdXwHfEyL7MOb62i1AGQVLtIQM+iCE9CGOtrfhR+mmA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"jiti": "^2.6.1"
"jiti": "2.6.1"
},
"engines": {
"node": ">=v18"
@ -593,6 +608,18 @@
"is-arrayish": "^0.2.1"
}
},
"node_modules/es-toolkit": {
"version": "1.46.1",
"resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.46.1.tgz",
"integrity": "sha512-5eNtXOs3tbfxXOj04tjjseeWkRWaoCjdEI+96DgwzZoe6c9juL49pXlzAFTI72aWC9Y8p7168g6XIKjh7k6pyQ==",
"dev": true,
"license": "MIT",
"optional": true,
"workspaces": [
"docs",
"benchmarks"
]
},
"node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@ -766,17 +793,17 @@
}
},
"node_modules/global-directory": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz",
"integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/global-directory/-/global-directory-5.0.0.tgz",
"integrity": "sha512-1pgFdhK3J2LeM+dVf2Pd424yHx2ou338lC0ErNP2hPx4j8eW1Sp0XqSjNxtk6Tc4Kr5wlWtSvz8cn2yb7/SG/w==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"ini": "4.1.1"
"ini": "6.0.0"
},
"engines": {
"node": ">=18"
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@ -946,14 +973,14 @@
"license": "ISC"
},
"node_modules/ini": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz",
"integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/ini/-/ini-6.0.0.tgz",
"integrity": "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ==",
"dev": true,
"license": "ISC",
"optional": true,
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": "^20.17.0 || >=22.9.0"
}
},
"node_modules/inquirer": {
@ -1221,9 +1248,9 @@
"optional": true
},
"node_modules/jsonfile": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz",
"integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
"integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -1255,14 +1282,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/lodash.mergewith": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz",
"integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==",
"dev": true,
"license": "MIT",
"optional": true
},
"node_modules/log-symbols": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
@ -1640,9 +1659,9 @@
"optional": true
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true,
"license": "MIT",
"engines": {
@ -1900,9 +1919,9 @@
}
},
"node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"dev": true,
"license": "Apache-2.0",
"optional": true,
@ -1916,9 +1935,9 @@
}
},
"node_modules/undici-types": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"version": "7.19.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz",
"integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==",
"dev": true,
"license": "MIT",
"optional": true,

View File

@ -1,7 +1,7 @@
{
"name": "@commitlint/config-validator",
"type": "module",
"version": "20.4.0",
"version": "20.5.0",
"description": "config validator for commitlint.config.js",
"main": "lib/validate.js",
"types": "lib/validate.d.ts",
@ -39,8 +39,8 @@
"@commitlint/utils": "^20.0.0"
},
"dependencies": {
"@commitlint/types": "^20.4.0",
"@commitlint/types": "^20.5.0",
"ajv": "^8.11.0"
},
"gitHead": "c68de5e24b010e38eac171f35ba18d31bb1fd3dd"
"gitHead": "a7918e9cf70f822505cb4422c03150a86f802627"
}

View File

@ -1 +1 @@
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAIA,OAAuB,EACtB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EAEnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,WAAW,EAEX,eAAe,EAEf,UAAU,EACV,MAAM,mBAAmB,CAAC;AAmB3B,wBAA8B,IAAI,CACjC,IAAI,GAAE,UAAe,EACrB,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,eAAe,CAAC,CAoG1B;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC"}
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAIA,OAAuB,EACtB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EAEnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,WAAW,EAEX,eAAe,EAEf,UAAU,EACV,MAAM,mBAAmB,CAAC;AAmB3B,wBAA8B,IAAI,CACjC,IAAI,GAAE,UAAe,EACrB,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,eAAe,CAAC,CAsG1B;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC"}

View File

@ -3,7 +3,7 @@ import { validateConfig } from "@commitlint/config-validator";
import executeRule from "@commitlint/execute-rule";
import resolveExtends, { resolveFrom, resolveFromSilent, resolveGlobalSilent, loadParserPreset, } from "@commitlint/resolve-extends";
import isPlainObject from "is-plain-obj";
import mergeWith from "lodash.mergewith";
import { merge } from "es-toolkit/compat";
import { loadConfig } from "./utils/load-config.js";
import { loadParserOpts } from "./utils/load-parser-opts.js";
import loadPlugin from "./utils/load-plugin.js";
@ -25,11 +25,14 @@ export default async function load(seed = {}, options = {}) {
const configFilePath = loaded?.filepath;
let config = {};
if (loaded) {
validateConfig(loaded.filepath || "", loaded.config);
config = loaded.config;
const resolvedConfig = typeof loaded.config === "function"
? await loaded.config()
: await loaded.config;
validateConfig(loaded.filepath || "", resolvedConfig);
config = resolvedConfig;
}
// Merge passed config with file based options
config = mergeWith({
config = merge({
extends: [],
plugins: [],
rules: {},
@ -56,7 +59,9 @@ export default async function load(seed = {}, options = {}) {
const deduplicatedPlugins = [...new Set(extended.plugins)];
for (const plugin of deduplicatedPlugins) {
if (typeof plugin === "string") {
plugins = await loadPlugin(plugins, plugin, process.env.DEBUG === "true");
plugins = await loadPlugin(plugins, plugin, {
debug: process.env.DEBUG === "true",
});
}
else {
plugins.local = plugin;

View File

@ -1 +1 @@
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"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AAiB,EAAE,mBAAmB,EAAE,CAAC"}

View File

@ -1 +1 @@
{"version":3,"file":"load-parser-opts.d.ts","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAgBvC,wBAAsB,cAAc,CACnC,aAAa,EACV,MAAM,GACN,SAAS,CAAC,YAAY,CAAC,GACvB,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,CAAC,GAC/B,SAAS,GACV,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA0DnC"}
{"version":3,"file":"load-parser-opts.d.ts","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAgBvC,wBAAsB,cAAc,CACnC,aAAa,EACV,MAAM,GACN,SAAS,CAAC,YAAY,CAAC,GACvB,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,CAAC,GAC/B,SAAS,GACV,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAiEnC"}

View File

@ -23,7 +23,11 @@ export async function loadParserOpts(pendingParser) {
parser.parserOpts = await parser.parserOpts;
if (isObjectLike(parser.parserOpts) &&
isObjectLike(parser.parserOpts.parserOpts)) {
parser.parserOpts = parser.parserOpts.parserOpts;
// Preserve any user-provided properties (e.g. issuePrefixes) that
// were merged at the outer parserOpts level during config resolution,
// while unwrapping the inner module-provided parserOpts (#4640).
const { parserOpts: inner, ...rest } = parser.parserOpts;
parser.parserOpts = { ...inner, ...rest };
}
return parser;
}

View File

@ -1 +1 @@
{"version":3,"file":"load-parser-opts.js","sourceRoot":"","sources":["../../src/utils/load-parser-opts.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wBACT,UAAU,EAAE,IAAI,EAAE,UAAU,IAAI,IAAI,EAAE,MAAM;qBAC5C,CAAC,CAAC;gBACJ,CAAC,CAAC,CAAC;YACJ,CAAC;YACD,OAAO;QACR,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}

View File

@ -1,3 +1,7 @@
import { PluginRecords } from "@commitlint/types";
export default function loadPlugin(plugins: PluginRecords, pluginName: string, debug?: boolean): Promise<PluginRecords>;
export interface LoadPluginOptions {
debug?: boolean;
searchPaths?: string[];
}
export default function loadPlugin(plugins: PluginRecords, pluginName: string, options?: LoadPluginOptions | boolean): Promise<PluginRecords>;
//# sourceMappingURL=load-plugin.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"load-plugin.d.ts","sourceRoot":"","sources":["../../src/utils/load-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAiB1D,wBAA8B,UAAU,CACvC,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,OAAe,GACpB,OAAO,CAAC,aAAa,CAAC,CA8DxB"}
{"version":3,"file":"load-plugin.d.ts","sourceRoot":"","sources":["../../src/utils/load-plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAqC1D,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAWD,wBAA8B,UAAU,CACvC,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,iBAAiB,GAAG,OAAY,GACvC,OAAO,CAAC,aAAa,CAAC,CAuJxB"}

View File

@ -1,19 +1,56 @@
import { createRequire } from "node:module";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import pc from "picocolors";
import { normalizePackageName, getShorthandName } from "./plugin-naming.js";
import { WhitespacePluginError, MissingPluginError } from "./plugin-errors.js";
import { resolveFromNpxCache } from "@commitlint/resolve-extends";
const require = createRequire(import.meta.url);
const __dirname = path.resolve(fileURLToPath(import.meta.url), "..");
const dynamicImport = async (id) => {
const imported = await import(path.isAbsolute(id) ? pathToFileURL(id).toString() : id);
return ("default" in imported && imported.default) || imported;
};
export default async function loadPlugin(plugins, pluginName, debug = false) {
function sanitizeErrorMessage(message) {
return message
.replace(/\/[^/]+\/node_modules/g, "...")
.replace(/\\[^\\]+\\node_modules/g, "...");
}
function findPackageJson(dir) {
let current = dir;
const root = path.parse(dir).root;
while (current !== root) {
const pkgPath = path.join(current, "package.json");
if (fs.existsSync(pkgPath)) {
return pkgPath;
}
current = path.dirname(current);
}
return null;
}
function normalizeOptions(options) {
if (typeof options === "boolean") {
return { debug: options };
}
return options;
}
export default async function loadPlugin(plugins, pluginName, options = {}) {
const normalized = normalizeOptions(options);
const { debug = false, searchPaths = [] } = normalized;
for (const searchPath of searchPaths) {
if (typeof searchPath !== "string" || !path.isAbsolute(searchPath)) {
throw new Error(`Invalid searchPath "${searchPath}": must be an absolute path`);
}
if (!fs.existsSync(searchPath)) {
throw new Error(`Invalid searchPath "${searchPath}": directory does not exist`);
}
if (!fs.statSync(searchPath).isDirectory()) {
throw new Error(`Invalid searchPath "${searchPath}": must be a directory, not a file`);
}
}
const longName = normalizePackageName(pluginName);
const shortName = getShorthandName(longName);
let plugin;
if (pluginName.match(/\s+/u)) {
throw new WhitespacePluginError(pluginName, {
pluginName: longName,
@ -21,42 +58,99 @@ export default async function loadPlugin(plugins, pluginName, debug = false) {
}
const pluginKey = longName === pluginName ? shortName : pluginName;
if (!plugins[pluginKey]) {
try {
plugin = await dynamicImport(longName);
}
catch (pluginLoadErr) {
let plugin;
let resolvedPath;
// Try to load from npx cache directories using require.resolve
const npxResolvedPath = resolveFromNpxCache(longName);
if (npxResolvedPath) {
try {
// Check whether the plugin exists
require.resolve(longName);
plugin = await dynamicImport(npxResolvedPath);
resolvedPath = npxResolvedPath;
}
catch (error) {
// If the plugin can't be resolved, display the missing plugin error (usually a config or install error)
console.error(pc.red(`Failed to load plugin ${longName}.`));
const message = error?.message || "Unknown error occurred";
throw new MissingPluginError(pluginName, message, {
pluginName: longName,
commitlintPath: path.resolve(__dirname, "../.."),
});
catch (err) {
if (debug) {
console.debug(`Failed to load plugin ${longName} from npx cache: ${err.message}`);
}
}
}
// Try to load from additional search paths (extended config's node_modules)
if (!plugin) {
for (const searchPath of searchPaths) {
try {
resolvedPath = require.resolve(longName, { paths: [searchPath] });
plugin = await dynamicImport(resolvedPath);
break;
}
catch (err) {
if (debug) {
console.debug(`Failed to load plugin ${longName} from ${searchPath}: ${err.message}`);
}
}
}
}
// Try default resolution as last resort
if (!plugin) {
try {
plugin = await dynamicImport(longName);
// Try to resolve path for debug logging
try {
resolvedPath = require.resolve(longName);
}
catch {
// Ignore - path not critical
}
}
catch (err) {
let resolutionError;
try {
resolvedPath = require.resolve(longName);
}
catch (resolveErr) {
resolutionError = resolveErr;
}
if (resolutionError) {
// Resolution failed - throw MissingPluginError
if (debug) {
console.debug(`Failed to resolve plugin ${longName}: ${resolutionError.message}`);
}
throw new MissingPluginError(pluginName, sanitizeErrorMessage(resolutionError.message), {
pluginName: longName,
commitlintPath: path.resolve(__dirname, "../.."),
});
}
// Resolution succeeded but import failed - rethrow original error
throw err;
}
// Otherwise, the plugin exists and is throwing on module load for some reason, so print the stack trace.
throw pluginLoadErr;
}
// This step is costly, so skip if debug is disabled
if (debug) {
const resolvedPath = require.resolve(longName);
let version = null;
try {
version = require(`${longName}/package.json`).version;
}
catch (e) {
// Do nothing
if (resolvedPath) {
try {
const pkgPath = findPackageJson(path.dirname(resolvedPath));
if (pkgPath) {
version = require(pkgPath).version;
}
}
catch {
// Do nothing
}
}
const loadedPluginAndVersion = version
? `${longName}@${version}`
: `${longName}, version unknown`;
console.log(pc.blue(`Loaded plugin ${pluginName} (${loadedPluginAndVersion}) (from ${resolvedPath})`));
const fromPath = resolvedPath ? ` (from ${resolvedPath})` : "";
console.log(pc.blue(`Loaded plugin ${pluginName} (${loadedPluginAndVersion})${fromPath}`));
}
if (plugin) {
plugins[pluginKey] = plugin;
}
else {
throw new MissingPluginError(pluginName, "Plugin loaded but is undefined", {
pluginName: longName,
commitlintPath: path.resolve(__dirname, "../.."),
});
}
plugins[pluginKey] = plugin;
}
return plugins;
}

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "@commitlint/load",
"type": "module",
"version": "20.4.0",
"version": "20.5.3",
"description": "Load shared commitlint configuration",
"main": "lib/load.js",
"types": "lib/load.d.ts",
@ -36,22 +36,21 @@
},
"license": "MIT",
"devDependencies": {
"@commitlint/test": "^20.4.0",
"@types/lodash.mergewith": "^4.6.8",
"@commitlint/test": "^20.4.3",
"@types/node": "^18.19.17",
"conventional-changelog-atom": "^5.0.0",
"typescript": "^5.2.2"
"typescript": "^6.0.0"
},
"dependencies": {
"@commitlint/config-validator": "^20.4.0",
"@commitlint/config-validator": "^20.5.0",
"@commitlint/execute-rule": "^20.0.0",
"@commitlint/resolve-extends": "^20.4.0",
"@commitlint/types": "^20.4.0",
"cosmiconfig": "^9.0.0",
"@commitlint/resolve-extends": "^20.5.3",
"@commitlint/types": "^20.5.0",
"cosmiconfig": "^9.0.1",
"cosmiconfig-typescript-loader": "^6.1.0",
"es-toolkit": "^1.46.0",
"is-plain-obj": "^4.1.0",
"lodash.mergewith": "^4.6.2",
"picocolors": "^1.1.1"
},
"gitHead": "c68de5e24b010e38eac171f35ba18d31bb1fd3dd"
"gitHead": "31e959a3d17d4403f1142f825c43cccf2e0f7dc4"
}

View File

@ -21,9 +21,15 @@ export interface ResolveExtendsContext {
dynamicImport?<T>(id: string): T | Promise<T>;
}
export default function resolveExtends(config?: UserConfig, context?: ResolveExtendsContext): Promise<UserConfig>;
export declare function resolveFromSilent(specifier: string, parent: string): string | void;
export declare function resolveFromSilent(specifier: string, parent: string): string | undefined;
/**
* Resolve a module specifier from npx cache directories.
* Iterates all npx cache directories and returns the first successful resolution.
* Uses require.resolve for proper Node module resolution (respects package.json main/exports).
*/
export declare function resolveFromNpxCache(specifier: string): string | undefined;
/**
* @see https://github.com/sindresorhus/resolve-global/blob/682a6bb0bd8192b74a6294219bb4c536b3708b65/index.js#L7
*/
export declare function resolveGlobalSilent(specifier: string): string | void;
export declare function resolveGlobalSilent(specifier: string): string | undefined;
//# sourceMappingURL=index.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA0BlE;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,MAuC7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC5B,sBAAsB,MAAM,KAC1B,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY,CAAC,CASnD,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IACtE,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9C;AAED,wBAA8B,cAAc,CAC3C,MAAM,GAAE,UAAe,EACvB,OAAO,G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C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAIpB;AAqED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAazE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkBzE"}

View File

@ -1,15 +1,16 @@
import { createRequire } from "node:module";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { pathToFileURL, fileURLToPath } from "node:url";
import globalDirectory from "global-directory";
import { moduleResolve } from "import-meta-resolve";
import mergeWith from "lodash.mergewith";
import { mergeWith } from "es-toolkit/compat";
import resolveFrom_ from "resolve-from";
import { validateConfig } from "@commitlint/config-validator";
const require = createRequire(import.meta.url);
const dynamicImport = async (id) => {
if (id.endsWith(".json")) {
const require = createRequire(import.meta.url);
return require(id);
}
const imported = await import(path.isAbsolute(id) ? pathToFileURL(id).toString() : id);
@ -96,20 +97,25 @@ async function loadExtends(config = {}, context = {}) {
const ext = e ? (Array.isArray(e) ? e : [e]) : [];
return await ext.reduce(async (configs, raw) => {
const resolved = resolveConfig(raw, context);
const c = await (context.dynamicImport || dynamicImport)(resolved);
// Shallow-copy so we never mutate an ESM namespace object (#4647).
const c = {
...(await (context.dynamicImport || dynamicImport)(resolved)),
};
const cwd = path.dirname(resolved);
const ctx = { ...context, cwd };
// Resolve parser preset if none was present before
if (!context.parserPreset &&
typeof c === "object" &&
typeof c.parserPreset === "string") {
// Always resolve string parser presets from extended configs so that
// their parserOpts (headerPattern, etc.) are available for merging.
// Previously this was skipped when the user provided any parserPreset,
// which caused partial user overrides (e.g. just issuePrefixes) to
// lose the extended preset's headerPattern (see #4640).
if (typeof c === "object" && typeof c.parserPreset === "string") {
const resolvedParserPreset = resolveFrom(c.parserPreset, cwd);
const parserPreset = {
name: c.parserPreset,
...(await loadParserPreset(resolvedParserPreset)),
};
ctx.parserPreset = parserPreset;
config.parserPreset = parserPreset;
c.parserPreset = parserPreset;
}
validateConfig(resolved, config);
return [...(await configs), ...(await loadExtends(c, ctx)), c];
@ -159,6 +165,83 @@ export function resolveFromSilent(specifier, parent) {
}
catch { }
}
/**
* Get the npm cache directory.
* Respects npm config (npm_config_cache env var or npm config get cache).
*/
function getNpmCacheDir() {
if (process.env.npm_config_cache) {
return process.env.npm_config_cache;
}
try {
const { execSync } = require("child_process");
const cacheDir = execSync("npm config get cache", {
encoding: "utf8",
stdio: ["pipe", "pipe", "ignore"],
}).trim();
if (cacheDir) {
return cacheDir;
}
}
catch {
// Ignore errors
}
const home = os.homedir();
return path.join(home, ".npm");
}
let npxCachePathsCache;
/**
* Get the npx cache directory paths.
* npx stores packages in a subdirectory of the npm cache (e.g., ~/.npm/_npx).
* Results are memoized and sorted by mtime (most recent first) for deterministic resolution.
*/
function getNpxCachePaths() {
if (npxCachePathsCache) {
return npxCachePathsCache;
}
const npmCache = getNpmCacheDir();
const npxPath = path.join(npmCache, "_npx");
if (!fs.existsSync(npxPath)) {
npxCachePathsCache = [];
return [];
}
try {
const entries = fs.readdirSync(npxPath, { withFileTypes: true });
const dirs = entries
.filter((entry) => entry.isDirectory())
.map((entry) => ({
path: path.join(npxPath, entry.name, "node_modules"),
mtime: fs.statSync(path.join(npxPath, entry.name)).mtime,
}))
.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
npxCachePathsCache = dirs.map((d) => d.path);
}
catch (err) {
if (process.env.DEBUG === "true") {
console.debug(`Failed to read npx cache: ${err.message}`);
}
npxCachePathsCache = [];
}
return npxCachePathsCache;
}
/**
* Resolve a module specifier from npx cache directories.
* Iterates all npx cache directories and returns the first successful resolution.
* Uses require.resolve for proper Node module resolution (respects package.json main/exports).
*/
export function resolveFromNpxCache(specifier) {
for (const npxDir of getNpxCachePaths()) {
try {
return require.resolve(specifier, { paths: [npxDir] });
}
catch (err) {
if (process.env.DEBUG === "true") {
console.debug(`Failed to resolve ${specifier} from ${npxDir}: ${err.message}`);
}
}
}
return undefined;
}
/**
* @see https://github.com/sindresorhus/resolve-global/blob/682a6bb0bd8192b74a6294219bb4c536b3708b65/index.js#L7
*/
@ -170,7 +253,13 @@ export function resolveGlobalSilent(specifier) {
try {
return resolveFrom(specifier, globalPackages);
}
catch { }
catch (err) {
if (process.env.DEBUG === "true") {
console.debug(`Failed to resolve ${specifier} from global: ${err.message}`);
}
}
}
// Check npx cache directories
return resolveFromNpxCache(specifier);
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "@commitlint/resolve-extends",
"type": "module",
"version": "20.4.0",
"version": "20.5.3",
"description": "Lint your commit messages",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -36,16 +36,15 @@
},
"license": "MIT",
"devDependencies": {
"@commitlint/utils": "^20.0.0",
"@types/lodash.mergewith": "^4.6.8"
"@commitlint/utils": "^20.0.0"
},
"dependencies": {
"@commitlint/config-validator": "^20.4.0",
"@commitlint/types": "^20.4.0",
"global-directory": "^4.0.1",
"@commitlint/config-validator": "^20.5.0",
"@commitlint/types": "^20.5.0",
"es-toolkit": "^1.46.0",
"global-directory": "^5.0.0",
"import-meta-resolve": "^4.0.0",
"lodash.mergewith": "^4.6.2",
"resolve-from": "^5.0.0"
},
"gitHead": "c68de5e24b010e38eac171f35ba18d31bb1fd3dd"
"gitHead": "31e959a3d17d4403f1142f825c43cccf2e0f7dc4"
}

View File

@ -4,6 +4,7 @@ export type PromptConfig = {
settings: {
scopeEnumSeparator: string;
enableMultipleScopes: boolean;
useExclamationMark: boolean;
};
messages: PromptMessages;
questions: Partial<Record<PromptName, {

View File

@ -1 +1 @@
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAClB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,GACN,QAAQ,CAAC;AAEZ,MAAM,MAAM,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AAC,YAAY,CAAC,CAAC;AAEzD,KAAK,WAAW,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;SACf,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3B;CACD,CAAC"}

View File

@ -38,11 +38,14 @@ export declare enum RuleConfigQuality {
User = 0,
Qualified = 1
}
export type QualifiedRuleConfig<T> = (() => RuleConfigTuple<T>) | (() => Promise<RuleConfigTuple<T>>) | RuleConfigTuple<T>;
export interface RuleConfigContext {
cwd?: string;
}
export type QualifiedRuleConfig<T> = ((ctx?: RuleConfigContext) => RuleConfigTuple<T>) | ((ctx?: RuleConfigContext) => Promise<RuleConfigTuple<T>>) | RuleConfigTuple<T>;
export type RuleConfig<V = RuleConfigQuality.Qualified, T = void> = V extends RuleConfigQuality.Qualified ? RuleConfigTuple<T> : QualifiedRuleConfig<T>;
export type CaseRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, TargetCaseType | TargetCaseType[]>;
export type CaseRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, TargetCaseType | readonly TargetCaseType[]>;
export type LengthRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, number>;
export type EnumRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, string[]>;
export type EnumRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, readonly string[]>;
export type ObjectRuleConfig<V = RuleConfigQuality.User, T = Record<string, unknown>> = RuleConfig<V, T>;
export type RulesConfig<V = RuleConfigQuality.User> = {
"body-case": CaseRuleConfig<V>;
@ -65,14 +68,14 @@ export type RulesConfig<V = RuleConfigQuality.User> = {
"header-trim": RuleConfig<V>;
"references-empty": RuleConfig<V>;
"scope-case": CaseRuleConfig<V> | ObjectRuleConfig<V, {
cases: TargetCaseType[];
delimiters?: string[];
cases: readonly TargetCaseType[];
delimiters?: readonly string[];
}>;
"scope-delimiter-style": EnumRuleConfig<V>;
"scope-empty": RuleConfig<V>;
"scope-enum": EnumRuleConfig<V> | ObjectRuleConfig<V, {
scopes: string[];
delimiters?: string[];
scopes: readonly string[];
delimiters?: readonly string[];
}>;
"scope-max-length": LengthRuleConfig<V>;
"scope-min-length": LengthRuleConfig<V>;

View File

@ -1 +1 @@
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEnD,MAAM,MAAM,QAAQ,CAAC,KAAK,GAAG,KAAK,EAAE,IAAI,SAAS,QAAQ,GAAG,QAAQ,IAAI,CACvE,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,mBAAmB,EAC1B,KAAK,CAAC,EAAE,KAAK,KACT,IAAI,SAAS,QAAQ,GACvB,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAClC,IAAI,SAAS,OAAO,GACnB,OAAO,CAAC,WAAW,CAAC,GACpB,IAAI,SAAS,MAAM,GAClB,WAAW,GACX,KAAK,CAAC;AAEX,MAAM,MAAM,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC5D,MAAM,MAAM,SAAS,CAAC,KAAK,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChE,MAAM,MAAM,QAAQ,CAAC,KAAK,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE9D;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,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC/B,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACvC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAEvC,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC"}

View File

@ -1,7 +1,7 @@
{
"name": "@commitlint/types",
"type": "module",
"version": "20.4.0",
"version": "20.5.0",
"description": "Shared types for commitlint packages",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -29,11 +29,12 @@
},
"license": "MIT",
"dependencies": {
"conventional-commits-parser": "^6.2.1",
"conventional-commits-parser": "^6.3.0",
"picocolors": "^1.1.1"
},
"devDependencies": {
"@commitlint/utils": "^20.0.0"
"@commitlint/utils": "^20.0.0",
"@types/conventional-commits-parser": "^5.0.2"
},
"gitHead": "c68de5e24b010e38eac171f35ba18d31bb1fd3dd"
"gitHead": "a7918e9cf70f822505cb4422c03150a86f802627"
}

View File

@ -1,9 +1,6 @@
MIT License
Copyright (c) 2023 NeoForged project
This license applies to the template files as supplied by github.com/NeoForged/MDK
The MIT License (MIT)
Copyright (c) 2016 - present, TrigenSoftware
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

79
node_modules/@simple-libs/stream-utils/README.md generated vendored Normal file
View File

@ -0,0 +1,79 @@
# @simple-libs/stream-utils
[![ESM-only package][package]][package-url]
[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependencies status][deps]][deps-url]
[![Install size][size]][size-url]
[![Build status][build]][build-url]
[![Coverage status][coverage]][coverage-url]
[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
[package-url]: https://nodejs.org/api/esm.html
[npm]: https://img.shields.io/npm/v/@simple-libs/stream-utils.svg
[npm-url]: https://www.npmjs.com/package/@simple-libs/stream-utils
[node]: https://img.shields.io/node/v/@simple-libs/stream-utils.svg
[node-url]: https://nodejs.org
[deps]: https://img.shields.io/librariesio/release/npm/@simple-libs/stream-utils
[deps-url]: https://libraries.io/npm/@simple-libs%2Fstream-utils
[size]: https://packagephobia.com/badge?p=@simple-libs/stream-utils
[size-url]: https://packagephobia.com/result?p=@simple-libs/stream-utils
[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/simple-libs/tests.yml?branch=main
[build-url]: https://github.com/TrigenSoftware/simple-libs/actions
[coverage]: https://coveralls.io/repos/github/TrigenSoftware/simple-libs/badge.svg?branch=main
[coverage-url]: https://coveralls.io/github/TrigenSoftware/simple-libs?branch=main
A small set of utilities for streams.
## Install
```bash
# pnpm
pnpm add @simple-libs/stream-utils
# yarn
yarn add @simple-libs/stream-utils
# npm
npm i @simple-libs/stream-utils
```
## Usage
```ts
import {
toArray,
concatBufferStream,
concatStringStream,
firstFromStream,
mergeReadables
} from '@simple-libs/stream-utils'
// Convert a readable stream to an array
await toArray(Readable.from(['foo', 'bar', 'baz']))
// Returns ['foo', 'bar', 'baz']
// Concatenate a stream of buffers into a single buffer
await concatBufferStream(Readable.from([Buffer.from('foo'), Buffer.from('bar')]))
// Returns <Buffer 66 6f 6f 62 61 72>
// Concatenate a stream of strings into a single string
await concatStringStream(Readable.from(['foo', 'bar']))
// Returns 'foobar'
// Get the first value from a stream
await firstFromStream(Readable.from(['foo', 'bar']))
// Returns 'foo'
// Merges multiple Readable streams into a single Readable stream.
// Each chunk will be an object containing the source stream name and the chunk data.
await mergeReadables({
foo: Readable.from(['foo1', 'foo2']),
bar: Readable.from(['bar1', 'bar2'])
})
// Returns [{ source: 'foo', chunk: 'foo1' }, { source: 'foo', chunk: 'foo2' }, { source: 'bar', chunk: 'bar1' }, { source: 'bar', chunk: 'bar2' }]
```

51
node_modules/@simple-libs/stream-utils/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,51 @@
import { Readable } from 'stream';
/**
* Get all items from an async iterable and return them as an array.
* @param iterable
* @returns A promise that resolves to an array of items.
*/
export declare function toArray<T>(iterable: AsyncIterable<T>): Promise<T[]>;
/**
* Concatenate all buffers from an async iterable into a single Buffer.
* @param iterable
* @returns A promise that resolves to a single Buffer containing all concatenated buffers.
*/
export declare function concatBufferStream(iterable: AsyncIterable<Buffer>): Promise<Buffer<ArrayBuffer>>;
/**
* Concatenate all strings from an async iterable into a single string.
* @param iterable
* @returns A promise that resolves to a single string containing all concatenated strings.
*/
export declare function concatStringStream(iterable: AsyncIterable<string>): Promise<string>;
/**
* Get the first item from an async iterable.
* @param stream
* @returns A promise that resolves to the first item, or null if the iterable is empty.
*/
export declare function firstFromStream<T>(stream: AsyncIterable<T>): Promise<T | null>;
export interface MergedReadableChunk<K extends string, T = Buffer> {
source: K;
chunk: T;
}
/**
* Merges multiple Readable streams into a single Readable stream.
* Each chunk will be an object containing the source stream name and the chunk data.
* @param streams - An object where keys are stream names and values are Readable streams.
* @returns A merged Readable stream.
*/
export declare function mergeReadables<K extends string, T = Buffer>(streams: Record<K, Readable>): Readable & AsyncIterable<MergedReadableChunk<K, T>>;
/**
* Split stream by separator.
* @param stream
* @param separator
* @yields String chunks.
*/
export declare function splitStream(stream: AsyncIterable<string | Buffer>, separator: string): AsyncGenerator<string, void, unknown>;
/**
* Parse JSON objects from a stream, separated by a delimiter (default is newline).
* @param stream
* @param delimiter
* @yields Parsed JSON objects of type T.
*/
export declare function parseJsonStream<T>(stream: AsyncIterable<string | Buffer>, delimiter?: RegExp): AsyncGenerator<Awaited<T>, void, unknown>;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAQzE;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,gCAEvE;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,mBAEvE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,qBAMhE;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,MAAM;IAC/D,MAAM,EAAE,CAAC,CAAA;IACT,KAAK,EAAE,CAAC,CAAA;CACT;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,CAAC,SAAS,MAAM,EAChB,CAAC,GAAG,MAAM,EAEV,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,GAC3B,QAAQ,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAwBrD;AAED;;;;;GAKG;AACH,wBAAuB,WAAW,CAChC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EACtC,SAAS,EAAE,MAAM,yCAoBlB;AAED;;;;;GAKG;AACH,wBAAuB,eAAe,CAAC,CAAC,EACtC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EACtC,SAAS,SAAU,6CAuBpB"}

116
node_modules/@simple-libs/stream-utils/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,116 @@
import { Readable } from 'stream';
/**
* Get all items from an async iterable and return them as an array.
* @param iterable
* @returns A promise that resolves to an array of items.
*/
export async function toArray(iterable) {
const result = [];
for await (const item of iterable) {
result.push(item);
}
return result;
}
/**
* Concatenate all buffers from an async iterable into a single Buffer.
* @param iterable
* @returns A promise that resolves to a single Buffer containing all concatenated buffers.
*/
export async function concatBufferStream(iterable) {
return Buffer.concat(await toArray(iterable));
}
/**
* Concatenate all strings from an async iterable into a single string.
* @param iterable
* @returns A promise that resolves to a single string containing all concatenated strings.
*/
export async function concatStringStream(iterable) {
return (await toArray(iterable)).join('');
}
/**
* Get the first item from an async iterable.
* @param stream
* @returns A promise that resolves to the first item, or null if the iterable is empty.
*/
export async function firstFromStream(stream) {
for await (const tag of stream) {
return tag;
}
return null;
}
/**
* Merges multiple Readable streams into a single Readable stream.
* Each chunk will be an object containing the source stream name and the chunk data.
* @param streams - An object where keys are stream names and values are Readable streams.
* @returns A merged Readable stream.
*/
export function mergeReadables(streams) {
const mergedStream = new Readable({
objectMode: true,
read() { }
});
let ended = 0;
Object.entries(streams).forEach(([name, stream], _i, entries) => {
stream
.on('data', (chunk) => mergedStream.push({
source: name,
chunk
}))
.on('end', () => {
ended += 1;
if (ended === entries.length) {
mergedStream.push(null);
}
})
.on('error', err => mergedStream.destroy(err));
});
return mergedStream;
}
/**
* Split stream by separator.
* @param stream
* @param separator
* @yields String chunks.
*/
export async function* splitStream(stream, separator) {
let chunk;
let payload;
let buffer = '';
for await (chunk of stream) {
buffer += chunk.toString();
if (buffer.includes(separator)) {
payload = buffer.split(separator);
buffer = payload.pop() || '';
yield* payload;
}
}
if (buffer) {
yield buffer;
}
}
/**
* Parse JSON objects from a stream, separated by a delimiter (default is newline).
* @param stream
* @param delimiter
* @yields Parsed JSON objects of type T.
*/
export async function* parseJsonStream(stream, delimiter = /\r?\n/) {
let chunk;
let payload;
let buffer = '';
let json;
for await (chunk of stream) {
buffer += chunk.toString();
if (delimiter.test(buffer)) {
payload = buffer.split(delimiter);
buffer = payload.pop() || '';
for (json of payload) {
yield JSON.parse(json);
}
}
}
if (buffer) {
yield JSON.parse(buffer);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaW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yxLQUFLLENBQUMsU0FBUyxDQUFDLENBQUE7WUFDakMsTUFBTSxHQUFHLE9BQU8sQ0FBQyxHQUFHLEVBQUUsSUFBSSxFQUFFLENBQUE7WUFFNUIsS0FBSyxJQUFJLElBQUksT0FBTyxFQUFFLENBQUM7Z0JBQ3JCLE1BQU0sSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQU0sQ0FBQTtZQUM3QixDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFFRCxJQUFJLE1BQU0sRUFBRSxDQUFDO1FBQ1gsTUFBTSxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBTSxDQUFBO0lBQy9CLENBQUM7QUFDSCxDQUFDIn0=

38
node_modules/@simple-libs/stream-utils/package.json generated vendored Normal file
View File

@ -0,0 +1,38 @@
{
"name": "@simple-libs/stream-utils",
"type": "module",
"version": "1.2.0",
"description": "A small set of utilities for streams.",
"author": {
"name": "Dan Onoshko",
"email": "danon0404@gmail.com",
"url": "https://github.com/dangreen"
},
"license": "MIT",
"homepage": "https://github.com/TrigenSoftware/simple-libs/tree/main/packages/stream-utils#readme",
"funding": "https://ko-fi.com/dangreen",
"repository": {
"type": "git",
"url": "https://github.com/TrigenSoftware/simple-libs.git",
"directory": "packages/stream-utils"
},
"bugs": {
"url": "https://github.com/TrigenSoftware/simple-libs/issues"
},
"keywords": [
"stream",
"streams",
"utilities",
"utils"
],
"engines": {
"node": ">=18"
},
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"files": [
"dist"
]
}

2
node_modules/@types/node/README.md generated vendored
View File

@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
### Additional Details
* Last updated: Sat, 28 Feb 2026 20:39:10 GMT
* Last updated: Fri, 10 Apr 2026 03:39:58 GMT
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
# Credits

View File

@ -1,8 +1,3 @@
/**
* The `node:assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert.js)
*/
declare module "node:assert" {
import strict = require("node:assert/strict");
/**
@ -253,10 +248,10 @@ declare module "node:assert" {
* import assert from 'node:assert/strict';
*
* // Using `assert()` works the same:
* assert(0);
* assert(2 + 2 > 5);;
* // AssertionError: The expression evaluated to a falsy value:
* //
* // assert(0)
* // assert(2 + 2 > 5)
* ```
* @since v0.1.21
*/

View File

@ -1,49 +1,3 @@
/**
* In strict assertion mode, non-strict methods behave like their corresponding
* strict methods. For example, `assert.deepEqual()` will behave like
* `assert.deepStrictEqual()`.
*
* In strict assertion mode, error messages for objects display a diff. In legacy
* assertion mode, error messages for objects display the objects, often truncated.
*
* To use strict assertion mode:
*
* ```js
* import { strict as assert } from 'node:assert';
* ```
*
* ```js
* import assert from 'node:assert/strict';
* ```
*
* Example error diff:
*
* ```js
* import { strict as assert } from 'node:assert';
*
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
* // AssertionError: Expected inputs to be strictly deep-equal:
* // + actual - expected ... Lines skipped
* //
* // [
* // [
* // ...
* // 2,
* // + 3
* // - '3'
* // ],
* // ...
* // 5
* // ]
* ```
*
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
* environment variables. This will also deactivate the colors in the REPL. For
* more on color support in terminal environments, read the tty
* [`getColorDepth()`](https://nodejs.org/docs/latest-v25.x/api/tty.html#writestreamgetcolordepthenv) documentation.
* @since v15.0.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert/strict.js)
*/
declare module "node:assert/strict" {
import {
Assert,

View File

@ -1,19 +1,3 @@
/**
* We strongly discourage the use of the `async_hooks` API.
* Other APIs that can cover most of its use cases include:
*
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v25.x/api/async_context.html#class-asynclocalstorage) tracks async context
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v25.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
*
* The `node:async_hooks` module provides an API to track asynchronous resources.
* It can be accessed using:
*
* ```js
* import async_hooks from 'node:async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/async_hooks.js)
*/
declare module "node:async_hooks" {
/**
* ```js
@ -123,37 +107,31 @@ declare module "node:async_hooks" {
function triggerAsyncId(): number;
interface HookCallbacks {
/**
* Called when a class is constructed that has the possibility to emit an asynchronous event.
* @param asyncId A unique ID for the async resource
* @param type The type of the async resource
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
* The [`init` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#initasyncid-type-triggerasyncid-resource).
*/
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
/**
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
* The before callback is called just before said callback is executed.
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
* The [`before` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#beforeasyncid).
*/
before?(asyncId: number): void;
/**
* Called immediately after the callback specified in `before` is completed.
*
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
* The [`after` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#afterasyncid).
*/
after?(asyncId: number): void;
/**
* Called when a promise has resolve() called. This may not be in the same execution id
* as the promise itself.
* @param asyncId the unique id for the promise that was resolve()d.
* The [`promiseResolve` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#promiseresolveasyncid).
*/
promiseResolve?(asyncId: number): void;
/**
* Called after the resource corresponding to asyncId is destroyed
* @param asyncId a unique ID for the async resource
* The [`destroy` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#destroyasyncid).
*/
destroy?(asyncId: number): void;
/**
* Whether the hook should track `Promise`s. Cannot be `false` if
* `promiseResolve` is set.
* @default true
*/
trackPromises?: boolean | undefined;
}
interface AsyncHook {
/**
@ -174,7 +152,8 @@ declare module "node:async_hooks" {
*
* All callbacks are optional. For example, if only resource cleanup needs to
* be tracked, then only the `destroy` callback needs to be passed. The
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
* specifics of all functions that can be passed to `callbacks` is in the
* [Hook Callbacks](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#hook-callbacks) section.
*
* ```js
* import { createHook } from 'node:async_hooks';
@ -202,12 +181,13 @@ declare module "node:async_hooks" {
* ```
*
* Because promises are asynchronous resources whose lifecycle is tracked
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and
* `destroy()` callbacks _must not_ be async functions that return promises.
* @since v8.1.0
* @param callbacks The `Hook Callbacks` to register
* @return Instance used for disabling and enabling hooks
* @param options The [Hook Callbacks](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#hook-callbacks) to register
* @returns Instance used for disabling and enabling hooks
*/
function createHook(callbacks: HookCallbacks): AsyncHook;
function createHook(options: HookCallbacks): AsyncHook;
interface AsyncResourceOptions {
/**
* The ID of the execution context that created this async event.

View File

@ -174,7 +174,7 @@ declare module "node:buffer" {
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
* in `list` by adding their lengths.
*
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
* If `totalLength` is provided, it must be an unsigned integer. If the
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
* truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is
* less than `totalLength`, the remaining space is filled with zeros.

45
node_modules/@types/node/buffer.d.ts generated vendored
View File

@ -1,48 +1,3 @@
/**
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
* Node.js APIs support `Buffer`s.
*
* The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and
* extends it with methods that cover additional use cases. Node.js APIs accept
* plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well.
*
* While the `Buffer` class is available within the global scope, it is still
* recommended to explicitly reference it via an import or require statement.
*
* ```js
* import { Buffer } from 'node:buffer';
*
* // Creates a zero-filled Buffer of length 10.
* const buf1 = Buffer.alloc(10);
*
* // Creates a Buffer of length 10,
* // filled with bytes which all have the value `1`.
* const buf2 = Buffer.alloc(10, 1);
*
* // Creates an uninitialized buffer of length 10.
* // This is faster than calling Buffer.alloc() but the returned
* // Buffer instance might contain old data that needs to be
* // overwritten using fill(), write(), or other functions that fill the Buffer's
* // contents.
* const buf3 = Buffer.allocUnsafe(10);
*
* // Creates a Buffer containing the bytes [1, 2, 3].
* const buf4 = Buffer.from([1, 2, 3]);
*
* // Creates a Buffer containing the bytes [1, 1, 1, 1] the entries
* // are all truncated using `(value &#x26; 255)` to fit into the range 0255.
* const buf5 = Buffer.from([257, 257.5, -255, '1']);
*
* // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':
* // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)
* // [116, 195, 169, 115, 116] (in decimal notation)
* const buf6 = Buffer.from('tést');
*
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
* const buf7 = Buffer.from('tést', 'latin1');
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/buffer.js)
*/
declare module "node:buffer" {
import { ReadableStream } from "node:stream/web";
/**

View File

@ -1,70 +1,3 @@
/**
* The `node:child_process` module provides the ability to spawn subprocesses in
* a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
* is primarily provided by the {@link spawn} function:
*
* ```js
* import { spawn } from 'node:child_process';
* import { once } from 'node:events';
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
* console.log(`stdout: ${data}`);
* });
*
* ls.stderr.on('data', (data) => {
* console.error(`stderr: ${data}`);
* });
*
* const [code] = await once(ls, 'close');
* console.log(`child process exited with code ${code}`);
* ```
*
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
* the parent Node.js process and the spawned subprocess. These pipes have
* limited (and platform-specific) capacity. If the subprocess writes to
* stdout in excess of that limit without the output being captured, the
* subprocess blocks, waiting for the pipe buffer to accept more data. This is
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
*
* The command lookup is performed using the `options.env.PATH` environment
* variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
* used. If `options.env` is set without `PATH`, lookup on Unix is performed
* on a default search path search of `/usr/bin:/bin` (see your operating system's
* manual for execvpe/execvp), on Windows the current processes environment
* variable `PATH` is used.
*
* On Windows, environment variables are case-insensitive. Node.js
* lexicographically sorts the `env` keys and uses the first one that
* case-insensitively matches. Only first (in lexicographic order) entry will be
* passed to the subprocess. This might lead to issues on Windows when passing
* objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`.
*
* The {@link spawn} method spawns the child process asynchronously,
* without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
* the event loop until the spawned process either exits or is terminated.
*
* For convenience, the `node:child_process` module provides a handful of
* synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
* top of {@link spawn} or {@link spawnSync}.
*
* * {@link exec}: spawns a shell and runs a command within that
* shell, passing the `stdout` and `stderr` to a callback function when
* complete.
* * {@link execFile}: similar to {@link exec} except
* that it spawns the command directly without first spawning a shell by
* default.
* * {@link fork}: spawns a new Node.js process and invokes a
* specified module with an IPC communication channel established that allows
* sending messages between parent and child.
* * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop.
* * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop.
*
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
* the synchronous methods can have significant impact on performance due to
* stalling the event loop while spawned processes complete.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/child_process.js)
*/
declare module "node:child_process" {
import { NonSharedBuffer } from "node:buffer";
import * as dgram from "node:dgram";
@ -228,6 +161,11 @@ declare module "node:child_process" {
/**
* The `subprocess.exitCode` property indicates the exit code of the child process.
* If the child process is still running, the field will be `null`.
*
* When the child process is terminated by a signal, `subprocess.exitCode` will be
* `null` and `subprocess.signalCode` will be set. To get the corresponding
* POSIX exit code, use
* `util.convertProcessSignalToExitCode(subprocess.signalCode)`.
*/
readonly exitCode: number | null;
/**

View File

@ -1,57 +1,3 @@
/**
* Clusters of Node.js processes can be used to run multiple instances of Node.js
* that can distribute workloads among their application threads. When process isolation
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html)
* module instead, which allows running multiple application threads within a single Node.js instance.
*
* The cluster module allows easy creation of child processes that all share
* server ports.
*
* ```js
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
*
* const numCPUs = availableParallelism();
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
*
* // Fork workers.
* for (let i = 0; i < numCPUs; i++) {
* cluster.fork();
* }
*
* cluster.on('exit', (worker, code, signal) => {
* console.log(`worker ${worker.process.pid} died`);
* });
* } else {
* // Workers can share any TCP connection
* // In this case it is an HTTP server
* http.createServer((req, res) => {
* res.writeHead(200);
* res.end('hello world\n');
* }).listen(8000);
*
* console.log(`Worker ${process.pid} started`);
* }
* ```
*
* Running Node.js will now share port 8000 between the workers:
*
* ```console
* $ node server.js
* Primary 3596 is running
* Worker 4324 started
* Worker 4520 started
* Worker 6056 started
* Worker 5644 started
* ```
*
* On Windows, it is not yet possible to set up a named pipe server in a worker.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/cluster.js)
*/
declare module "node:cluster" {
import * as child_process from "node:child_process";
import { EventEmitter, InternalEventEmitter } from "node:events";

View File

@ -1,61 +1,3 @@
/**
* The `node:console` module provides a simple debugging console that is similar to
* the JavaScript console mechanism provided by web browsers.
*
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdout) and
* [`process.stderr`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v25.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
*
* ```js
* console.log('hello world');
* // Prints: hello world, to stdout
* console.log('hello %s', 'world');
* // Prints: hello world, to stdout
* console.error(new Error('Whoops, something bad happened'));
* // Prints error message and stack trace to stderr:
* // Error: Whoops, something bad happened
* // at [eval]:5:15
* // at Script.runInThisContext (node:vm:132:18)
* // at Object.runInThisContext (node:vm:309:38)
* // at node:internal/process/execution:77:19
* // at [eval]-wrapper:6:22
* // at evalScript (node:internal/process/execution:76:60)
* // at node:internal/main/eval_string:23:3
*
* const name = 'Will Robinson';
* console.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to stderr
* ```
*
* Example using the `Console` class:
*
* ```js
* const out = getStreamSomehow();
* const err = getStreamSomehow();
* const myConsole = new console.Console(out, err);
*
* myConsole.log('hello world');
* // Prints: hello world, to out
* myConsole.log('hello %s', 'world');
* // Prints: hello world, to out
* myConsole.error(new Error('Whoops, something bad happened'));
* // Prints: [Error: Whoops, something bad happened], to err
*
* const name = 'Will Robinson';
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/console.js)
*/
declare module "node:console" {
import { InspectOptions } from "node:util";
namespace console {

View File

@ -1,9 +1,3 @@
/**
* @deprecated The `node:constants` module is deprecated. When requiring access to constants
* relevant to specific Node.js builtin modules, developers should instead refer
* to the `constants` property exposed by the relevant module. For instance,
* `require('node:fs').constants` and `require('node:os').constants`.
*/
declare module "node:constants" {
const constants:
& typeof import("node:os").constants.dlopen

18
node_modules/@types/node/crypto.d.ts generated vendored
View File

@ -1,21 +1,3 @@
/**
* The `node:crypto` module provides cryptographic functionality that includes a
* set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify
* functions.
*
* ```js
* const { createHmac } = await import('node:crypto');
*
* const secret = 'abcdefg';
* const hash = createHmac('sha256', secret)
* .update('I love cupcakes')
* .digest('hex');
* console.log(hash);
* // Prints:
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/crypto.js)
*/
declare module "node:crypto" {
import { NonSharedBuffer } from "node:buffer";
import * as stream from "node:stream";

27
node_modules/@types/node/dgram.d.ts generated vendored
View File

@ -1,30 +1,3 @@
/**
* The `node:dgram` module provides an implementation of UDP datagram sockets.
*
* ```js
* import dgram from 'node:dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* server.close();
* });
*
* server.on('message', (msg, rinfo) => {
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
* });
*
* server.on('listening', () => {
* const address = server.address();
* console.log(`server listening ${address.address}:${address.port}`);
* });
*
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dgram.js)
*/
declare module "node:dgram" {
import { NonSharedBuffer } from "node:buffer";
import * as dns from "node:dns";

View File

@ -1,27 +1,3 @@
/**
* The `node:diagnostics_channel` module provides an API to create named channels
* to report arbitrary message data for diagnostics purposes.
*
* It can be accessed using:
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* ```
*
* It is intended that a module writer wanting to report diagnostics messages
* will create one or many top-level channels to report messages through.
* Channels may also be acquired at runtime but it is not encouraged
* due to the additional overhead of doing so. Channels may be exported for
* convenience, but as long as the name is known it can be acquired anywhere.
*
* If you intend for your module to produce diagnostics data for others to
* consume it is recommended that you include documentation of what named
* channels are used along with the shape of the message data. Channel names
* should generally include the module name to avoid collisions with data from
* other modules.
* @since v15.1.0, v14.17.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/diagnostics_channel.js)
*/
declare module "node:diagnostics_channel" {
import { AsyncLocalStorage } from "node:async_hooks";
/**

46
node_modules/@types/node/dns.d.ts generated vendored
View File

@ -1,49 +1,3 @@
/**
* The `node:dns` module enables name resolution. For example, use it to look up IP
* addresses of host names.
*
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
* DNS protocol for lookups. {@link lookup} uses the operating system
* facilities to perform name resolution. It may not need to perform any network
* communication. To perform name resolution the way other applications on the same
* system do, use {@link lookup}.
*
* ```js
* import dns from 'node:dns';
*
* dns.lookup('example.org', (err, address, family) => {
* console.log('address: %j family: IPv%s', address, family);
* });
* // address: "93.184.216.34" family: IPv4
* ```
*
* All other functions in the `node:dns` module connect to an actual DNS server to
* perform name resolution. They will always use the network to perform DNS
* queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
* DNS queries, bypassing other name-resolution facilities.
*
* ```js
* import dns from 'node:dns';
*
* dns.resolve4('archive.org', (err, addresses) => {
* if (err) throw err;
*
* console.log(`addresses: ${JSON.stringify(addresses)}`);
*
* addresses.forEach((a) => {
* dns.reverse(a, (err, hostnames) => {
* if (err) {
* throw err;
* }
* console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
* });
* });
* });
* ```
*
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v25.x/api/dns.html#implementation-considerations) for more information.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dns.js)
*/
declare module "node:dns" {
// Supported getaddrinfo flags.
/**

View File

@ -1,9 +1,3 @@
/**
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
* that return `Promise` objects rather than using callbacks. The API is accessible
* via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
* @since v10.6.0
*/
declare module "node:dns/promises" {
import {
AnyRecord,

16
node_modules/@types/node/domain.d.ts generated vendored
View File

@ -1,19 +1,3 @@
/**
* **This module is pending deprecation.** Once a replacement API has been
* finalized, this module will be fully deprecated. Most developers should
* **not** have cause to use this module. Users who absolutely must have
* the functionality that domains provide may rely on it for the time being
* but should expect to have to migrate to a different solution
* in the future.
*
* Domains provide a way to handle multiple different IO operations as a
* single group. If any of the event emitters or callbacks registered to a
* domain emit an `'error'` event, or throw an error, then the domain object
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
* exit immediately with an error code.
* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/domain.js)
*/
declare module "node:domain" {
import { EventEmitter } from "node:events";
/**

55
node_modules/@types/node/events.d.ts generated vendored
View File

@ -1,39 +1,3 @@
/**
* Much of the Node.js core API is built around an idiomatic asynchronous
* event-driven architecture in which certain kinds of objects (called "emitters")
* emit named events that cause `Function` objects ("listeners") to be called.
*
* For instance: a `net.Server` object emits an event each time a peer
* connects to it; a `fs.ReadStream` emits an event when the file is opened;
* a `stream` emits an event whenever data is available to be read.
*
* All objects that emit events are instances of the `EventEmitter` class. These
* objects expose an `eventEmitter.on()` function that allows one or more
* functions to be attached to named events emitted by the object. Typically,
* event names are camel-cased strings but any valid JavaScript property key
* can be used.
*
* When the `EventEmitter` object emits an event, all of the functions attached
* to that specific event are called _synchronously_. Any values returned by the
* called listeners are _ignored_ and discarded.
*
* The following example shows a simple `EventEmitter` instance with a single
* listener. The `eventEmitter.on()` method is used to register listeners, while
* the `eventEmitter.emit()` method is used to trigger the event.
*
* ```js
* import { EventEmitter } from 'node:events';
*
* class MyEmitter extends EventEmitter {}
*
* const myEmitter = new MyEmitter();
* myEmitter.on('event', () => {
* console.log('an event occurred!');
* });
* myEmitter.emit('event');
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/events.js)
*/
declare module "node:events" {
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
// #region Event map helpers
@ -638,24 +602,17 @@ declare module "node:events" {
*/
function getMaxListeners(emitter: EventEmitter | EventTarget): number;
/**
* A class method that returns the number of listeners for the given `eventName`
* registered on the given `emitter`.
* Returns the number of registered listeners for the event named `eventName`.
*
* ```js
* import { EventEmitter, listenerCount } from 'node:events';
* For `EventEmitter`s this behaves exactly the same as calling `.listenerCount`
* on the emitter.
*
* const myEmitter = new EventEmitter();
* myEmitter.on('event', () => {});
* myEmitter.on('event', () => {});
* console.log(listenerCount(myEmitter, 'event'));
* // Prints: 2
* ```
* For `EventTarget`s this is the only way to obtain the listener count. This can
* be useful for debugging and diagnostic purposes.
* @since v0.9.12
* @deprecated Use `emitter.listenerCount()` instead.
* @param emitter The emitter to query
* @param eventName The event name
*/
function listenerCount(emitter: EventEmitter, eventName: string | symbol): number;
function listenerCount(emitter: EventTarget, eventName: string): number;
interface OnOptions extends Abortable {
/**
* Names of events that will end the iteration.

22
node_modules/@types/node/fs.d.ts generated vendored
View File

@ -1,23 +1,3 @@
/**
* The `node:fs` module enables interacting with the file system in a
* way modeled on standard POSIX functions.
*
* To use the promise-based APIs:
*
* ```js
* import * as fs from 'node:fs/promises';
* ```
*
* To use the callback and sync APIs:
*
* ```js
* import * as fs from 'node:fs';
* ```
*
* All file system operations have synchronous, callback, and promise-based
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/fs.js)
*/
declare module "node:fs" {
import { NonSharedBuffer } from "node:buffer";
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
@ -3553,10 +3533,12 @@ declare module "node:fs" {
*/
function unwatchFile(filename: PathLike, listener?: StatsListener): void;
function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
type WatchIgnorePredicate = string | RegExp | ((filename: string) => boolean);
interface WatchOptions extends Abortable {
encoding?: BufferEncoding | "buffer" | undefined;
persistent?: boolean | undefined;
recursive?: boolean | undefined;
ignore?: WatchIgnorePredicate | readonly WatchIgnorePredicate[] | undefined;
}
interface WatchOptionsWithBufferEncoding extends WatchOptions {
encoding: "buffer";

View File

@ -1,13 +1,3 @@
/**
* The `fs/promises` API provides asynchronous file system methods that return
* promises.
*
* The promise APIs use the underlying Node.js threadpool to perform file
* system operations off the event loop thread. These operations are not
* synchronized or threadsafe. Care must be taken when performing multiple
* concurrent modifications on the same file or data corruption may occur.
* @since v10.0.0
*/
declare module "node:fs/promises" {
import { NonSharedBuffer } from "node:buffer";
import { Abortable } from "node:events";

64
node_modules/@types/node/http.d.ts generated vendored
View File

@ -1,44 +1,3 @@
/**
* To use the HTTP server and client one must import the `node:http` module.
*
* The HTTP interfaces in Node.js are designed to support many features
* of the protocol which have been traditionally difficult to use.
* In particular, large, possibly chunk-encoded, messages. The interface is
* careful to never buffer entire requests or responses, so the
* user is able to stream data.
*
* HTTP message headers are represented by an object like this:
*
* ```json
* { "content-length": "123",
* "content-type": "text/plain",
* "connection": "keep-alive",
* "host": "example.com",
* "accept": "*" }
* ```
*
* Keys are lowercased. Values are not modified.
*
* In order to support the full spectrum of possible HTTP applications, the Node.js
* HTTP API is very low-level. It deals with stream handling and message
* parsing only. It parses a message into headers and body but it does not
* parse the actual headers or the body.
*
* See `message.headers` for details on how duplicate headers are handled.
*
* The raw headers as they were received are retained in the `rawHeaders` property, which is an array of `[key, value, key2, value2, ...]`. For
* example, the previous message header object might have a `rawHeaders` list like the following:
*
* ```js
* [ 'ConTent-Length', '123456',
* 'content-LENGTH', '123',
* 'content-type', 'text/plain',
* 'CONNECTION', 'keep-alive',
* 'Host', 'example.com',
* 'accepT', '*' ]
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/http.js)
*/
declare module "node:http" {
import { NonSharedBuffer } from "node:buffer";
import { LookupOptions } from "node:dns";
@ -954,7 +913,7 @@ declare module "node:http" {
* been transmitted are equal or not.
*
* Attempting to set a header field name or value that contains invalid characters
* will result in a \[`Error`\]\[\] being thrown.
* will result in a `Error` being thrown.
* @since v0.1.30
*/
writeHead(
@ -2136,6 +2095,27 @@ declare module "node:http" {
* @param [max=1000]
*/
function setMaxIdleHTTPParsers(max: number): void;
/**
* Dynamically resets the global configurations to enable built-in proxy support for
* `fetch()` and `http.request()`/`https.request()` at runtime, as an alternative
* to using the `--use-env-proxy` flag or `NODE_USE_ENV_PROXY` environment variable.
* It can also be used to override settings configured from the environment variables.
*
* As this function resets the global configurations, any previously configured
* `http.globalAgent`, `https.globalAgent` or undici global dispatcher would be
* overridden after this function is invoked. It's recommended to invoke it before any
* requests are made and avoid invoking it in the middle of any requests.
*
* See [Built-in Proxy Support](https://nodejs.org/docs/latest-v25.x/api/http.html#built-in-proxy-support) for details on proxy URL formats and `NO_PROXY`
* syntax.
* @since v25.4.0
* @param proxyEnv An object containing proxy configuration. This accepts the
* same options as the `proxyEnv` option accepted by {@link Agent}. **Default:**
* `process.env`.
* @returns A function that restores the original agent and dispatcher
* settings to the state before this `http.setGlobalProxyFromEnv()` is invoked.
*/
function setGlobalProxyFromEnv(proxyEnv?: ProxyEnv): () => void;
/**
* Global instance of `Agent` which is used as the default for all HTTP client
* requests. Diverges from a default `Agent` configuration by having `keepAlive`

10
node_modules/@types/node/http2.d.ts generated vendored
View File

@ -1,13 +1,3 @@
/**
* The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol.
* It can be accessed using:
*
* ```js
* import http2 from 'node:http2';
* ```
* @since v8.4.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/http2.js)
*/
declare module "node:http2" {
import { NonSharedBuffer } from "node:buffer";
import { InternalEventEmitter } from "node:events";

View File

@ -1,8 +1,3 @@
/**
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
* separate module.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/https.js)
*/
declare module "node:https" {
import * as http from "node:http";
import { Duplex } from "node:stream";

View File

@ -1,8 +1,3 @@
/**
* The `node:inspector` module provides an API for interacting with the V8
* inspector.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector.js)
*/
declare module "node:inspector" {
import { EventEmitter } from "node:events";
/**
@ -218,6 +213,51 @@ declare module "node:inspector" {
*/
function put(url: string, data: string): void;
}
namespace DOMStorage {
/**
* This feature is only available with the
* `--experimental-storage-inspection` flag enabled.
*
* Broadcasts the `DOMStorage.domStorageItemAdded` event to connected frontends.
* This event indicates that a new item has been added to the storage.
* @since v25.5.0
*/
function domStorageItemAdded(params: DomStorageItemAddedEventDataType): void;
/**
* This feature is only available with the
* `--experimental-storage-inspection` flag enabled.
*
* Broadcasts the `DOMStorage.domStorageItemRemoved` event to connected frontends.
* This event indicates that an item has been removed from the storage.
* @since v25.5.0
*/
function domStorageItemRemoved(params: DomStorageItemRemovedEventDataType): void;
/**
* This feature is only available with the
* `--experimental-storage-inspection` flag enabled.
* Broadcasts the `DOMStorage.domStorageItemUpdated` event to connected frontends.
* This event indicates that a storage item has been updated.
* @since v25.5.0
*/
function domStorageItemUpdated(params: DomStorageItemUpdatedEventDataType): void;
/**
* This feature is only available with the
* `--experimental-storage-inspection` flag enabled.
*
* Broadcasts the `DOMStorage.domStorageItemsCleared` event to connected
* frontends. This event indicates that all items have been cleared from the
* storage.
* @since v25.5.0
*/
function domStorageItemsCleared(params: DomStorageItemsClearedEventDataType): void;
/**
* This feature is only available with the
* `--experimental-storage-inspection` flag enabled.
* @since v25.5.0
*/
function registerStorage(params: unknown): void;
}
}
declare module "inspector" {
export * from "node:inspector";

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,3 @@
/**
* The `node:inspector/promises` module provides an API for interacting with the V8
* inspector.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector/promises.js)
* @since v19.0.0
*/
declare module "node:inspector/promises" {
import { EventEmitter } from "node:events";
export { close, console, NetworkResources, open, url, waitForDebugger } from "node:inspector";

65
node_modules/@types/node/module.d.ts generated vendored
View File

@ -1,6 +1,3 @@
/**
* @since v0.3.7
*/
declare module "node:module" {
import { URL } from "node:url";
class Module {
@ -383,59 +380,18 @@ declare module "node:module" {
| "module-typescript"
| "wasm";
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
/**
* The `initialize` hook provides a way to define a custom function that runs in
* the hooks thread when the hooks module is initialized. Initialization happens
* when the hooks module is registered via {@link register}.
*
* This hook can receive data from a {@link register} invocation, including
* ports and other transferable objects. The return value of `initialize` can be a
* `Promise`, in which case it will be awaited before the main application thread
* execution resumes.
*/
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
interface ResolveHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAttributes: ImportAttributes;
/**
* The module importing this one, or undefined if this is the Node.js entry point
*/
parentURL: string | undefined;
}
interface ResolveFnOutput {
/**
* A hint to the load hook (it might be ignored); can be an intermediary value.
*/
format?: string | null | undefined;
/**
* The import attributes to use when caching the module (optional; if excluded the input will be used)
*/
importAttributes?: ImportAttributes | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The absolute URL to which this input resolves
*/
url: string;
}
/**
* The `resolve` hook chain is responsible for telling Node.js where to find and
* how to cache a given `import` statement or expression, or `require` call. It can
* optionally return a format (such as `'module'`) as a hint to the `load` hook. If
* a format is specified, the `load` hook is ultimately responsible for providing
* the final `format` value (and it is free to ignore the hint provided by
* `resolve`); if `resolve` provides a `format`, a custom `load` hook is required
* even if only to pass the value to the Node.js default `load` hook.
*/
type ResolveHook = (
specifier: string,
context: ResolveHookContext,
@ -453,36 +409,15 @@ declare module "node:module" {
) => ResolveFnOutput,
) => ResolveFnOutput;
interface LoadHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* The format optionally supplied by the `resolve` hook chain (can be an intermediary value).
*/
format: string | null | undefined;
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAttributes: ImportAttributes;
}
interface LoadFnOutput {
format: string | null | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The source for Node.js to evaluate
*/
source?: ModuleSource | undefined;
}
/**
* The `load` hook provides a way to define a custom method of determining how a
* URL should be interpreted, retrieved, and parsed. It is also in charge of
* validating the import attributes.
*/
type LoadHook = (
url: string,
context: LoadHookContext,

77
node_modules/@types/node/net.d.ts generated vendored
View File

@ -1,17 +1,3 @@
/**
* > Stability: 2 - Stable
*
* The `node:net` module provides an asynchronous network API for creating stream-based
* TCP or `IPC` servers ({@link createServer}) and clients
* ({@link createConnection}).
*
* It can be accessed using:
*
* ```js
* import net from 'node:net';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/net.js)
*/
declare module "node:net" {
import { NonSharedBuffer } from "node:buffer";
import * as dns from "node:dns";
@ -34,6 +20,11 @@ declare module "node:net" {
readable?: boolean | undefined;
writable?: boolean | undefined;
signal?: AbortSignal | undefined;
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
blockList?: BlockList | undefined;
typeOfService?: number | undefined;
}
interface OnReadOpts {
buffer: Uint8Array | (() => Uint8Array);
@ -52,9 +43,6 @@ declare module "node:net" {
hints?: number | undefined;
family?: number | undefined;
lookup?: LookupFunction | undefined;
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
@ -63,7 +51,6 @@ declare module "node:net" {
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
blockList?: BlockList | undefined;
}
interface IpcSocketConnectOpts {
path: string;
@ -116,9 +103,14 @@ declare module "node:net" {
* See `Writable` stream `write()` method for more
* information.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
*/
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
/**
* Sends data on the socket, with an explicit encoding for string data.
* @see {@link Socket.write} for full details.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
*/
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
/**
* Initiate a connection on a given socket.
@ -226,6 +218,37 @@ declare module "node:net" {
* @return The socket itself.
*/
setKeepAlive(enable?: boolean, initialDelay?: number): this;
/**
* Returns the current Type of Service (TOS) field for IPv4 packets or Traffic
* Class for IPv6 packets for this socket.
*
* `setTypeOfService()` may be called before the socket is connected; the value
* will be cached and applied when the socket establishes a connection.
* `getTypeOfService()` will return the currently set value even before connection.
*
* On some platforms (e.g., Linux), certain TOS/ECN bits may be masked or ignored,
* and behavior can differ between IPv4 and IPv6 or dual-stack sockets. Callers
* should verify platform-specific semantics.
* @since v25.6.0
* @returns The current TOS value.
*/
getTypeOfService(): number;
/**
* Sets the Type of Service (TOS) field for IPv4 packets or Traffic Class for IPv6
* Packets sent from this socket. This can be used to prioritize network traffic.
*
* `setTypeOfService()` may be called before the socket is connected; the value
* will be cached and applied when the socket establishes a connection.
* `getTypeOfService()` will return the currently set value even before connection.
*
* On some platforms (e.g., Linux), certain TOS/ECN bits may be masked or ignored,
* and behavior can differ between IPv4 and IPv6 or dual-stack sockets. Callers
* should verify platform-specific semantics.
* @since v25.6.0
* @param tos The TOS value to set (0-255).
* @returns The socket itself.
*/
setTypeOfService(tos: number): this;
/**
* Returns the bound `address`, the address `family` name and `port` of the
* socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
@ -358,12 +381,26 @@ declare module "node:net" {
*
* See `writable.end()` for further details.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
* @param callback Optional callback for when the socket is finished.
* @return The socket itself.
*/
end(callback?: () => void): this;
/**
* Half-closes the socket, with one final chunk of data.
* @see {@link Socket.end} for full details.
* @since v0.1.90
* @param callback Optional callback for when the socket is finished.
* @return The socket itself.
*/
end(buffer: Uint8Array | string, callback?: () => void): this;
/**
* Half-closes the socket, with one final chunk of data.
* @see {@link Socket.end} for full details.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
* @param callback Optional callback for when the socket is finished.
* @return The socket itself.
*/
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
// #region InternalEventEmitter
addListener<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;

9
node_modules/@types/node/os.d.ts generated vendored
View File

@ -1,12 +1,3 @@
/**
* The `node:os` module provides operating system-related utility methods and
* properties. It can be accessed using:
*
* ```js
* import os from 'node:os';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/os.js)
*/
declare module "node:os" {
import { NonSharedBuffer } from "buffer";
interface CpuInfo {

View File

@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "25.3.3",
"version": "25.6.0",
"description": "TypeScript definitions for node",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
@ -147,9 +147,9 @@
},
"scripts": {},
"dependencies": {
"undici-types": "~7.18.0"
"undici-types": "~7.19.0"
},
"peerDependencies": {},
"typesPublisherContentHash": "6c6cbe69ae05494de79d9c121e6d089d78ce104f31505de1c79c523dfcbeba42",
"typeScriptVersion": "5.2"
"typesPublisherContentHash": "753bd9272f1c86686cc2d1bb435a7f033157f700201f64f0319742347e1ca060",
"typeScriptVersion": "5.3"
}

9
node_modules/@types/node/path.d.ts generated vendored
View File

@ -1,12 +1,3 @@
/**
* The `node:path` module provides utilities for working with file and directory
* paths. It can be accessed using:
*
* ```js
* import path from 'node:path';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/path.js)
*/
declare module "node:path" {
namespace path {
/**

View File

@ -1,34 +1,3 @@
/**
* This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
* Node.js-specific performance measurements.
*
* Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
*
* * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
* * [Performance Timeline](https://w3c.github.io/performance-timeline/)
* * [User Timing](https://www.w3.org/TR/user-timing/)
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
*
* ```js
* import { PerformanceObserver, performance } from 'node:perf_hooks';
*
* const obs = new PerformanceObserver((items) => {
* console.log(items.getEntries()[0].duration);
* performance.clearMarks();
* });
* obs.observe({ type: 'measure' });
* performance.measure('Start to Now');
*
* performance.mark('A');
* doSomeLongRunningProcess(() => {
* performance.measure('A to Now', 'A');
*
* performance.mark('B');
* performance.measure('A to B', 'A', 'B');
* });
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/perf_hooks.js)
*/
declare module "node:perf_hooks" {
import { InternalEventTargetEventProperties } from "node:events";
// #region web types

View File

@ -729,7 +729,8 @@ declare module "node:process" {
* arguments passed when the Node.js process was launched. The first element will
* be {@link execPath}. See `process.argv0` if access to the original value
* of `argv[0]` is needed. The second element will be the path to the JavaScript
* file being executed. The remaining elements will be any additional command-line
* file being executed. If a [program entry point](https://nodejs.org/docs/latest-v25.x/api/cli.html#program-entry-point) was provided, the second element
* will be the absolute path to it. The remaining elements are additional command-line
* arguments.
*
* For example, assuming the following script for `process-args.js`:
@ -1861,6 +1862,24 @@ declare module "node:process" {
*/
readonly release: ProcessRelease;
readonly features: ProcessFeatures;
/**
* The `process.traceProcessWarnings` property indicates whether the `--trace-warnings` flag
* is set on the current Node.js process. This property allows programmatic control over the
* tracing of warnings, enabling or disabling stack traces for warnings at runtime.
*
* ```js
* // Enable trace warnings
* process.traceProcessWarnings = true;
*
* // Emit a warning with a stack trace
* process.emitWarning('Warning with stack trace');
*
* // Disable trace warnings
* process.traceProcessWarnings = false;
* ```
* @since v6.10.0
*/
traceProcessWarnings: boolean;
/**
* `process.umask()` returns the Node.js process's file mode creation mask. Child
* processes inherit the mask from the parent process.

View File

@ -1,31 +1,3 @@
/**
* **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users
* currently depending on the `punycode` module should switch to using the
* userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
* encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
*
* The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It
* can be accessed using:
*
* ```js
* import punycode from 'node:punycode';
* ```
*
* [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
* primarily intended for use in Internationalized Domain Names. Because host
* names in URLs are limited to ASCII characters only, Domain Names that contain
* non-ASCII characters must be converted into ASCII using the Punycode scheme.
* For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
* to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`.
*
* The `punycode` module provides a simple implementation of the Punycode standard.
*
* The `punycode` module is a third-party dependency used by Node.js and
* made available to developers as a convenience. Fixes or other modifications to
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
* @deprecated
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/punycode.js)
*/
declare module "node:punycode" {
/**
* The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only

View File

@ -1,16 +1,3 @@
/**
* The `node:querystring` module provides utilities for parsing and formatting URL
* query strings. It can be accessed using:
*
* ```js
* import querystring from 'node:querystring';
* ```
*
* `querystring` is more performant than `URLSearchParams` but is not a
* standardized API. Use `URLSearchParams` when performance is not critical or
* when compatibility with browser code is desirable.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/querystring.js)
*/
declare module "node:querystring" {
interface StringifyOptions {
/**

13
node_modules/@types/node/quic.d.ts generated vendored
View File

@ -1,16 +1,3 @@
/**
* The 'node:quic' module provides an implementation of the QUIC protocol.
* To access it, start Node.js with the `--experimental-quic` option and:
*
* ```js
* import quic from 'node:quic';
* ```
*
* The module is only available under the `node:` scheme.
* @since v23.8.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/quic.js)
*/
declare module "node:quic" {
import { KeyObject, webcrypto } from "node:crypto";
import { SocketAddress } from "node:net";

View File

@ -1,38 +1,3 @@
/**
* The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream
* (such as [`process.stdin`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdin)) one line at a time.
*
* To use the promise-based APIs:
*
* ```js
* import * as readline from 'node:readline/promises';
* ```
*
* To use the callback and sync APIs:
*
* ```js
* import * as readline from 'node:readline';
* ```
*
* The following simple example illustrates the basic use of the `node:readline` module.
*
* ```js
* import * as readline from 'node:readline/promises';
* import { stdin as input, stdout as output } from 'node:process';
*
* const rl = readline.createInterface({ input, output });
*
* const answer = await rl.question('What do you think of Node.js? ');
*
* console.log(`Thank you for your valuable feedback: ${answer}`);
*
* rl.close();
* ```
*
* Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be
* received on the `input` stream.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/readline.js)
*/
declare module "node:readline" {
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
interface Key {
@ -44,6 +9,7 @@ declare module "node:readline" {
}
interface InterfaceEventMap {
"close": [];
"error": [error: Error];
"history": [history: string[]];
"line": [input: string];
"pause": [];

View File

@ -1,6 +1,3 @@
/**
* @since v17.0.0
*/
declare module "node:readline/promises" {
import { Abortable } from "node:events";
import {

10
node_modules/@types/node/repl.d.ts generated vendored
View File

@ -1,13 +1,3 @@
/**
* The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation
* that is available both as a standalone program or includible in other
* applications. It can be accessed using:
*
* ```js
* import repl from 'node:repl';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/repl.js)
*/
declare module "node:repl" {
import { AsyncCompleter, Completer, Interface, InterfaceEventMap } from "node:readline";
import { InspectOptions } from "node:util";

115
node_modules/@types/node/sea.d.ts generated vendored
View File

@ -1,118 +1,3 @@
/**
* This feature allows the distribution of a Node.js application conveniently to a
* system that does not have Node.js installed.
*
* Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing
* the injection of a blob prepared by Node.js, which can contain a bundled script,
* into the `node` binary. During start up, the program checks if anything has been
* injected. If the blob is found, it executes the script in the blob. Otherwise
* Node.js operates as it normally does.
*
* The single executable application feature currently only supports running a
* single embedded script using the `CommonJS` module system.
*
* Users can create a single executable application from their bundled script
* with the `node` binary itself and any tool which can inject resources into the
* binary.
*
* Here are the steps for creating a single executable application using one such
* tool, [postject](https://github.com/nodejs/postject):
*
* 1. Create a JavaScript file:
* ```bash
* echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
* ```
* 2. Create a configuration file building a blob that can be injected into the
* single executable application (see `Generating single executable preparation blobs` for details):
* ```bash
* echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
* ```
* 3. Generate the blob to be injected:
* ```bash
* node --experimental-sea-config sea-config.json
* ```
* 4. Create a copy of the `node` executable and name it according to your needs:
* * On systems other than Windows:
* ```bash
* cp $(command -v node) hello
* ```
* * On Windows:
* ```text
* node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')"
* ```
* The `.exe` extension is necessary.
* 5. Remove the signature of the binary (macOS and Windows only):
* * On macOS:
* ```bash
* codesign --remove-signature hello
* ```
* * On Windows (optional):
* [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
* If this step is
* skipped, ignore any signature-related warning from postject.
* ```powershell
* signtool remove /s hello.exe
* ```
* 6. Inject the blob into the copied binary by running `postject` with
* the following options:
* * `hello` / `hello.exe` \- The name of the copy of the `node` executable
* created in step 4.
* * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary
* where the contents of the blob will be stored.
* * `sea-prep.blob` \- The name of the blob created in step 1.
* * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been
* injected.
* * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the
* segment in the binary where the contents of the blob will be
* stored.
* To summarize, here is the required command for each platform:
* * On Linux:
* ```bash
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
* ```
* * On Windows - PowerShell:
* ```powershell
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob `
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
* ```
* * On Windows - Command Prompt:
* ```text
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
* ```
* * On macOS:
* ```bash
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
* --macho-segment-name NODE_SEA
* ```
* 7. Sign the binary (macOS and Windows only):
* * On macOS:
* ```bash
* codesign --sign - hello
* ```
* * On Windows (optional):
* A certificate needs to be present for this to work. However, the unsigned
* binary would still be runnable.
* ```powershell
* signtool sign /fd SHA256 hello.exe
* ```
* 8. Run the binary:
* * On systems other than Windows
* ```console
* $ ./hello world
* Hello, world!
* ```
* * On Windows
* ```console
* $ .\hello.exe world
* Hello, world!
* ```
* @since v19.7.0, v18.16.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/src/node_sea.cc)
*/
declare module "node:sea" {
type AssetKey = string;
/**

190
node_modules/@types/node/sqlite.d.ts generated vendored
View File

@ -1,47 +1,3 @@
/**
* The `node:sqlite` module facilitates working with SQLite databases.
* To access it:
*
* ```js
* import sqlite from 'node:sqlite';
* ```
*
* This module is only available under the `node:` scheme. The following will not
* work:
*
* ```js
* import sqlite from 'sqlite';
* ```
*
* The following example shows the basic usage of the `node:sqlite` module to open
* an in-memory database, write data to the database, and then read the data back.
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
* const database = new DatabaseSync(':memory:');
*
* // Execute SQL statements from strings.
* database.exec(`
* CREATE TABLE data(
* key INTEGER PRIMARY KEY,
* value TEXT
* ) STRICT
* `);
* // Create a prepared statement to insert data into the database.
* const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
* // Execute the prepared statement with bound values.
* insert.run(1, 'hello');
* insert.run(2, 'world');
* // Create a prepared statement to read data from the database.
* const query = database.prepare('SELECT * FROM data ORDER BY key');
* // Execute the prepared statement and log the result set.
* console.log(query.all());
* // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ]
* ```
* @since v22.5.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/sqlite.js)
*/
declare module "node:sqlite" {
import { PathLike } from "node:fs";
type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView;
@ -128,7 +84,7 @@ declare module "node:sqlite" {
* language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
* The defensive flag can also be set using `enableDefensive()`.
* @since v25.1.0
* @default false
* @default true
*/
defensive?: boolean | undefined;
}
@ -233,6 +189,28 @@ declare module "node:sqlite" {
*/
inverse?: ((accumulator: T, ...args: SQLOutputValue[]) => T) | undefined;
}
interface PrepareOptions {
/**
* If `true`, integer fields are read as `BigInt`s.
* @since v25.5.0
*/
readBigInts?: boolean | undefined;
/**
* If `true`, results are returned as arrays.
* @since v25.5.0
*/
returnArrays?: boolean | undefined;
/**
* If `true`, allows binding named parameters without the prefix character.
* @since v25.5.0
*/
allowBareNamedParameters?: boolean | undefined;
/**
* If `true`, unknown named parameters are ignored.
* @since v25.5.0
*/
allowUnknownNamedParameters?: boolean | undefined;
}
/**
* This class represents a single [connection](https://www.sqlite.org/c3ref/sqlite3.html) to a SQLite database. All APIs
* exposed by this class execute synchronously.
@ -425,19 +403,73 @@ declare module "node:sqlite" {
* around [`sqlite3_prepare_v2()`](https://www.sqlite.org/c3ref/prepare.html).
* @since v22.5.0
* @param sql A SQL string to compile to a prepared statement.
* @param options Optional configuration for the prepared statement.
* @return The prepared statement.
*/
prepare(sql: string): StatementSync;
prepare(sql: string, options?: PrepareOptions): StatementSync;
/**
* Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for
* storing prepared statements. This allows for the efficient reuse of prepared
* statements by tagging them with a unique identifier.
* Creates a new {@link SQLTagStore}, which is a Least Recently Used (LRU) cache
* for storing prepared statements. This allows for the efficient reuse of
* prepared statements by tagging them with a unique identifier.
*
* When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared
* statement for that specific SQL string already exists in the cache. If it does,
* the cached statement is used. If not, a new prepared statement is created,
* executed, and then stored in the cache for future use. This mechanism helps to
* avoid the overhead of repeatedly parsing and preparing the same SQL statements.
* statement for the corresponding SQL query string already exists in the cache.
* If it does, the cached statement is used. If not, a new prepared statement is
* created, executed, and then stored in the cache for future use. This mechanism
* helps to avoid the overhead of repeatedly parsing and preparing the same SQL
* statements.
*
* Tagged statements bind the placeholder values from the template literal as
* parameters to the underlying prepared statement. For example:
*
* ```js
* sqlTagStore.get`SELECT ${value}`;
* ```
*
* is equivalent to:
*
* ```js
* db.prepare('SELECT ?').get(value);
* ```
*
* However, in the first example, the tag store will cache the underlying prepared
* statement for future use.
*
* > **Note:** The `${value}` syntax in tagged statements _binds_ a parameter to
* > the prepared statement. This differs from its behavior in _untagged_ template
* > literals, where it performs string interpolation.
* >
* > ```js
* > // This a safe example of binding a parameter to a tagged statement.
* > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`;
* >
* > // This is an *unsafe* example of an untagged template string.
* > // `id` is interpolated into the query text as a string.
* > // This can lead to SQL injection and data corruption.
* > db.run(`INSERT INTO t1 (id) VALUES (${id})`);
* > ```
*
* The tag store will match a statement from the cache if the query strings
* (including the positions of any bound placeholders) are identical.
*
* ```js
* // The following statements will match in the cache:
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`;
*
* // The following statements will not match, as the query strings
* // and bound placeholders differ:
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
* sqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`;
*
* // The following statements will not match, as matches are case-sensitive:
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
* sqlTagStore.get`select * from t1 where id = ${id} and active = 1`;
* ```
*
* The only way of binding parameters in tagged statements is with the `${value}`
* syntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query
* string itself.
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
@ -453,8 +485,8 @@ declare module "node:sqlite" {
* sql.run`INSERT INTO users VALUES (2, 'Bob')`;
*
* // Using the 'get' method to retrieve a single row.
* const id = 1;
* const user = sql.get`SELECT * FROM users WHERE id = ${id}`;
* const name = 'Alice';
* const user = sql.get`SELECT * FROM users WHERE name = ${name}`;
* console.log(user); // { id: 1, name: 'Alice' }
*
* // Using the 'all' method to retrieve all rows.
@ -543,26 +575,39 @@ declare module "node:sqlite" {
* [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).
*/
close(): void;
/**
* Closes the session. If the session is already closed, does nothing.
* @since v24.9.0
*/
[Symbol.dispose](): void;
}
/**
* This class represents a single LRU (Least Recently Used) cache for storing
* prepared statements.
*
* Instances of this class are created via the database.createSQLTagStore() method,
* not by using a constructor. The store caches prepared statements based on the
* provided SQL query string. When the same query is seen again, the store
* Instances of this class are created via the `database.createTagStore()`
* method, not by using a constructor. The store caches prepared statements based
* on the provided SQL query string. When the same query is seen again, the store
* retrieves the cached statement and safely applies the new values through
* parameter binding, thereby preventing attacks like SQL injection.
*
* The cache has a maxSize that defaults to 1000 statements, but a custom size can
* be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this
* be provided (e.g., `database.createTagStore(100)`). All APIs exposed by this
* class execute synchronously.
* @since v24.9.0
*/
interface SQLTagStore {
/**
* Executes the given SQL query and returns all resulting rows as an array of objects.
* Executes the given SQL query and returns all resulting rows as an array of
* objects.
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An array of objects representing the rows returned by the query.
*/
all(
stringElements: TemplateStringsArray,
@ -570,7 +615,15 @@ declare module "node:sqlite" {
): Record<string, SQLOutputValue>[];
/**
* Executes the given SQL query and returns the first resulting row as an object.
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An object representing the first row returned by
* the query, or `undefined` if no rows are returned.
*/
get(
stringElements: TemplateStringsArray,
@ -578,7 +631,14 @@ declare module "node:sqlite" {
): Record<string, SQLOutputValue> | undefined;
/**
* Executes the given SQL query and returns an iterator over the resulting rows.
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An iterator that yields objects representing the rows returned by the query.
*/
iterate(
stringElements: TemplateStringsArray,
@ -586,15 +646,21 @@ declare module "node:sqlite" {
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
/**
* Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An object containing information about the execution, including `changes` and `lastInsertRowid`.
*/
run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges;
/**
* A read-only property that returns the number of prepared statements currently in the cache.
* @since v24.9.0
* @returns The maximum number of prepared statements the cache can hold.
*/
size(): number;
readonly size: number;
/**
* A read-only property that returns the maximum number of prepared statements the cache can hold.
* @since v24.9.0

70
node_modules/@types/node/stream.d.ts generated vendored
View File

@ -1,22 +1,3 @@
/**
* A stream is an abstract interface for working with streaming data in Node.js.
* The `node:stream` module provides an API for implementing the stream interface.
*
* There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v25.x/api/http.html#class-httpincomingmessage)
* and [`process.stdout`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdout) are both stream instances.
*
* Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v25.x/api/events.html#class-eventemitter).
*
* To access the `node:stream` module:
*
* ```js
* import stream from 'node:stream';
* ```
*
* The `node:stream` module is useful for creating new types of stream instances.
* It is usually not necessary to use the `node:stream` module to consume streams.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/stream.js)
*/
declare module "node:stream" {
import { Blob } from "node:buffer";
import { Abortable, EventEmitter } from "node:events";
@ -81,6 +62,7 @@ declare module "node:stream" {
interface ArrayOptions extends ReadableOperatorOptions {}
interface ReadableToWebOptions {
strategy?: web.QueuingStrategy | undefined;
type?: web.ReadableStreamType | undefined;
}
interface ReadableEventMap {
"close": [];
@ -485,13 +467,18 @@ declare module "node:stream" {
* }
* }
*
* const wordsStream = Readable.from(['this is', 'compose as operator']).compose(splitToWords);
* const wordsStream = Readable.from(['text passed through', 'composed stream']).compose(splitToWords);
* const words = await wordsStream.toArray();
*
* console.log(words); // prints ['this', 'is', 'compose', 'as', 'operator']
* console.log(words); // prints ['text', 'passed', 'through', 'composed', 'stream']
* ```
*
* See [`stream.compose`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information.
* `readable.compose(s)` is equivalent to `stream.compose(readable, s)`.
*
* This method also allows for an `AbortSignal` to be provided, which will destroy
* the composed stream when aborted.
*
* See [`stream.compose(...streams)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information.
* @since v19.1.0, v18.13.0
* @returns a stream composed with the stream `stream`.
*/
@ -893,11 +880,20 @@ declare module "node:stream" {
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param [encoding='utf8'] The encoding, if `chunk` is a string.
* @param callback Callback for when this chunk of data is flushed.
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;
/**
* Writes data to the stream, with an explicit encoding for string data.
* @see {@link Writable.write} for full details.
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param encoding The encoding, if `chunk` is a string.
* @param callback Callback for when this chunk of data is flushed.
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;
/**
* The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream.
@ -922,13 +918,27 @@ declare module "node:stream" {
* // Writing more now is not allowed!
* ```
* @since v0.9.4
* @param cb Callback for when the stream is finished.
*/
end(cb?: () => void): this;
/**
* Signals that no more data will be written, with one final chunk of data.
* @see {@link Writable.end} for full details.
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param cb Callback for when the stream is finished.
*/
end(chunk: any, cb?: () => void): this;
/**
* Signals that no more data will be written, with one final chunk of data.
* @see {@link Writable.end} for full details.
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param encoding The encoding if `chunk` is a string
* @param callback Callback for when the stream is finished.
* @param cb Callback for when the stream is finished.
*/
end(cb?: () => void): this;
end(chunk: any, cb?: () => void): this;
end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
/**
* The `writable.cork()` method forces all written data to be buffered in memory.
@ -1056,6 +1066,9 @@ declare module "node:stream" {
writableHighWaterMark?: number | undefined;
writableCorked?: number | undefined;
}
interface DuplexToWebOptions {
type?: web.ReadableStreamType | undefined;
}
interface DuplexEventMap extends ReadableEventMap, WritableEventMap {}
/**
* Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
@ -1109,7 +1122,7 @@ declare module "node:stream" {
* A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
* @since v17.0.0
*/
static toWeb(streamDuplex: NodeJS.ReadWriteStream): web.ReadableWritablePair;
static toWeb(streamDuplex: NodeJS.ReadWriteStream, options?: DuplexToWebOptions): web.ReadableWritablePair;
/**
* A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
* @since v17.0.0
@ -1653,7 +1666,8 @@ declare module "node:stream" {
* console.log(res); // prints 'HELLOWORLD'
* ```
*
* See [`readable.compose(stream)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#readablecomposestream-options) for `stream.compose` as operator.
* For convenience, the `readable.compose(stream)` method is available on
* `Readable` and `Duplex` streams as a wrapper for this function.
* @since v16.9.0
* @experimental
*/

View File

@ -1,33 +1,109 @@
/**
* The utility consumer functions provide common options for consuming
* streams.
* @since v16.7.0
*/
declare module "node:stream/consumers" {
import { Blob, NonSharedBuffer } from "node:buffer";
import { ReadableStream } from "node:stream/web";
/**
* ```js
* import { arrayBuffer } from 'node:stream/consumers';
* import { Readable } from 'node:stream';
* import { TextEncoder } from 'node:util';
*
* const encoder = new TextEncoder();
* const dataArray = encoder.encode('hello world from consumers!');
*
* const readable = Readable.from(dataArray);
* const data = await arrayBuffer(readable);
* console.log(`from readable: ${data.byteLength}`);
* // Prints: from readable: 76
* ```
* @since v16.7.0
* @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream.
*/
function arrayBuffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
/**
* ```js
* import { blob } from 'node:stream/consumers';
*
* const dataBlob = new Blob(['hello world from consumers!']);
*
* const readable = dataBlob.stream();
* const data = await blob(readable);
* console.log(`from readable: ${data.size}`);
* // Prints: from readable: 27
* ```
* @since v16.7.0
* @returns Fulfills with a `Blob` containing the full contents of the stream.
*/
function blob(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<Blob>;
/**
* ```js
* import { buffer } from 'node:stream/consumers';
* import { Readable } from 'node:stream';
* import { Buffer } from 'node:buffer';
*
* const dataBuffer = Buffer.from('hello world from consumers!');
*
* const readable = Readable.from(dataBuffer);
* const data = await buffer(readable);
* console.log(`from readable: ${data.length}`);
* // Prints: from readable: 27
* ```
* @since v16.7.0
* @returns Fulfills with a `Buffer` containing the full contents of the stream.
*/
function buffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NonSharedBuffer>;
/**
* ```js
* import { bytes } from 'node:stream/consumers';
* import { Readable } from 'node:stream';
* import { Buffer } from 'node:buffer';
*
* const dataBuffer = Buffer.from('hello world from consumers!');
*
* const readable = Readable.from(dataBuffer);
* const data = await bytes(readable);
* console.log(`from readable: ${data.length}`);
* // Prints: from readable: 27
* ```
* @since v25.6.0
* @returns Fulfills with a `Uint8Array` containing the full contents of the stream.
*/
function bytes(
stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>,
): Promise<NodeJS.NonSharedUint8Array>;
/**
* ```js
* import { json } from 'node:stream/consumers';
* import { Readable } from 'node:stream';
*
* const items = Array.from(
* {
* length: 100,
* },
* () => ({
* message: 'hello world from consumers!',
* }),
* );
*
* const readable = Readable.from(JSON.stringify(items));
* const data = await json(readable);
* console.log(`from readable: ${data.length}`);
* // Prints: from readable: 100
* ```
* @since v16.7.0
* @returns Fulfills with the contents of the stream parsed as a
* UTF-8 encoded string that is then passed through `JSON.parse()`.
*/
function json(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
/**
* ```js
* import { text } from 'node:stream/consumers';
* import { Readable } from 'node:stream';
*
* const readable = Readable.from('Hello world from consumers!');
* const data = await text(readable);
* console.log(`from readable: ${data.length}`);
* // Prints: from readable: 27
* ```
* @since v16.7.0
* @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string.
*/

View File

@ -206,7 +206,7 @@ declare module "node:stream/web" {
interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null;
close(): void;
enqueue(chunk?: R): void;
enqueue(chunk: R): void;
error(e?: any): void;
}
var ReadableStreamDefaultController: {
@ -251,7 +251,7 @@ declare module "node:stream/web" {
};
interface TransformStreamDefaultController<O = any> {
readonly desiredSize: number | null;
enqueue(chunk?: O): void;
enqueue(chunk: O): void;
error(reason?: any): void;
terminate(): void;
}
@ -284,7 +284,7 @@ declare module "node:stream/web" {
abort(reason?: any): Promise<void>;
close(): Promise<void>;
releaseLock(): void;
write(chunk?: W): Promise<void>;
write(chunk: W): Promise<void>;
}
var WritableStreamDefaultWriter: {
prototype: WritableStreamDefaultWriter;

View File

@ -1,43 +1,3 @@
/**
* The `node:string_decoder` module provides an API for decoding `Buffer` objects
* into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
* characters. It can be accessed using:
*
* ```js
* import { StringDecoder } from 'node:string_decoder';
* ```
*
* The following example shows the basic use of the `StringDecoder` class.
*
* ```js
* import { StringDecoder } from 'node:string_decoder';
* const decoder = new StringDecoder('utf8');
*
* const cent = Buffer.from([0xC2, 0xA2]);
* console.log(decoder.write(cent)); // Prints: ¢
*
* const euro = Buffer.from([0xE2, 0x82, 0xAC]);
* console.log(decoder.write(euro)); // Prints: €
* ```
*
* When a `Buffer` instance is written to the `StringDecoder` instance, an
* internal buffer is used to ensure that the decoded string does not contain
* any incomplete multibyte characters. These are held in the buffer until the
* next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
*
* In the following example, the three UTF-8 encoded bytes of the European Euro
* symbol (``) are written over three separate operations:
*
* ```js
* import { StringDecoder } from 'node:string_decoder';
* const decoder = new StringDecoder('utf8');
*
* decoder.write(Buffer.from([0xE2]));
* decoder.write(Buffer.from([0x82]));
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/string_decoder.js)
*/
declare module "node:string_decoder" {
class StringDecoder {
constructor(encoding?: BufferEncoding);

160
node_modules/@types/node/test.d.ts generated vendored
View File

@ -1,83 +1,3 @@
/**
* The `node:test` module facilitates the creation of JavaScript tests.
* To access it:
*
* ```js
* import test from 'node:test';
* ```
*
* This module is only available under the `node:` scheme. The following will not
* work:
*
* ```js
* import test from 'node:test';
* ```
*
* Tests created via the `test` module consist of a single function that is
* processed in one of three ways:
*
* 1. A synchronous function that is considered failing if it throws an exception,
* and is considered passing otherwise.
* 2. A function that returns a `Promise` that is considered failing if the `Promise` rejects, and is considered passing if the `Promise` fulfills.
* 3. A function that receives a callback function. If the callback receives any
* truthy value as its first argument, the test is considered failing. If a
* falsy value is passed as the first argument to the callback, the test is
* considered passing. If the test function receives a callback function and
* also returns a `Promise`, the test will fail.
*
* The following example illustrates how tests are written using the `test` module.
*
* ```js
* test('synchronous passing test', (t) => {
* // This test passes because it does not throw an exception.
* assert.strictEqual(1, 1);
* });
*
* test('synchronous failing test', (t) => {
* // This test fails because it throws an exception.
* assert.strictEqual(1, 2);
* });
*
* test('asynchronous passing test', async (t) => {
* // This test passes because the Promise returned by the async
* // function is settled and not rejected.
* assert.strictEqual(1, 1);
* });
*
* test('asynchronous failing test', async (t) => {
* // This test fails because the Promise returned by the async
* // function is rejected.
* assert.strictEqual(1, 2);
* });
*
* test('failing test using Promises', (t) => {
* // Promises can be used directly as well.
* return new Promise((resolve, reject) => {
* setImmediate(() => {
* reject(new Error('this will cause the test to fail'));
* });
* });
* });
*
* test('callback passing test', (t, done) => {
* // done() is the callback function. When the setImmediate() runs, it invokes
* // done() with no arguments.
* setImmediate(done);
* });
*
* test('callback failing test', (t, done) => {
* // When the setImmediate() runs, done() is invoked with an Error object and
* // the test fails.
* setImmediate(() => {
* done(new Error('callback failure'));
* });
* });
* ```
*
* If any tests fail, the process exit code is set to `1`.
* @since v18.0.0, v16.17.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test.js)
*/
declare module "node:test" {
import { AssertMethodNames } from "node:assert";
import { Readable, ReadableEventMap } from "node:stream";
@ -191,6 +111,11 @@ declare module "node:test" {
function only(name?: string, fn?: SuiteFn): Promise<void>;
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
function only(fn?: SuiteFn): Promise<void>;
// added in v25.5.0, undocumented
function expectFailure(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
function expectFailure(name?: string, fn?: SuiteFn): Promise<void>;
function expectFailure(options?: TestOptions, fn?: SuiteFn): Promise<void>;
function expectFailure(fn?: SuiteFn): Promise<void>;
}
/**
* Shorthand for skipping a test. This is the same as calling {@link test} with `options.skip` set to `true`.
@ -216,6 +141,11 @@ declare module "node:test" {
function only(name?: string, fn?: TestFn): Promise<void>;
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
function only(fn?: TestFn): Promise<void>;
// added in v25.5.0, undocumented
function expectFailure(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function expectFailure(name?: string, fn?: TestFn): Promise<void>;
function expectFailure(options?: TestOptions, fn?: TestFn): Promise<void>;
function expectFailure(fn?: TestFn): Promise<void>;
/**
* The type of a function passed to {@link test}. The first argument to this function is a {@link TestContext} object.
* If the test uses callbacks, the callback function is passed as the second argument.
@ -237,7 +167,7 @@ declare module "node:test" {
}
interface RunOptions {
/**
* If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file.
* If a number is provided, then that many tests would run asynchronously (they are still managed by the single-threaded event loop).
* If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time.
* @default false
*/
@ -399,6 +329,13 @@ declare module "node:test" {
* @default 0
*/
functionCoverage?: number | undefined;
/**
* Specify environment variables to be passed along to the test process.
* This options is not compatible with `isolation='none'`. These variables will override
* those from the main process, and are not merged with `process.env`.
* @since v25.6.0
*/
env?: NodeJS.ProcessEnv | undefined;
}
interface TestsStreamEventMap extends ReadableEventMap {
"data": [data: TestEvent];
@ -480,7 +417,7 @@ declare module "node:test" {
}
namespace EventData {
interface Error extends globalThis.Error {
cause: globalThis.Error;
cause: unknown;
}
interface LocationInfo {
/**
@ -969,7 +906,6 @@ declare module "node:test" {
* @since v22.2.0, v20.15.0
*/
readonly assert: TestContextAssert;
readonly attempt: number;
/**
* This function is used to create a hook running before subtest of the current test.
* @param fn The hook function. The first argument to this function is a `TestContext` object.
@ -1032,6 +968,21 @@ declare module "node:test" {
* @since v18.8.0, v16.18.0
*/
readonly name: string;
/**
* Indicated whether the test succeeded.
* @since v21.7.0, v20.12.0
*/
readonly passed: boolean;
/**
* The failure reason for the test/case; wrapped and available via `context.error.cause`.
* @since v21.7.0, v20.12.0
*/
readonly error: EventData.Error | null;
/**
* Number of times the test has been attempted.
* @since v21.7.0, v20.12.0
*/
readonly attempt: number;
/**
* This function is used to set the number of assertions and subtests that are expected to run
* within the test. If the number of assertions and subtests that run does not match the
@ -1286,6 +1237,11 @@ declare module "node:test" {
* @since v22.6.0
*/
readonly filePath: string | undefined;
/**
* The name of the suite and each of its ancestors, separated by `>`.
* @since v22.3.0, v20.16.0
*/
readonly fullName: string;
/**
* The name of the suite.
* @since v18.8.0, v16.18.0
@ -1345,6 +1301,8 @@ declare module "node:test" {
* @since v22.2.0
*/
plan?: number | undefined;
// added in v25.5.0, undocumented
expectFailure?: boolean | undefined;
}
/**
* This function creates a hook that runs before executing a suite.
@ -1353,7 +1311,7 @@ declare module "node:test" {
* describe('tests', async () => {
* before(() => console.log('about to run some test'));
* it('is a subtest', () => {
* assert.ok('some relevant assertion here');
* // Some relevant assertion here
* });
* });
* ```
@ -1369,7 +1327,7 @@ declare module "node:test" {
* describe('tests', async () => {
* after(() => console.log('finished running tests'));
* it('is a subtest', () => {
* assert.ok('some relevant assertion here');
* // Some relevant assertion here
* });
* });
* ```
@ -1385,7 +1343,7 @@ declare module "node:test" {
* describe('tests', async () => {
* beforeEach(() => console.log('about to run a test'));
* it('is a subtest', () => {
* assert.ok('some relevant assertion here');
* // Some relevant assertion here
* });
* });
* ```
@ -1402,7 +1360,7 @@ declare module "node:test" {
* describe('tests', async () => {
* afterEach(() => console.log('finished running a test'));
* it('is a subtest', () => {
* assert.ok('some relevant assertion here');
* // Some relevant assertion here
* });
* });
* ```
@ -2034,24 +1992,28 @@ declare module "node:test" {
*/
enable(options?: MockTimersOptions): void;
/**
* You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer.
* Note: This method will execute any mocked timers that are in the past from the new time.
* In the below example we are setting a new time for the mocked date.
* Sets the current Unix timestamp that will be used as reference for any mocked
* `Date` objects.
*
* ```js
* import assert from 'node:assert';
* import { test } from 'node:test';
* test('sets the time of a date object', (context) => {
* // Optionally choose what to mock
* context.mock.timers.enable({ apis: ['Date'], now: 100 });
* assert.strictEqual(Date.now(), 100);
* // Advance in time will also advance the date
* context.mock.timers.setTime(1000);
* context.mock.timers.tick(200);
* assert.strictEqual(Date.now(), 1200);
*
* test('runAll functions following the given order', (context) => {
* const now = Date.now();
* const setTime = 1000;
* // Date.now is not mocked
* assert.deepStrictEqual(Date.now(), now);
*
* context.mock.timers.enable({ apis: ['Date'] });
* context.mock.timers.setTime(setTime);
* // Date.now is now 1000
* assert.strictEqual(Date.now(), setTime);
* });
* ```
* @since v21.2.0, v20.11.0
*/
setTime(time: number): void;
setTime(milliseconds: number): void;
/**
* This function restores the default behavior of all mocks that were previously
* created by this `MockTimers` instance and disassociates the mocks

View File

@ -1,41 +1,3 @@
/**
* The `node:test` module supports passing `--test-reporter`
* flags for the test runner to use a specific reporter.
*
* The following built-reporters are supported:
*
* * `spec`
* The `spec` reporter outputs the test results in a human-readable format. This
* is the default reporter.
*
* * `tap`
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
*
* * `dot`
* The `dot` reporter outputs the test results in a compact format,
* where each passing test is represented by a `.`,
* and each failing test is represented by a `X`.
*
* * `junit`
* The junit reporter outputs test results in a jUnit XML format
*
* * `lcov`
* The `lcov` reporter outputs test coverage when used with the
* `--experimental-test-coverage` flag.
*
* The exact output of these reporters is subject to change between versions of
* Node.js, and should not be relied on programmatically. If programmatic access
* to the test runner's output is required, use the events emitted by the
* `TestsStream`.
*
* The reporters are available via the `node:test/reporters` module:
*
* ```js
* import { tap, spec, dot, junit, lcov } from 'node:test/reporters';
* ```
* @since v19.9.0, v18.17.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test/reporters.js)
*/
declare module "node:test/reporters" {
import { Transform, TransformOptions } from "node:stream";
import { EventData } from "node:test";

10
node_modules/@types/node/timers.d.ts generated vendored
View File

@ -1,13 +1,3 @@
/**
* The `timer` module exposes a global API for scheduling functions to
* be called at some future period of time. Because the timer functions are
* globals, there is no need to import `node:timers` to use the API.
*
* The timer functions within Node.js implement a similar API as the timers API
* provided by Web Browsers but use a different internal implementation that is
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers.js)
*/
declare module "node:timers" {
import { Abortable } from "node:events";
import * as promises from "node:timers/promises";

View File

@ -1,18 +1,3 @@
/**
* The `timers/promises` API provides an alternative set of timer functions
* that return `Promise` objects. The API is accessible via
* `require('node:timers/promises')`.
*
* ```js
* import {
* setTimeout,
* setImmediate,
* setInterval,
* } from 'node:timers/promises';
* ```
* @since v15.0.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers/promises.js)
*/
declare module "node:timers/promises" {
import { TimerOptions } from "node:timers";
/**

31
node_modules/@types/node/tls.d.ts generated vendored
View File

@ -1,13 +1,3 @@
/**
* The `node:tls` module provides an implementation of the Transport Layer Security
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
* The module can be accessed using:
*
* ```js
* import tls from 'node:tls';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tls.js)
*/
declare module "node:tls" {
import { NonSharedBuffer } from "node:buffer";
import { X509Certificate } from "node:crypto";
@ -200,16 +190,11 @@ declare module "node:tls" {
* An optional Buffer instance containing a TLS session.
*/
session?: Buffer | undefined;
/**
* If true, specifies that the OCSP status request extension will be
* added to the client hello and an 'OCSPResponse' event will be
* emitted on the socket before establishing a secure communication
*/
requestOCSP?: boolean | undefined;
}
interface TLSSocketEventMap extends net.SocketEventMap {
"keylog": [line: NonSharedBuffer];
"OCSPResponse": [response: NonSharedBuffer];
"secure": [];
"secureConnect": [];
"session": [session: NonSharedBuffer];
}
@ -551,8 +536,12 @@ declare module "node:tls" {
*/
requestCert?: boolean | undefined;
/**
* An array of strings or a Buffer naming possible ALPN protocols.
* (Protocols should be ordered by their priority.)
* An array of strings, or a single `Buffer`, `TypedArray`, or `DataView` containing the supported
* ALPN protocols. Buffers should have the format `[len][name][len][name]...`
* e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the
* next protocol name. Passing an array is usually much simpler, e.g.
* `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher
* preference than those later.
*/
ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined;
/**
@ -572,6 +561,12 @@ declare module "node:tls" {
* @default true
*/
rejectUnauthorized?: boolean | undefined;
/**
* If true, specifies that the OCSP status request extension will be
* added to the client hello and an 'OCSPResponse' event will be
* emitted on the socket before establishing a secure communication.
*/
requestOCSP?: boolean | undefined;
}
interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts {
/**

View File

@ -1,97 +1,3 @@
/**
* The `node:trace_events` module provides a mechanism to centralize tracing information
* generated by V8, Node.js core, and userspace code.
*
* Tracing can be enabled with the `--trace-event-categories` command-line flag
* or by using the `trace_events` module. The `--trace-event-categories` flag
* accepts a list of comma-separated category names.
*
* The available categories are:
*
* * `node`: An empty placeholder.
* * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) trace data.
* The [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
* * `node.console`: Enables capture of `console.time()` and `console.count()` output.
* * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
* * `node.threadpoolwork.async`: Enables capture of trace data for threadpool asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
* * `node.dns.native`: Enables capture of trace data for DNS queries.
* * `node.net.native`: Enables capture of trace data for network.
* * `node.environment`: Enables capture of Node.js Environment milestones.
* * `node.fs.sync`: Enables capture of trace data for file system sync methods.
* * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods.
* * `node.fs.async`: Enables capture of trace data for file system async methods.
* * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods.
* * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v25.x/api/perf_hooks.html) measurements.
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
* measures and marks.
* * `node.perf.timerify`: Enables capture of only Performance API timerify
* measurements.
* * `node.promises.rejections`: Enables capture of trace data tracking the number
* of unhandled Promise rejections and handled-after-rejections.
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
* * `v8`: The [V8](https://nodejs.org/docs/latest-v25.x/api/v8.html) events are GC, compiling, and execution related.
* * `node.http`: Enables capture of trace data for http request / response.
*
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
*
* ```bash
* node --trace-event-categories v8,node,node.async_hooks server.js
* ```
*
* Prior versions of Node.js required the use of the `--trace-events-enabled` flag to enable trace events. This requirement has been removed. However, the `--trace-events-enabled` flag _may_ still be
* used and will enable the `node`, `node.async_hooks`, and `v8` trace event categories by default.
*
* ```bash
* node --trace-events-enabled
*
* # is equivalent to
*
* node --trace-event-categories v8,node,node.async_hooks
* ```
*
* Alternatively, trace events may be enabled using the `node:trace_events` module:
*
* ```js
* import trace_events from 'node:trace_events';
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
*
* // do work
*
* tracing.disable(); // Disable trace event capture for the 'node.perf' category
* ```
*
* Running Node.js with tracing enabled will produce log files that can be opened
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
*
* The logging file is by default called `node_trace.${rotation}.log`, where `${rotation}` is an incrementing log-rotation id. The filepath pattern can
* be specified with `--trace-event-file-pattern` that accepts a template
* string that supports `${rotation}` and `${pid}`:
*
* ```bash
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
* ```
*
* To guarantee that the log file is properly generated after signal events like `SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
* in your code, such as:
*
* ```js
* process.on('SIGINT', function onSigint() {
* console.info('Received SIGINT.');
* process.exit(130); // Or applicable exit code depending on OS and signal
* });
* ```
*
* The tracing system uses the same time source
* as the one used by `process.hrtime()`.
* However the trace-event timestamps are expressed in microseconds,
* unlike `process.hrtime()` which returns nanoseconds.
*
* The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#class-worker) threads.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/trace_events.js)
*/
declare module "node:trace_events" {
/**
* The `Tracing` object is used to enable or disable tracing for sets of

View File

@ -172,7 +172,7 @@ declare module "node:buffer" {
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
* in `list` by adding their lengths.
*
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
* If `totalLength` is provided, it must be an unsigned integer. If the
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
* truncated to `totalLength`.
*

25
node_modules/@types/node/tty.d.ts generated vendored
View File

@ -1,28 +1,3 @@
/**
* The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module
* directly. However, it can be accessed using:
*
* ```js
* import tty from 'node:tty';
* ```
*
* When Node.js detects that it is being run with a text terminal ("TTY")
* attached, `process.stdin` will, by default, be initialized as an instance of `tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
* default, be instances of `tty.WriteStream`. The preferred method of determining
* whether Node.js is being run within a TTY context is to check that the value of
* the `process.stdout.isTTY` property is `true`:
*
* ```console
* $ node -p -e "Boolean(process.stdout.isTTY)"
* true
* $ node -p -e "Boolean(process.stdout.isTTY)" | cat
* false
* ```
*
* In most cases, there should be little to no reason for an application to
* manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tty.js)
*/
declare module "node:tty" {
import * as net from "node:net";
/**

31
node_modules/@types/node/url.d.ts generated vendored
View File

@ -1,12 +1,3 @@
/**
* The `node:url` module provides utilities for URL resolution and parsing. It can
* be accessed using:
*
* ```js
* import url from 'node:url';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/url.js)
*/
declare module "node:url" {
import { Blob, NonSharedBuffer } from "node:buffer";
import { ClientRequestArgs } from "node:http";
@ -334,6 +325,19 @@ declare module "node:url" {
* new URL('file:///hello world').pathname; // Incorrect: /hello%20world
* fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
* ```
*
* **Security Considerations:**
*
* This function decodes percent-encoded characters, including encoded dot-segments
* (`%2e` as `.` and `%2e%2e` as `..`), and then normalizes the resulting path.
* This means that encoded directory traversal sequences (such as `%2e%2e`) are
* decoded and processed as actual path traversal, even though encoded slashes
* (`%2F`, `%5C`) are correctly rejected.
*
* **Applications must not rely on `fileURLToPath()` alone to prevent directory
* traversal attacks.** Always perform explicit path validation and security checks
* on the returned path value to ensure it remains within expected boundaries
* before using it for file system operations.
* @since v10.12.0
* @param url The file URL string or URL object to convert to a path.
* @return The fully-resolved platform-specific Node.js file path.
@ -344,6 +348,15 @@ declare module "node:url" {
* representation of the path, a `Buffer` is returned. This conversion is
* helpful when the input URL contains percent-encoded segments that are
* not valid UTF-8 / Unicode sequences.
*
* **Security Considerations:**
*
* This function has the same security considerations as `url.fileURLToPath()`.
* It decodes percent-encoded characters, including encoded dot-segments
* (`%2e` as `.` and `%2e%2e` as `..`), and normalizes the path. **Applications
* must not rely on this function alone to prevent directory traversal attacks.**
* Always perform explicit path validation on the returned buffer value before
* using it for file system operations.
* @since v24.3.0
* @param url The file URL string or URL object to convert to a path.
* @returns The fully-resolved platform-specific Node.js file path

39
node_modules/@types/node/util.d.ts generated vendored
View File

@ -1,13 +1,3 @@
/**
* The `node:util` module supports the needs of Node.js internal APIs. Many of the
* utilities are useful for application and module developers as well. To access
* it:
*
* ```js
* import util from 'node:util';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/util.js)
*/
declare module "node:util" {
export * as types from "node:util/types";
export type InspectStyle =
@ -308,6 +298,9 @@ declare module "node:util" {
* Returns an array of call site objects containing the stack of
* the caller function.
*
* Unlike accessing an `error.stack`, the result returned from this API is not
* interfered with `Error.prepareStackTrace`.
*
* ```js
* import { getCallSites } from 'node:util';
*
@ -320,7 +313,7 @@ declare module "node:util" {
* console.log(`Function Name: ${callSite.functionName}`);
* console.log(`Script Name: ${callSite.scriptName}`);
* console.log(`Line Number: ${callSite.lineNumber}`);
* console.log(`Column Number: ${callSite.column}`);
* console.log(`Column Number: ${callSite.columnNumber}`);
* });
* // CallSite 1:
* // Function Name: exampleFunction
@ -750,6 +743,28 @@ declare module "node:util" {
* @legacy Use ES2015 class syntax and `extends` keyword instead.
*/
export function inherits(constructor: unknown, superConstructor: unknown): void;
/**
* The `util.convertProcessSignalToExitCode()` method converts a signal name to its
* corresponding POSIX exit code. Following the POSIX standard, the exit code
* for a process terminated by a signal is calculated as `128 + signal number`.
*
* If `signal` is not a valid signal name, then an error will be thrown. See
* [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals.
*
* ```js
* import { convertProcessSignalToExitCode } from 'node:util';
*
* console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)
* console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)
* ```
*
* This is particularly useful when working with processes to determine
* the exit code based on the signal that terminated the process.
* @since v25.4.0
* @param signal A signal name (e.g. `'SIGTERM'`)
* @returns The exit code corresponding to `signal`
*/
export function convertProcessSignalToExitCode(signal: NodeJS.Signals): number;
export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
export interface DebugLogger extends DebugLoggerFunction {
/**
@ -804,7 +819,7 @@ declare module "node:util" {
*
* ```js
* import { debuglog } from 'node:util';
* const log = debuglog('foo');
* const log = debuglog('foo-bar');
*
* log('hi there, it\'s foo-bar [%d]', 2333);
* ```

19
node_modules/@types/node/v8.d.ts generated vendored
View File

@ -1,11 +1,3 @@
/**
* The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
*
* ```js
* import v8 from 'node:v8';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/v8.js)
*/
declare module "node:v8" {
import { NonSharedBuffer } from "node:buffer";
import { Readable } from "node:stream";
@ -95,7 +87,7 @@ declare module "node:v8" {
* buffers and external strings.
*
* `total_allocated_bytes` The value of total allocated bytes since the Isolate
* creation
* creation.
*
* ```js
* {
@ -112,7 +104,8 @@ declare module "node:v8" {
* number_of_detached_contexts: 0,
* total_global_handles_size: 8192,
* used_global_handles_size: 3296,
* external_memory: 318824
* external_memory: 318824,
* total_allocated_bytes: 45224088
* }
* ```
* @since v1.0.0
@ -308,7 +301,6 @@ declare module "node:v8" {
* ```
* @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap.
* @since v20.13.0
* @experimental
*/
function queryObjects(ctor: Function): number | string[];
function queryObjects(ctor: Function, options: { format: "count" }): number;
@ -737,6 +729,11 @@ declare module "node:v8" {
* @since v19.6.0, v18.15.0
*/
stop(): GCProfilerResult;
/**
* Stop collecting GC data, and discard the profile.
* @since v25.5.0
*/
[Symbol.dispose](): void;
}
interface GCProfilerResult {
version: number;

38
node_modules/@types/node/vm.d.ts generated vendored
View File

@ -1,41 +1,3 @@
/**
* The `node:vm` module enables compiling and running code within V8 Virtual
* Machine contexts.
*
* **The `node:vm` module is not a security**
* **mechanism. Do not use it to run untrusted code.**
*
* JavaScript code can be compiled and run immediately or
* compiled, saved, and run later.
*
* A common use case is to run the code in a different V8 Context. This means
* invoked code has a different global object than the invoking code.
*
* One can provide the context by `contextifying` an
* object. The invoked code treats any property in the context like a
* global variable. Any changes to global variables caused by the invoked
* code are reflected in the context object.
*
* ```js
* import vm from 'node:vm';
*
* const x = 1;
*
* const context = { x: 2 };
* vm.createContext(context); // Contextify the object.
*
* const code = 'x += 40; var y = 17;';
* // `x` and `y` are global variables in the context.
* // Initially, x has the value 2 because that is the value of context.x.
* vm.runInContext(code, context);
*
* console.log(context.x); // 42
* console.log(context.y); // 17
*
* console.log(x); // 1; y is not defined.
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/vm.js)
*/
declare module "node:vm" {
import { NonSharedBuffer } from "node:buffer";
import { ImportAttributes, ImportPhase } from "node:module";

71
node_modules/@types/node/wasi.d.ts generated vendored
View File

@ -1,74 +1,3 @@
/**
* **The `node:wasi` module does not currently provide the**
* **comprehensive file system security properties provided by some WASI runtimes.**
* **Full support for secure file system sandboxing may or may not be implemented in**
* **future. In the mean time, do not rely on it to run untrusted code.**
*
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives WebAssembly applications access to the underlying
* operating system via a collection of POSIX-like functions.
*
* ```js
* import { readFile } from 'node:fs/promises';
* import { WASI } from 'node:wasi';
* import { argv, env } from 'node:process';
*
* const wasi = new WASI({
* version: 'preview1',
* args: argv,
* env,
* preopens: {
* '/local': '/some/real/path/that/wasm/can/access',
* },
* });
*
* const wasm = await WebAssembly.compile(
* await readFile(new URL('./demo.wasm', import.meta.url)),
* );
* const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject());
*
* wasi.start(instance);
* ```
*
* To run the above example, create a new WebAssembly text format file named `demo.wat`:
*
* ```text
* (module
* ;; Import the required fd_write WASI function which will write the given io vectors to stdout
* ;; The function signature for fd_write is:
* ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
* (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
*
* (memory 1)
* (export "memory" (memory 0))
*
* ;; Write 'hello world\n' to memory at an offset of 8 bytes
* ;; Note the trailing newline which is required for the text to appear
* (data (i32.const 8) "hello world\n")
*
* (func $main (export "_start")
* ;; Creating a new io vector within linear memory
* (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
* (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
*
* (call $fd_write
* (i32.const 1) ;; file_descriptor - 1 for stdout
* (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
* (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
* (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
* )
* drop ;; Discard the number of bytes written from the top of the stack
* )
* )
* ```
*
* Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
*
* ```bash
* wat2wasm demo.wat
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/wasi.js)
*/
declare module "node:wasi" {
interface WASIOptions {
/**

View File

@ -1,59 +1,3 @@
/**
* The `node:worker_threads` module enables the use of threads that execute
* JavaScript in parallel. To access it:
*
* ```js
* import worker from 'node:worker_threads';
* ```
*
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
* They do not help much with I/O-intensive work. The Node.js built-in
* asynchronous I/O operations are more efficient than Workers can be.
*
* Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
* so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
*
* ```js
* import {
* Worker,
* isMainThread,
* parentPort,
* workerData,
* } from 'node:worker_threads';
*
* if (!isMainThread) {
* const { parse } = await import('some-js-parsing-library');
* const script = workerData;
* parentPort.postMessage(parse(script));
* }
*
* export default function parseJSAsync(script) {
* return new Promise((resolve, reject) => {
* const worker = new Worker(new URL(import.meta.url), {
* workerData: script,
* });
* worker.on('message', resolve);
* worker.on('error', reject);
* worker.on('exit', (code) => {
* if (code !== 0)
* reject(new Error(`Worker stopped with exit code ${code}`));
* });
* });
* };
* ```
*
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the
* overhead of creating Workers would likely exceed their benefit.
*
* When implementing a worker pool, use the `AsyncResource` API to inform
* diagnostic tools (e.g. to provide asynchronous stack traces) about the
* correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation.
*
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
* specifically `argv` and `execArgv` options.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/worker_threads.js)
*/
declare module "node:worker_threads" {
import {
EventEmitter,
@ -396,11 +340,15 @@ declare module "node:worker_threads" {
interface Worker extends InternalEventEmitter<WorkerEventMap> {}
/**
* Mark an object as not transferable. If `object` occurs in the transfer list of
* a `port.postMessage()` call, it is ignored.
* a [`port.postMessage()`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#portpostmessagevalue-transferlist) call, an error is thrown. This is a no-op if
* `object` is a primitive value.
*
* In particular, this makes sense for objects that can be cloned, rather than
* transferred, and which are used by other objects on the sending side.
* For example, Node.js marks the `ArrayBuffer`s it uses for its `Buffer pool` with this.
* For example, Node.js marks the `ArrayBuffer`s it uses for its
* [`Buffer` pool](https://nodejs.org/docs/latest-v25.x/api/buffer.html#static-method-bufferallocunsafesize) with this.
* `ArrayBuffer.prototype.transfer()` is disallowed on such array buffer
* instances.
*
* This operation cannot be undone.
*
@ -414,11 +362,17 @@ declare module "node:worker_threads" {
* markAsUntransferable(pooledBuffer);
*
* const { port1 } = new MessageChannel();
* port1.postMessage(typedArray1, [ typedArray1.buffer ]);
* try {
* // This will throw an error, because pooledBuffer is not transferable.
* port1.postMessage(typedArray1, [ typedArray1.buffer ]);
* } catch (error) {
* // error.name === 'DataCloneError'
* }
*
* // The following line prints the contents of typedArray1 -- it still owns
* // its memory and has been cloned, not transferred. Without
* // `markAsUntransferable()`, this would print an empty Uint8Array.
* // its memory and has not been transferred. Without
* // `markAsUntransferable()`, this would print an empty Uint8Array and the
* // postMessage call would have succeeded.
* // typedArray2 is intact as well.
* console.log(typedArray1);
* console.log(typedArray2);

Some files were not shown because too many files have changed in this diff Show More