es-git 0.2.0-next.114 → 0.2.0-next.115

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 +279 -0
  2. package/index.js +5 -1
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -1442,6 +1442,66 @@ export interface SignaturePayload {
1442
1442
  email: string
1443
1443
  timeOptions?: SignatureTimeOptions
1444
1444
  }
1445
+ export interface Status {
1446
+ current: boolean
1447
+ indexNew: boolean
1448
+ indexModified: boolean
1449
+ indexDeleted: boolean
1450
+ indexRenamed: boolean
1451
+ indexTypechange: boolean
1452
+ wtNew: boolean
1453
+ wtModified: boolean
1454
+ wtDeleted: boolean
1455
+ wtTypechange: boolean
1456
+ wtRenamed: boolean
1457
+ ignored: boolean
1458
+ conflicted: boolean
1459
+ }
1460
+ /**
1461
+ * - `Index` : Only gives status based on HEAD to index comparison, not looking at
1462
+ * working directory changes.
1463
+ * - `Workdir` : Only gives status based on index to working directory comparison, not
1464
+ * comparing the index to the HEAD.
1465
+ * - `IndexAndWorkdi` : The default, this roughly matches `git status --porcelain` regarding
1466
+ * which files are included and in what order.
1467
+ */
1468
+ export type StatusShow = 'Index' | 'Workdir' | 'IndexAndWorkdir';
1469
+ export interface StatusOptions {
1470
+ /**
1471
+ * Select the files on which to report status.
1472
+ * The default, if unspecified, is to show the index and the working directory.
1473
+ */
1474
+ show?: StatusShow
1475
+ /**
1476
+ * Path patterns to match (using fnmatch-style matching).
1477
+ * If the `disablePathspecMatch` option is given, then this is a literal
1478
+ * path to match. If this is not called, then there will be no patterns to
1479
+ * match and the entire directory will be used.
1480
+ */
1481
+ pathspecs?: Array<string>
1482
+ /**
1483
+ * Flag whether untracked files will be included.
1484
+ * Untracked files will only be included if the workdir files are included
1485
+ * in the status "show" option.
1486
+ */
1487
+ includeUntracked?: boolean
1488
+ includeIgnored?: boolean
1489
+ includeUnmodified?: boolean
1490
+ excludeSubmodules?: boolean
1491
+ recurseUntrackedDirs?: boolean
1492
+ disablePathspecMatch?: boolean
1493
+ recurseIgnoredDirs?: boolean
1494
+ renamesHeadToIndex?: boolean
1495
+ renamesIndexToWorkdir?: boolean
1496
+ sortCaseSensitively?: boolean
1497
+ sortCaseInsensitively?: boolean
1498
+ renamesFromRewrites?: boolean
1499
+ noRefresh?: boolean
1500
+ updateIndex?: boolean
1501
+ includeUnreadable?: boolean
1502
+ includeUnreadableAsUntracked?: boolean
1503
+ renameThreshold?: number
1504
+ }
1445
1505
  /**
1446
1506
  * Determine whether a tag name is valid, meaning that (when prefixed with refs/tags/) that
1447
1507
  * it is a valid reference name, and that any additional tag name restrictions are imposed
@@ -4314,6 +4374,108 @@ export declare class Repository {
4314
4374
  * @returns Revwalk to traverse the commit graph in this repository.
4315
4375
  */
4316
4376
  revwalk(): Revwalk
4377
+ /**
4378
+ * Test if the ignore rules apply to a given file.
4379
+ *
4380
+ * This function checks the ignore rules to see if they would apply to the
4381
+ * given file. This indicates if the file would be ignored regardless of
4382
+ * whether the file is already in the index or committed to the repository.
4383
+ *
4384
+ * One way to think of this is if you were to do "git add ." on the
4385
+ * directory containing the file, would it be added or not?
4386
+ *
4387
+ * @category Repository/Methods
4388
+ * @signature
4389
+ * ```ts
4390
+ * class Repository {
4391
+ * statusShouldIgnore(path: string): boolean;
4392
+ * }
4393
+ * ```
4394
+ *
4395
+ * @param {string} path - A given file path.
4396
+ * @returns Returns `true` if the ignore rules apply to a given file.
4397
+ */
4398
+ statusShouldIgnore(path: string): boolean
4399
+ /**
4400
+ * Get file status for a single file.
4401
+ *
4402
+ * This tries to get status for the filename that you give. If no files
4403
+ * match that name (in either the HEAD, index, or working directory), this
4404
+ * returns NotFound.
4405
+ *
4406
+ * If the name matches multiple files (for example, if the path names a
4407
+ * directory or if running on a case- insensitive filesystem and yet the
4408
+ * HEAD has two entries that both match the path), then this returns
4409
+ * Ambiguous because it cannot give correct results.
4410
+ *
4411
+ * This does not do any sort of rename detection. Renames require a set of
4412
+ * targets and because of the path filtering, there is not enough
4413
+ * information to check renames correctly. To check file status with rename
4414
+ * detection, there is no choice but to do a full `statuses` and scan
4415
+ * through looking for the path that you are interested in.
4416
+ *
4417
+ * @category Repository/Methods
4418
+ * @signature
4419
+ * ```ts
4420
+ * class Repository {
4421
+ * getStatusFile(path: string): Status;
4422
+ * }
4423
+ * ```
4424
+ *
4425
+ * @param {string} path - A single file path.
4426
+ * @returns The `Status` of this single file.
4427
+ * @throws Throws error if the status file does not exist.
4428
+ */
4429
+ getStatusFile(path: string): Status
4430
+ /**
4431
+ * Get file status for a single file.
4432
+ *
4433
+ * This tries to get status for the filename that you give. If no files
4434
+ * match that name (in either the HEAD, index, or working directory), this
4435
+ * returns NotFound.
4436
+ *
4437
+ * If the name matches multiple files (for example, if the path names a
4438
+ * directory or if running on a case- insensitive filesystem and yet the
4439
+ * HEAD has two entries that both match the path), then this returns
4440
+ * Ambiguous because it cannot give correct results.
4441
+ *
4442
+ * This does not do any sort of rename detection. Renames require a set of
4443
+ * targets and because of the path filtering, there is not enough
4444
+ * information to check renames correctly. To check file status with rename
4445
+ * detection, there is no choice but to do a full `statuses` and scan
4446
+ * through looking for the path that you are interested in.
4447
+ *
4448
+ * @category Repository/Methods
4449
+ * @signature
4450
+ * ```ts
4451
+ * class Repository {
4452
+ * findStatusFile(path: string): Status | null;
4453
+ * }
4454
+ * ```
4455
+ *
4456
+ * @param {string} path - A single file path.
4457
+ * @returns The `Status` of this single file. If the status file does not exists, returns `null`.
4458
+ */
4459
+ findStatusFile(path: string): Status | null
4460
+ /**
4461
+ * Gather file status information and populate the returned structure.
4462
+ *
4463
+ * Note that if a pathspec is given in the options to filter the
4464
+ * status, then the results from rename detection (if you enable it) may
4465
+ * not be accurate. To do rename detection properly, this must be called
4466
+ * with no pathspec so that all files can be considered.
4467
+ *
4468
+ * @category Repository/Methods
4469
+ * @signature
4470
+ * ```ts
4471
+ * class Repository {
4472
+ * statuses(): Statuses;
4473
+ * }
4474
+ * ```
4475
+ *
4476
+ * @returns A container for a list of status information about a repository.
4477
+ */
4478
+ statuses(): Statuses
4317
4479
  /**
4318
4480
  * Lookup a tag object by prefix hash from the repository.
4319
4481
  *
@@ -4759,6 +4921,123 @@ export declare class Revwalk {
4759
4921
  */
4760
4922
  hideRef(reference: string): this
4761
4923
  }
4924
+ /**
4925
+ * A container for a list of status information about a repository.
4926
+ *
4927
+ * Each instance appears as if it were a collection, having a length and
4928
+ * allowing indexing, as well as providing an iterator.
4929
+ */
4930
+ export declare class Statuses {
4931
+ /**
4932
+ * Gets a status entry from this list at the specified index.
4933
+ *
4934
+ * @category Status/Statuses
4935
+ * @signature
4936
+ * ```ts
4937
+ * class Statuses {
4938
+ * get(index: number): StatusEntry | null;
4939
+ * }
4940
+ * ```
4941
+ *
4942
+ * @param {number} index - Index of the status entry to get.
4943
+ * @returns A status entry from this list at the specified index. Returns `null` if the status
4944
+ * entry does not exist.
4945
+ */
4946
+ get(index: number): StatusEntry | null
4947
+ /**
4948
+ * Gets the count of status entries in this list.
4949
+ *
4950
+ * @category Status/Statuses
4951
+ * @signature
4952
+ * ```ts
4953
+ * class Statuses {
4954
+ * len(): number;
4955
+ * }
4956
+ * ```
4957
+ *
4958
+ * @returns If there are no changes in status (according to the options given
4959
+ * when the status list was created), this should return 0.
4960
+ */
4961
+ len(): bigint
4962
+ /**
4963
+ * @category Status/Statuses
4964
+ * @signature
4965
+ * ```ts
4966
+ * class Statuses {
4967
+ * isEmpty(): boolean;
4968
+ * }
4969
+ * ```
4970
+ *
4971
+ * @returns Return `true` if there is no status entry in this list.
4972
+ */
4973
+ isEmpty(): boolean
4974
+ /** Returns an iterator over the statuses in this list. */
4975
+ iter(): StatusesIter
4976
+ }
4977
+ export declare class StatusesIter {
4978
+ [Symbol.iterator](): Iterator<StatusEntry, void, void>
4979
+ }
4980
+ /** A structure representing an entry in the `Statuses` structure. */
4981
+ export declare class StatusEntry {
4982
+ /**
4983
+ * Access this entry's path name as a string.
4984
+ *
4985
+ * @category Status/StatusEntry
4986
+ * @signature
4987
+ * ```ts
4988
+ * class StatusEntry {
4989
+ * path(): string;
4990
+ * }
4991
+ * ```
4992
+ *
4993
+ * @returns The path of this entry.
4994
+ */
4995
+ path(): string
4996
+ /**
4997
+ * Access the status for this file.
4998
+ *
4999
+ * @category Status/StatusEntry
5000
+ * @signature
5001
+ * ```ts
5002
+ * class StatusEntry {
5003
+ * status(): Status;
5004
+ * }
5005
+ * ```
5006
+ *
5007
+ * @returns Status data for this entry.
5008
+ */
5009
+ status(): Status
5010
+ /**
5011
+ * Access detailed information about the differences between the file in
5012
+ * `HEAD` and the file in the index.
5013
+ *
5014
+ * @category Status/StatusEntry
5015
+ * @signature
5016
+ * ```ts
5017
+ * class StatusEntry {
5018
+ * headToIndex(): DiffDelta | null;
5019
+ * }
5020
+ * ```
5021
+ *
5022
+ * @returns The differences between the file in `HEAD` and the file in the index.
5023
+ */
5024
+ headToIndex(): DiffDelta | null
5025
+ /**
5026
+ * Access detailed information about the differences between the file in
5027
+ * the index and the file in the working directory.
5028
+ *
5029
+ * @category Status/StatusEntry
5030
+ * @signature
5031
+ * ```ts
5032
+ * class StatusEntry {
5033
+ * indexToWorkdir(): DiffDelta | null;
5034
+ * }
5035
+ * ```
5036
+ *
5037
+ * @returns Differences between the file in the index and the file in the working directory.
5038
+ */
5039
+ indexToWorkdir(): DiffDelta | null
5040
+ }
4762
5041
  /**
4763
5042
  * A class to represent a git [tag][1].
4764
5043
  *
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, 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, 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
@@ -375,6 +375,10 @@ module.exports.revparseModeContains = revparseModeContains
375
375
  module.exports.RevwalkSort = RevwalkSort
376
376
  module.exports.Revwalk = Revwalk
377
377
  module.exports.createSignature = createSignature
378
+ module.exports.StatusShow = StatusShow
379
+ module.exports.Statuses = Statuses
380
+ module.exports.StatusesIter = StatusesIter
381
+ module.exports.StatusEntry = StatusEntry
378
382
  module.exports.isValidTagName = isValidTagName
379
383
  module.exports.Tag = Tag
380
384
  module.exports.TreeWalkMode = TreeWalkMode
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-git",
3
- "version": "0.2.0-next.114+458013d",
3
+ "version": "0.2.0-next.115+0a7a680",
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.114+458013d",
61
- "es-git-darwin-arm64": "0.2.0-next.114+458013d",
62
- "es-git-win32-x64-msvc": "0.2.0-next.114+458013d",
63
- "es-git-win32-arm64-msvc": "0.2.0-next.114+458013d",
64
- "es-git-linux-x64-gnu": "0.2.0-next.114+458013d",
65
- "es-git-linux-x64-musl": "0.2.0-next.114+458013d",
66
- "es-git-android-arm64": "0.2.0-next.114+458013d",
67
- "es-git-linux-arm64-gnu": "0.2.0-next.114+458013d",
68
- "es-git-linux-arm64-musl": "0.2.0-next.114+458013d",
69
- "es-git-android-arm-eabi": "0.2.0-next.114+458013d"
60
+ "es-git-darwin-x64": "0.2.0-next.115+0a7a680",
61
+ "es-git-darwin-arm64": "0.2.0-next.115+0a7a680",
62
+ "es-git-win32-x64-msvc": "0.2.0-next.115+0a7a680",
63
+ "es-git-win32-arm64-msvc": "0.2.0-next.115+0a7a680",
64
+ "es-git-linux-x64-gnu": "0.2.0-next.115+0a7a680",
65
+ "es-git-linux-x64-musl": "0.2.0-next.115+0a7a680",
66
+ "es-git-android-arm64": "0.2.0-next.115+0a7a680",
67
+ "es-git-linux-arm64-gnu": "0.2.0-next.115+0a7a680",
68
+ "es-git-linux-arm64-musl": "0.2.0-next.115+0a7a680",
69
+ "es-git-android-arm-eabi": "0.2.0-next.115+0a7a680"
70
70
  }
71
71
  }