es-git 0.2.0-next.119 → 0.2.0-next.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +123 -1
  2. package/index.js +3 -1
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -656,6 +656,33 @@ export interface IndexUpdateAllOptions {
656
656
  */
657
657
  onMatch?: (args: IndexOnMatchCallbackArgs) => number
658
658
  }
659
+ export interface AddMailmapEntryData {
660
+ realName?: string
661
+ realEmail?: string
662
+ replaceName?: string
663
+ replaceEmail: string
664
+ }
665
+ /**
666
+ * Create a mailmap from the contents of a string.
667
+ *
668
+ * The format of the string should follow the rules of the mailmap file:
669
+ * ```
670
+ * # Comment line (ignored)
671
+ * Seokju Me <seokju.me@toss.im> Seokju Na <seokju.me@gmail.com>
672
+ * ```
673
+ *
674
+ * @param {string} content - Content of the mailmap file
675
+ * @returns A new mailmap object
676
+ * @throws An error if operation failed
677
+ *
678
+ * @category Mailmap
679
+ *
680
+ * @signature
681
+ * ```ts
682
+ * function createMailmapFromBuffer(content: string): Mailmap;
683
+ * ```
684
+ */
685
+ export declare function createMailmapFromBuffer(content: string): Mailmap
659
686
  /**
660
687
  * - `Any` : Any kind of git object
661
688
  * - `Commit` : An object which corresponds to a git commit
@@ -2050,6 +2077,38 @@ export declare class Commit {
2050
2077
  * @returns `GitObject` that casted from this commit.
2051
2078
  */
2052
2079
  asObject(): GitObject
2080
+ /**
2081
+ * Get the author of this commit, using the mailmap to map it to the canonical name and email.
2082
+ *
2083
+ * @category Commit/Methods
2084
+ *
2085
+ * @signature
2086
+ * ```ts
2087
+ * class Commit {
2088
+ * authorWithMailmap(mailmap: Mailmap): Signature;
2089
+ * }
2090
+ * ```
2091
+ *
2092
+ * @param {Mailmap} mailmap - The mailmap to use for mapping
2093
+ * @returns Author signature of this commit with mapping applied
2094
+ */
2095
+ authorWithMailmap(mailmap: Mailmap): Signature
2096
+ /**
2097
+ * Get the committer of this commit, using the mailmap to map it to the canonical name and email.
2098
+ *
2099
+ * @category Commit/Methods
2100
+ *
2101
+ * @signature
2102
+ * ```ts
2103
+ * class Commit {
2104
+ * committerWithMailmap(mailmap: Mailmap): Signature;
2105
+ * }
2106
+ * ```
2107
+ *
2108
+ * @param {Mailmap} mailmap - The mailmap to use for mapping
2109
+ * @returns Committer signature of this commit with mapping applied
2110
+ */
2111
+ committerWithMailmap(mailmap: Mailmap): Signature
2053
2112
  }
2054
2113
  /** An iterator over the `ConfigEntry` values of a config. */
2055
2114
  export declare class ConfigEntries {
@@ -3138,6 +3197,54 @@ export declare class Index {
3138
3197
  export declare class IndexEntries {
3139
3198
  [Symbol.iterator](): Iterator<IndexEntry, void, void>
3140
3199
  }
3200
+ /** A wrapper around git2::Mailmap providing Node.js bindings */
3201
+ export declare class Mailmap {
3202
+ /**
3203
+ * Add a new Mailmap entry.
3204
+ *
3205
+ * Maps an author/committer (specified by `replace_name` and `replace_email`)
3206
+ * to the specified real name and email. The `replace_email` is required but
3207
+ * the other parameters can be null.
3208
+ *
3209
+ * If both `replace_name` and `replace_email` are provided, then the entry will
3210
+ * apply to those who match both. If only `replace_name` is provided,
3211
+ * it will apply to anyone with that name, regardless of email. If only
3212
+ * `replace_email` is provided, it will apply to anyone with that email,
3213
+ * regardless of name.
3214
+ *
3215
+ * @param {AddMailmapEntryData} entry - The mailmap entry data.
3216
+ * @returns {void}
3217
+ * @throws An error if the operation failed.
3218
+ *
3219
+ * @category Mailmap/Methods
3220
+ *
3221
+ * @signature
3222
+ * ```ts
3223
+ * class Mailmap {
3224
+ * addEntry(entry: AddMailmapEntryData): void;
3225
+ * }
3226
+ * ```
3227
+ */
3228
+ addEntry(entry: AddMailmapEntryData): void
3229
+ /**
3230
+ * Resolve a signature to its canonical form using a mailmap.
3231
+ *
3232
+ * Returns a new signature with the canonical name and email.
3233
+ *
3234
+ * @param {SignaturePayload} signature - Signature to resolve
3235
+ * @returns The resolved signature with canonical name and email
3236
+ *
3237
+ * @category Mailmap/Methods
3238
+ *
3239
+ * @signature
3240
+ * ```ts
3241
+ * class Mailmap {
3242
+ * resolveSignature(signature: SignaturePayload): Signature;
3243
+ * }
3244
+ * ```
3245
+ */
3246
+ resolveSignature(signature: SignaturePayload): Signature
3247
+ }
3141
3248
  /**
3142
3249
  * A class to represent a git [object][1].
3143
3250
  *
@@ -4007,7 +4114,7 @@ export declare class Repository {
4007
4114
  * @signature
4008
4115
  * ```ts
4009
4116
  * class Repository {
4010
- * addIgnoreRule(rules: string): boolean;
4117
+ * addIgnoreRule(rules: string): void;
4011
4118
  * }
4012
4119
  * ```
4013
4120
  *
@@ -4092,6 +4199,21 @@ export declare class Repository {
4092
4199
  * @returns The index file for this repository.
4093
4200
  */
4094
4201
  index(): Index
4202
+ /**
4203
+ * Gets this repository's mailmap.
4204
+ *
4205
+ * @category Repository/Methods
4206
+ *
4207
+ * @signature
4208
+ * ```ts
4209
+ * class Repository {
4210
+ * mailmap(): Mailmap | null;
4211
+ * }
4212
+ * ```
4213
+ *
4214
+ * @returns The mailmap object if it exists, null otherwise
4215
+ */
4216
+ mailmap(): Mailmap | null
4095
4217
  /**
4096
4218
  * Lookup a reference to one of the objects in a repository.
4097
4219
  *
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { Blame, BlameHunks, BlameHunksByLine, Blob, isValidBranchName, Branch, Branches, BranchType, Commit, ConfigLevel, ConfigEntries, Config, openConfig, openDefaultConfig, findGlobalConfigPath, findSystemConfigPath, findXdgConfigPath, parseConfigBool, parseConfigI32, parseConfigI64, DiffFlags, diffFlagsContains, DeltaType, DiffFormat, Diff, DiffStats, Deltas, DiffDelta, FileMode, DiffFile, IndexStage, Index, IndexEntries, ObjectType, GitObject, isValidOid, isZeroOid, zeroOid, hashObjectOid, hashFileOid, ReferenceType, Reference, isValidReferenceName, ReferenceFormat, normalizeReferenceName, Direction, CredentialType, FetchPrune, AutotagOption, RemoteRedirect, Remote, RepositoryState, RepositoryInitMode, Repository, initRepository, openRepository, discoverRepository, cloneRepository, RevparseMode, revparseModeContains, RevwalkSort, Revwalk, createSignature, StatusShow, Statuses, StatusesIter, StatusEntry, isValidTagName, Tag, TreeWalkMode, Tree, TreeIter, TreeEntry } = nativeBinding
313
+ const { Blame, BlameHunks, BlameHunksByLine, Blob, isValidBranchName, Branch, Branches, BranchType, Commit, ConfigLevel, ConfigEntries, Config, openConfig, openDefaultConfig, findGlobalConfigPath, findSystemConfigPath, findXdgConfigPath, parseConfigBool, parseConfigI32, parseConfigI64, DiffFlags, diffFlagsContains, DeltaType, DiffFormat, Diff, DiffStats, Deltas, DiffDelta, FileMode, DiffFile, IndexStage, Index, IndexEntries, Mailmap, createMailmapFromBuffer, ObjectType, GitObject, isValidOid, isZeroOid, zeroOid, hashObjectOid, hashFileOid, ReferenceType, Reference, isValidReferenceName, ReferenceFormat, normalizeReferenceName, Direction, CredentialType, FetchPrune, AutotagOption, RemoteRedirect, Remote, RepositoryState, RepositoryInitMode, Repository, initRepository, openRepository, discoverRepository, cloneRepository, RevparseMode, revparseModeContains, RevwalkSort, Revwalk, createSignature, StatusShow, Statuses, StatusesIter, StatusEntry, isValidTagName, Tag, TreeWalkMode, Tree, TreeIter, TreeEntry } = nativeBinding
314
314
 
315
315
  module.exports.Blame = Blame
316
316
  module.exports.BlameHunks = BlameHunks
@@ -345,6 +345,8 @@ module.exports.DiffFile = DiffFile
345
345
  module.exports.IndexStage = IndexStage
346
346
  module.exports.Index = Index
347
347
  module.exports.IndexEntries = IndexEntries
348
+ module.exports.Mailmap = Mailmap
349
+ module.exports.createMailmapFromBuffer = createMailmapFromBuffer
348
350
  module.exports.ObjectType = ObjectType
349
351
  module.exports.GitObject = GitObject
350
352
  module.exports.isValidOid = isValidOid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-git",
3
- "version": "0.2.0-next.119+1d63da8",
3
+ "version": "0.2.0-next.121+1a7c34b",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -57,15 +57,15 @@
57
57
  "vitest": "^3.0.5"
58
58
  },
59
59
  "optionalDependencies": {
60
- "es-git-darwin-x64": "0.2.0-next.119+1d63da8",
61
- "es-git-darwin-arm64": "0.2.0-next.119+1d63da8",
62
- "es-git-win32-x64-msvc": "0.2.0-next.119+1d63da8",
63
- "es-git-win32-arm64-msvc": "0.2.0-next.119+1d63da8",
64
- "es-git-linux-x64-gnu": "0.2.0-next.119+1d63da8",
65
- "es-git-linux-x64-musl": "0.2.0-next.119+1d63da8",
66
- "es-git-android-arm64": "0.2.0-next.119+1d63da8",
67
- "es-git-linux-arm64-gnu": "0.2.0-next.119+1d63da8",
68
- "es-git-linux-arm64-musl": "0.2.0-next.119+1d63da8",
69
- "es-git-android-arm-eabi": "0.2.0-next.119+1d63da8"
60
+ "es-git-darwin-x64": "0.2.0-next.121+1a7c34b",
61
+ "es-git-darwin-arm64": "0.2.0-next.121+1a7c34b",
62
+ "es-git-win32-x64-msvc": "0.2.0-next.121+1a7c34b",
63
+ "es-git-win32-arm64-msvc": "0.2.0-next.121+1a7c34b",
64
+ "es-git-linux-x64-gnu": "0.2.0-next.121+1a7c34b",
65
+ "es-git-linux-x64-musl": "0.2.0-next.121+1a7c34b",
66
+ "es-git-android-arm64": "0.2.0-next.121+1a7c34b",
67
+ "es-git-linux-arm64-gnu": "0.2.0-next.121+1a7c34b",
68
+ "es-git-linux-arm64-musl": "0.2.0-next.121+1a7c34b",
69
+ "es-git-android-arm-eabi": "0.2.0-next.121+1a7c34b"
70
70
  }
71
71
  }