feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
This commit is contained in:
parent
a4a738da53
commit
768f38fc97
|
|
@ -116,8 +116,38 @@ publishing {
|
|||
}
|
||||
}
|
||||
repositories {
|
||||
// 本地仓库
|
||||
maven {
|
||||
url System.getenv('local_maven_url')
|
||||
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(PublishToMavenRepository) {
|
||||
dependsOn assemble
|
||||
dependsOn javadoc
|
||||
}
|
||||
|
||||
tasks.named('build') {
|
||||
dependsOn javadoc, sourcesJar
|
||||
}
|
||||
|
||||
tasks.register('cleanRepo', Delete) {
|
||||
delete layout.buildDirectory.dir("repo")
|
||||
}
|
||||
|
||||
tasks.named('clean') {
|
||||
dependsOn cleanRepo
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ processResources {
|
|||
tasks.named('javadoc', Javadoc).configure {
|
||||
dependsOn(configurations.commonJava)
|
||||
source(configurations.commonJava)
|
||||
options.encoding = 'UTF-8'
|
||||
options.charSet = 'UTF-8'
|
||||
options.links("https://docs.oracle.com/en/java/javase/21/docs/api/")
|
||||
options.memberLevel = JavadocMemberLevel.PUBLIC
|
||||
options.addBooleanOption('Xdoclint:none', true)
|
||||
options.addStringOption('doctitle', "${mod_id} ${minecraft_version} ${version} Javadoc")
|
||||
}
|
||||
|
||||
tasks.named('sourcesJar', Jar) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ configurations {
|
|||
|
||||
artifacts {
|
||||
commonJava sourceSets.main.java.sourceDirectories.singleFile
|
||||
commonResources sourceSets.main.resources.sourceDirectories.singleFile
|
||||
commonResources sourceSets.main.resources.sourceDirectories.singleFile, file('src/generated/resources')
|
||||
}
|
||||
|
||||
clean {
|
||||
delete 'generated'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,14 @@ dependencies {
|
|||
}
|
||||
|
||||
loom {
|
||||
def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
|
||||
if (aw.exists()) {
|
||||
accessWidenerPath.set(aw)
|
||||
def commonResources = project(':common').file('src/main/resources/').getAbsolutePath().toString()
|
||||
def fabricResources = file('src/main/resources/').getAbsolutePath().toString()
|
||||
def fabricBuildResources = file('build/resources/main/').getAbsolutePath().toString()
|
||||
def commonBuildResources = project(':common').file('build/resources/main/').getAbsolutePath().toString()
|
||||
def generatedOutput = project(':common').file('src/generated/resources/').getAbsolutePath().toString()
|
||||
|
||||
if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) {
|
||||
accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
|
||||
}
|
||||
mixin {
|
||||
defaultRefmapName.set("${mod_id}.refmap.json")
|
||||
|
|
@ -26,12 +31,111 @@ loom {
|
|||
setConfigName('Fabric Client')
|
||||
ideConfigGenerated(true)
|
||||
runDir('runs/client')
|
||||
programArgs "--username", "dev"
|
||||
def args = [
|
||||
"-Dlib39.modid=${mod_id}".toString(),
|
||||
"-Dlib39.output=${generatedOutput}".toString(),
|
||||
"-Dlib39.existing.fabric=${fabricResources}".toString(),
|
||||
"-Dlib39.existing.common=${commonResources}".toString(),
|
||||
"-Dlib39.existing.fabricBuild=${fabricBuildResources}".toString(),
|
||||
"-Dlib39.existing.commonBuild=${commonBuildResources}".toString()
|
||||
]
|
||||
vmArgs.addAll(args)
|
||||
|
||||
// 也可以添加JVM参数
|
||||
vmArgs.addAll(
|
||||
"-Dfabric.log.level=info",
|
||||
"-Dmixin.debug.export=true"
|
||||
)
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName('Fabric Server')
|
||||
ideConfigGenerated(true)
|
||||
runDir('runs/server')
|
||||
def args = [
|
||||
"-Dlib39.modid=${mod_id}".toString(),
|
||||
"-Dlib39.output=${generatedOutput}".toString(),
|
||||
"-Dlib39.existing.fabric=${fabricResources}".toString(),
|
||||
"-Dlib39.existing.common=${commonResources}".toString(),
|
||||
"-Dlib39.existing.fabricBuild=${fabricBuildResources}".toString(),
|
||||
"-Dlib39.existing.commonBuild=${commonBuildResources}".toString()
|
||||
]
|
||||
vmArgs.addAll(args)
|
||||
}
|
||||
}
|
||||
tasks.named('sourcesJar', Jar) {
|
||||
dependsOn classes
|
||||
dependsOn project(':common').tasks.named('sourcesJar') // 显式依赖common的source
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
archiveClassifier.set('sources')
|
||||
from sourceSets.main.allSource
|
||||
from project(':common').sourceSets.main.allSource
|
||||
}
|
||||
|
||||
tasks.named('javadoc', Javadoc) {
|
||||
source project(':common').sourceSets.main.allJava
|
||||
dependsOn project(':common').tasks.named('javadoc') // 显式依赖common的javadoc
|
||||
source sourceSets.main.allJava
|
||||
classpath = configurations.compileClasspath
|
||||
classpath += project(':common').sourceSets.main.compileClasspath
|
||||
options.encoding = 'UTF-8'
|
||||
options.charSet = 'UTF-8'
|
||||
options.links("https://docs.oracle.com/en/java/javase/21/docs/api/")
|
||||
options.memberLevel = JavadocMemberLevel.PUBLIC
|
||||
options.addBooleanOption('Xdoclint:none', true)
|
||||
options.addStringOption('doctitle', "${mod_id} ${minecraft_version} ${version} Javadoc")
|
||||
}
|
||||
|
||||
tasks.named('javadocJar', Jar) {
|
||||
dependsOn javadoc
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
archiveClassifier.set('javadoc')
|
||||
from javadoc.destinationDir
|
||||
from project(':common').javadoc.destinationDir
|
||||
}
|
||||
|
||||
tasks.named('build') {
|
||||
dependsOn tasks.named('sourcesJar')
|
||||
dependsOn tasks.named('javadocJar')
|
||||
}
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
// 重置artifactsId
|
||||
artifactId = "${mod_id}-fabric-${minecraft_version}"
|
||||
artifacts.clear()
|
||||
// 手动添加需要的artifacts
|
||||
artifact(remapJar) {
|
||||
builtBy remapJar
|
||||
}
|
||||
artifact(remapSourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
classifier = 'sources'
|
||||
}
|
||||
artifact(javadocJar) {
|
||||
builtBy javadocJar
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
pom {
|
||||
name = mod_name
|
||||
description = project.description ?: "default"
|
||||
developers {
|
||||
developer {
|
||||
id = mod_author
|
||||
name = mod_author
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tasks.named('generateMetadataFileForMavenJavaPublication') {
|
||||
dependsOn tasks.named('remapJar')
|
||||
dependsOn tasks.named('remapSourcesJar')
|
||||
dependsOn tasks.named('javadocJar')
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,12 @@ jar {
|
|||
}
|
||||
|
||||
minecraft {
|
||||
def commonResources = project(':common').file('src/main/resources/').getAbsolutePath()
|
||||
def forgeResources = file('src/main/resources/').getAbsolutePath()
|
||||
def forgeBuildResources = file('build/resources/main/').getAbsolutePath()
|
||||
def commonBuildResources = project(':common').file('build/resources/main/').getAbsolutePath()
|
||||
def generatedOutput = project(':common').file('src/generated/resources/').getAbsolutePath()
|
||||
|
||||
mappings channel: 'official', version: minecraft_version
|
||||
|
||||
copyIdeResources = true //Calls processResources when in dev
|
||||
|
|
@ -27,9 +33,9 @@ minecraft {
|
|||
// This location is hardcoded in Forge and can not be changed.
|
||||
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
||||
// Forge still uses SRG names during compile time, so we cannot use the common AT's
|
||||
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
if (at.exists()) {
|
||||
accessTransformer = at
|
||||
accessTransformers = ["src/main/resources/META-INF/accesstransformer.cfg"]
|
||||
}
|
||||
|
||||
runs {
|
||||
|
|
@ -42,6 +48,12 @@ minecraft {
|
|||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
args '--mod', project.mod_id,
|
||||
'--all',
|
||||
'--existing', forgeResources,
|
||||
'--existing', commonResources,
|
||||
'--existing', forgeBuildResources,
|
||||
'--existing', commonBuildResources
|
||||
}
|
||||
|
||||
server {
|
||||
|
|
@ -53,6 +65,12 @@ minecraft {
|
|||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
args '--mod', project.mod_id,
|
||||
'--all',
|
||||
'--existing', forgeResources,
|
||||
'--existing', commonResources,
|
||||
'--existing', forgeBuildResources,
|
||||
'--existing', commonBuildResources
|
||||
}
|
||||
|
||||
data {
|
||||
|
|
@ -65,11 +83,18 @@ minecraft {
|
|||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
args '--mod', mod_id,
|
||||
'--all',
|
||||
'--output', generatedOutput,
|
||||
'--existing', forgeResources,
|
||||
'--existing', commonResources,
|
||||
'--existing', forgeBuildResources,
|
||||
'--existing', commonBuildResources
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources.srcDir 'src/generated/resources'
|
||||
sourceSets.main.resources.srcDir project(':common').file('src/generated/resources')
|
||||
|
||||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
|
@ -82,13 +107,101 @@ dependencies {
|
|||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
fg.component(it)
|
||||
artifactId = "${mod_id}-forge-${minecraft_version}"
|
||||
artifacts.clear()
|
||||
artifact(jar) {
|
||||
builtBy jar
|
||||
}
|
||||
artifact(sourcesJar) {
|
||||
builtBy sourcesJar
|
||||
classifier = 'sources'
|
||||
}
|
||||
artifact(javadocJar) {
|
||||
builtBy javadocJar
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
pom {
|
||||
name = mod_name
|
||||
description = project.description ?: "default"
|
||||
developers {
|
||||
developer {
|
||||
id = mod_author
|
||||
name = mod_author
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 配置sourceJar任务
|
||||
tasks.named('sourcesJar', Jar) {
|
||||
dependsOn classes
|
||||
dependsOn project(':common').tasks.named('sourcesJar') // 显式依赖common的source
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
archiveClassifier.set('sources')
|
||||
from sourceSets.main.allSource
|
||||
from project(':common').sourceSets.main.allSource
|
||||
}
|
||||
|
||||
// 配置javadoc任务
|
||||
tasks.named('javadoc', Javadoc) {
|
||||
source project(':common').sourceSets.main.allJava
|
||||
source sourceSets.main.allJava
|
||||
classpath = configurations.compileClasspath
|
||||
classpath += project(':common').sourceSets.main.compileClasspath
|
||||
options.encoding = 'UTF-8'
|
||||
options.charSet = 'UTF-8'
|
||||
options.links("https://docs.oracle.com/en/java/javase/17/docs/api/")
|
||||
options.memberLevel = JavadocMemberLevel.PUBLIC
|
||||
options.addBooleanOption('Xdoclint:none', true)
|
||||
options.addStringOption('doctitle', "${mod_id} ${minecraft_version} ${version} Javadoc")
|
||||
}
|
||||
|
||||
// 配置javadocJar任务
|
||||
tasks.named('javadocJar', Jar) {
|
||||
dependsOn javadoc
|
||||
dependsOn project(':common').tasks.named('javadoc') // 显式依赖common的javadoc
|
||||
|
||||
archiveClassifier.set('javadoc')
|
||||
from javadoc.destinationDir
|
||||
from project(':common').javadoc.destinationDir
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
// 确保build任务包含所有需要的jar
|
||||
tasks.named('build') {
|
||||
dependsOn tasks.named('sourcesJar')
|
||||
dependsOn tasks.named('javadocJar')
|
||||
}
|
||||
|
||||
|
||||
sourceSets.each {
|
||||
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
|
||||
it.output.resourcesDir = dir
|
||||
it.java.destinationDirectory = dir
|
||||
}
|
||||
|
||||
processResources {
|
||||
from project(':common').sourceSets.main.resources
|
||||
inputs.property "version", project.version
|
||||
inputs.property "minecraft_version", minecraft_version
|
||||
inputs.property "forge_version", forge_version
|
||||
inputs.property "mod_id", mod_id
|
||||
inputs.property "mod_name", mod_name
|
||||
inputs.property "description", description
|
||||
inputs.property "mod_author", mod_author
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand([
|
||||
version: project.version,
|
||||
minecraft_version: minecraft_version,
|
||||
forge_version: forge_version,
|
||||
mod_id: mod_id,
|
||||
mod_name: mod_name,
|
||||
description: description,
|
||||
mod_author: mod_author
|
||||
])
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
|
@ -2,7 +2,11 @@ plugins {
|
|||
id 'multiloader-loader'
|
||||
id 'net.neoforged.moddev'
|
||||
}
|
||||
|
||||
def commonResources = project(':common').file('src/main/resources/').getAbsolutePath()
|
||||
def neoforgeResources = file('src/main/resources/').getAbsolutePath()
|
||||
def neoforgeBuildResources = file('build/resources/main/').getAbsolutePath()
|
||||
def commonBuildResources = project(':common').file('build/resources/main/').getAbsolutePath()
|
||||
def generatedOutput = project(':common').file('src/generated/resources/').getAbsolutePath()
|
||||
neoForge {
|
||||
version = neoforge_version
|
||||
// Automatically enable neoforge AccessTransformers if the file exists
|
||||
|
|
@ -21,17 +25,40 @@ neoForge {
|
|||
}
|
||||
client {
|
||||
client()
|
||||
programArguments.addAll(
|
||||
'--mod', project.mod_id,
|
||||
'--all',
|
||||
'--existing', neoforgeResources,
|
||||
'--existing', commonResources,
|
||||
'--existing', neoforgeBuildResources,
|
||||
'--existing', commonBuildResources
|
||||
)
|
||||
}
|
||||
data {
|
||||
data()
|
||||
|
||||
// DataGen can be run by - "./gradlew :neoforge:runData" in Terminal.
|
||||
// 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()
|
||||
|
||||
programArguments.addAll(
|
||||
'--mod', project.mod_id,
|
||||
'--all',
|
||||
'--output', generatedOutput,
|
||||
'--existing', neoforgeResources,
|
||||
'--existing', commonResources,
|
||||
'--existing', neoforgeBuildResources,
|
||||
'--existing', commonBuildResources
|
||||
)
|
||||
}
|
||||
server {
|
||||
server()
|
||||
programArguments.addAll(
|
||||
'--mod', project.mod_id,
|
||||
'--all',
|
||||
'--existing', neoforgeResources,
|
||||
'--existing', commonResources,
|
||||
'--existing', neoforgeBuildResources,
|
||||
'--existing', commonBuildResources
|
||||
)
|
||||
}
|
||||
}
|
||||
mods {
|
||||
|
|
|
|||
16
node_modules/.bin/conventional-commits-parser
generated
vendored
Normal file
16
node_modules/.bin/conventional-commits-parser
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../conventional-commits-parser/dist/cli/index.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../conventional-commits-parser/dist/cli/index.js" "$@"
|
||||
fi
|
||||
17
node_modules/.bin/conventional-commits-parser.cmd
generated
vendored
Normal file
17
node_modules/.bin/conventional-commits-parser.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\conventional-commits-parser\dist\cli\index.js" %*
|
||||
28
node_modules/.bin/conventional-commits-parser.ps1
generated
vendored
Normal file
28
node_modules/.bin/conventional-commits-parser.ps1
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
16
node_modules/.bin/jiti
generated
vendored
Normal file
16
node_modules/.bin/jiti
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../jiti/lib/jiti-cli.mjs" "$@"
|
||||
else
|
||||
exec node "$basedir/../jiti/lib/jiti-cli.mjs" "$@"
|
||||
fi
|
||||
17
node_modules/.bin/jiti.cmd
generated
vendored
Normal file
17
node_modules/.bin/jiti.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jiti\lib\jiti-cli.mjs" %*
|
||||
28
node_modules/.bin/jiti.ps1
generated
vendored
Normal file
28
node_modules/.bin/jiti.ps1
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
2058
node_modules/.package-lock.json
generated
vendored
Normal file
2058
node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/babel-code-frame) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/code-frame --dev
|
||||
```
|
||||
217
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
217
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var picocolors = require('picocolors');
|
||||
var jsTokens = require('js-tokens');
|
||||
var helperValidatorIdentifier = require('@babel/helper-validator-identifier');
|
||||
|
||||
function isColorSupported() {
|
||||
return (typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported
|
||||
);
|
||||
}
|
||||
const compose = (f, g) => v => f(g(v));
|
||||
function buildDefs(colors) {
|
||||
return {
|
||||
keyword: colors.cyan,
|
||||
capitalized: colors.yellow,
|
||||
jsxIdentifier: colors.yellow,
|
||||
punctuator: colors.yellow,
|
||||
number: colors.magenta,
|
||||
string: colors.green,
|
||||
regex: colors.magenta,
|
||||
comment: colors.gray,
|
||||
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
|
||||
gutter: colors.gray,
|
||||
marker: compose(colors.red, colors.bold),
|
||||
message: compose(colors.red, colors.bold),
|
||||
reset: colors.reset
|
||||
};
|
||||
}
|
||||
const defsOn = buildDefs(picocolors.createColors(true));
|
||||
const defsOff = buildDefs(picocolors.createColors(false));
|
||||
function getDefs(enabled) {
|
||||
return enabled ? defsOn : defsOff;
|
||||
}
|
||||
|
||||
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
let tokenize;
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const getTokenType = function (token, offset, text) {
|
||||
if (token.type === "name") {
|
||||
const tokenValue = token.value;
|
||||
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
||||
return "jsxIdentifier";
|
||||
}
|
||||
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
|
||||
if (firstChar !== firstChar.toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
return token.type;
|
||||
};
|
||||
tokenize = function* (text) {
|
||||
let match;
|
||||
while (match = jsTokens.default.exec(text)) {
|
||||
const token = jsTokens.matchToToken(match);
|
||||
yield {
|
||||
type: getTokenType(token, match.index, text),
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
};
|
||||
function highlight(text) {
|
||||
if (text === "") return "";
|
||||
const defs = getDefs(true);
|
||||
let highlighted = "";
|
||||
for (const {
|
||||
type,
|
||||
value
|
||||
} of tokenize(text)) {
|
||||
if (type in defs) {
|
||||
highlighted += value.split(NEWLINE$1).map(str => defs[type](str)).join("\n");
|
||||
} else {
|
||||
highlighted += value;
|
||||
}
|
||||
}
|
||||
return highlighted;
|
||||
}
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
function getMarkerLines(loc, source, opts, startLineBaseZero) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||
const {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line - startLineBaseZero;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line - startLineBaseZero;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
const lineDiff = endLine - startLine;
|
||||
const markerLines = {};
|
||||
if (lineDiff) {
|
||||
for (let i = 0; i <= lineDiff; i++) {
|
||||
const lineNumber = i + startLine;
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
const sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
};
|
||||
}
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
||||
const startLineBaseZero = (opts.startLine || 1) - 1;
|
||||
const defs = getDefs(shouldHighlight);
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts, startLineBaseZero);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end + startLineBaseZero).length;
|
||||
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
if (hasMarker) {
|
||||
let markerLine = "";
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + defs.message(opts.message);
|
||||
}
|
||||
}
|
||||
return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
||||
} else {
|
||||
return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
||||
}
|
||||
}).join("\n");
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||
}
|
||||
if (shouldHighlight) {
|
||||
return defs.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
function index (rawLines, lineNumber, colNumber, opts = {}) {
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
const deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
const location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
||||
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = index;
|
||||
exports.highlight = highlight;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@babel/code-frame/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/code-frame/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
32
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.29.0",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.28.5",
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"charcodes": "^0.2.0",
|
||||
"import-meta-resolve": "^4.1.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
||||
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# @babel/helper-validator-identifier
|
||||
|
||||
> Validate identifier/keywords name
|
||||
|
||||
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/babel-helper-validator-identifier) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/helper-validator-identifier
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-validator-identifier
|
||||
```
|
||||
70
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
Normal file
70
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isIdentifierChar = isIdentifierChar;
|
||||
exports.isIdentifierName = isIdentifierName;
|
||||
exports.isIdentifierStart = isIdentifierStart;
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||
let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
|
||||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||||
function isInAstralSet(code, set) {
|
||||
let pos = 0x10000;
|
||||
for (let i = 0, length = set.length; i < length; i += 2) {
|
||||
pos += set[i];
|
||||
if (pos > code) return false;
|
||||
pos += set[i + 1];
|
||||
if (pos >= code) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isIdentifierStart(code) {
|
||||
if (code < 65) return code === 36;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||||
}
|
||||
return isInAstralSet(code, astralIdentifierStartCodes);
|
||||
}
|
||||
function isIdentifierChar(code) {
|
||||
if (code < 48) return code === 36;
|
||||
if (code < 58) return true;
|
||||
if (code < 65) return false;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||||
}
|
||||
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
||||
}
|
||||
function isIdentifierName(name) {
|
||||
let isFirst = true;
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
let cp = name.charCodeAt(i);
|
||||
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
|
||||
const trail = name.charCodeAt(++i);
|
||||
if ((trail & 0xfc00) === 0xdc00) {
|
||||
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
|
||||
}
|
||||
}
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
if (!isIdentifierStart(cp)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!isIdentifierChar(cp)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !isFirst;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=identifier.js.map
|
||||
1
node_modules/@babel/helper-validator-identifier/lib/identifier.js.map
generated
vendored
Normal file
1
node_modules/@babel/helper-validator-identifier/lib/identifier.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
57
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
Normal file
57
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierChar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _identifier.isIdentifierChar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierName", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _identifier.isIdentifierName;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierStart", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _identifier.isIdentifierStart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isKeyword", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isKeyword;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isStrictBindOnlyReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isStrictBindReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isStrictReservedWord;
|
||||
}
|
||||
});
|
||||
var _identifier = require("./identifier.js");
|
||||
var _keyword = require("./keyword.js");
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@babel/helper-validator-identifier/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/helper-validator-identifier/lib/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"names":["_identifier","require","_keyword"],"sources":["../src/index.ts"],"sourcesContent":["export {\n isIdentifierName,\n isIdentifierChar,\n isIdentifierStart,\n} from \"./identifier.ts\";\nexport {\n isReservedWord,\n isStrictBindOnlyReservedWord,\n isStrictBindReservedWord,\n isStrictReservedWord,\n isKeyword,\n} from \"./keyword.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}
|
||||
35
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
Normal file
35
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isKeyword = isKeyword;
|
||||
exports.isReservedWord = isReservedWord;
|
||||
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
||||
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
||||
exports.isStrictReservedWord = isStrictReservedWord;
|
||||
const reservedWords = {
|
||||
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
||||
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
||||
strictBind: ["eval", "arguments"]
|
||||
};
|
||||
const keywords = new Set(reservedWords.keyword);
|
||||
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
||||
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
||||
function isReservedWord(word, inModule) {
|
||||
return inModule && word === "await" || word === "enum";
|
||||
}
|
||||
function isStrictReservedWord(word, inModule) {
|
||||
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
||||
}
|
||||
function isStrictBindOnlyReservedWord(word) {
|
||||
return reservedWordsStrictBindSet.has(word);
|
||||
}
|
||||
function isStrictBindReservedWord(word, inModule) {
|
||||
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
||||
}
|
||||
function isKeyword(word) {
|
||||
return keywords.has(word);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=keyword.js.map
|
||||
1
node_modules/@babel/helper-validator-identifier/lib/keyword.js.map
generated
vendored
Normal file
1
node_modules/@babel/helper-validator-identifier/lib/keyword.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"names":["reservedWords","keyword","strict","strictBind","keywords","Set","reservedWordsStrictSet","reservedWordsStrictBindSet","isReservedWord","word","inModule","isStrictReservedWord","has","isStrictBindOnlyReservedWord","isStrictBindReservedWord","isKeyword"],"sources":["../src/keyword.ts"],"sourcesContent":["const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,aAAa,GAAG;EACpBC,OAAO,EAAE,CACP,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,QAAQ,CACT;EACDC,MAAM,EAAE,CACN,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;EACDC,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW;AAClC,CAAC;AACD,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACL,aAAa,CAACC,OAAO,CAAC;AAC/C,MAAMK,sBAAsB,GAAG,IAAID,GAAG,CAACL,aAAa,CAACE,MAAM,CAAC;AAC5D,MAAMK,0BAA0B,GAAG,IAAIF,GAAG,CAACL,aAAa,CAACG,UAAU,CAAC;AAK7D,SAASK,cAAcA,CAACC,IAAY,EAAEC,QAAiB,EAAW;EACvE,OAAQA,QAAQ,IAAID,IAAI,KAAK,OAAO,IAAKA,IAAI,KAAK,MAAM;AAC1D;AAOO,SAASE,oBAAoBA,CAACF,IAAY,EAAEC,QAAiB,EAAW;EAC7E,OAAOF,cAAc,CAACC,IAAI,EAAEC,QAAQ,CAAC,IAAIJ,sBAAsB,CAACM,GAAG,CAACH,IAAI,CAAC;AAC3E;AAMO,SAASI,4BAA4BA,CAACJ,IAAY,EAAW;EAClE,OAAOF,0BAA0B,CAACK,GAAG,CAACH,IAAI,CAAC;AAC7C;AAOO,SAASK,wBAAwBA,CACtCL,IAAY,EACZC,QAAiB,EACR;EACT,OACEC,oBAAoB,CAACF,IAAI,EAAEC,QAAQ,CAAC,IAAIG,4BAA4B,CAACJ,IAAI,CAAC;AAE9E;AAEO,SAASM,SAASA,CAACN,IAAY,EAAW;EAC/C,OAAOL,QAAQ,CAACQ,GAAG,CAACH,IAAI,CAAC;AAC3B","ignoreList":[]}
|
||||
31
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
Normal file
31
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "@babel/helper-validator-identifier",
|
||||
"version": "7.28.5",
|
||||
"description": "Validate identifier/keywords name",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-validator-identifier"
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/index.d.ts",
|
||||
"default": "./lib/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@unicode/unicode-17.0.0": "^1.6.10",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"type": "commonjs"
|
||||
}
|
||||
105
node_modules/@commitlint/config-validator/lib/commitlint.schema.json
generated
vendored
Normal file
105
node_modules/@commitlint/config-validator/lib/commitlint.schema.json
generated
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"type": "object",
|
||||
"definitions": {
|
||||
"rule": {
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "A rule",
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"description": "Level: 0 disables the rule. For 1 it will be considered a warning, for 2 an error",
|
||||
"type": "number",
|
||||
"enum": [0, 1, 2]
|
||||
},
|
||||
{
|
||||
"description": "Applicable: always|never: never inverts the rule",
|
||||
"type": "string",
|
||||
"enum": ["always", "never"]
|
||||
},
|
||||
{
|
||||
"description": "Value: the value for this rule"
|
||||
}
|
||||
],
|
||||
"minItems": 1,
|
||||
"maxItems": 3,
|
||||
"additionalItems": false
|
||||
},
|
||||
{
|
||||
"description": "A rule",
|
||||
"typeof": "function"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"extends": {
|
||||
"description": "Resolveable ids to commitlint configurations to extend",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
{ "type": "string" }
|
||||
]
|
||||
},
|
||||
"parserPreset": {
|
||||
"description": "Resolveable id to conventional-changelog parser preset to import and use",
|
||||
"oneOf": [
|
||||
{ "type": "string" },
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"path": { "type": "string" },
|
||||
"parserOpts": {}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
{ "typeof": "function" }
|
||||
]
|
||||
},
|
||||
"helpUrl": {
|
||||
"description": "Custom URL to show upon failure",
|
||||
"type": "string"
|
||||
},
|
||||
"formatter": {
|
||||
"description": "Resolveable id to package, from node_modules, which formats the output",
|
||||
"type": "string"
|
||||
},
|
||||
"rules": {
|
||||
"description": "Rules to check against",
|
||||
"type": "object",
|
||||
"propertyNames": { "type": "string" },
|
||||
"additionalProperties": { "$ref": "#/definitions/rule" }
|
||||
},
|
||||
"plugins": {
|
||||
"description": "Resolveable ids of commitlint plugins from node_modules",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{ "type": "string" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["rules"],
|
||||
"properties": {
|
||||
"rules": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ignores": {
|
||||
"type": "array",
|
||||
"items": { "typeof": "function" },
|
||||
"description": "Additional commits to ignore, defined by ignore matchers"
|
||||
},
|
||||
"defaultIgnores": {
|
||||
"description": "Whether commitlint uses the default ignore rules",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
node_modules/@commitlint/config-validator/lib/formatErrors.d.ts
generated
vendored
Normal file
9
node_modules/@commitlint/config-validator/lib/formatErrors.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import type { ErrorObject } from "ajv";
|
||||
/**
|
||||
* Formats an array of schema validation errors.
|
||||
* @param errors An array of error messages to format.
|
||||
* @returns Formatted error message
|
||||
* Based on https://github.com/eslint/eslint/blob/master/lib/shared/config-validator.js#L237-L261
|
||||
*/
|
||||
export declare function formatErrors(errors: ErrorObject[]): string;
|
||||
//# sourceMappingURL=formatErrors.d.ts.map
|
||||
1
node_modules/@commitlint/config-validator/lib/formatErrors.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/config-validator/lib/formatErrors.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"formatErrors.d.ts","sourceRoot":"","sources":["../src/formatErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAoC1D"}
|
||||
35
node_modules/@commitlint/config-validator/lib/formatErrors.js
generated
vendored
Normal file
35
node_modules/@commitlint/config-validator/lib/formatErrors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Formats an array of schema validation errors.
|
||||
* @param errors An array of error messages to format.
|
||||
* @returns Formatted error message
|
||||
* Based on https://github.com/eslint/eslint/blob/master/lib/shared/config-validator.js#L237-L261
|
||||
*/
|
||||
export function formatErrors(errors) {
|
||||
return errors
|
||||
.map((error) => {
|
||||
if (error.keyword === "additionalProperties" &&
|
||||
"additionalProperty" in error.params) {
|
||||
const formattedPropertyPath = error.instancePath.length
|
||||
? `${error.instancePath.slice(1)}.${error.params.additionalProperty}`
|
||||
: error.params.additionalProperty;
|
||||
return `Unexpected top-level property "${formattedPropertyPath}"`;
|
||||
}
|
||||
if (error.keyword === "type") {
|
||||
const formattedField = error.instancePath.slice(1);
|
||||
if (!formattedField) {
|
||||
return `Config has the wrong type - ${error.message}`;
|
||||
}
|
||||
return `Property "${formattedField}" has the wrong type - ${error.message}`;
|
||||
}
|
||||
const field = (error.instancePath[0] === "."
|
||||
? error.instancePath.slice(1)
|
||||
: error.instancePath) || "Config";
|
||||
if (error.keyword === "typeof") {
|
||||
return `"${field}" should be a ${error.schema}. Value: ${JSON.stringify(error.data)}`;
|
||||
}
|
||||
return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
|
||||
})
|
||||
.map((message) => `\t- ${message}.\n`)
|
||||
.join("");
|
||||
}
|
||||
//# sourceMappingURL=formatErrors.js.map
|
||||
1
node_modules/@commitlint/config-validator/lib/formatErrors.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/config-validator/lib/formatErrors.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"formatErrors.js","sourceRoot":"","sources":["../src/formatErrors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB;IACjD,OAAO,MAAM;SACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACd,IACC,KAAK,CAAC,OAAO,KAAK,sBAAsB;YACxC,oBAAoB,IAAI,KAAK,CAAC,MAAM,EACnC,CAAC;YACF,MAAM,qBAAqB,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM;gBACtD,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,kBAAkB,EAAE;gBACrE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAEnC,OAAO,kCAAkC,qBAAqB,GAAG,CAAC;QACnE,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC9B,MAAM,cAAc,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACnD,IAAI,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAAC;YACvD,CAAC;YACD,OAAO,aAAa,cAAc,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC;QAC7E,CAAC;QACD,MAAM,KAAK,GACV,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG;YAC7B,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC;QACpC,IAAI,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,IAAI,KAAK,iBAAiB,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,SAAS,CACtE,KAAK,CAAC,IAAI,CACV,EAAE,CAAC;QACL,CAAC;QAED,OAAO,IAAI,KAAK,KAAK,KAAK,CAAC,OAAO,YAAY,IAAI,CAAC,SAAS,CAC3D,KAAK,CAAC,IAAI,CACV,EAAE,CAAC;IACL,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,CAAC;SACrC,IAAI,CAAC,EAAE,CAAC,CAAC;AACZ,CAAC"}
|
||||
3
node_modules/@commitlint/config-validator/lib/validate.d.ts
generated
vendored
Normal file
3
node_modules/@commitlint/config-validator/lib/validate.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { UserConfig } from "@commitlint/types";
|
||||
export declare function validateConfig(source: string, config: unknown): asserts config is UserConfig;
|
||||
//# sourceMappingURL=validate.d.ts.map
|
||||
1
node_modules/@commitlint/config-validator/lib/validate.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/config-validator/lib/validate.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAsB/C,wBAAgB,cAAc,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACb,OAAO,CAAC,MAAM,IAAI,UAAU,CA4B9B"}
|
||||
39
node_modules/@commitlint/config-validator/lib/validate.js
generated
vendored
Normal file
39
node_modules/@commitlint/config-validator/lib/validate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { createRequire } from "node:module";
|
||||
import _Ajv from "ajv";
|
||||
import { formatErrors } from "./formatErrors.js";
|
||||
const require = createRequire(import.meta.url);
|
||||
const schema = require("./commitlint.schema.json");
|
||||
const TYPE_OF = [
|
||||
"undefined",
|
||||
"string",
|
||||
"number",
|
||||
"object",
|
||||
"function",
|
||||
"boolean",
|
||||
"symbol",
|
||||
];
|
||||
// FIXME: https://github.com/ajv-validator/ajv/issues/2132
|
||||
const Ajv = _Ajv;
|
||||
export function validateConfig(source, config) {
|
||||
const ajv = new Ajv({
|
||||
meta: false,
|
||||
strict: false,
|
||||
useDefaults: true,
|
||||
validateSchema: false,
|
||||
verbose: true,
|
||||
});
|
||||
ajv.addKeyword({
|
||||
keyword: "typeof",
|
||||
validate: function typeOfFunc(schema, data) {
|
||||
return typeof data === schema;
|
||||
},
|
||||
metaSchema: { type: "string", enum: TYPE_OF },
|
||||
schema: true,
|
||||
});
|
||||
const validate = ajv.compile(schema);
|
||||
const isValid = validate(config);
|
||||
if (!isValid && validate.errors && validate.errors.length) {
|
||||
throw new Error(`Commitlint configuration in ${source} is invalid:\n${formatErrors(validate.errors)}`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=validate.js.map
|
||||
1
node_modules/@commitlint/config-validator/lib/validate.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/config-validator/lib/validate.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,IAAI,MAAM,KAAK,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,MAAM,GAA8C,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAE9F,MAAM,OAAO,GAAG;IACf,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,QAAQ;CACR,CAAC;AAEF,0DAA0D;AAC1D,MAAM,GAAG,GAAG,IAAsC,CAAC;AAEnD,MAAM,UAAU,cAAc,CAC7B,MAAc,EACd,MAAe;IAEf,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,KAAK;QACrB,OAAO,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,GAAG,CAAC,UAAU,CAAC;QACd,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,SAAS,UAAU,CAAC,MAAW,EAAE,IAAS;YACnD,OAAO,OAAO,IAAI,KAAK,MAAM,CAAC;QAC/B,CAAC;QACD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;QAC7C,MAAM,EAAE,IAAI;KACZ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEjC,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACd,+BAA+B,MAAM,iBAAiB,YAAY,CACjE,QAAQ,CAAC,MAAM,CACf,EAAE,CACH,CAAC;IACH,CAAC;AACF,CAAC"}
|
||||
21
node_modules/@commitlint/config-validator/license.md
generated
vendored
Normal file
21
node_modules/@commitlint/config-validator/license.md
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 - present Mario Nebl
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
46
node_modules/@commitlint/config-validator/package.json
generated
vendored
Normal file
46
node_modules/@commitlint/config-validator/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "@commitlint/config-validator",
|
||||
"type": "module",
|
||||
"version": "20.5.0",
|
||||
"description": "config validator for commitlint.config.js",
|
||||
"main": "lib/validate.js",
|
||||
"types": "lib/validate.d.ts",
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"scripts": {
|
||||
"deps": "dep-check",
|
||||
"pkg": "pkg-check --skip-import"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=v18"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/conventional-changelog/commitlint.git",
|
||||
"directory": "@commitlint/config-validator"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
||||
},
|
||||
"homepage": "https://commitlint.js.org/",
|
||||
"keywords": [
|
||||
"conventional-changelog",
|
||||
"commitlint",
|
||||
"library",
|
||||
"core"
|
||||
],
|
||||
"author": {
|
||||
"name": "Mario Nebl",
|
||||
"email": "hello@herebecode.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@commitlint/utils": "^20.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@commitlint/types": "^20.5.0",
|
||||
"ajv": "^8.11.0"
|
||||
},
|
||||
"gitHead": "a7918e9cf70f822505cb4422c03150a86f802627"
|
||||
}
|
||||
7
node_modules/@commitlint/execute-rule/lib/index.d.ts
generated
vendored
Normal file
7
node_modules/@commitlint/execute-rule/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
type Rule<T> = readonly [string, Config<T>];
|
||||
type Config<T> = T | Promise<T> | ExectableConfig<T>;
|
||||
type ExectableConfig<T> = (() => T) | (() => Promise<T>);
|
||||
type ExecutedRule<T> = readonly [string, T];
|
||||
export default execute;
|
||||
export declare function execute<T = unknown>(rule?: Rule<T>): Promise<ExecutedRule<T> | null>;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@commitlint/execute-rule/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/execute-rule/lib/index.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AACrD,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzD,KAAK,YAAY,CAAC,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAE5C,eAAe,OAAO,CAAC;AAEvB,wBAAsB,OAAO,CAAC,CAAC,GAAG,OAAO,EACxC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GACZ,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAUjC"}
|
||||
13
node_modules/@commitlint/execute-rule/lib/index.js
generated
vendored
Normal file
13
node_modules/@commitlint/execute-rule/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export default execute;
|
||||
export async function execute(rule) {
|
||||
if (!Array.isArray(rule)) {
|
||||
return null;
|
||||
}
|
||||
const [name, config] = rule;
|
||||
const fn = executable(config) ? config : async () => config;
|
||||
return [name, await fn()];
|
||||
}
|
||||
function executable(config) {
|
||||
return typeof config === "function";
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@commitlint/execute-rule/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/execute-rule/lib/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,eAAe,OAAO,CAAC;AAEvB,MAAM,CAAC,KAAK,UAAU,OAAO,CAC5B,IAAc;IAEd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE5B,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC;IAE5D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,UAAU,CAAI,MAAiB;IACvC,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC;AACrC,CAAC"}
|
||||
21
node_modules/@commitlint/execute-rule/license.md
generated
vendored
Normal file
21
node_modules/@commitlint/execute-rule/license.md
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 - present Mario Nebl
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
42
node_modules/@commitlint/execute-rule/package.json
generated
vendored
Normal file
42
node_modules/@commitlint/execute-rule/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"name": "@commitlint/execute-rule",
|
||||
"type": "module",
|
||||
"version": "20.0.0",
|
||||
"description": "Lint your commit messages",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"scripts": {
|
||||
"deps": "dep-check",
|
||||
"pkg": "pkg-check"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=v18"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/conventional-changelog/commitlint.git",
|
||||
"directory": "@commitlint/execute-rule"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/conventional-changelog/commitlint/issues"
|
||||
},
|
||||
"homepage": "https://commitlint.js.org/",
|
||||
"keywords": [
|
||||
"conventional-changelog",
|
||||
"commitlint",
|
||||
"library",
|
||||
"core"
|
||||
],
|
||||
"author": {
|
||||
"name": "Mario Nebl",
|
||||
"email": "hello@herebecode.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@commitlint/utils": "^20.0.0"
|
||||
},
|
||||
"gitHead": "407be6c96b1a108ee012ed5330b0d80a165952d5"
|
||||
}
|
||||
15
node_modules/@commitlint/load/README.md
generated
vendored
Normal file
15
node_modules/@commitlint/load/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# @commitlint/load
|
||||
|
||||
Load shared commitlint configuration
|
||||
|
||||
## Getting started
|
||||
|
||||
```shell
|
||||
npm install --save-dev @commitlint/load
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Consult [API docs](https://commitlint.js.org/api/load) for comprehensive documentation.
|
||||
|
||||
Documentation generated from [`docs` folder](../../docs/api/format.md).
|
||||
5
node_modules/@commitlint/load/lib/load.d.ts
generated
vendored
Normal file
5
node_modules/@commitlint/load/lib/load.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { resolveFrom, resolveFromSilent, resolveGlobalSilent } from "@commitlint/resolve-extends";
|
||||
import { LoadOptions, QualifiedConfig, UserConfig } from "@commitlint/types";
|
||||
export default function load(seed?: UserConfig, options?: LoadOptions): Promise<QualifiedConfig>;
|
||||
export { resolveFrom, resolveFromSilent, resolveGlobalSilent };
|
||||
//# sourceMappingURL=load.d.ts.map
|
||||
1
node_modules/@commitlint/load/lib/load.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/load.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +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,CAsG1B;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC"}
|
||||
102
node_modules/@commitlint/load/lib/load.js
generated
vendored
Normal file
102
node_modules/@commitlint/load/lib/load.js
generated
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
import path from "node:path";
|
||||
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 { 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";
|
||||
/**
|
||||
* formatter should be kept as is when unable to resolve it from config directory
|
||||
*/
|
||||
const resolveFormatter = (formatter, parent) => {
|
||||
try {
|
||||
return resolveFrom(formatter, parent);
|
||||
}
|
||||
catch (error) {
|
||||
return formatter;
|
||||
}
|
||||
};
|
||||
export default async function load(seed = {}, options = {}) {
|
||||
const cwd = typeof options.cwd === "undefined" ? process.cwd() : options.cwd;
|
||||
const loaded = await loadConfig(cwd, options.file);
|
||||
const baseDirectory = loaded?.filepath ? path.dirname(loaded.filepath) : cwd;
|
||||
const configFilePath = loaded?.filepath;
|
||||
let config = {};
|
||||
if (loaded) {
|
||||
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 = merge({
|
||||
extends: [],
|
||||
plugins: [],
|
||||
rules: {},
|
||||
}, config, seed);
|
||||
// Resolve parserPreset key
|
||||
if (typeof config.parserPreset === "string") {
|
||||
const resolvedParserPreset = resolveFrom(config.parserPreset, configFilePath);
|
||||
config.parserPreset = {
|
||||
name: config.parserPreset,
|
||||
...(await loadParserPreset(resolvedParserPreset)),
|
||||
};
|
||||
}
|
||||
// Resolve extends key
|
||||
const extended = await resolveExtends(config, {
|
||||
prefix: "commitlint-config",
|
||||
cwd: baseDirectory,
|
||||
parserPreset: await config.parserPreset,
|
||||
});
|
||||
if (!extended.formatter || typeof extended.formatter !== "string") {
|
||||
extended.formatter = "@commitlint/format";
|
||||
}
|
||||
let plugins = {};
|
||||
if (Array.isArray(extended.plugins)) {
|
||||
const deduplicatedPlugins = [...new Set(extended.plugins)];
|
||||
for (const plugin of deduplicatedPlugins) {
|
||||
if (typeof plugin === "string") {
|
||||
plugins = await loadPlugin(plugins, plugin, {
|
||||
debug: process.env.DEBUG === "true",
|
||||
});
|
||||
}
|
||||
else {
|
||||
plugins.local = plugin;
|
||||
}
|
||||
}
|
||||
}
|
||||
const rules = (await Promise.all(Object.entries(extended.rules || {}).map((entry) => executeRule(entry)))).reduce((registry, item) => {
|
||||
// type of `item` can be null, but Object.entries always returns key pair
|
||||
const [key, value] = item;
|
||||
registry[key] = value;
|
||||
return registry;
|
||||
}, {});
|
||||
const helpUrl = typeof extended.helpUrl === "string"
|
||||
? extended.helpUrl
|
||||
: typeof config.helpUrl === "string"
|
||||
? config.helpUrl
|
||||
: "https://github.com/conventional-changelog/commitlint/#what-is-commitlint";
|
||||
const prompt = extended.prompt && isPlainObject(extended.prompt) ? extended.prompt : {};
|
||||
return {
|
||||
extends: Array.isArray(extended.extends)
|
||||
? extended.extends
|
||||
: typeof extended.extends === "string"
|
||||
? [extended.extends]
|
||||
: [],
|
||||
// Resolve config-relative formatter module
|
||||
formatter: resolveFormatter(extended.formatter, configFilePath),
|
||||
// Resolve parser-opts from preset
|
||||
parserPreset: await loadParserOpts(extended.parserPreset),
|
||||
ignores: extended.ignores,
|
||||
defaultIgnores: extended.defaultIgnores,
|
||||
plugins: plugins,
|
||||
rules: rules,
|
||||
helpUrl: helpUrl,
|
||||
prompt,
|
||||
};
|
||||
}
|
||||
export { resolveFrom, resolveFromSilent, resolveGlobalSilent };
|
||||
//# sourceMappingURL=load.js.map
|
||||
1
node_modules/@commitlint/load/lib/load.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/load.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"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"}
|
||||
9
node_modules/@commitlint/load/lib/utils/load-config.d.ts
generated
vendored
Normal file
9
node_modules/@commitlint/load/lib/utils/load-config.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export interface LoadConfigResult {
|
||||
config: unknown;
|
||||
filepath: string;
|
||||
isEmpty?: boolean;
|
||||
}
|
||||
export declare function loadConfig(cwd: string, configPath?: string): Promise<LoadConfigResult | null>;
|
||||
export declare const isDynamicAwaitSupported: () => boolean;
|
||||
export declare const isEsmModule: (cwd: string) => boolean;
|
||||
//# sourceMappingURL=load-config.d.ts.map
|
||||
1
node_modules/@commitlint/load/lib/utils/load-config.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/load-config.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAKD,wBAAsB,UAAU,CAC/B,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA6DlC;AAKD,eAAO,MAAM,uBAAuB,eAOnC,CAAC;AAGF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,YAStC,CAAC"}
|
||||
81
node_modules/@commitlint/load/lib/utils/load-config.js
generated
vendored
Normal file
81
node_modules/@commitlint/load/lib/utils/load-config.js
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import { existsSync, readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { cosmiconfig, defaultLoadersSync, defaultLoaders, } from "cosmiconfig";
|
||||
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
||||
const moduleName = "commitlint";
|
||||
const searchStrategy = "global";
|
||||
export async function loadConfig(cwd, configPath) {
|
||||
let tsLoaderInstance;
|
||||
const tsLoader = (...args) => {
|
||||
if (!tsLoaderInstance) {
|
||||
tsLoaderInstance = TypeScriptLoader();
|
||||
}
|
||||
return tsLoaderInstance(...args);
|
||||
};
|
||||
// If dynamic await is supported (Node >= v20.8.0) or directory uses ESM, support
|
||||
// async js/cjs loaders (dynamic import). Otherwise, use synchronous js/cjs loaders.
|
||||
const loaders = isDynamicAwaitSupported() || isEsmModule(cwd)
|
||||
? defaultLoaders
|
||||
: defaultLoadersSync;
|
||||
const explorer = cosmiconfig(moduleName, {
|
||||
searchStrategy,
|
||||
searchPlaces: [
|
||||
// cosmiconfig overrides default searchPlaces if any new search place is added (For e.g. `*.ts` files),
|
||||
// we need to manually merge default searchPlaces from https://github.com/davidtheclark/cosmiconfig#searchplaces
|
||||
"package.json",
|
||||
"package.yaml",
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`.${moduleName}rc.mjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.cjs`,
|
||||
`${moduleName}.config.mjs`,
|
||||
// files supported by TypescriptLoader
|
||||
`.${moduleName}rc.ts`,
|
||||
`.${moduleName}rc.cts`,
|
||||
`.${moduleName}rc.mts`,
|
||||
`${moduleName}.config.ts`,
|
||||
`${moduleName}.config.cts`,
|
||||
`${moduleName}.config.mts`,
|
||||
],
|
||||
loaders: {
|
||||
".ts": tsLoader,
|
||||
".cts": tsLoader,
|
||||
".mts": tsLoader,
|
||||
".cjs": loaders[".cjs"],
|
||||
".js": loaders[".js"],
|
||||
},
|
||||
});
|
||||
const explicitPath = configPath ? path.resolve(cwd, configPath) : undefined;
|
||||
const explore = explicitPath ? explorer.load : explorer.search;
|
||||
const searchPath = explicitPath ? explicitPath : cwd;
|
||||
const local = await explore(searchPath);
|
||||
if (local) {
|
||||
return local;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// See the following issues for more context, contributing to failing Jest tests:
|
||||
// - Issue: https://github.com/nodejs/node/issues/40058
|
||||
// - Resolution: https://github.com/nodejs/node/pull/48510 (Node v20.8.0)
|
||||
export const isDynamicAwaitSupported = () => {
|
||||
const [major, minor] = process.version
|
||||
.replace("v", "")
|
||||
.split(".")
|
||||
.map((val) => parseInt(val));
|
||||
return major >= 20 && minor >= 8;
|
||||
};
|
||||
// Is the given directory set up to use ESM (ECMAScript Modules)?
|
||||
export const isEsmModule = (cwd) => {
|
||||
const packagePath = path.join(cwd, "package.json");
|
||||
if (!existsSync(packagePath)) {
|
||||
return false;
|
||||
}
|
||||
const packageJSON = readFileSync(packagePath, { encoding: "utf-8" });
|
||||
return JSON.parse(packageJSON)?.type === "module";
|
||||
};
|
||||
//# sourceMappingURL=load-config.js.map
|
||||
1
node_modules/@commitlint/load/lib/utils/load-config.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/load-config.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"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"}
|
||||
5
node_modules/@commitlint/load/lib/utils/load-parser-opts.d.ts
generated
vendored
Normal file
5
node_modules/@commitlint/load/lib/utils/load-parser-opts.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { ParserPreset } from "@commitlint/types";
|
||||
type Awaitable<T> = T | PromiseLike<T>;
|
||||
export declare function loadParserOpts(pendingParser: string | Awaitable<ParserPreset> | (() => Awaitable<ParserPreset>) | undefined): Promise<ParserPreset | undefined>;
|
||||
export {};
|
||||
//# sourceMappingURL=load-parser-opts.d.ts.map
|
||||
1
node_modules/@commitlint/load/lib/utils/load-parser-opts.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/load-parser-opts.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +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,CAiEnC"}
|
||||
60
node_modules/@commitlint/load/lib/utils/load-parser-opts.js
generated
vendored
Normal file
60
node_modules/@commitlint/load/lib/utils/load-parser-opts.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
function isObjectLike(obj) {
|
||||
return Boolean(obj) && typeof obj === "object"; // typeof null === 'object'
|
||||
}
|
||||
function isParserOptsFunction(obj) {
|
||||
return typeof obj.parserOpts === "function";
|
||||
}
|
||||
export async function loadParserOpts(pendingParser) {
|
||||
if (typeof pendingParser === "function") {
|
||||
return loadParserOpts(pendingParser());
|
||||
}
|
||||
if (!pendingParser || typeof pendingParser !== "object") {
|
||||
return undefined;
|
||||
}
|
||||
// Await for the module, loaded with require
|
||||
const parser = await pendingParser;
|
||||
// exit early, no opts to resolve
|
||||
if (!parser.parserOpts) {
|
||||
return parser;
|
||||
}
|
||||
// Pull nested parserOpts, might happen if overwritten with a module in main config
|
||||
if (typeof parser.parserOpts === "object") {
|
||||
// Await parser opts if applicable
|
||||
parser.parserOpts = await parser.parserOpts;
|
||||
if (isObjectLike(parser.parserOpts) &&
|
||||
isObjectLike(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;
|
||||
}
|
||||
// Create parser opts from factory
|
||||
if (isParserOptsFunction(parser) &&
|
||||
typeof parser.name === "string" &&
|
||||
parser.name.startsWith("conventional-changelog-")) {
|
||||
return new Promise((resolve) => {
|
||||
const result = parser.parserOpts((_, opts) => {
|
||||
resolve({
|
||||
...parser,
|
||||
parserOpts: opts?.parserOpts,
|
||||
});
|
||||
});
|
||||
// If result has data or a promise, the parser doesn't support factory-init
|
||||
// due to https://github.com/nodejs/promises-debugging/issues/16 it just quits, so let's use this fallback
|
||||
if (result) {
|
||||
Promise.resolve(result).then((opts) => {
|
||||
resolve({
|
||||
...parser,
|
||||
parserOpts: opts?.parserOpts || opts?.parser,
|
||||
});
|
||||
});
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
return parser;
|
||||
}
|
||||
//# sourceMappingURL=load-parser-opts.js.map
|
||||
1
node_modules/@commitlint/load/lib/utils/load-parser-opts.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/load-parser-opts.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"load-parser-opts.js","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":"AAIA,SAAS,YAAY,CAAC,GAAY;IACjC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,2BAA2B;AAC5E,CAAC;AAED,SAAS,oBAAoB,CAC5B,GAAM;IAMN,OAAO,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,aAIY;IAEZ,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;QACzC,OAAO,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,aAAa,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACzD,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,4CAA4C;IAC5C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;IAEnC,iCAAiC;IACjC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IACf,CAAC;IAED,mFAAmF;IACnF,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC3C,kCAAkC;QAClC,MAAM,CAAC,UAAU,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC;QAC5C,IACC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;YAC/B,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,EACzC,CAAC;YACF,kEAAkE;YAClE,sEAAsE;YACtE,iEAAiE;YACjE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,UAGH,CAAC;YAC5C,MAAM,CAAC,UAAU,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC;QAC3C,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,kCAAkC;IAClC,IACC,oBAAoB,CAAC,MAAM,CAAC;QAC5B,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;QAC/B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAChD,CAAC;QACF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAQ,EAAE,IAAI,EAAE,EAAE;gBACnD,OAAO,CAAC;oBACP,GAAG,MAAM;oBACT,UAAU,EAAE,IAAI,EAAE,UAAU;iBAC5B,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,2EAA2E;YAC3E,0GAA0G;YAC1G,IAAI,MAAM,EAAE,CAAC;gBACZ,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBACrC,OAAO,CAAC;wBACP,GAAG,MAAM;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"}
|
||||
7
node_modules/@commitlint/load/lib/utils/load-plugin.d.ts
generated
vendored
Normal file
7
node_modules/@commitlint/load/lib/utils/load-plugin.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { PluginRecords } from "@commitlint/types";
|
||||
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
|
||||
1
node_modules/@commitlint/load/lib/utils/load-plugin.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/load-plugin.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"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"}
|
||||
157
node_modules/@commitlint/load/lib/utils/load-plugin.js
generated
vendored
Normal file
157
node_modules/@commitlint/load/lib/utils/load-plugin.js
generated
vendored
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
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;
|
||||
};
|
||||
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);
|
||||
if (pluginName.match(/\s+/u)) {
|
||||
throw new WhitespacePluginError(pluginName, {
|
||||
pluginName: longName,
|
||||
});
|
||||
}
|
||||
const pluginKey = longName === pluginName ? shortName : pluginName;
|
||||
if (!plugins[pluginKey]) {
|
||||
let plugin;
|
||||
let resolvedPath;
|
||||
// Try to load from npx cache directories using require.resolve
|
||||
const npxResolvedPath = resolveFromNpxCache(longName);
|
||||
if (npxResolvedPath) {
|
||||
try {
|
||||
plugin = await dynamicImport(npxResolvedPath);
|
||||
resolvedPath = npxResolvedPath;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
// This step is costly, so skip if debug is disabled
|
||||
if (debug) {
|
||||
let version = null;
|
||||
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`;
|
||||
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, "../.."),
|
||||
});
|
||||
}
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
//# sourceMappingURL=load-plugin.js.map
|
||||
1
node_modules/@commitlint/load/lib/utils/load-plugin.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/load-plugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
node_modules/@commitlint/load/lib/utils/plugin-errors.d.ts
generated
vendored
Normal file
13
node_modules/@commitlint/load/lib/utils/plugin-errors.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export declare class WhitespacePluginError extends Error {
|
||||
__proto__: ErrorConstructor;
|
||||
messageTemplate: string;
|
||||
messageData: any;
|
||||
constructor(pluginName?: string, data?: any);
|
||||
}
|
||||
export declare class MissingPluginError extends Error {
|
||||
__proto__: ErrorConstructor;
|
||||
messageTemplate: string;
|
||||
messageData: any;
|
||||
constructor(pluginName?: string, errorMessage?: string, data?: any);
|
||||
}
|
||||
//# sourceMappingURL=plugin-errors.d.ts.map
|
||||
1
node_modules/@commitlint/load/lib/utils/plugin-errors.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/plugin-errors.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"plugin-errors.d.ts","sourceRoot":"","sources":["../../src/utils/plugin-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAsB,SAAQ,KAAK;IAC/C,SAAS,mBAAS;IAEX,eAAe,EAAE,MAAM,CAAsB;IAC7C,WAAW,EAAE,GAAG,CAAM;gBAEjB,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ;CAO/C;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC5C,SAAS,mBAAS;IAEX,eAAe,EAAE,MAAM,CAAoB;IAC3C,WAAW,EAAE,GAAG,CAAC;gBAEZ,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,EAAE,IAAI,GAAE,GAAQ;CAO1E"}
|
||||
21
node_modules/@commitlint/load/lib/utils/plugin-errors.js
generated
vendored
Normal file
21
node_modules/@commitlint/load/lib/utils/plugin-errors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export class WhitespacePluginError extends Error {
|
||||
__proto__ = Error;
|
||||
messageTemplate = "whitespace-found";
|
||||
messageData = {};
|
||||
constructor(pluginName, data = {}) {
|
||||
super(`Whitespace found in plugin name '${pluginName}'`);
|
||||
this.messageData = data;
|
||||
Object.setPrototypeOf(this, WhitespacePluginError.prototype);
|
||||
}
|
||||
}
|
||||
export class MissingPluginError extends Error {
|
||||
__proto__ = Error;
|
||||
messageTemplate = "plugin-missing";
|
||||
messageData;
|
||||
constructor(pluginName, errorMessage = "", data = {}) {
|
||||
super(`Failed to load plugin ${pluginName}: ${errorMessage}`);
|
||||
this.messageData = data;
|
||||
Object.setPrototypeOf(this, MissingPluginError.prototype);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=plugin-errors.js.map
|
||||
1
node_modules/@commitlint/load/lib/utils/plugin-errors.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/plugin-errors.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"plugin-errors.js","sourceRoot":"","sources":["../../src/utils/plugin-errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC/C,SAAS,GAAG,KAAK,CAAC;IAEX,eAAe,GAAW,kBAAkB,CAAC;IAC7C,WAAW,GAAQ,EAAE,CAAC;IAE7B,YAAY,UAAmB,EAAE,OAAY,EAAE;QAC9C,KAAK,CAAC,oCAAoC,UAAU,GAAG,CAAC,CAAC;QAEzD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACD;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC5C,SAAS,GAAG,KAAK,CAAC;IAEX,eAAe,GAAW,gBAAgB,CAAC;IAC3C,WAAW,CAAM;IAExB,YAAY,UAAmB,EAAE,eAAuB,EAAE,EAAE,OAAY,EAAE;QACzE,KAAK,CAAC,yBAAyB,UAAU,KAAK,YAAY,EAAE,CAAC,CAAC;QAE9D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;CACD"}
|
||||
20
node_modules/@commitlint/load/lib/utils/plugin-naming.d.ts
generated
vendored
Normal file
20
node_modules/@commitlint/load/lib/utils/plugin-naming.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Brings package name to correct format based on prefix
|
||||
* @param {string} name The name of the package.
|
||||
* @returns {string} Normalized name of the package
|
||||
* @private
|
||||
*/
|
||||
export declare function normalizePackageName(name: string): string;
|
||||
/**
|
||||
* Removes the prefix from a fullname.
|
||||
* @param {string} fullname The term which may have the prefix.
|
||||
* @returns {string} The term without prefix.
|
||||
*/
|
||||
export declare function getShorthandName(fullname: string): string;
|
||||
/**
|
||||
* Gets the scope (namespace) of a term.
|
||||
* @param {string} term The term which may have the namespace.
|
||||
* @returns {string} The namepace of the term if it has one.
|
||||
*/
|
||||
export declare function getNamespaceFromTerm(term: string): string;
|
||||
//# sourceMappingURL=plugin-naming.d.ts.map
|
||||
1
node_modules/@commitlint/load/lib/utils/plugin-naming.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/plugin-naming.d.ts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"plugin-naming.d.ts","sourceRoot":"","sources":["../../src/utils/plugin-naming.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,UA2ChD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,UAiBhD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,UAIhD"}
|
||||
80
node_modules/@commitlint/load/lib/utils/plugin-naming.js
generated
vendored
Normal file
80
node_modules/@commitlint/load/lib/utils/plugin-naming.js
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import path from "node:path";
|
||||
// largely adapted from eslint's plugin system
|
||||
const NAMESPACE_REGEX = /^@.*\//u;
|
||||
// In eslint this is a parameter - we don't need to support the extra options
|
||||
const prefix = "commitlint-plugin";
|
||||
// Replace Windows with posix style paths
|
||||
function convertPathToPosix(filepath) {
|
||||
const normalizedFilepath = path.normalize(filepath);
|
||||
const posixFilepath = normalizedFilepath.replace(/\\/gu, "/");
|
||||
return posixFilepath;
|
||||
}
|
||||
/**
|
||||
* Brings package name to correct format based on prefix
|
||||
* @param {string} name The name of the package.
|
||||
* @returns {string} Normalized name of the package
|
||||
* @private
|
||||
*/
|
||||
export function normalizePackageName(name) {
|
||||
let normalizedName = name;
|
||||
/**
|
||||
* On Windows, name can come in with Windows slashes instead of Unix slashes.
|
||||
* Normalize to Unix first to avoid errors later on.
|
||||
* https://github.com/eslint/eslint/issues/5644
|
||||
*/
|
||||
if (normalizedName.indexOf("\\") > -1) {
|
||||
normalizedName = convertPathToPosix(normalizedName);
|
||||
}
|
||||
if (normalizedName.charAt(0) === "@") {
|
||||
/**
|
||||
* it's a scoped package
|
||||
* package name is the prefix, or just a username
|
||||
*/
|
||||
const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), scopedPackageNameRegex = new RegExp(`^${prefix}(?:-|$)`, "u");
|
||||
if (scopedPackageShortcutRegex.test(normalizedName)) {
|
||||
normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);
|
||||
}
|
||||
else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) {
|
||||
/**
|
||||
* for scoped packages, insert the prefix after the first / unless
|
||||
* the path is already @scope/eslint or @scope/eslint-xxx-yyy
|
||||
*/
|
||||
normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`);
|
||||
}
|
||||
}
|
||||
else if (normalizedName.indexOf(`${prefix}-`) !== 0) {
|
||||
normalizedName = `${prefix}-${normalizedName}`;
|
||||
}
|
||||
return normalizedName;
|
||||
}
|
||||
/**
|
||||
* Removes the prefix from a fullname.
|
||||
* @param {string} fullname The term which may have the prefix.
|
||||
* @returns {string} The term without prefix.
|
||||
*/
|
||||
export function getShorthandName(fullname) {
|
||||
if (fullname[0] === "@") {
|
||||
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
|
||||
if (matchResult) {
|
||||
return matchResult[1];
|
||||
}
|
||||
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
|
||||
if (matchResult) {
|
||||
return `${matchResult[1]}/${matchResult[2]}`;
|
||||
}
|
||||
}
|
||||
else if (fullname.startsWith(`${prefix}-`)) {
|
||||
return fullname.slice(prefix.length + 1);
|
||||
}
|
||||
return fullname;
|
||||
}
|
||||
/**
|
||||
* Gets the scope (namespace) of a term.
|
||||
* @param {string} term The term which may have the namespace.
|
||||
* @returns {string} The namepace of the term if it has one.
|
||||
*/
|
||||
export function getNamespaceFromTerm(term) {
|
||||
const match = NAMESPACE_REGEX.exec(term);
|
||||
return match ? match[0] : "";
|
||||
}
|
||||
//# sourceMappingURL=plugin-naming.js.map
|
||||
1
node_modules/@commitlint/load/lib/utils/plugin-naming.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/load/lib/utils/plugin-naming.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"plugin-naming.js","sourceRoot":"","sources":["../../src/utils/plugin-naming.ts"],"names":[],"mappings":"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"}
|
||||
21
node_modules/@commitlint/load/license.md
generated
vendored
Normal file
21
node_modules/@commitlint/load/license.md
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 - present Mario Nebl
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
16
node_modules/@commitlint/load/node_modules/.bin/js-yaml
generated
vendored
Normal file
16
node_modules/@commitlint/load/node_modules/.bin/js-yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||
fi
|
||||
17
node_modules/@commitlint/load/node_modules/.bin/js-yaml.cmd
generated
vendored
Normal file
17
node_modules/@commitlint/load/node_modules/.bin/js-yaml.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\js-yaml\bin\js-yaml.js" %*
|
||||
28
node_modules/@commitlint/load/node_modules/.bin/js-yaml.ps1
generated
vendored
Normal file
28
node_modules/@commitlint/load/node_modules/.bin/js-yaml.ps1
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
16
node_modules/@commitlint/load/node_modules/.bin/tsc
generated
vendored
Normal file
16
node_modules/@commitlint/load/node_modules/.bin/tsc
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
||||
else
|
||||
exec node "$basedir/../typescript/bin/tsc" "$@"
|
||||
fi
|
||||
17
node_modules/@commitlint/load/node_modules/.bin/tsc.cmd
generated
vendored
Normal file
17
node_modules/@commitlint/load/node_modules/.bin/tsc.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsc" %*
|
||||
28
node_modules/@commitlint/load/node_modules/.bin/tsc.ps1
generated
vendored
Normal file
28
node_modules/@commitlint/load/node_modules/.bin/tsc.ps1
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../typescript/bin/tsc" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../typescript/bin/tsc" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
16
node_modules/@commitlint/load/node_modules/.bin/tsserver
generated
vendored
Normal file
16
node_modules/@commitlint/load/node_modules/.bin/tsserver
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
||||
else
|
||||
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
||||
fi
|
||||
17
node_modules/@commitlint/load/node_modules/.bin/tsserver.cmd
generated
vendored
Normal file
17
node_modules/@commitlint/load/node_modules/.bin/tsserver.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsserver" %*
|
||||
28
node_modules/@commitlint/load/node_modules/.bin/tsserver.ps1
generated
vendored
Normal file
28
node_modules/@commitlint/load/node_modules/.bin/tsserver.ps1
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
21
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/LICENCE
generated
vendored
Normal file
21
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/LICENCE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 Alex Miller <codex.nz@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
82
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/README.md
generated
vendored
Normal file
82
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# cosmiconfig-typescript-loader
|
||||
|
||||
> ⚙️🚀 TypeScript config file support for cosmiconfig
|
||||
|
||||
[](https://github.com/Codex-/cosmiconfig-typescript-loader/actions/workflows/build.yml)
|
||||
[](https://codecov.io/gh/Codex-/cosmiconfig-typescript-loader)
|
||||
[](https://www.npmjs.com/package/cosmiconfig-typescript-loader)
|
||||
|
||||
## Usage
|
||||
|
||||
Simply add `TypeScriptLoader` to the list of loaders for the `.ts` file type, and `await` loading:
|
||||
|
||||
```ts
|
||||
import { cosmiconfig } from "cosmiconfig";
|
||||
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
||||
|
||||
const moduleName = "module";
|
||||
const explorer = cosmiconfig("test", {
|
||||
searchPlaces: [
|
||||
"package.json",
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.ts`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.ts`,
|
||||
`${moduleName}.config.cjs`,
|
||||
],
|
||||
loaders: {
|
||||
".ts": TypeScriptLoader(),
|
||||
},
|
||||
});
|
||||
|
||||
const cfg = await explorer.load("./");
|
||||
```
|
||||
|
||||
Or more simply if you only support loading of a TypeScript based configuration file:
|
||||
|
||||
```ts
|
||||
import { cosmiconfig } from "cosmiconfig";
|
||||
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
||||
|
||||
const moduleName = "module";
|
||||
const explorer = cosmiconfig("test", {
|
||||
loaders: {
|
||||
".ts": TypeScriptLoader(),
|
||||
},
|
||||
});
|
||||
|
||||
const cfg = await explorer.load("./amazing.config.ts");
|
||||
```
|
||||
|
||||
### Synchronously loading
|
||||
|
||||
With the release of Jiti 2, the synchronous loader has now been deprecated. It can still be used by using the `TypeScriptLoaderSync` export:
|
||||
|
||||
```ts
|
||||
import { cosmiconfig } from "cosmiconfig";
|
||||
import { TypeScriptLoaderSync } from "cosmiconfig-typescript-loader";
|
||||
|
||||
const moduleName = "module";
|
||||
const explorer = cosmiconfig("test", {
|
||||
loaders: {
|
||||
".ts": TypeScriptLoaderSync(),
|
||||
},
|
||||
});
|
||||
|
||||
const cfg = explorer.load("./amazing.config.ts");
|
||||
```
|
||||
|
||||
## `@endemolshinegroup/cosmiconfig-typescript-loader`
|
||||
|
||||
This package serves as a drop in replacement for `@endemolshinegroup/cosmiconfig-typescript-loader`. At the time of publishing this, `endemolshinegroup` is not maintaining the original package. I can only assume this is to do with the fact that Endemol Shine Group [was purchased and absorbed by another business](https://en.wikipedia.org/wiki/Endemol_Shine_Group#Sale_to_Banijay). This discontinuation of development efforts towards the original package left any open issues and pull requests unresolved.
|
||||
|
||||
This new package resolves the following original issues:
|
||||
|
||||
- [`#134`](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/134): "Doesn't work with Cosmiconfig sync API"
|
||||
- [`#147`](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/147): "doesn't provide typescript, requested by ts-node"
|
||||
- [`#155`](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/155): "Misleading TypeScriptCompileError when user's tsconfig.json "module" is set to "es2015""
|
||||
32
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/cjs/index.cjs
generated
vendored
Normal file
32
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/cjs/index.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// lib/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
TypeScriptLoader: () => import_loader.TypeScriptLoader,
|
||||
TypeScriptLoaderSync: () => import_loader.TypeScriptLoaderSync
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
var import_loader = require("./loader.cjs");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TypeScriptLoader,
|
||||
TypeScriptLoaderSync
|
||||
});
|
||||
61
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/cjs/loader.cjs
generated
vendored
Normal file
61
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/cjs/loader.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// lib/loader.ts
|
||||
var loader_exports = {};
|
||||
__export(loader_exports, {
|
||||
TypeScriptLoader: () => TypeScriptLoader,
|
||||
TypeScriptLoaderSync: () => TypeScriptLoaderSync
|
||||
});
|
||||
module.exports = __toCommonJS(loader_exports);
|
||||
var import_jiti = require("jiti");
|
||||
var import_typescript_compile_error = require("./typescript-compile-error.cjs");
|
||||
function TypeScriptLoader(options) {
|
||||
const loader = (0, import_jiti.createJiti)("", { interopDefault: true, ...options });
|
||||
return async (path, _content) => {
|
||||
try {
|
||||
const result = await loader.import(path);
|
||||
return result.default || result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw import_typescript_compile_error.TypeScriptCompileError.fromError(error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
function TypeScriptLoaderSync(options) {
|
||||
const loader = (0, import_jiti.createJiti)("", { interopDefault: true, ...options });
|
||||
return (path, _content) => {
|
||||
try {
|
||||
const result = loader(path);
|
||||
return result.default || result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw import_typescript_compile_error.TypeScriptCompileError.fromError(error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TypeScriptLoader,
|
||||
TypeScriptLoaderSync
|
||||
});
|
||||
43
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/cjs/typescript-compile-error.cjs
generated
vendored
Normal file
43
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/cjs/typescript-compile-error.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// lib/typescript-compile-error.ts
|
||||
var typescript_compile_error_exports = {};
|
||||
__export(typescript_compile_error_exports, {
|
||||
TypeScriptCompileError: () => TypeScriptCompileError
|
||||
});
|
||||
module.exports = __toCommonJS(typescript_compile_error_exports);
|
||||
var TypeScriptCompileError = class _TypeScriptCompileError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
static fromError(error) {
|
||||
const message = `TypeScriptLoader failed to compile TypeScript:
|
||||
${error.message}`;
|
||||
const newError = new _TypeScriptCompileError(message);
|
||||
newError.stack = error.stack;
|
||||
return newError;
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TypeScriptCompileError
|
||||
});
|
||||
9
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/esm/index.mjs
generated
vendored
Normal file
9
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/esm/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// lib/index.ts
|
||||
import {
|
||||
TypeScriptLoader,
|
||||
TypeScriptLoaderSync
|
||||
} from "./loader.mjs";
|
||||
export {
|
||||
TypeScriptLoader,
|
||||
TypeScriptLoaderSync
|
||||
};
|
||||
35
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/esm/loader.mjs
generated
vendored
Normal file
35
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/esm/loader.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// lib/loader.ts
|
||||
import { createJiti } from "jiti";
|
||||
import { TypeScriptCompileError } from "./typescript-compile-error.mjs";
|
||||
function TypeScriptLoader(options) {
|
||||
const loader = createJiti("", { interopDefault: true, ...options });
|
||||
return async (path, _content) => {
|
||||
try {
|
||||
const result = await loader.import(path);
|
||||
return result.default || result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw TypeScriptCompileError.fromError(error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
function TypeScriptLoaderSync(options) {
|
||||
const loader = createJiti("", { interopDefault: true, ...options });
|
||||
return (path, _content) => {
|
||||
try {
|
||||
const result = loader(path);
|
||||
return result.default || result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw TypeScriptCompileError.fromError(error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
TypeScriptLoader,
|
||||
TypeScriptLoaderSync
|
||||
};
|
||||
18
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/esm/typescript-compile-error.mjs
generated
vendored
Normal file
18
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/esm/typescript-compile-error.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// lib/typescript-compile-error.ts
|
||||
var TypeScriptCompileError = class _TypeScriptCompileError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
static fromError(error) {
|
||||
const message = `TypeScriptLoader failed to compile TypeScript:
|
||||
${error.message}`;
|
||||
const newError = new _TypeScriptCompileError(message);
|
||||
newError.stack = error.stack;
|
||||
return newError;
|
||||
}
|
||||
};
|
||||
export {
|
||||
TypeScriptCompileError
|
||||
};
|
||||
2
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/types/index.d.ts
generated
vendored
Normal file
2
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { TypeScriptLoader, TypeScriptLoaderSync, } from "./loader.js";
|
||||
export type { TypeScriptCompileError } from "./typescript-compile-error.js";
|
||||
10
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/types/loader.d.ts
generated
vendored
Normal file
10
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/types/loader.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import type { LoaderResult, LoaderSync } from "cosmiconfig";
|
||||
import { createJiti } from "jiti";
|
||||
type JitiOptions = Parameters<typeof createJiti>[1];
|
||||
type LoaderAsync = (filepath: string, content: string) => Promise<LoaderResult>;
|
||||
export declare function TypeScriptLoader(options?: JitiOptions): LoaderAsync;
|
||||
/**
|
||||
* @deprecated use `TypeScriptLoader`
|
||||
*/
|
||||
export declare function TypeScriptLoaderSync(options?: JitiOptions): LoaderSync;
|
||||
export {};
|
||||
4
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/types/typescript-compile-error.d.ts
generated
vendored
Normal file
4
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/dist/types/typescript-compile-error.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export declare class TypeScriptCompileError extends Error {
|
||||
constructor(message: string);
|
||||
static fromError(error: Error): TypeScriptCompileError;
|
||||
}
|
||||
81
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/package.json
generated
vendored
Normal file
81
node_modules/@commitlint/load/node_modules/cosmiconfig-typescript-loader/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"name": "cosmiconfig-typescript-loader",
|
||||
"version": "6.3.0",
|
||||
"description": "TypeScript loader for cosmiconfig",
|
||||
"author": "Alex Miller <codex.nz@gmail.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/Codex-/cosmiconfig-typescript-loader#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Codex-/cosmiconfig-typescript-loader.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Codex-/cosmiconfig-typescript-loader/issues"
|
||||
},
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"main": "dist/cjs/index.cjs",
|
||||
"module": "dist/esm/index.mjs",
|
||||
"types": "dist/types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"default": "./dist/esm/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm build:types && pnpm build:sources",
|
||||
"build:sources": "node ./scripts/esbuild.config.mjs",
|
||||
"build:types": "tsc -p tsconfig.build.json",
|
||||
"check:types": "tsc -p tsconfig.json",
|
||||
"format": "pnpm format:check --write",
|
||||
"format:check": "prettier --check \"{**/*,*}.{js,cjs,mjs,ts}\"",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
"release": "release-it",
|
||||
"test": "jest",
|
||||
"test:coverage": "jest --coverage"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=v18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "*",
|
||||
"cosmiconfig": ">=9",
|
||||
"typescript": ">=5"
|
||||
},
|
||||
"dependencies": {
|
||||
"jiti": "2.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "10.0.1",
|
||||
"@swc/core": "1.15.24",
|
||||
"@swc/jest": "0.2.39",
|
||||
"@types/jest": "30.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.58.0",
|
||||
"auto-changelog": "2.5.0",
|
||||
"chalk": "5.6.2",
|
||||
"cosmiconfig": "9.0.1",
|
||||
"esbuild": "0.28.0",
|
||||
"eslint": "10.2.0",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"eslint-import-resolver-typescript": "4.4.4",
|
||||
"eslint-plugin-import-x": "4.16.2",
|
||||
"jest": "30.3.0",
|
||||
"prettier": "3.8.1",
|
||||
"release-it": "20.0.0-1",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "8.58.0"
|
||||
},
|
||||
"keywords": [
|
||||
"cosmiconfig",
|
||||
"typescript"
|
||||
]
|
||||
}
|
||||
22
node_modules/@commitlint/load/node_modules/cosmiconfig/LICENSE
generated
vendored
Normal file
22
node_modules/@commitlint/load/node_modules/cosmiconfig/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 David Clark
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
782
node_modules/@commitlint/load/node_modules/cosmiconfig/README.md
generated
vendored
Normal file
782
node_modules/@commitlint/load/node_modules/cosmiconfig/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,782 @@
|
|||
# cosmiconfig
|
||||
|
||||
[](https://codecov.io/gh/cosmiconfig/cosmiconfig)
|
||||
|
||||
Cosmiconfig searches for and loads configuration for your program.
|
||||
|
||||
It features smart defaults based on conventional expectations in the JavaScript ecosystem.
|
||||
But it's also flexible enough to search wherever you'd like to search, and load whatever you'd like to load.
|
||||
|
||||
By default, Cosmiconfig will check the current directory for the following:
|
||||
|
||||
- a `package.json` property
|
||||
- a JSON or YAML, extensionless "rc file"
|
||||
- an "rc file" with the extensions `.json`, `.yaml`, `.yml`, `.js`, `.ts`, `.mjs`, or `.cjs`
|
||||
- any of the above two inside a `.config` subdirectory
|
||||
- a `.config.js`, `.config.ts`, `.config.mjs`, or `.config.cjs` file
|
||||
|
||||
For example, if your module's name is "myapp", cosmiconfig will search up the directory tree for configuration in the following places:
|
||||
|
||||
- a `myapp` property in `package.json`
|
||||
- a `.myapprc` file in JSON or YAML format
|
||||
- a `.myapprc.json`, `.myapprc.yaml`, `.myapprc.yml`, `.myapprc.js`, `.myapprc.ts`, `.myapprc.mjs`, or `.myapprc.cjs` file
|
||||
- a `myapprc`, `myapprc.json`, `myapprc.yaml`, `myapprc.yml`, `myapprc.js`, `myapprc.ts`, `myapprc.mjs`, or `myapprc.cjs` file inside a `.config` subdirectory
|
||||
- a `myapp.config.js`, `myapp.config.ts`, `myapp.config.mjs`, or `myapp.config.cjs` file
|
||||
|
||||
Optionally, you can tell it to search up the directory tree using [search strategies],
|
||||
checking each of these places in each directory, until it finds some acceptable configuration (or hits the home directory).
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage for tooling developers](#usage-for-tooling-developers)
|
||||
- [Result](#result)
|
||||
- [Asynchronous API](#asynchronous-api)
|
||||
- [cosmiconfig()](#cosmiconfig-1)
|
||||
- [explorer.search()](#explorersearch)
|
||||
- [explorer.load()](#explorerload)
|
||||
- [explorer.clearLoadCache()](#explorerclearloadcache)
|
||||
- [explorer.clearSearchCache()](#explorerclearsearchcache)
|
||||
- [explorer.clearCaches()](#explorerclearcaches)
|
||||
- [Synchronous API](#synchronous-api)
|
||||
- [cosmiconfigSync()](#cosmiconfigsync)
|
||||
- [explorerSync.search()](#explorersyncsearch)
|
||||
- [explorerSync.load()](#explorersyncload)
|
||||
- [explorerSync.clearLoadCache()](#explorersyncclearloadcache)
|
||||
- [explorerSync.clearSearchCache()](#explorersyncclearsearchcache)
|
||||
- [explorerSync.clearCaches()](#explorersyncclearcaches)
|
||||
- [cosmiconfigOptions](#cosmiconfigoptions)
|
||||
- [searchStrategy](#searchstrategy)
|
||||
- [searchPlaces](#searchplaces)
|
||||
- [loaders](#loaders)
|
||||
- [packageProp](#packageprop)
|
||||
- [stopDir](#stopdir)
|
||||
- [cache](#cache)
|
||||
- [transform](#transform)
|
||||
- [ignoreEmptySearchPlaces](#ignoreemptysearchplaces)
|
||||
- [Loading JS modules](#loading-js-modules)
|
||||
- [Caching](#caching)
|
||||
- [Differences from rc](#differences-from-rc)
|
||||
- [Usage for end users](#usage-for-end-users)
|
||||
- [Imports](#imports)
|
||||
- [Contributing & Development](#contributing--development)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install cosmiconfig
|
||||
```
|
||||
|
||||
Tested in Node 14+.
|
||||
|
||||
## Usage for tooling developers
|
||||
|
||||
*If you are an end user (i.e. a user of a tool that uses cosmiconfig, like `prettier` or `stylelint`),
|
||||
you can skip down to [the end user section](#usage-for-end-users).*
|
||||
|
||||
Create a Cosmiconfig explorer, then either `search` for or directly `load` a configuration file.
|
||||
|
||||
```js
|
||||
const { cosmiconfig, cosmiconfigSync } = require('cosmiconfig');
|
||||
// ...
|
||||
const explorer = cosmiconfig(moduleName);
|
||||
|
||||
// Search for a configuration by walking up directories.
|
||||
// See documentation for search, below.
|
||||
explorer.search()
|
||||
.then((result) => {
|
||||
// result.config is the parsed configuration object.
|
||||
// result.filepath is the path to the config file that was found.
|
||||
// result.isEmpty is true if there was nothing to parse in the config file.
|
||||
})
|
||||
.catch((error) => {
|
||||
// Do something constructive.
|
||||
});
|
||||
|
||||
// Load a configuration directly when you know where it should be.
|
||||
// The result object is the same as for search.
|
||||
// See documentation for load, below.
|
||||
explorer.load(pathToConfig).then(/* ... */);
|
||||
|
||||
// You can also search and load synchronously.
|
||||
const explorerSync = cosmiconfigSync(moduleName);
|
||||
|
||||
const searchedFor = explorerSync.search();
|
||||
const loaded = explorerSync.load(pathToConfig);
|
||||
```
|
||||
|
||||
## Result
|
||||
|
||||
The result object you get from `search` or `load` has the following properties:
|
||||
|
||||
- **config:** The parsed configuration object. `undefined` if the file is empty.
|
||||
- **filepath:** The path to the configuration file that was found.
|
||||
- **isEmpty:** `true` if the configuration file is empty. This property will not be present if the configuration file is not empty.
|
||||
|
||||
## Asynchronous API
|
||||
|
||||
### cosmiconfig()
|
||||
|
||||
```js
|
||||
const { cosmiconfig } = require('cosmiconfig');
|
||||
const explorer = cosmiconfig(moduleName, /* optional */ cosmiconfigOptions)
|
||||
```
|
||||
|
||||
Creates a cosmiconfig instance ("explorer") configured according to the arguments, and initializes its caches.
|
||||
|
||||
#### moduleName
|
||||
|
||||
Type: `string`. **Required.**
|
||||
|
||||
Your module name. This is used to create the default [`searchPlaces`] and [`packageProp`].
|
||||
|
||||
If your [`searchPlaces`] value will include files, as it does by default (e.g. `${moduleName}rc`), your `moduleName` must consist of characters allowed in filenames. That means you should not copy scoped package names, such as `@my-org/my-package`, directly into `moduleName`.
|
||||
|
||||
**[`cosmiconfigOptions`] are documented below.**
|
||||
You may not need them, and should first read about the functions you'll use.
|
||||
|
||||
### explorer.search()
|
||||
|
||||
```js
|
||||
explorer.search([searchFrom]).then(result => { /* ... */ })
|
||||
```
|
||||
|
||||
Searches for a configuration file. Returns a Promise that resolves with a [result] or with `null`, if no configuration file is found.
|
||||
|
||||
You can do the same thing synchronously with [`explorerSync.search()`].
|
||||
|
||||
Let's say your module name is `goldengrahams` so you initialized with `const explorer = cosmiconfig('goldengrahams');`.
|
||||
Here's how your default [`search()`] will work:
|
||||
|
||||
- Starting from `process.cwd()` (or some other directory defined by the `searchFrom` argument to [`search()`]), look for configuration objects in the following places:
|
||||
1. A `goldengrahams` property in a `package.json` file.
|
||||
2. A `.goldengrahamsrc` file with JSON or YAML syntax.
|
||||
3. A `.goldengrahamsrc.json`, `.goldengrahamsrc.yaml`, `.goldengrahamsrc.yml`, `.goldengrahamsrc.js`, `.goldengrahamsrc.ts`, `.goldengrahamsrc.mjs`, or `.goldengrahamsrc.cjs` file. (To learn more about how JS files are loaded, see ["Loading JS modules"].)
|
||||
4. A `goldengrahamsrc`, `goldengrahamsrc.json`, `goldengrahamsrc.yaml`, `goldengrahamsrc.yml`, `goldengrahamsrc.js`, `goldengrahamsrc.ts`, `goldengrahamsrc.mjs`, or `goldengrahamsrc.cjs` file in the `.config` subdirectory.
|
||||
5. A `goldengrahams.config.js`, `goldengrahams.config.ts`, `goldengrahams.config.mjs`, or `goldengrahams.config.cjs` file. (To learn more about how JS files are loaded, see ["Loading JS modules"].)
|
||||
- If none of those searches reveal a configuration object, continue depending on the current search strategy:
|
||||
- If it's `none` (which is the default if you don't specify a [`stopDir`] option), stop here and return/resolve with `null`.
|
||||
- If it's `global` (which is the default if you specify a [`stopDir`] option), move up one directory level and try again,
|
||||
recursing until arriving at the configured [`stopDir`] option, which defaults to the user's home directory.
|
||||
- After arriving at the [`stopDir`], the global configuration directory (as defined by [`env-paths`] without prefix) is also checked,
|
||||
looking at the files `config`, `config.json`, `config.yaml`, `config.yml`, `config.js`, `config.ts`, `config.cjs`, and `config.mjs`
|
||||
in the directory `~/.config/goldengrahams/` (on Linux; see [`env-paths`] documentation for other OSs).
|
||||
- If it's `project`, check whether a `package.json` file is present in the current directory, and if not,
|
||||
move up one directory level and try again, recursing until there is one.
|
||||
- If at any point a parsable configuration is found, the [`search()`] Promise resolves with its [result] \(or, with [`explorerSync.search()`], the [result] is returned).
|
||||
- If no configuration object is found, the [`search()`] Promise resolves with `null` (or, with [`explorerSync.search()`], `null` is returned).
|
||||
- If a configuration object is found *but is malformed* (causing a parsing error), the [`search()`] Promise rejects with that error (so you should `.catch()` it). (Or, with [`explorerSync.search()`], the error is thrown.)
|
||||
|
||||
**If you know exactly where your configuration file should be, you can use [`load()`], instead.**
|
||||
|
||||
**The search process is highly customizable.**
|
||||
Use the cosmiconfig options [`searchPlaces`] and [`loaders`] to precisely define where you want to look for configurations and how you want to load them.
|
||||
|
||||
#### searchFrom
|
||||
|
||||
Type: `string`.
|
||||
Default: `process.cwd()`.
|
||||
|
||||
A filename.
|
||||
[`search()`] will start its search here.
|
||||
|
||||
If the value is a directory, that's where the search starts.
|
||||
If it's a file, the search starts in that file's directory.
|
||||
|
||||
### explorer.load()
|
||||
|
||||
```js
|
||||
explorer.load(loadPath).then(result => { /* ... */ })
|
||||
```
|
||||
|
||||
Loads a configuration file. Returns a Promise that resolves with a [result] or rejects with an error (if the file does not exist or cannot be loaded).
|
||||
|
||||
Use `load` if you already know where the configuration file is and you just need to load it.
|
||||
|
||||
```js
|
||||
explorer.load('load/this/file.json'); // Tries to load load/this/file.json.
|
||||
```
|
||||
|
||||
If you load a `package.json` file, the result will be derived from whatever property is specified as your [`packageProp`].
|
||||
`package.yaml` will work as well if you specify these file names in your [`searchPlaces`].
|
||||
|
||||
You can do the same thing synchronously with [`explorerSync.load()`].
|
||||
|
||||
### explorer.clearLoadCache()
|
||||
|
||||
Clears the cache used in [`load()`].
|
||||
|
||||
### explorer.clearSearchCache()
|
||||
|
||||
Clears the cache used in [`search()`].
|
||||
|
||||
### explorer.clearCaches()
|
||||
|
||||
Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
|
||||
|
||||
## Synchronous API
|
||||
|
||||
### cosmiconfigSync()
|
||||
|
||||
```js
|
||||
const { cosmiconfigSync } = require('cosmiconfig');
|
||||
const explorerSync = cosmiconfigSync(moduleName, /* optional */ cosmiconfigOptions)
|
||||
```
|
||||
|
||||
Creates a *synchronous* cosmiconfig instance ("explorerSync") configured according to the arguments, and initializes its caches.
|
||||
|
||||
See [`cosmiconfig()`](#cosmiconfig-1).
|
||||
|
||||
### explorerSync.search()
|
||||
|
||||
```js
|
||||
const result = explorerSync.search([searchFrom]);
|
||||
```
|
||||
|
||||
Synchronous version of [`explorer.search()`].
|
||||
|
||||
Returns a [result] or `null`.
|
||||
|
||||
### explorerSync.load()
|
||||
|
||||
```js
|
||||
const result = explorerSync.load(loadPath);
|
||||
```
|
||||
|
||||
Synchronous version of [`explorer.load()`].
|
||||
|
||||
Returns a [result].
|
||||
|
||||
### explorerSync.clearLoadCache()
|
||||
|
||||
Clears the cache used in [`load()`].
|
||||
|
||||
### explorerSync.clearSearchCache()
|
||||
|
||||
Clears the cache used in [`search()`].
|
||||
|
||||
### explorerSync.clearCaches()
|
||||
|
||||
Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
|
||||
|
||||
## cosmiconfigOptions
|
||||
|
||||
Type: `Object`.
|
||||
|
||||
Possible options are documented below.
|
||||
|
||||
### searchStrategy
|
||||
|
||||
Type: `string`
|
||||
Default: `global` if [`stopDir`] is specified, `none` otherwise.
|
||||
|
||||
The strategy that should be used to determine which directories to check for configuration files.
|
||||
|
||||
- `none`: Only checks in the current working directory.
|
||||
- `project`: Starts in the current working directory, traversing upwards until a `package.{json,yaml}` file is found.
|
||||
- `global`: Starts in the current working directory, traversing upwards until the configured [`stopDir`]
|
||||
(or the current user's home directory if none is given). Then, if no configuration is found, also look in the
|
||||
operating system's default configuration directory (according to [`env-paths`] without prefix),
|
||||
where a different set of file names is checked:
|
||||
|
||||
```js
|
||||
[
|
||||
`config`,
|
||||
`config.json`,
|
||||
`config.yaml`,
|
||||
`config.yml`,
|
||||
`config.js`,
|
||||
`config.ts`,
|
||||
`config.cjs`,
|
||||
`config.mjs`
|
||||
]
|
||||
```
|
||||
|
||||
### searchPlaces
|
||||
|
||||
Type: `Array<string>`.
|
||||
Default: See below.
|
||||
|
||||
An array of places that [`search()`] will check in each directory as it moves up the directory tree.
|
||||
Each place is relative to the directory being searched, and the places are checked in the specified order.
|
||||
|
||||
**Default `searchPlaces`:**
|
||||
|
||||
For the [asynchronous API](#asynchronous-api), these are the default `searchPlaces`:
|
||||
|
||||
```js
|
||||
[
|
||||
'package.json',
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.ts`,
|
||||
`.${moduleName}rc.mjs`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`.config/${moduleName}rc`,
|
||||
`.config/${moduleName}rc.json`,
|
||||
`.config/${moduleName}rc.yaml`,
|
||||
`.config/${moduleName}rc.yml`,
|
||||
`.config/${moduleName}rc.js`,
|
||||
`.config/${moduleName}rc.ts`,
|
||||
`.config/${moduleName}rc.mjs`,
|
||||
`.config/${moduleName}rc.cjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.ts`,
|
||||
`${moduleName}.config.mjs`,
|
||||
`${moduleName}.config.cjs`,
|
||||
];
|
||||
```
|
||||
|
||||
For the [synchronous API](#synchronous-api), the only difference is that `.mjs` files are not included. See ["Loading JS modules"] for more information.
|
||||
|
||||
Create your own array to search more, fewer, or altogether different places.
|
||||
|
||||
Every item in `searchPlaces` needs to have a loader in [`loaders`] that corresponds to its extension.
|
||||
(Common extensions are covered by default loaders.)
|
||||
Read more about [`loaders`] below.
|
||||
|
||||
`package.json` is a special value: When it is included in `searchPlaces`, Cosmiconfig will always parse it as JSON and load a property within it, not the whole file.
|
||||
That property is defined with the [`packageProp`] option, and defaults to your module name.
|
||||
|
||||
`package.yaml` (used by pnpm) works the same way.
|
||||
|
||||
Examples, with a module named `porgy`:
|
||||
|
||||
```js
|
||||
// Disallow extensions on rc files:
|
||||
['package.json', '.porgyrc', 'porgy.config.js']
|
||||
```
|
||||
|
||||
```js
|
||||
// Limit the options dramatically:
|
||||
['package.json', '.porgyrc']
|
||||
```
|
||||
|
||||
```js
|
||||
// Maybe you want to look for a wide variety of JS flavors:
|
||||
[
|
||||
'porgy.config.js',
|
||||
'porgy.config.mjs',
|
||||
'porgy.config.ts',
|
||||
'porgy.config.coffee'
|
||||
]
|
||||
// ^^ You will need to designate a custom loader to tell
|
||||
// Cosmiconfig how to handle `.coffee` files.
|
||||
```
|
||||
|
||||
```js
|
||||
// Look within a .config/ subdirectory of every searched directory:
|
||||
[
|
||||
'package.json',
|
||||
'.porgyrc',
|
||||
'.config/.porgyrc',
|
||||
'.porgyrc.json',
|
||||
'.config/.porgyrc.json'
|
||||
]
|
||||
```
|
||||
|
||||
### loaders
|
||||
|
||||
Type: `Object`.
|
||||
Default: See below.
|
||||
|
||||
An object that maps extensions to the loader functions responsible for loading and parsing files with those extensions.
|
||||
|
||||
Cosmiconfig exposes its default loaders on the named export `defaultLoaders` and `defaultLoadersSync`.
|
||||
|
||||
**Default `loaders`:**
|
||||
|
||||
```js
|
||||
const { defaultLoaders, defaultLoadersSync } = require('cosmiconfig');
|
||||
|
||||
console.log(Object.entries(defaultLoaders));
|
||||
// [
|
||||
// [ '.mjs', [Function: loadJs] ],
|
||||
// [ '.cjs', [Function: loadJs] ],
|
||||
// [ '.js', [Function: loadJs] ],
|
||||
// [ '.ts', [Function: loadTs] ],
|
||||
// [ '.json', [Function: loadJson] ],
|
||||
// [ '.yaml', [Function: loadYaml] ],
|
||||
// [ '.yml', [Function: loadYaml] ],
|
||||
// [ 'noExt', [Function: loadYaml] ]
|
||||
// ]
|
||||
|
||||
console.log(Object.entries(defaultLoadersSync));
|
||||
// [
|
||||
// [ '.cjs', [Function: loadJsSync] ],
|
||||
// [ '.js', [Function: loadJsSync] ],
|
||||
// [ '.ts', [Function: loadTsSync] ],
|
||||
// [ '.json', [Function: loadJson] ],
|
||||
// [ '.yaml', [Function: loadYaml] ],
|
||||
// [ '.yml', [Function: loadYaml] ],
|
||||
// [ 'noExt', [Function: loadYaml] ]
|
||||
// ]
|
||||
```
|
||||
|
||||
(YAML is a superset of JSON; which means YAML parsers can parse JSON; which is how extensionless files can be either YAML *or* JSON with only one parser.)
|
||||
|
||||
**If you provide a `loaders` object, your object will be *merged* with the defaults.**
|
||||
So you can override one or two without having to override them all.
|
||||
|
||||
**Keys in `loaders`** are extensions (starting with a period), or `noExt` to specify the loader for files *without* extensions, like `.myapprc`.
|
||||
|
||||
**Values in `loaders`** are a loader function (described below) whose values are loader functions.
|
||||
|
||||
**The most common use case for custom loaders value is to load extensionless `rc` files as strict JSON**, instead of JSON *or* YAML (the default).
|
||||
To accomplish that, provide the following `loaders` value:
|
||||
|
||||
```js
|
||||
{
|
||||
noExt: defaultLoaders['.json'];
|
||||
}
|
||||
```
|
||||
|
||||
If you want to load files that are not handled by the loader functions Cosmiconfig exposes, you can write a custom loader function or use one from NPM if it exists.
|
||||
|
||||
**Use cases for custom loader function:**
|
||||
|
||||
- Allow configuration syntaxes that aren't handled by Cosmiconfig's defaults, like JSON5, INI, or XML.
|
||||
- Parse JS files with Babel before deriving the configuration.
|
||||
|
||||
**Custom loader functions** have the following signature:
|
||||
|
||||
```ts
|
||||
// Sync
|
||||
type SyncLoader = (filepath: string, content: string) => Object | null
|
||||
|
||||
// Async
|
||||
type AsyncLoader = (filepath: string, content: string) => Object | null | Promise<Object | null>
|
||||
```
|
||||
|
||||
Cosmiconfig reads the file when it checks whether the file exists, so it will provide you with both the file's path and its content.
|
||||
Do whatever you need to, and return either a configuration object or `null` (or, for async-only loaders, a Promise that resolves with one of those).
|
||||
`null` indicates that no real configuration was found and the search should continue.
|
||||
|
||||
A few things to note:
|
||||
|
||||
- If you use a custom loader, be aware of whether it's sync or async: you cannot use async customer loaders with the sync API ([`cosmiconfigSync()`]).
|
||||
- **Special JS syntax can also be handled by using a `require` hook**, because `defaultLoaders['.js']` just uses `require`.
|
||||
Whether you use custom loaders or a `require` hook is up to you.
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
// Allow JSON5 syntax:
|
||||
cosmiconfig('foo', {
|
||||
loaders: {
|
||||
'.json': json5Loader
|
||||
}
|
||||
});
|
||||
|
||||
// Allow a special configuration syntax of your own creation:
|
||||
cosmiconfig('foo', {
|
||||
loaders: {
|
||||
'.special': specialLoader
|
||||
}
|
||||
});
|
||||
|
||||
// Allow many flavors of JS, using custom loaders:
|
||||
cosmiconfig('foo', {
|
||||
loaders: {
|
||||
'.coffee': coffeeScriptLoader
|
||||
}
|
||||
});
|
||||
|
||||
// Allow many flavors of JS but rely on require hooks:
|
||||
cosmiconfig('foo', {
|
||||
loaders: {
|
||||
'.coffee': defaultLoaders['.js']
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### packageProp
|
||||
|
||||
Type: `string | Array<string>`.
|
||||
Default: `` `${moduleName}` ``.
|
||||
|
||||
Name of the property in `package.json` (or `package.yaml`) to look for.
|
||||
|
||||
Use a period-delimited string or an array of strings to describe a path to nested properties.
|
||||
|
||||
For example, the value `'configs.myPackage'` or `['configs', 'myPackage']` will get you the `"myPackage"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"configs": {
|
||||
"myPackage": {"option": "value"}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If nested property names within the path include periods, you need to use an array of strings. For example, the value `['configs', 'foo.bar', 'baz']` will get you the `"baz"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"configs": {
|
||||
"foo.bar": {
|
||||
"baz": {"option": "value"}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If a string includes period but corresponds to a top-level property name, it will not be interpreted as a period-delimited path. For example, the value `'one.two'` will get you the `"three"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"one.two": "three",
|
||||
"one": {
|
||||
"two": "four"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### stopDir
|
||||
|
||||
Type: `string`.
|
||||
Default: Absolute path to your home directory.
|
||||
|
||||
Directory where the search will stop.
|
||||
|
||||
### cache
|
||||
|
||||
Type: `boolean`.
|
||||
Default: `true`.
|
||||
|
||||
If `false`, no caches will be used.
|
||||
Read more about ["Caching"](#caching) below.
|
||||
|
||||
### transform
|
||||
|
||||
Type: `(Result) => Promise<Result> | Result`.
|
||||
|
||||
A function that transforms the parsed configuration. Receives the [result].
|
||||
|
||||
If using [`search()`] or [`load()`] \(which are async), the transform function can return the transformed result or return a Promise that resolves with the transformed result.
|
||||
If using `cosmiconfigSync`, [`search()`] or [`load()`], the function must be synchronous and return the transformed result.
|
||||
|
||||
The reason you might use this option — instead of simply applying your transform function some other way — is that *the transformed result will be cached*. If your transformation involves additional filesystem I/O or other potentially slow processing, you can use this option to avoid repeating those steps every time a given configuration is searched or loaded.
|
||||
|
||||
### ignoreEmptySearchPlaces
|
||||
|
||||
Type: `boolean`.
|
||||
Default: `true`.
|
||||
|
||||
By default, if [`search()`] encounters an empty file (containing nothing but whitespace) in one of the [`searchPlaces`], it will ignore the empty file and move on.
|
||||
If you'd like to load empty configuration files, instead, set this option to `false`.
|
||||
|
||||
Why might you want to load empty configuration files?
|
||||
If you want to throw an error, or if an empty configuration file means something to your program.
|
||||
|
||||
## Loading JS modules
|
||||
|
||||
Your end users can provide JS configuration files as ECMAScript modules (ESM) under the following conditions:
|
||||
|
||||
- You (the cosmiconfig user) use cosmiconfig's [asynchronous API](#asynchronous-api).
|
||||
- Your end user runs a version of Node that supports ESM ([>=12.17.0](https://nodejs.org/en/blog/release/v12.17.0/), or earlier with the `--experimental-modules` flag).
|
||||
- Your end user provides an `.mjs` configuration file, or a `.js` file whose nearest parent `package.json` file contains `"type": "module"`. (See [Node's method for determining a file's module system](https://nodejs.org/api/packages.html#packages_determining_module_system).)
|
||||
|
||||
With cosmiconfig's [asynchronous API](#asynchronous-api), the default [`searchPlaces`] include `.js`, `.ts`, `.mjs`, and `.cjs` files. Cosmiconfig loads all these file types with the [dynamic `import` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports).
|
||||
|
||||
With the [synchronous API](#synchronous-api), JS configuration files are always treated as CommonJS, and `.mjs` files are ignored, because there is no synchronous API for the dynamic `import` function.
|
||||
|
||||
## Caching
|
||||
|
||||
As of v2, cosmiconfig uses caching to reduce the need for repetitious reading of the filesystem or expensive transforms. Every new cosmiconfig instance (created with `cosmiconfig()`) has its own caches.
|
||||
|
||||
To avoid or work around caching, you can do the following:
|
||||
|
||||
- Set the `cosmiconfig` option [`cache`] to `false`.
|
||||
- Use the cache-clearing methods [`clearLoadCache()`], [`clearSearchCache()`], and [`clearCaches()`].
|
||||
- Create separate instances of cosmiconfig (separate "explorers").
|
||||
|
||||
## Differences from [rc](https://github.com/dominictarr/rc)
|
||||
|
||||
[rc](https://github.com/dominictarr/rc) serves its focused purpose well. cosmiconfig differs in a few key ways — making it more useful for some projects, less useful for others:
|
||||
|
||||
- Looks for configuration in some different places: in a `package.json` property, an rc file, a `.config.js` file, and rc files with extensions.
|
||||
- Built-in support for JSON, YAML, and CommonJS formats.
|
||||
- Stops at the first configuration found, instead of finding all that can be found up the directory tree and merging them automatically.
|
||||
- Options.
|
||||
- Asynchronous by default (though can be run synchronously).
|
||||
|
||||
## Usage for end users
|
||||
|
||||
When configuring a tool, you can use multiple file formats and put these in multiple places.
|
||||
|
||||
Usually, a tool would mention this in its own README file,
|
||||
but by default, these are the following places, where `{NAME}` represents the name of the tool:
|
||||
|
||||
```
|
||||
package.json
|
||||
.{NAME}rc
|
||||
.{NAME}rc.json
|
||||
.{NAME}rc.yaml
|
||||
.{NAME}rc.yml
|
||||
.{NAME}rc.js
|
||||
.{NAME}rc.ts
|
||||
.{NAME}rc.cjs
|
||||
.config/{NAME}rc
|
||||
.config/{NAME}rc.json
|
||||
.config/{NAME}rc.yaml
|
||||
.config/{NAME}rc.yml
|
||||
.config/{NAME}rc.js
|
||||
.config/{NAME}rc.ts
|
||||
.config/{NAME}rc.mjs
|
||||
.config/{NAME}rc.cjs
|
||||
{NAME}.config.js
|
||||
{NAME}.config.ts
|
||||
{NAME}.config.mjs
|
||||
{NAME}.config.cjs
|
||||
```
|
||||
|
||||
The contents of these files are defined by the tool.
|
||||
For example, you can configure prettier to enforce semicolons at the end of the line
|
||||
using a file named `.config/prettierrc.yml`:
|
||||
|
||||
```yaml
|
||||
semi: true
|
||||
```
|
||||
|
||||
Additionally, you have the option to put a property named after the tool in your `package.json` file,
|
||||
with the contents of that property being the same as the file contents. To use the same example as above:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "your-project",
|
||||
"dependencies": {},
|
||||
"prettier": {
|
||||
"semi": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This has the advantage that you can put the configuration of all tools
|
||||
(at least the ones that use cosmiconfig) in one file.
|
||||
|
||||
You can also add a `cosmiconfig` key within your `package.json` file or create one of the following files
|
||||
to configure `cosmiconfig` itself:
|
||||
|
||||
```
|
||||
.config/config.json
|
||||
.config/config.yaml
|
||||
.config/config.yml
|
||||
.config/config.js
|
||||
.config/config.ts
|
||||
.config/config.cjs
|
||||
```
|
||||
|
||||
The following properties are currently actively supported in these places:
|
||||
|
||||
```yaml
|
||||
cosmiconfig:
|
||||
# adds places where configuration files are being searched
|
||||
searchPlaces:
|
||||
- .config/{name}.yml
|
||||
# to enforce a custom naming convention and format, don't merge the above with the tool-defined search places
|
||||
# (`true` is the default setting)
|
||||
mergeSearchPlaces: false
|
||||
```
|
||||
|
||||
> **Note:** technically, you can overwrite all options described in [cosmiconfigOptions](#cosmiconfigoptions) here,
|
||||
> but everything not listed above should be used at your own risk, as it has not been tested explicitly.
|
||||
> The only exceptions to this are the `loaders` property, which is explicitly not supported at this time,
|
||||
> and the `searchStrategy` property, which is intentionally disallowed.
|
||||
|
||||
You can also add more root properties outside the `cosmiconfig` property
|
||||
to configure your tools, entirely eliminating the need to look for additional configuration files:
|
||||
|
||||
```yaml
|
||||
cosmiconfig:
|
||||
searchPlaces: []
|
||||
|
||||
prettier:
|
||||
semi: true
|
||||
```
|
||||
|
||||
### Imports
|
||||
|
||||
Wherever you put your configuration (the package.json file, a root config file or a package-specific config file),
|
||||
you can use the special `$import` key to import another file as a base.
|
||||
|
||||
For example, you can import from an npm package (in this example, `@foocorp/config`).
|
||||
|
||||
`.prettierrc.base.yml` in said npm package could define some company-wide defaults:
|
||||
|
||||
```yaml
|
||||
printWidth: 120
|
||||
semi: true
|
||||
tabWidth: 2
|
||||
```
|
||||
|
||||
And then, the `.prettierrc.yml` file in the project itself would just reference that file,
|
||||
optionally overriding the defaults with project-specific settings:
|
||||
|
||||
```yaml
|
||||
$import: node_modules/@foocorp/config/.prettierrc.base.yml
|
||||
# we want more space!
|
||||
printWidth: 200
|
||||
```
|
||||
|
||||
It is possible to import multiple base files by specifying an array of paths,
|
||||
which will be processed in declaration order;
|
||||
that means that the last entry will win if there are conflicting properties.
|
||||
|
||||
It is also possible to import file formats other than the importing format
|
||||
as long as they are supported by the loaders specified by the developer of the tool you're configuring.
|
||||
|
||||
```yaml
|
||||
$import: [first.yml, second.json, third.config.js]
|
||||
```
|
||||
|
||||
## Contributing & Development
|
||||
|
||||
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
||||
|
||||
And please do participate!
|
||||
|
||||
[result]: #result
|
||||
|
||||
[`load()`]: #explorerload
|
||||
|
||||
[`search()`]: #explorersearch
|
||||
|
||||
[`clearloadcache()`]: #explorerclearloadcache
|
||||
|
||||
[`clearsearchcache()`]: #explorerclearsearchcache
|
||||
|
||||
[`cosmiconfig()`]: #cosmiconfig
|
||||
|
||||
[`cosmiconfigSync()`]: #cosmiconfigsync
|
||||
|
||||
[`clearcaches()`]: #explorerclearcaches
|
||||
|
||||
[`packageprop`]: #packageprop
|
||||
|
||||
[`cache`]: #cache
|
||||
|
||||
[`stopdir`]: #stopdir
|
||||
|
||||
[`searchplaces`]: #searchplaces
|
||||
|
||||
[`loaders`]: #loaders
|
||||
|
||||
[`cosmiconfigoptions`]: #cosmiconfigoptions
|
||||
|
||||
[`explorerSync.search()`]: #explorersyncsearch
|
||||
|
||||
[`explorerSync.load()`]: #explorersyncload
|
||||
|
||||
[`explorer.search()`]: #explorersearch
|
||||
|
||||
[`explorer.load()`]: #explorerload
|
||||
|
||||
["Loading JS modules"]: #loading-js-modules
|
||||
|
||||
[`env-paths`]: https://github.com/sindresorhus/env-paths
|
||||
|
||||
[search strategies]: #searchstrategy
|
||||
2
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/Explorer.d.ts
generated
vendored
Normal file
2
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/Explorer.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=Explorer.d.ts.map
|
||||
170
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/Explorer.js
generated
vendored
Normal file
170
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/Explorer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Explorer = void 0;
|
||||
const promises_1 = __importDefault(require("fs/promises"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const defaults_1 = require("./defaults");
|
||||
const ExplorerBase_js_1 = require("./ExplorerBase.js");
|
||||
const merge_1 = require("./merge");
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class Explorer extends ExplorerBase_js_1.ExplorerBase {
|
||||
async load(filepath) {
|
||||
filepath = path_1.default.resolve(filepath);
|
||||
const load = async () => {
|
||||
return await this.config.transform(await this.#readConfiguration(filepath));
|
||||
};
|
||||
if (this.loadCache) {
|
||||
return await (0, util_js_1.emplace)(this.loadCache, filepath, load);
|
||||
}
|
||||
return await load();
|
||||
}
|
||||
async search(from = '') {
|
||||
if (this.config.metaConfigFilePath) {
|
||||
this.loadingMetaConfig = true;
|
||||
const config = await this.load(this.config.metaConfigFilePath);
|
||||
this.loadingMetaConfig = false;
|
||||
if (config && !config.isEmpty) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
from = path_1.default.resolve(from);
|
||||
const dirs = this.#getDirs(from);
|
||||
const firstDirIter = await dirs.next();
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (firstDirIter.done) {
|
||||
// this should never happen
|
||||
throw new Error(`Could not find any folders to iterate through (start from ${from})`);
|
||||
}
|
||||
let currentDir = firstDirIter.value;
|
||||
const search = async () => {
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (await (0, util_js_1.isDirectory)(currentDir.path)) {
|
||||
for (const filepath of this.getSearchPlacesForDir(currentDir, defaults_1.globalConfigSearchPlaces)) {
|
||||
try {
|
||||
const result = await this.#readConfiguration(filepath);
|
||||
if (result !== null &&
|
||||
!(result.isEmpty && this.config.ignoreEmptySearchPlaces)) {
|
||||
return await this.config.transform(result);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === 'ENOENT' ||
|
||||
error.code === 'EISDIR' ||
|
||||
error.code === 'ENOTDIR' ||
|
||||
error.code === 'EACCES') {
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const nextDirIter = await dirs.next();
|
||||
if (!nextDirIter.done) {
|
||||
currentDir = nextDirIter.value;
|
||||
if (this.searchCache) {
|
||||
return await (0, util_js_1.emplace)(this.searchCache, currentDir.path, search);
|
||||
}
|
||||
return await search();
|
||||
}
|
||||
return await this.config.transform(null);
|
||||
};
|
||||
if (this.searchCache) {
|
||||
return await (0, util_js_1.emplace)(this.searchCache, from, search);
|
||||
}
|
||||
return await search();
|
||||
}
|
||||
async #readConfiguration(filepath, importStack = []) {
|
||||
const contents = await promises_1.default.readFile(filepath, { encoding: 'utf-8' });
|
||||
return this.toCosmiconfigResult(filepath, await this.#loadConfigFileWithImports(filepath, contents, importStack));
|
||||
}
|
||||
async #loadConfigFileWithImports(filepath, contents, importStack) {
|
||||
const loadedContent = await this.#loadConfiguration(filepath, contents);
|
||||
if (!loadedContent || !(0, merge_1.hasOwn)(loadedContent, '$import')) {
|
||||
return loadedContent;
|
||||
}
|
||||
const fileDirectory = path_1.default.dirname(filepath);
|
||||
const { $import: imports, ...ownContent } = loadedContent;
|
||||
const importPaths = Array.isArray(imports) ? imports : [imports];
|
||||
const newImportStack = [...importStack, filepath];
|
||||
this.validateImports(filepath, importPaths, newImportStack);
|
||||
const importedConfigs = await Promise.all(importPaths.map(async (importPath) => {
|
||||
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
||||
const result = await this.#readConfiguration(fullPath, newImportStack);
|
||||
return result?.config;
|
||||
}));
|
||||
return (0, merge_1.mergeAll)([...importedConfigs, ownContent], {
|
||||
mergeArrays: this.config.mergeImportArrays,
|
||||
});
|
||||
}
|
||||
async #loadConfiguration(filepath, contents) {
|
||||
if (contents.trim() === '') {
|
||||
return;
|
||||
}
|
||||
const extension = path_1.default.extname(filepath);
|
||||
const loader = this.config.loaders[extension || 'noExt'] ??
|
||||
this.config.loaders['default'];
|
||||
if (!loader) {
|
||||
throw new Error(`No loader specified for ${(0, ExplorerBase_js_1.getExtensionDescription)(extension)}`);
|
||||
}
|
||||
try {
|
||||
const loadedContents = await loader(filepath, contents);
|
||||
if (path_1.default.basename(filepath, extension) !== 'package') {
|
||||
return loadedContents;
|
||||
}
|
||||
return ((0, util_js_1.getPropertyByPath)(loadedContents, this.config.packageProp ?? this.config.moduleName) ?? null);
|
||||
}
|
||||
catch (error) {
|
||||
error.filepath = filepath;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
async #fileExists(path) {
|
||||
try {
|
||||
await promises_1.default.stat(path);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
async *#getDirs(startDir) {
|
||||
switch (this.config.searchStrategy) {
|
||||
case 'none': {
|
||||
// only check in the passed directory (defaults to working directory)
|
||||
yield { path: startDir, isGlobalConfig: false };
|
||||
return;
|
||||
}
|
||||
case 'project': {
|
||||
let currentDir = startDir;
|
||||
while (true) {
|
||||
yield { path: currentDir, isGlobalConfig: false };
|
||||
for (const ext of ['json', 'yaml']) {
|
||||
const packageFile = path_1.default.join(currentDir, `package.${ext}`);
|
||||
if (await this.#fileExists(packageFile)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const parentDir = path_1.default.dirname(currentDir);
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (parentDir === currentDir) {
|
||||
// we're probably at the root of the directory structure
|
||||
break;
|
||||
}
|
||||
currentDir = parentDir;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'global': {
|
||||
yield* this.getGlobalDirs(startDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Explorer = Explorer;
|
||||
//# sourceMappingURL=Explorer.js.map
|
||||
2
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerBase.d.ts
generated
vendored
Normal file
2
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerBase.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=ExplorerBase.d.ts.map
|
||||
126
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
Normal file
126
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getExtensionDescription = exports.ExplorerBase = void 0;
|
||||
const env_paths_1 = __importDefault(require("env-paths"));
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ExplorerBase {
|
||||
#loadingMetaConfig = false;
|
||||
config;
|
||||
loadCache;
|
||||
searchCache;
|
||||
constructor(options) {
|
||||
this.config = options;
|
||||
if (options.cache) {
|
||||
this.loadCache = new Map();
|
||||
this.searchCache = new Map();
|
||||
}
|
||||
this.#validateConfig();
|
||||
}
|
||||
set loadingMetaConfig(value) {
|
||||
this.#loadingMetaConfig = value;
|
||||
}
|
||||
#validateConfig() {
|
||||
const config = this.config;
|
||||
for (const place of config.searchPlaces) {
|
||||
const extension = path_1.default.extname(place);
|
||||
const loader = this.config.loaders[extension || 'noExt'] ??
|
||||
this.config.loaders['default'];
|
||||
if (loader === undefined) {
|
||||
throw new Error(`Missing loader for ${getExtensionDescription(place)}.`);
|
||||
}
|
||||
if (typeof loader !== 'function') {
|
||||
throw new Error(`Loader for ${getExtensionDescription(place)} is not a function: Received ${typeof loader}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearLoadCache() {
|
||||
if (this.loadCache) {
|
||||
this.loadCache.clear();
|
||||
}
|
||||
}
|
||||
clearSearchCache() {
|
||||
if (this.searchCache) {
|
||||
this.searchCache.clear();
|
||||
}
|
||||
}
|
||||
clearCaches() {
|
||||
this.clearLoadCache();
|
||||
this.clearSearchCache();
|
||||
}
|
||||
toCosmiconfigResult(filepath, config) {
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
if (config === undefined) {
|
||||
return { filepath, config: undefined, isEmpty: true };
|
||||
}
|
||||
if (this.config.applyPackagePropertyPathToConfiguration ||
|
||||
this.#loadingMetaConfig) {
|
||||
const packageProp = this.config.packageProp ?? this.config.moduleName;
|
||||
config = (0, util_js_1.getPropertyByPath)(config, packageProp);
|
||||
}
|
||||
if (config === undefined) {
|
||||
return { filepath, config: undefined, isEmpty: true };
|
||||
}
|
||||
return { config, filepath };
|
||||
}
|
||||
validateImports(containingFilePath, imports, importStack) {
|
||||
const fileDirectory = path_1.default.dirname(containingFilePath);
|
||||
for (const importPath of imports) {
|
||||
if (typeof importPath !== 'string') {
|
||||
throw new Error(`${containingFilePath}: Key $import must contain a string or a list of strings`);
|
||||
}
|
||||
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
||||
if (fullPath === containingFilePath) {
|
||||
throw new Error(`Self-import detected in ${containingFilePath}`);
|
||||
}
|
||||
const idx = importStack.indexOf(fullPath);
|
||||
if (idx !== -1) {
|
||||
throw new Error(`Circular import detected:
|
||||
${[...importStack, fullPath]
|
||||
.map((path, i) => `${i + 1}. ${path}`)
|
||||
.join('\n')} (same as ${idx + 1}.)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
getSearchPlacesForDir(dir, globalConfigPlaces) {
|
||||
return (dir.isGlobalConfig ? globalConfigPlaces : this.config.searchPlaces).map((place) => path_1.default.join(dir.path, place));
|
||||
}
|
||||
getGlobalConfigDir() {
|
||||
return (0, env_paths_1.default)(this.config.moduleName, { suffix: '' }).config;
|
||||
}
|
||||
*getGlobalDirs(startDir) {
|
||||
const stopDir = path_1.default.resolve(this.config.stopDir ?? os_1.default.homedir());
|
||||
yield { path: startDir, isGlobalConfig: false };
|
||||
let currentDir = startDir;
|
||||
while (currentDir !== stopDir) {
|
||||
const parentDir = path_1.default.dirname(currentDir);
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (parentDir === currentDir) {
|
||||
// we're probably at the root of the directory structure
|
||||
break;
|
||||
}
|
||||
yield { path: parentDir, isGlobalConfig: false };
|
||||
currentDir = parentDir;
|
||||
}
|
||||
yield { path: this.getGlobalConfigDir(), isGlobalConfig: true };
|
||||
}
|
||||
}
|
||||
exports.ExplorerBase = ExplorerBase;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function getExtensionDescription(extension) {
|
||||
/* istanbul ignore next -- @preserve */
|
||||
return extension ? `extension "${extension}"` : 'files without extensions';
|
||||
}
|
||||
exports.getExtensionDescription = getExtensionDescription;
|
||||
//# sourceMappingURL=ExplorerBase.js.map
|
||||
2
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerSync.d.ts
generated
vendored
Normal file
2
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerSync.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=ExplorerSync.d.ts.map
|
||||
184
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerSync.js
generated
vendored
Normal file
184
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/ExplorerSync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExplorerSync = void 0;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const defaults_1 = require("./defaults");
|
||||
const ExplorerBase_js_1 = require("./ExplorerBase.js");
|
||||
const merge_1 = require("./merge");
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ExplorerSync extends ExplorerBase_js_1.ExplorerBase {
|
||||
load(filepath) {
|
||||
filepath = path_1.default.resolve(filepath);
|
||||
const load = () => {
|
||||
return this.config.transform(this.#readConfiguration(filepath));
|
||||
};
|
||||
if (this.loadCache) {
|
||||
return (0, util_js_1.emplace)(this.loadCache, filepath, load);
|
||||
}
|
||||
return load();
|
||||
}
|
||||
search(from = '') {
|
||||
if (this.config.metaConfigFilePath) {
|
||||
this.loadingMetaConfig = true;
|
||||
const config = this.load(this.config.metaConfigFilePath);
|
||||
this.loadingMetaConfig = false;
|
||||
if (config && !config.isEmpty) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
from = path_1.default.resolve(from);
|
||||
const dirs = this.#getDirs(from);
|
||||
const firstDirIter = dirs.next();
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (firstDirIter.done) {
|
||||
// this should never happen
|
||||
throw new Error(`Could not find any folders to iterate through (start from ${from})`);
|
||||
}
|
||||
let currentDir = firstDirIter.value;
|
||||
const search = () => {
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if ((0, util_js_1.isDirectorySync)(currentDir.path)) {
|
||||
for (const filepath of this.getSearchPlacesForDir(currentDir, defaults_1.globalConfigSearchPlacesSync)) {
|
||||
try {
|
||||
const result = this.#readConfiguration(filepath);
|
||||
if (result !== null &&
|
||||
!(result.isEmpty && this.config.ignoreEmptySearchPlaces)) {
|
||||
return this.config.transform(result);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === 'ENOENT' ||
|
||||
error.code === 'EISDIR' ||
|
||||
error.code === 'ENOTDIR' ||
|
||||
error.code === 'EACCES') {
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const nextDirIter = dirs.next();
|
||||
if (!nextDirIter.done) {
|
||||
currentDir = nextDirIter.value;
|
||||
if (this.searchCache) {
|
||||
return (0, util_js_1.emplace)(this.searchCache, currentDir.path, search);
|
||||
}
|
||||
return search();
|
||||
}
|
||||
return this.config.transform(null);
|
||||
};
|
||||
if (this.searchCache) {
|
||||
return (0, util_js_1.emplace)(this.searchCache, from, search);
|
||||
}
|
||||
return search();
|
||||
}
|
||||
#readConfiguration(filepath, importStack = []) {
|
||||
const contents = fs_1.default.readFileSync(filepath, 'utf8');
|
||||
return this.toCosmiconfigResult(filepath, this.#loadConfigFileWithImports(filepath, contents, importStack));
|
||||
}
|
||||
#loadConfigFileWithImports(filepath, contents, importStack) {
|
||||
const loadedContent = this.#loadConfiguration(filepath, contents);
|
||||
if (!loadedContent || !(0, merge_1.hasOwn)(loadedContent, '$import')) {
|
||||
return loadedContent;
|
||||
}
|
||||
const fileDirectory = path_1.default.dirname(filepath);
|
||||
const { $import: imports, ...ownContent } = loadedContent;
|
||||
const importPaths = Array.isArray(imports) ? imports : [imports];
|
||||
const newImportStack = [...importStack, filepath];
|
||||
this.validateImports(filepath, importPaths, newImportStack);
|
||||
const importedConfigs = importPaths.map((importPath) => {
|
||||
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
||||
const result = this.#readConfiguration(fullPath, newImportStack);
|
||||
return result?.config;
|
||||
});
|
||||
return (0, merge_1.mergeAll)([...importedConfigs, ownContent], {
|
||||
mergeArrays: this.config.mergeImportArrays,
|
||||
});
|
||||
}
|
||||
#loadConfiguration(filepath, contents) {
|
||||
if (contents.trim() === '') {
|
||||
return;
|
||||
}
|
||||
const extension = path_1.default.extname(filepath);
|
||||
const loader = this.config.loaders[extension || 'noExt'] ??
|
||||
this.config.loaders['default'];
|
||||
if (!loader) {
|
||||
throw new Error(`No loader specified for ${(0, ExplorerBase_js_1.getExtensionDescription)(extension)}`);
|
||||
}
|
||||
try {
|
||||
const loadedContents = loader(filepath, contents);
|
||||
if (path_1.default.basename(filepath, extension) !== 'package') {
|
||||
return loadedContents;
|
||||
}
|
||||
return ((0, util_js_1.getPropertyByPath)(loadedContents, this.config.packageProp ?? this.config.moduleName) ?? null);
|
||||
}
|
||||
catch (error) {
|
||||
error.filepath = filepath;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
#fileExists(path) {
|
||||
try {
|
||||
fs_1.default.statSync(path);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*#getDirs(startDir) {
|
||||
switch (this.config.searchStrategy) {
|
||||
case 'none': {
|
||||
// there is no next dir
|
||||
yield { path: startDir, isGlobalConfig: false };
|
||||
return;
|
||||
}
|
||||
case 'project': {
|
||||
let currentDir = startDir;
|
||||
while (true) {
|
||||
yield { path: currentDir, isGlobalConfig: false };
|
||||
for (const ext of ['json', 'yaml']) {
|
||||
const packageFile = path_1.default.join(currentDir, `package.${ext}`);
|
||||
if (this.#fileExists(packageFile)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const parentDir = path_1.default.dirname(currentDir);
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (parentDir === currentDir) {
|
||||
// we're probably at the root of the directory structure
|
||||
break;
|
||||
}
|
||||
currentDir = parentDir;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'global': {
|
||||
yield* this.getGlobalDirs(startDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @deprecated Use {@link ExplorerSync.prototype.load}.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
loadSync(filepath) {
|
||||
return this.load(filepath);
|
||||
}
|
||||
/**
|
||||
* @deprecated Use {@link ExplorerSync.prototype.search}.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
searchSync(from = '') {
|
||||
return this.search(from);
|
||||
}
|
||||
}
|
||||
exports.ExplorerSync = ExplorerSync;
|
||||
//# sourceMappingURL=ExplorerSync.js.map
|
||||
5
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/cacheWrapper.d.ts
generated
vendored
Normal file
5
node_modules/@commitlint/load/node_modules/cosmiconfig/dist/cacheWrapper.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { Cache, CosmiconfigResult } from './types';
|
||||
declare function cacheWrapper(cache: Cache, key: string, fn: () => Promise<CosmiconfigResult>): Promise<CosmiconfigResult>;
|
||||
declare function cacheWrapperSync(cache: Cache, key: string, fn: () => CosmiconfigResult): CosmiconfigResult;
|
||||
export { cacheWrapper, cacheWrapperSync };
|
||||
//# sourceMappingURL=cacheWrapper.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user