@napi-rs/simple-git
Advanced tools
Comparing version 0.1.7 to 0.1.8
144
index.d.ts
@@ -6,2 +6,35 @@ /* tslint:disable */ | ||
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 | ||
} | ||
/** An enumeration of all possible kinds of references. */ | ||
@@ -57,2 +90,50 @@ export const enum ReferenceType { | ||
} | ||
/** An iterator over the diffs in a delta */ | ||
export class Deltas { | ||
[Symbol.iterator](): Iterator<DiffDelta, void, void> | ||
} | ||
export class DiffDelta { | ||
/** Returns the number of files in this delta. */ | ||
numFiles(): number | ||
/** Returns the status of this entry */ | ||
status(): Delta | ||
/** | ||
* Return the file which represents the "from" side of the diff. | ||
* | ||
* What side this means depends on the function that was used to generate | ||
* the diff and will be documented on the function itself. | ||
*/ | ||
oldFile(): DiffFile | ||
/** | ||
* Return the file which represents the "to" side of the diff. | ||
* | ||
* What side this means depends on the function that was used to generate | ||
* the diff and will be documented on the function itself. | ||
*/ | ||
newFile(): DiffFile | ||
} | ||
export class DiffFile { | ||
/** | ||
* Returns the path, in bytes, of the entry relative to the working | ||
* directory of the repository. | ||
*/ | ||
path(): string | null | ||
} | ||
export 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 class Reference { | ||
@@ -93,3 +174,3 @@ /** | ||
*/ | ||
name(): string | undefined | null | ||
name(): string | null | ||
/** | ||
@@ -103,3 +184,3 @@ * Get the full shorthand of a reference. | ||
*/ | ||
shorthand(): string | undefined | null | ||
shorthand(): string | null | ||
/** | ||
@@ -111,3 +192,3 @@ * Get the OID pointed to by a direct reference. | ||
*/ | ||
target(): string | undefined | null | ||
target(): string | null | ||
/** | ||
@@ -119,4 +200,11 @@ * Return the peeled OID target of this reference. | ||
*/ | ||
targetPeel(): string | undefined | null | ||
targetPeel(): string | null | ||
/** | ||
* Peel a reference to a tree | ||
* | ||
* This method recursively peels the reference until it reaches | ||
* a tree. | ||
*/ | ||
peelToTree(): Tree | ||
/** | ||
* Get full name to the reference pointed to by a symbolic reference. | ||
@@ -127,3 +215,3 @@ * | ||
*/ | ||
symbolicTarget(): string | undefined | null | ||
symbolicTarget(): string | null | ||
/** | ||
@@ -158,3 +246,3 @@ * Resolve a symbolic reference to a direct reference. | ||
*/ | ||
name(): string | undefined | null | ||
name(): string | null | ||
/** | ||
@@ -165,3 +253,3 @@ * Get the remote's url. | ||
*/ | ||
url(): string | undefined | null | ||
url(): string | null | ||
/** | ||
@@ -172,3 +260,3 @@ * Get the remote's pushurl. | ||
*/ | ||
pushurl(): string | undefined | null | ||
pushurl(): string | null | ||
/** | ||
@@ -263,3 +351,3 @@ * Get the remote's default branch. | ||
*/ | ||
workdir(): string | undefined | null | ||
workdir(): string | null | ||
/** | ||
@@ -279,3 +367,3 @@ * Set the path to the working directory for this repository. | ||
*/ | ||
namespace(): string | undefined | null | ||
namespace(): string | null | ||
/** Set the active namespace for this repository. */ | ||
@@ -296,4 +384,40 @@ setNamespace(namespace: string): void | ||
remote(name: string): Remote | ||
/** Lookup a reference to one of the objects in a repository. */ | ||
findTree(oid: string): Tree | ||
/** | ||
* Create a diff between a tree and the working directory. | ||
* | ||
* The tree you provide will be used for the "old_file" side of the delta, | ||
* and the working directory will be used for the "new_file" side. | ||
* | ||
* This is not the same as `git diff <treeish>` or `git diff-index | ||
* <treeish>`. Those commands use information from the index, whereas this | ||
* function strictly returns the differences between the tree and the files | ||
* in the working directory, regardless of the state of the index. Use | ||
* `tree_to_workdir_with_index` to emulate those commands. | ||
* | ||
* To see difference between this and `tree_to_workdir_with_index`, | ||
* consider the example of a staged file deletion where the file has then | ||
* been put back into the working dir and further modified. The | ||
* tree-to-workdir diff for that file is 'modified', but `git diff` would | ||
* show status 'deleted' since there is a staged delete. | ||
* | ||
* If `None` is passed for `tree`, then an empty tree is used. | ||
*/ | ||
diffTreeToWorkdir(oldTree?: Tree | undefined | null): Diff | ||
/** | ||
* Create a diff between a tree and the working directory using index data | ||
* to account for staged deletes, tracked files, etc. | ||
* | ||
* This emulates `git diff <tree>` by diffing the tree to the index and | ||
* the index to the working directory and blending the results into a | ||
* single diff that includes staged deleted, etc. | ||
*/ | ||
diffTreeToWorkdirWithIndex(oldTree?: Tree | undefined | null): Diff | ||
getFileLatestModifiedDate(filepath: string): number | ||
getFileLatestModifiedDateAsync(filepath: string, signal?: AbortSignal | undefined | null): Promise<number> | ||
} | ||
export class Tree { | ||
/** Get the id (SHA1) of a repository object */ | ||
id(): string | ||
} |
@@ -239,4 +239,9 @@ const { existsSync, readFileSync } = require('fs') | ||
const { Reference, ReferenceType, Direction, Remote, RemoteCallbacks, FetchOptions, RepositoryState, RepositoryOpenFlags, Repository } = nativeBinding | ||
const { Deltas, DiffDelta, Delta, DiffFile, Diff, Reference, ReferenceType, Direction, Remote, RemoteCallbacks, FetchOptions, RepositoryState, RepositoryOpenFlags, Repository, Tree } = nativeBinding | ||
module.exports.Deltas = Deltas | ||
module.exports.DiffDelta = DiffDelta | ||
module.exports.Delta = Delta | ||
module.exports.DiffFile = DiffFile | ||
module.exports.Diff = Diff | ||
module.exports.Reference = Reference | ||
@@ -251,1 +256,2 @@ module.exports.ReferenceType = ReferenceType | ||
module.exports.Repository = Repository | ||
module.exports.Tree = Tree |
{ | ||
"name": "@napi-rs/simple-git", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"main": "index.js", | ||
@@ -31,5 +31,5 @@ "types": "./index.d.ts", | ||
"devDependencies": { | ||
"@napi-rs/cli": "^2.5.0", | ||
"@types/node": "^17.0.21", | ||
"ava": "^4.0.1", | ||
"@napi-rs/cli": "^2.8.0", | ||
"@types/node": "^17.0.31", | ||
"ava": "^4.2.0", | ||
"pretty-ms": "^7.0.1" | ||
@@ -50,14 +50,14 @@ }, | ||
"optionalDependencies": { | ||
"@napi-rs/simple-git-win32-x64-msvc": "0.1.7", | ||
"@napi-rs/simple-git-darwin-x64": "0.1.7", | ||
"@napi-rs/simple-git-linux-x64-gnu": "0.1.7", | ||
"@napi-rs/simple-git-darwin-arm64": "0.1.7", | ||
"@napi-rs/simple-git-android-arm64": "0.1.7", | ||
"@napi-rs/simple-git-linux-arm64-gnu": "0.1.7", | ||
"@napi-rs/simple-git-linux-arm64-musl": "0.1.7", | ||
"@napi-rs/simple-git-win32-arm64-msvc": "0.1.7", | ||
"@napi-rs/simple-git-linux-arm-gnueabihf": "0.1.7", | ||
"@napi-rs/simple-git-linux-x64-musl": "0.1.7", | ||
"@napi-rs/simple-git-android-arm-eabi": "0.1.7" | ||
"@napi-rs/simple-git-win32-x64-msvc": "0.1.8", | ||
"@napi-rs/simple-git-darwin-x64": "0.1.8", | ||
"@napi-rs/simple-git-linux-x64-gnu": "0.1.8", | ||
"@napi-rs/simple-git-darwin-arm64": "0.1.8", | ||
"@napi-rs/simple-git-android-arm64": "0.1.8", | ||
"@napi-rs/simple-git-linux-arm64-gnu": "0.1.8", | ||
"@napi-rs/simple-git-linux-arm64-musl": "0.1.8", | ||
"@napi-rs/simple-git-win32-arm64-msvc": "0.1.8", | ||
"@napi-rs/simple-git-linux-arm-gnueabihf": "0.1.8", | ||
"@napi-rs/simple-git-linux-x64-musl": "0.1.8", | ||
"@napi-rs/simple-git-android-arm-eabi": "0.1.8" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28423
656