Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@napi-rs/simple-git

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@napi-rs/simple-git - npm Package Compare versions

Comparing version
0.1.19
to
0.1.20
+411
-372
index.d.ts

@@ -1,258 +0,3 @@

/* tslint:disable */
/* auto-generated by NAPI-RS */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export const enum DiffFlags {
/**
* File(s) treated as binary data.
* 1 << 0
*/
Binary = 1,
/**
* File(s) treated as text data.
* 1 << 1
*/
NotBinary = 2,
/**
* `id` value is known correct.
* 1 << 2
*/
ValidId = 4,
/**
* File exists at this side of the delta.
* 1 << 3
*/
Exists = 8
}
/** Valid modes for index and tree entries. */
export const enum FileMode {
/** Unreadable */
Unreadable = 0,
/** Tree */
Tree = 1,
/** Blob */
Blob = 2,
/** Group writable blob. Obsolete mode kept for compatibility reasons */
BlobGroupWritable = 3,
/** Blob executable */
BlobExecutable = 4,
/** Link */
Link = 5,
/** Commit */
Commit = 6
}
export const enum Delta {
/** No changes */
Unmodified = 0,
/** Entry does not exist in old version */
Added = 1,
/** Entry does not exist in new version */
Deleted = 2,
/** Entry content changed between old and new */
Modified = 3,
/** Entry was renamed between old and new */
Renamed = 4,
/** Entry was copied from another old entry */
Copied = 5,
/** Entry is ignored item in workdir */
Ignored = 6,
/** Entry is untracked item in workdir */
Untracked = 7,
/** Type of entry changed between old and new */
Typechange = 8,
/** Entry is unreadable */
Unreadable = 9,
/** Entry in the index is conflicted */
Conflicted = 10
}
export interface DiffOptions {
/**
* When generating output, include the names of unmodified files if they
* are included in the `Diff`. Normally these are skipped in the formats
* that list files (e.g. name-only, name-status, raw). Even with this these
* will not be included in the patch format.
*/
showUnmodified?: boolean
}
export const enum ObjectType {
/** Any kind of git object */
Any = 0,
/** An object which corresponds to a git commit */
Commit = 1,
/** An object which corresponds to a git tree */
Tree = 2,
/** An object which corresponds to a git blob */
Blob = 3,
/** An object which corresponds to a git tag */
Tag = 4
}
/** An enumeration of all possible kinds of references. */
export const enum ReferenceType {
/** A reference which points at an object id. */
Direct = 0,
/** A reference which points at another reference. */
Symbolic = 1,
Unknown = 2
}
/** An enumeration of the possible directions for a remote. */
export const enum Direction {
/** Data will be fetched (read) from this remote. */
Fetch = 0,
/** Data will be pushed (written) to this remote. */
Push = 1
}
/** Configuration for how pruning is done on a fetch */
export const enum FetchPrune {
/** Use the setting from the configuration */
Unspecified = 0,
/** Force pruning on */
On = 1,
/** Force pruning off */
Off = 2
}
/** Automatic tag following options. */
export const enum AutotagOption {
/** Use the setting from the remote's configuration */
Unspecified = 0,
/** Ask the server for tags pointing to objects we're already downloading */
Auto = 1,
/** Don't ask for any tags beyond the refspecs */
None = 2,
/** Ask for all the tags */
All = 3
}
/**
* Remote redirection settings; whether redirects to another host are
* permitted.
*
* By default, git will follow a redirect on the initial request
* (`/info/refs`), but not subsequent requests.
*/
export const enum RemoteRedirect {
/** Do not follow any off-site redirects at any stage of the fetch or push. */
None = 0,
/**
* Allow off-site redirects only upon the initial request. This is the
* default.
*/
Initial = 1,
/** Allow redirects at any stage in the fetch or push. */
All = 2
}
/** Types of credentials that can be requested by a credential callback. */
export const enum CredentialType {
/** 1 << 0 */
UserPassPlaintext = 1,
/** 1 << 1 */
SshKey = 2,
/** 1 << 6 */
SshMemory = 64,
/** 1 << 2 */
SshCustom = 4,
/** 1 << 3 */
Default = 8,
/** 1 << 4 */
SshInteractive = 16,
/** 1 << 5 */
Username = 32
}
export interface CredInfo {
credType: CredentialType
url: string
username: string
}
export const enum RemoteUpdateFlags {
UpdateFetchHead = 1,
ReportUnchanged = 2
}
export interface Progress {
totalObjects: number
indexedObjects: number
receivedObjects: number
localObjects: number
totalDeltas: number
indexedDeltas: number
receivedBytes: number
}
export interface PushTransferProgress {
current: number
total: number
bytes: number
}
/** Check whether a cred_type contains another credential type. */
export function credTypeContains(credType: CredentialType, another: CredentialType): boolean
export const enum RepositoryState {
Clean = 0,
Merge = 1,
Revert = 2,
RevertSequence = 3,
CherryPick = 4,
CherryPickSequence = 5,
Bisect = 6,
Rebase = 7,
RebaseInteractive = 8,
RebaseMerge = 9,
ApplyMailbox = 10,
ApplyMailboxOrRebase = 11
}
export const enum RepositoryOpenFlags {
/** Only open the specified path; don't walk upward searching. */
NoSearch = 0,
/** Search across filesystem boundaries. */
CrossFS = 1,
/** Force opening as bare repository, and defer loading its config. */
Bare = 2,
/** Don't try appending `/.git` to the specified repository path. */
NoDotGit = 3,
/** Respect environment variables like `$GIT_DIR`. */
FromEnv = 4
}
export const enum CloneLocal {
/**
* Auto-detect (default)
*
* Here libgit2 will bypass the git-aware transport for local paths, but
* use a normal fetch for `file://` URLs.
*/
Auto = 0,
/** Bypass the git-aware transport even for `file://` URLs. */
Local = 1,
/** Never bypass the git-aware transport */
None = 2,
/** Bypass the git-aware transport, but don't try to use hardlinks. */
NoLinks = 3
}
/** Orderings that may be specified for Revwalk iteration. */
export const enum Sort {
/**
* Sort the repository contents in no particular ordering.
*
* This sorting is arbitrary, implementation-specific, and subject to
* change at any time. This is the default sorting for new walkers.
*/
None = 0,
/**
* Sort the repository contents in topological order (children before
* parents).
*
* This sorting mode can be combined with time sorting.
* 1 << 0
*/
Topological = 1,
/**
* Sort the repository contents by commit time.
*
* This sorting mode can be combined with topological sorting.
* 1 << 1
*/
Time = 2,
/**
* Iterate through the repository contents in reverse order.
*
* This sorting mode can be combined with any others.
* 1 << 2
*/
Reverse = 4
}
export declare class Blob {

@@ -268,2 +13,3 @@ /** Get the id (SHA1) of a repository blob */

}
export declare class Commit {

@@ -408,2 +154,34 @@ /** Get the id (SHA1) of a repository object */

}
export declare class Cred {
/**
* Create a "default" credential usable for Negotiate mechanisms like NTLM
* or Kerberos authentication.
*/
constructor()
/**
* Create a new ssh key credential object used for querying an ssh-agent.
*
* The username specified is the username to authenticate.
*/
static sshKeyFromAgent(username: string): Cred
/** Create a new passphrase-protected ssh key credential object. */
static sshKey(username: string, publickey: string | undefined | null, privatekey: string, passphrase?: string | undefined | null): Cred
/** Create a new ssh key credential object reading the keys from memory. */
static sshKeyFromMemory(username: string, publickey: string | undefined | null, privatekey: string, passphrase?: string | undefined | null): Cred
/** Create a new plain-text username and password credential object. */
static userpassPlaintext(username: string, password: string): Cred
/**
* Create a credential to specify a username.
*
* This is used with ssh authentication to query for the username if none is
* specified in the URL.
*/
static username(username: string): Cred
/** Check whether a credential object contains username information. */
hasUsername(): boolean
/** Return the type of credentials that this object represents. */
credtype(): CredentialType
}
/** An iterator over the diffs in a delta */

@@ -413,2 +191,21 @@ export declare class Deltas {

}
export declare class Diff {
/**
* Merge one diff into another.
*
* This merges items from the "from" list into the "self" list. The
* resulting diff will have all items that appear in either list.
* If an item appears in both lists, then it will be "merged" to appear
* as if the old version was from the "onto" list and the new version
* is from the "from" list (with the exception that if the item has a
* pending DELETE in the middle, then it will show as deleted).
*/
merge(diff: Diff): void
/** Returns an iterator over the deltas in this diff. */
deltas(): Deltas
/** Check if deltas are sorted case sensitively or insensitively. */
isSortedIcase(): boolean
}
export declare class DiffDelta {

@@ -440,2 +237,3 @@ /**

}
export declare class DiffFile {

@@ -467,19 +265,41 @@ /**

}
export declare class Diff {
export declare class FetchOptions {
constructor()
/** Set the callbacks to use for the fetch operation. */
remoteCallback(callback: RemoteCallbacks): this
/** Set the proxy options to use for the fetch operation. */
proxyOptions(options: ProxyOptions): this
/** Set whether to perform a prune after the fetch. */
prune(prune: FetchPrune): this
/**
* Merge one diff into another.
* Set whether to write the results to FETCH_HEAD.
*
* This merges items from the "from" list into the "self" list. The
* resulting diff will have all items that appear in either list.
* If an item appears in both lists, then it will be "merged" to appear
* as if the old version was from the "onto" list and the new version
* is from the "from" list (with the exception that if the item has a
* pending DELETE in the middle, then it will show as deleted).
* Defaults to `true`.
*/
merge(diff: Diff): void
/** Returns an iterator over the deltas in this diff. */
deltas(): Deltas
/** Check if deltas are sorted case sensitively or insensitively. */
isSortedIcase(): boolean
updateFetchhead(update: boolean): this
/**
* Set fetch depth, a value less or equal to 0 is interpreted as pull
* everything (effectively the same as not declaring a limit depth).
*/
depth(depth: number): this
/**
* Set how to behave regarding tags on the remote, such as auto-downloading
* tags for objects we're downloading or downloading all of them.
*
* The default is to auto-follow tags.
*/
downloadTags(opt: AutotagOption): this
/**
* Set remote redirection settings; whether redirects to another host are
* permitted.
*
* By default, git will follow a redirect on the initial request
* (`/info/refs`), but not subsequent requests.
*/
followRedirects(opt: RemoteRedirect): this
/** Set extra headers for this fetch operation. */
customHeaders(headers: Array<string>): this
}
export declare class GitObject {

@@ -501,2 +321,19 @@ /** Get the id (SHA1) of a repository object */

}
export declare class ProxyOptions {
constructor()
/**
* Try to auto-detect the proxy from the git configuration.
*
* Note that this will override `url` specified before.
*/
auto(): this
/**
* Specify the exact URL of the proxy to use.
*
* Note that this will override `auto` specified before.
*/
url(url: string): this
}
export declare class Reference {

@@ -595,2 +432,3 @@ /**

}
export declare class Remote {

@@ -651,2 +489,3 @@ /** Ensure the remote name is well-formed. */

}
export declare class RemoteCallbacks {

@@ -687,84 +526,34 @@ constructor()

}
export declare class FetchOptions {
export declare class RepoBuilder {
constructor()
/** Set the callbacks to use for the fetch operation. */
remoteCallback(callback: RemoteCallbacks): this
/** Set the proxy options to use for the fetch operation. */
proxyOptions(options: ProxyOptions): this
/** Set whether to perform a prune after the fetch. */
prune(prune: FetchPrune): this
/**
* Set whether to write the results to FETCH_HEAD.
*
* Defaults to `true`.
* Indicate whether the repository will be cloned as a bare repository or
* not.
*/
updateFetchhead(update: boolean): this
bare(bare: boolean): this
/**
* Set fetch depth, a value less or equal to 0 is interpreted as pull
* everything (effectively the same as not declaring a limit depth).
*/
depth(depth: number): this
/**
* Set how to behave regarding tags on the remote, such as auto-downloading
* tags for objects we're downloading or downloading all of them.
* Specify the name of the branch to check out after the clone.
*
* The default is to auto-follow tags.
* If not specified, the remote's default branch will be used.
*/
downloadTags(opt: AutotagOption): this
branch(branch: string): this
/**
* Set remote redirection settings; whether redirects to another host are
* permitted.
* Configures options for bypassing the git-aware transport on clone.
*
* By default, git will follow a redirect on the initial request
* (`/info/refs`), but not subsequent requests.
* Bypassing it means that instead of a fetch libgit2 will copy the object
* database directory instead of figuring out what it needs, which is
* faster. If possible, it will hardlink the files to save space.
*/
followRedirects(opt: RemoteRedirect): this
/** Set extra headers for this fetch operation. */
customHeaders(headers: Array<string>): this
}
export declare class ProxyOptions {
constructor()
cloneLocal(cloneLocal: CloneLocal): this
/**
* Try to auto-detect the proxy from the git configuration.
* Options which control the fetch, including callbacks.
*
* Note that this will override `url` specified before.
* The callbacks are used for reporting fetch progress, and for acquiring
* credentials in the event they are needed.
*/
auto(): this
/**
* Specify the exact URL of the proxy to use.
*
* Note that this will override `auto` specified before.
*/
url(url: string): this
fetchOptions(fetchOptions: FetchOptions): this
clone(url: string, path: string): Repository
}
export declare class Cred {
/**
* Create a "default" credential usable for Negotiate mechanisms like NTLM
* or Kerberos authentication.
*/
constructor()
/**
* Create a new ssh key credential object used for querying an ssh-agent.
*
* The username specified is the username to authenticate.
*/
static sshKeyFromAgent(username: string): Cred
/** Create a new passphrase-protected ssh key credential object. */
static sshKey(username: string, publickey: string | undefined | null, privatekey: string, passphrase?: string | undefined | null): Cred
/** Create a new ssh key credential object reading the keys from memory. */
static sshKeyFromMemory(username: string, publickey: string | undefined | null, privatekey: string, passphrase?: string | undefined | null): Cred
/** Create a new plain-text username and password credential object. */
static userpassPlaintext(username: string, password: string): Cred
/**
* Create a credential to specify a username.
*
* This is used with ssh authentication to query for the username if none is
* specified in the URL.
*/
static username(username: string): Cred
/** Check whether a credential object contains username information. */
hasUsername(): boolean
/** Return the type of credentials that this object represents. */
credtype(): CredentialType
}
export declare class Repository {

@@ -993,2 +782,4 @@ static init(p: string): Repository

findTag(oid: string): Tag
/** Lookup a tag object by prefix hash from the repository. */
findTagByPrefix(prefixHash: string): Tag
/**

@@ -1011,3 +802,3 @@ * Delete an existing tag reference.

*/
tagForeach(cb: (arg0: string, arg1: Buffer) => void): void
tagForeach(cb: (arg0: string, arg1: Buffer) => boolean): void
/**

@@ -1060,32 +851,3 @@ * Create a diff between a tree and the working directory.

}
export declare class RepoBuilder {
constructor()
/**
* Indicate whether the repository will be cloned as a bare repository or
* not.
*/
bare(bare: boolean): this
/**
* Specify the name of the branch to check out after the clone.
*
* If not specified, the remote's default branch will be used.
*/
branch(branch: string): this
/**
* Configures options for bypassing the git-aware transport on clone.
*
* Bypassing it means that instead of a fetch libgit2 will copy the object
* database directory instead of figuring out what it needs, which is
* faster. If possible, it will hardlink the files to save space.
*/
cloneLocal(cloneLocal: CloneLocal): this
/**
* Options which control the fetch, including callbacks.
*
* The callbacks are used for reporting fetch progress, and for acquiring
* credentials in the event they are needed.
*/
fetchOptions(fetchOptions: FetchOptions): this
clone(url: string, path: string): Repository
}
export declare class RevWalk {

@@ -1179,2 +941,3 @@ [Symbol.iterator](): Iterator<string, void, void>

}
/**

@@ -1222,2 +985,3 @@ * A Signature is used to indicate authorship of various actions throughout the

}
export declare class Tag {

@@ -1255,2 +1019,3 @@ /**

}
export declare class Tree {

@@ -1274,5 +1039,3 @@ /** Get the id (SHA1) of a repository object */

}
export declare class TreeIter {
[Symbol.iterator](): Iterator<TreeEntry, void, void>
}
export declare class TreeEntry {

@@ -1288,1 +1051,277 @@ /** Get the id of the object pointed by the entry */

}
export declare class TreeIter {
[Symbol.iterator](): Iterator<TreeEntry, void, void>
}
/** Automatic tag following options. */
export declare const enum AutotagOption {
/** Use the setting from the remote's configuration */
Unspecified = 0,
/** Ask the server for tags pointing to objects we're already downloading */
Auto = 1,
/** Don't ask for any tags beyond the refspecs */
None = 2,
/** Ask for all the tags */
All = 3
}
export declare const enum CloneLocal {
/**
* Auto-detect (default)
*
* Here libgit2 will bypass the git-aware transport for local paths, but
* use a normal fetch for `file://` URLs.
*/
Auto = 0,
/** Bypass the git-aware transport even for `file://` URLs. */
Local = 1,
/** Never bypass the git-aware transport */
None = 2,
/** Bypass the git-aware transport, but don't try to use hardlinks. */
NoLinks = 3
}
/** Types of credentials that can be requested by a credential callback. */
export declare const enum CredentialType {
/** 1 << 0 */
UserPassPlaintext = 1,
/** 1 << 1 */
SshKey = 2,
/** 1 << 6 */
SshMemory = 64,
/** 1 << 2 */
SshCustom = 4,
/** 1 << 3 */
Default = 8,
/** 1 << 4 */
SshInteractive = 16,
/** 1 << 5 */
Username = 32
}
export interface CredInfo {
credType: CredentialType
url: string
username: string
}
/** Check whether a cred_type contains another credential type. */
export declare function credTypeContains(credType: CredentialType, another: CredentialType): boolean
export declare const enum Delta {
/** No changes */
Unmodified = 0,
/** Entry does not exist in old version */
Added = 1,
/** Entry does not exist in new version */
Deleted = 2,
/** Entry content changed between old and new */
Modified = 3,
/** Entry was renamed between old and new */
Renamed = 4,
/** Entry was copied from another old entry */
Copied = 5,
/** Entry is ignored item in workdir */
Ignored = 6,
/** Entry is untracked item in workdir */
Untracked = 7,
/** Type of entry changed between old and new */
Typechange = 8,
/** Entry is unreadable */
Unreadable = 9,
/** Entry in the index is conflicted */
Conflicted = 10
}
export declare const enum DiffFlags {
/**
* File(s) treated as binary data.
* 1 << 0
*/
Binary = 1,
/**
* File(s) treated as text data.
* 1 << 1
*/
NotBinary = 2,
/**
* `id` value is known correct.
* 1 << 2
*/
ValidId = 4,
/**
* File exists at this side of the delta.
* 1 << 3
*/
Exists = 8
}
export interface DiffOptions {
/**
* When generating output, include the names of unmodified files if they
* are included in the `Diff`. Normally these are skipped in the formats
* that list files (e.g. name-only, name-status, raw). Even with this these
* will not be included in the patch format.
*/
showUnmodified?: boolean
}
/** An enumeration of the possible directions for a remote. */
export declare const enum Direction {
/** Data will be fetched (read) from this remote. */
Fetch = 0,
/** Data will be pushed (written) to this remote. */
Push = 1
}
/** Configuration for how pruning is done on a fetch */
export declare const enum FetchPrune {
/** Use the setting from the configuration */
Unspecified = 0,
/** Force pruning on */
On = 1,
/** Force pruning off */
Off = 2
}
/** Valid modes for index and tree entries. */
export declare const enum FileMode {
/** Unreadable */
Unreadable = 0,
/** Tree */
Tree = 1,
/** Blob */
Blob = 2,
/** Group writable blob. Obsolete mode kept for compatibility reasons */
BlobGroupWritable = 3,
/** Blob executable */
BlobExecutable = 4,
/** Link */
Link = 5,
/** Commit */
Commit = 6
}
export declare const enum ObjectType {
/** Any kind of git object */
Any = 0,
/** An object which corresponds to a git commit */
Commit = 1,
/** An object which corresponds to a git tree */
Tree = 2,
/** An object which corresponds to a git blob */
Blob = 3,
/** An object which corresponds to a git tag */
Tag = 4
}
export interface Progress {
totalObjects: number
indexedObjects: number
receivedObjects: number
localObjects: number
totalDeltas: number
indexedDeltas: number
receivedBytes: number
}
export interface PushTransferProgress {
current: number
total: number
bytes: number
}
/** An enumeration of all possible kinds of references. */
export declare const enum ReferenceType {
/** A reference which points at an object id. */
Direct = 0,
/** A reference which points at another reference. */
Symbolic = 1,
Unknown = 2
}
/**
* Remote redirection settings; whether redirects to another host are
* permitted.
*
* By default, git will follow a redirect on the initial request
* (`/info/refs`), but not subsequent requests.
*/
export declare const enum RemoteRedirect {
/** Do not follow any off-site redirects at any stage of the fetch or push. */
None = 0,
/**
* Allow off-site redirects only upon the initial request. This is the
* default.
*/
Initial = 1,
/** Allow redirects at any stage in the fetch or push. */
All = 2
}
export declare const enum RemoteUpdateFlags {
UpdateFetchHead = 1,
ReportUnchanged = 2
}
export declare const enum RepositoryOpenFlags {
/** Only open the specified path; don't walk upward searching. */
NoSearch = 0,
/** Search across filesystem boundaries. */
CrossFS = 1,
/** Force opening as bare repository, and defer loading its config. */
Bare = 2,
/** Don't try appending `/.git` to the specified repository path. */
NoDotGit = 3,
/** Respect environment variables like `$GIT_DIR`. */
FromEnv = 4
}
export declare const enum RepositoryState {
Clean = 0,
Merge = 1,
Revert = 2,
RevertSequence = 3,
CherryPick = 4,
CherryPickSequence = 5,
Bisect = 6,
Rebase = 7,
RebaseInteractive = 8,
RebaseMerge = 9,
ApplyMailbox = 10,
ApplyMailboxOrRebase = 11
}
/** Orderings that may be specified for Revwalk iteration. */
export declare const enum Sort {
/**
* Sort the repository contents in no particular ordering.
*
* This sorting is arbitrary, implementation-specific, and subject to
* change at any time. This is the default sorting for new walkers.
*/
None = 0,
/**
* Sort the repository contents in topological order (children before
* parents).
*
* This sorting mode can be combined with time sorting.
* 1 << 0
*/
Topological = 1,
/**
* Sort the repository contents by commit time.
*
* This sorting mode can be combined with topological sorting.
* 1 << 1
*/
Time = 2,
/**
* Iterate through the repository contents in reverse order.
*
* This sorting mode can be combined with any others.
* 1 << 2
*/
Reverse = 4
}
+382
-301

@@ -1,309 +0,391 @@

/* tslint:disable */
// prettier-ignore
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { createRequire } = require('node:module')
require = createRequire(__filename)
const { platform, arch } = process
const { readFileSync } = require('node:fs')
let nativeBinding = null
let localFileExisted = false
let loadError = null
const loadErrors = []
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
const isMusl = () => {
let musl = false
if (process.platform === 'linux') {
musl = isMuslFromFilesystem()
if (musl === null) {
musl = isMuslFromReport()
}
if (musl === null) {
musl = isMuslFromChildProcess()
}
}
return musl
}
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
const isMuslFromFilesystem = () => {
try {
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
} catch {
return null
}
}
const isMuslFromReport = () => {
let report = null
if (typeof process.report?.getReport === 'function') {
process.report.excludeNetwork = true
report = process.report.getReport()
}
if (!report) {
return null
}
if (report.header && report.header.glibcVersionRuntime) {
return false
}
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) {
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
return false
}
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'simple-git.android-arm64.node'))
const isMuslFromChildProcess = () => {
try {
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
} catch (e) {
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
return false
}
}
function requireNative() {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
try {
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err)
}
} else if (process.platform === 'android') {
if (process.arch === 'arm64') {
try {
return require('./simple-git.android-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-android-arm64')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm') {
try {
return require('./simple-git.android-arm-eabi.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-android-arm-eabi')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
}
} else if (process.platform === 'win32') {
if (process.arch === 'x64') {
try {
return require('./simple-git.win32-x64-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-win32-x64-msvc')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'ia32') {
try {
return require('./simple-git.win32-ia32-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-win32-ia32-msvc')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./simple-git.win32-arm64-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-win32-arm64-msvc')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
}
} else if (process.platform === 'darwin') {
try {
return require('./simple-git.darwin-universal.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-darwin-universal')
} catch (e) {
loadErrors.push(e)
}
if (process.arch === 'x64') {
try {
return require('./simple-git.darwin-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-darwin-x64')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./simple-git.darwin-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-darwin-arm64')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
}
} else if (process.platform === 'freebsd') {
if (process.arch === 'x64') {
try {
return require('./simple-git.freebsd-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-freebsd-x64')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./simple-git.freebsd-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-freebsd-arm64')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
}
} else if (process.platform === 'linux') {
if (process.arch === 'x64') {
if (isMusl()) {
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.android-arm64.node')
} else {
nativeBinding = require('@napi-rs/simple-git-android-arm64')
}
return require('./simple-git.linux-x64-musl.node')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'simple-git.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.android-arm-eabi.node')
} else {
nativeBinding = require('@napi-rs/simple-git-android-arm-eabi')
}
return require('@napi-rs/simple-git-linux-x64-musl')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
}
break
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(
join(__dirname, 'simple-git.win32-x64-msvc.node')
)
} else {
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.win32-x64-msvc.node')
} else {
nativeBinding = require('@napi-rs/simple-git-win32-x64-msvc')
}
return require('./simple-git.linux-x64-gnu.node')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
case 'ia32':
localFileExisted = existsSync(
join(__dirname, 'simple-git.win32-ia32-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.win32-ia32-msvc.node')
} else {
nativeBinding = require('@napi-rs/simple-git-win32-ia32-msvc')
}
return require('@napi-rs/simple-git-linux-x64-gnu')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'simple-git.win32-arm64-msvc.node')
)
}
} else if (process.arch === 'arm64') {
if (isMusl()) {
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.win32-arm64-msvc.node')
} else {
nativeBinding = require('@napi-rs/simple-git-win32-arm64-msvc')
}
return require('./simple-git.linux-arm64-musl.node')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`)
}
break
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'simple-git.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.darwin-universal.node')
try {
return require('@napi-rs/simple-git-linux-arm64-musl')
} catch (e) {
loadErrors.push(e)
}
} else {
nativeBinding = require('@napi-rs/simple-git-darwin-universal')
try {
return require('./simple-git.linux-arm64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-linux-arm64-gnu')
} catch (e) {
loadErrors.push(e)
}
}
break
} catch {}
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'simple-git.darwin-x64.node'))
} else if (process.arch === 'arm') {
if (isMusl()) {
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.darwin-x64.node')
} else {
nativeBinding = require('@napi-rs/simple-git-darwin-x64')
}
return require('./simple-git.linux-arm-musleabihf.node')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'simple-git.darwin-arm64.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.darwin-arm64.node')
} else {
nativeBinding = require('@napi-rs/simple-git-darwin-arm64')
}
return require('@napi-rs/simple-git-linux-arm-musleabihf')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`)
}
break
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'simple-git.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.freebsd-x64.node')
} else {
nativeBinding = require('@napi-rs/simple-git-freebsd-x64')
}
} catch (e) {
loadError = e
}
break
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-x64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-x64-musl.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-x64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-x64-gnu.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-x64-gnu')
}
} catch (e) {
loadError = e
}
try {
return require('./simple-git.linux-arm-gnueabihf.node')
} catch (e) {
loadErrors.push(e)
}
break
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-arm64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-arm64-musl.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-arm64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-arm64-gnu.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-arm64-gnu')
}
} catch (e) {
loadError = e
}
try {
return require('@napi-rs/simple-git-linux-arm-gnueabihf')
} catch (e) {
loadErrors.push(e)
}
break
case 'arm':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
} else if (process.arch === 'riscv64') {
if (isMusl()) {
try {
return require('./simple-git.linux-riscv64-musl.node')
} catch (e) {
loadErrors.push(e)
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-riscv64-musl.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
try {
return require('@napi-rs/simple-git-linux-riscv64-musl')
} catch (e) {
loadErrors.push(e)
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'simple-git.linux-s390x-gnu.node')
)
} else {
try {
if (localFileExisted) {
nativeBinding = require('./simple-git.linux-s390x-gnu.node')
} else {
nativeBinding = require('@napi-rs/simple-git-linux-s390x-gnu')
}
return require('./simple-git.linux-riscv64-gnu.node')
} catch (e) {
loadError = e
loadErrors.push(e)
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
try {
return require('@napi-rs/simple-git-linux-riscv64-gnu')
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'ppc64') {
try {
return require('./simple-git.linux-ppc64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-linux-ppc64-gnu')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 's390x') {
try {
return require('./simple-git.linux-s390x-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-linux-s390x-gnu')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
}
break
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
} else if (process.platform === 'openharmony') {
if (process.arch === 'arm64') {
try {
return require('./simple-git.linux-arm64-ohos.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-linux-arm64-ohos')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'x64') {
try {
return require('./simple-git.linux-x64-ohos.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-linux-x64-ohos')
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm') {
try {
return require('./simple-git.linux-arm-ohos.node')
} catch (e) {
loadErrors.push(e)
}
try {
return require('@napi-rs/simple-git-linux-arm-ohos')
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
}
} else {
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
}
}
nativeBinding = requireNative()
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
try {
nativeBinding = require('./simple-git.wasi.cjs')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
loadErrors.push(err)
}
}
if (!nativeBinding) {
try {
nativeBinding = require('@napi-rs/simple-git-wasm32-wasi')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
loadErrors.push(err)
}
}
}
}
if (!nativeBinding) {
if (loadError) {
throw loadError
if (loadErrors.length > 0) {
throw new Error(
`Cannot find native binding. ` +
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
{ cause: loadErrors }
)
}

@@ -313,40 +395,39 @@ throw new Error(`Failed to load native binding`)

const { Blob, Commit, DiffFlags, FileMode, Deltas, DiffDelta, Delta, DiffFile, Diff, ObjectType, GitObject, Reference, ReferenceType, Direction, FetchPrune, AutotagOption, RemoteRedirect, CredentialType, RemoteUpdateFlags, Remote, RemoteCallbacks, FetchOptions, ProxyOptions, Cred, credTypeContains, RepositoryState, RepositoryOpenFlags, Repository, RepoBuilder, CloneLocal, Sort, RevWalk, Signature, Tag, Tree, TreeIter, TreeEntry } = nativeBinding
module.exports.Blob = Blob
module.exports.Commit = Commit
module.exports.DiffFlags = DiffFlags
module.exports.FileMode = FileMode
module.exports.Deltas = Deltas
module.exports.DiffDelta = DiffDelta
module.exports.Delta = Delta
module.exports.DiffFile = DiffFile
module.exports.Diff = Diff
module.exports.ObjectType = ObjectType
module.exports.GitObject = GitObject
module.exports.Reference = Reference
module.exports.ReferenceType = ReferenceType
module.exports.Direction = Direction
module.exports.FetchPrune = FetchPrune
module.exports.AutotagOption = AutotagOption
module.exports.RemoteRedirect = RemoteRedirect
module.exports.CredentialType = CredentialType
module.exports.RemoteUpdateFlags = RemoteUpdateFlags
module.exports.Remote = Remote
module.exports.RemoteCallbacks = RemoteCallbacks
module.exports.FetchOptions = FetchOptions
module.exports.ProxyOptions = ProxyOptions
module.exports.Cred = Cred
module.exports.credTypeContains = credTypeContains
module.exports.RepositoryState = RepositoryState
module.exports.RepositoryOpenFlags = RepositoryOpenFlags
module.exports.Repository = Repository
module.exports.RepoBuilder = RepoBuilder
module.exports.CloneLocal = CloneLocal
module.exports.Sort = Sort
module.exports.RevWalk = RevWalk
module.exports.Signature = Signature
module.exports.Tag = Tag
module.exports.Tree = Tree
module.exports.TreeIter = TreeIter
module.exports.TreeEntry = TreeEntry
module.exports = nativeBinding
module.exports.Blob = nativeBinding.Blob
module.exports.Commit = nativeBinding.Commit
module.exports.Cred = nativeBinding.Cred
module.exports.Deltas = nativeBinding.Deltas
module.exports.Diff = nativeBinding.Diff
module.exports.DiffDelta = nativeBinding.DiffDelta
module.exports.DiffFile = nativeBinding.DiffFile
module.exports.FetchOptions = nativeBinding.FetchOptions
module.exports.GitObject = nativeBinding.GitObject
module.exports.ProxyOptions = nativeBinding.ProxyOptions
module.exports.Reference = nativeBinding.Reference
module.exports.Remote = nativeBinding.Remote
module.exports.RemoteCallbacks = nativeBinding.RemoteCallbacks
module.exports.RepoBuilder = nativeBinding.RepoBuilder
module.exports.Repository = nativeBinding.Repository
module.exports.RevWalk = nativeBinding.RevWalk
module.exports.Signature = nativeBinding.Signature
module.exports.Tag = nativeBinding.Tag
module.exports.Tree = nativeBinding.Tree
module.exports.TreeEntry = nativeBinding.TreeEntry
module.exports.TreeIter = nativeBinding.TreeIter
module.exports.AutotagOption = nativeBinding.AutotagOption
module.exports.CloneLocal = nativeBinding.CloneLocal
module.exports.CredentialType = nativeBinding.CredentialType
module.exports.credTypeContains = nativeBinding.credTypeContains
module.exports.Delta = nativeBinding.Delta
module.exports.DiffFlags = nativeBinding.DiffFlags
module.exports.Direction = nativeBinding.Direction
module.exports.FetchPrune = nativeBinding.FetchPrune
module.exports.FileMode = nativeBinding.FileMode
module.exports.ObjectType = nativeBinding.ObjectType
module.exports.ReferenceType = nativeBinding.ReferenceType
module.exports.RemoteRedirect = nativeBinding.RemoteRedirect
module.exports.RemoteUpdateFlags = nativeBinding.RemoteUpdateFlags
module.exports.RepositoryOpenFlags = nativeBinding.RepositoryOpenFlags
module.exports.RepositoryState = nativeBinding.RepositoryState
module.exports.Sort = nativeBinding.Sort
{
"name": "@napi-rs/simple-git",
"version": "0.1.19",
"version": "0.1.20",
"main": "index.js",

@@ -10,18 +10,20 @@ "types": "./index.d.ts",

"napi": {
"name": "simple-git",
"triples": {
"additional": [
"aarch64-apple-darwin",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"powerpc64le-unknown-linux-gnu",
"s390x-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"armv7-linux-androideabi"
]
}
"binaryName": "simple-git",
"targets": [
"x86_64-pc-windows-msvc",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-gnu",
"i686-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"aarch64-apple-darwin",
"aarch64-linux-android",
"x86_64-unknown-freebsd",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-linux-androideabi",
"powerpc64le-unknown-linux-gnu",
"s390x-unknown-linux-gnu"
]
},

@@ -38,6 +40,6 @@ "ava": {

"devDependencies": {
"@napi-rs/cli": "^2.18.4",
"@types/node": "^20.12.7",
"ava": "^6.1.2",
"pretty-ms": "^9.0.0"
"@napi-rs/cli": "^3.0.1",
"@types/node": "^24.0.15",
"ava": "^6.4.1",
"pretty-ms": "^9.2.0"
},

@@ -55,19 +57,20 @@ "engines": {

},
"packageManager": "yarn@4.4.1",
"packageManager": "yarn@4.9.2",
"optionalDependencies": {
"@napi-rs/simple-git-win32-x64-msvc": "0.1.19",
"@napi-rs/simple-git-darwin-x64": "0.1.19",
"@napi-rs/simple-git-linux-x64-gnu": "0.1.19",
"@napi-rs/simple-git-darwin-arm64": "0.1.19",
"@napi-rs/simple-git-android-arm64": "0.1.19",
"@napi-rs/simple-git-linux-arm64-gnu": "0.1.19",
"@napi-rs/simple-git-linux-arm64-musl": "0.1.19",
"@napi-rs/simple-git-win32-arm64-msvc": "0.1.19",
"@napi-rs/simple-git-linux-powerpc64le-gnu": "0.1.19",
"@napi-rs/simple-git-linux-s390x-gnu": "0.1.19",
"@napi-rs/simple-git-linux-arm-gnueabihf": "0.1.19",
"@napi-rs/simple-git-linux-x64-musl": "0.1.19",
"@napi-rs/simple-git-freebsd-x64": "0.1.19",
"@napi-rs/simple-git-android-arm-eabi": "0.1.19"
"@napi-rs/simple-git-win32-x64-msvc": "0.1.20",
"@napi-rs/simple-git-darwin-x64": "0.1.20",
"@napi-rs/simple-git-linux-x64-gnu": "0.1.20",
"@napi-rs/simple-git-linux-x64-musl": "0.1.20",
"@napi-rs/simple-git-linux-arm64-gnu": "0.1.20",
"@napi-rs/simple-git-win32-ia32-msvc": "0.1.20",
"@napi-rs/simple-git-linux-arm-gnueabihf": "0.1.20",
"@napi-rs/simple-git-darwin-arm64": "0.1.20",
"@napi-rs/simple-git-android-arm64": "0.1.20",
"@napi-rs/simple-git-freebsd-x64": "0.1.20",
"@napi-rs/simple-git-linux-arm64-musl": "0.1.20",
"@napi-rs/simple-git-win32-arm64-msvc": "0.1.20",
"@napi-rs/simple-git-android-arm-eabi": "0.1.20",
"@napi-rs/simple-git-linux-ppc64-gnu": "0.1.20",
"@napi-rs/simple-git-linux-s390x-gnu": "0.1.20"
}
}