workspace-tools 0.41.1 → 0.41.3

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 (59) hide show
  1. package/lib/dependencies/index.js +7 -0
  2. package/lib/dependencies/index.js.map +1 -1
  3. package/lib/dependencies/transitiveDeps.js +5 -0
  4. package/lib/dependencies/transitiveDeps.js.map +1 -1
  5. package/lib/getPackageInfo.js +4 -0
  6. package/lib/getPackageInfo.js.map +1 -1
  7. package/lib/getPackageInfos.js +4 -0
  8. package/lib/getPackageInfos.js.map +1 -1
  9. package/lib/git/getDefaultRemote.js +1 -1
  10. package/lib/git/getDefaultRemote.js.map +1 -1
  11. package/lib/git/getRepositoryName.js +1 -1
  12. package/lib/git/getRepositoryName.js.map +1 -1
  13. package/lib/git/git.js +8 -0
  14. package/lib/git/git.js.map +1 -1
  15. package/lib/git/gitUtilities.js +27 -0
  16. package/lib/git/gitUtilities.js.map +1 -1
  17. package/lib/git/index.js +10 -0
  18. package/lib/git/index.js.map +1 -1
  19. package/lib/graph/index.js +1 -0
  20. package/lib/graph/index.js.map +1 -1
  21. package/lib/index.js +39 -0
  22. package/lib/index.js.map +1 -1
  23. package/lib/isCachingEnabled.js +4 -0
  24. package/lib/isCachingEnabled.js.map +1 -1
  25. package/lib/lockfile/parseLockFile.js +1 -1
  26. package/lib/lockfile/parseLockFile.js.map +1 -1
  27. package/lib/lockfile/readYaml.js +1 -1
  28. package/lib/lockfile/readYaml.js.map +1 -1
  29. package/lib/paths.js +9 -2
  30. package/lib/paths.js.map +1 -1
  31. package/lib/workspaces/getAllPackageJsonFiles.js +5 -0
  32. package/lib/workspaces/getAllPackageJsonFiles.js.map +1 -1
  33. package/lib/workspaces/getCatalogVersion.js +4 -0
  34. package/lib/workspaces/getCatalogVersion.js.map +1 -1
  35. package/lib/workspaces/getCatalogs.js +2 -2
  36. package/lib/workspaces/getCatalogs.js.map +1 -1
  37. package/lib/workspaces/getChangedPackages.js +10 -6
  38. package/lib/workspaces/getChangedPackages.js.map +1 -1
  39. package/lib/workspaces/getWorkspaceInfos.js +4 -0
  40. package/lib/workspaces/getWorkspaceInfos.js.map +1 -1
  41. package/lib/workspaces/getWorkspaceManagerRoot.js +2 -2
  42. package/lib/workspaces/getWorkspaceManagerRoot.js.map +1 -1
  43. package/lib/workspaces/getWorkspacePackagePaths.js +6 -2
  44. package/lib/workspaces/getWorkspacePackagePaths.js.map +1 -1
  45. package/lib/workspaces/getWorkspacePatterns.js +2 -2
  46. package/lib/workspaces/getWorkspacePatterns.js.map +1 -1
  47. package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js +5 -0
  48. package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js.map +1 -1
  49. package/lib/workspaces/implementations/getWorkspaceUtilities.js +5 -5
  50. package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
  51. package/lib/workspaces/implementations/index.js +4 -0
  52. package/lib/workspaces/implementations/index.js.map +1 -1
  53. package/lib/workspaces/implementations/lerna.js +3 -3
  54. package/lib/workspaces/implementations/lerna.js.map +1 -1
  55. package/lib/workspaces/wrapWorkspaceUtility.d.ts +1 -1
  56. package/lib/workspaces/wrapWorkspaceUtility.js +7 -3
  57. package/lib/workspaces/wrapWorkspaceUtility.js.map +1 -1
  58. package/package.json +2 -2
  59. package/lib/tsdoc-metadata.json +0 -11
@@ -2,6 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ 0 && (module.exports = {
6
+ getInternalDeps: null,
7
+ getTransitiveConsumers: null,
8
+ getTransitiveDependencies: null,
9
+ getTransitiveDependents: null,
10
+ getTransitiveProviders: null
11
+ });
5
12
  function _export(target, all) {
6
13
  for(var name in all)Object.defineProperty(target, name, {
7
14
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/dependencies/index.ts"],"sourcesContent":["import { getTransitiveConsumers, getTransitiveProviders } from \"./transitiveDeps.js\";\nimport { getPackageDependencies } from \"../graph/getPackageDependencies.js\";\n\n// Some deprecated functions below for backwards compatibility\n\nexport const getTransitiveDependencies = getTransitiveProviders;\n\nexport { getTransitiveProviders };\n\nexport const getTransitiveDependents = getTransitiveConsumers;\n\nexport { getTransitiveConsumers };\n\n/** @deprecated Do not use */\nexport const getInternalDeps = getPackageDependencies;\n"],"names":["getInternalDeps","getTransitiveConsumers","getTransitiveDependencies","getTransitiveDependents","getTransitiveProviders","getPackageDependencies"],"mappings":";;;;;;;;;;;QAcaA;eAAAA;;QAHJC;eAAAA,sCAAsB;;QANlBC;eAAAA;;QAIAC;eAAAA;;QAFJC;eAAAA,sCAAsB;;;gCAPgC;wCACxB;AAIhC,MAAMF,4BAA4BE,sCAAsB;AAIxD,MAAMD,0BAA0BF,sCAAsB;AAKtD,MAAMD,kBAAkBK,8CAAsB"}
1
+ {"version":3,"sources":["../../src/dependencies/index.ts"],"sourcesContent":["import { getTransitiveConsumers, getTransitiveProviders } from \"./transitiveDeps.js\";\nimport { getPackageDependencies } from \"../graph/getPackageDependencies.js\";\n\n// Some deprecated functions below for backwards compatibility\n\nexport const getTransitiveDependencies = getTransitiveProviders;\n\nexport { getTransitiveProviders };\n\nexport const getTransitiveDependents = getTransitiveConsumers;\n\nexport { getTransitiveConsumers };\n\n/** @deprecated Do not use */\nexport const getInternalDeps = getPackageDependencies;\n"],"names":["getInternalDeps","getTransitiveConsumers","getTransitiveDependencies","getTransitiveDependents","getTransitiveProviders","getPackageDependencies"],"mappings":";;;;;;;;;;;;;;;;;;QAcaA;eAAAA;;QAHJC;eAAAA,sCAAsB;;QANlBC;eAAAA;;QAIAC;eAAAA;;QAFJC;eAAAA,sCAAsB;;;gCAPgC;wCACxB;AAIhC,MAAMF,4BAA4BE,sCAAsB;AAIxD,MAAMD,0BAA0BF,sCAAsB;AAKtD,MAAMD,kBAAkBK,8CAAsB"}
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ 0 && (module.exports = {
6
+ getDependentMap: null,
7
+ getTransitiveConsumers: null,
8
+ getTransitiveProviders: null
9
+ });
5
10
  function _export(target, all) {
6
11
  for(var name in all)Object.defineProperty(target, name, {
7
12
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/dependencies/transitiveDeps.ts"],"sourcesContent":["import { type PackageInfos } from \"../types/PackageInfo.js\";\nimport { getPackageDependencies } from \"../graph/getPackageDependencies.js\";\nimport { isCachingEnabled } from \"../isCachingEnabled.js\";\n\nconst graphCache = new Map<string, [string | null, string][]>();\n\nfunction memoizedKey(packages: PackageInfos, scope: string[] = []) {\n return JSON.stringify({ packages, scope });\n}\n\nfunction getPackageGraph(packages: PackageInfos, scope: string[] = []) {\n const internalPackages = new Set(Object.keys(packages));\n const key = memoizedKey(packages, scope);\n\n if (isCachingEnabled() && graphCache.has(key)) {\n return graphCache.get(key)!;\n }\n\n const edges: [string | null, string][] = [];\n\n const visited = new Set<string>();\n const stack: string[] = scope.length > 0 ? [...scope] : Object.keys(packages);\n\n while (stack.length > 0) {\n const pkg = stack.pop()!;\n\n if (visited.has(pkg)) {\n continue;\n }\n\n visited.add(pkg);\n\n const info = packages[pkg];\n const deps = getPackageDependencies(info, internalPackages);\n\n if (deps.length > 0) {\n for (const dep of deps) {\n stack.push(dep);\n edges.push([dep, pkg]);\n }\n } else {\n edges.push([null, pkg]);\n }\n }\n\n graphCache.set(key, edges);\n\n return edges;\n}\n\nexport function getDependentMap(packages: PackageInfos): Map<string, Set<string>> {\n const graph = getPackageGraph(packages);\n const map = new Map<string, Set<string>>();\n for (const [from, to] of graph) {\n if (!map.has(to)) {\n map.set(to, new Set());\n }\n\n if (from) {\n map.get(to)!.add(from);\n }\n }\n\n return map;\n}\n\n/**\n * For a package graph of `a->b->c` (where `b` depends on `a`), transitive consumers of `a` are `b` & `c`\n * and their consumers (or what are the consequences of `a`)\n * @deprecated Do not use\n */\nexport function getTransitiveConsumers(targets: string[], packages: PackageInfos, scope: string[] = []): string[] {\n const graph = getPackageGraph(packages, scope);\n const pkgQueue: string[] = [...targets];\n const visited = new Set<string>();\n\n while (pkgQueue.length > 0) {\n const pkg = pkgQueue.shift()!;\n\n if (!visited.has(pkg)) {\n visited.add(pkg);\n\n for (const [from, to] of graph) {\n if (from === pkg) {\n pkgQueue.push(to);\n }\n }\n }\n }\n\n return [...visited].filter((pkg) => !targets.includes(pkg));\n}\n\n/**\n * For a package graph of `a->b->c` (where `b` depends on `a`), transitive providers of `c` are `a` & `b`\n * and their providers (or what is needed to satisfy `c`)\n *\n * @deprecated Do not use\n */\nexport function getTransitiveProviders(targets: string[], packages: PackageInfos): string[] {\n const graph = getPackageGraph(packages);\n const pkgQueue: string[] = [...targets];\n const visited = new Set<string>();\n\n while (pkgQueue.length > 0) {\n const pkg = pkgQueue.shift()!;\n\n if (!visited.has(pkg)) {\n visited.add(pkg);\n\n for (const [from, to] of graph) {\n if (to === pkg && from) {\n pkgQueue.push(from);\n }\n }\n }\n }\n\n return [...visited].filter((pkg) => !targets.includes(pkg));\n}\n"],"names":["getDependentMap","getTransitiveConsumers","getTransitiveProviders","graphCache","Map","memoizedKey","packages","scope","JSON","stringify","getPackageGraph","internalPackages","Set","Object","keys","key","isCachingEnabled","has","get","edges","visited","stack","length","pkg","pop","add","info","deps","getPackageDependencies","dep","push","set","graph","map","from","to","targets","pkgQueue","shift","filter","includes"],"mappings":";;;;;;;;;;;QAkDgBA;eAAAA;;QAqBAC;eAAAA;;QA4BAC;eAAAA;;;wCAlGuB;kCACN;AAEjC,MAAMC,aAAa,IAAIC;AAEvB,SAASC,YAAYC,QAAsB,EAAEC,QAAkB,EAAE;IAC/D,OAAOC,KAAKC,SAAS,CAAC;QAAEH;QAAUC;IAAM;AAC1C;AAEA,SAASG,gBAAgBJ,QAAsB,EAAEC,QAAkB,EAAE;IACnE,MAAMI,mBAAmB,IAAIC,IAAIC,OAAOC,IAAI,CAACR;IAC7C,MAAMS,MAAMV,YAAYC,UAAUC;IAElC,I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;KAAQ;IACvC,MAAMhB,UAAU,IAAIR;IAEpB,MAAOyB,SAASf,MAAM,GAAG,EAAG;QAC1B,MAAMC,MAAMc,SAASC,KAAK;QAE1B,IAAI,CAAClB,QAAQH,GAAG,CAACM,MAAM;YACrBH,QAAQK,GAAG,CAACF;YAEZ,KAAK,MAAM,CAACW,MAAMC,GAAG,IAAIH,MAAO;gBAC9B,IAAIE,SAASX,KAAK;oBAChBc,SAASP,IAAI,CAACK;gBAChB;YACF;QACF;IACF;IAEA,OAAO;WAAIf;KAAQ,CAACmB,MAAM,CAAC,CAAChB,MAAQ,CAACa,QAAQI,QAAQ,CAACjB;AACxD;AAQO,SAASrB,uBAAuBkC,OAAiB,EAAE9B,QAAsB;IAC9E,MAAM0B,QAAQtB,gBAAgBJ;IAC9B,MAAM+B,WAAqB;WAAID;KAAQ;IACvC,MAAMhB,UAAU,IAAIR;IAEpB,MAAOyB,SAASf,MAAM,GAAG,EAAG;QAC1B,MAAMC,MAAMc,SAASC,KAAK;QAE1B,IAAI,CAAClB,QAAQH,GAAG,CAACM,MAAM;YACrBH,QAAQK,GAAG,CAACF;YAEZ,KAAK,MAAM,CAACW,MAAMC,GAAG,IAAIH,MAAO;gBAC9B,IAAIG,OAAOZ,OAAOW,MAAM;oBACtBG,SAASP,IAAI,CAACI;gBAChB;YACF;QACF;IACF;IAEA,OAAO;WAAId;KAAQ,CAACmB,MAAM,CAAC,CAAChB,MAAQ,CAACa,QAAQI,QAAQ,CAACjB;AACxD"}
1
+ {"version":3,"sources":["../../src/dependencies/transitiveDeps.ts"],"sourcesContent":["import { type PackageInfos } from \"../types/PackageInfo.js\";\nimport { getPackageDependencies } from \"../graph/getPackageDependencies.js\";\nimport { isCachingEnabled } from \"../isCachingEnabled.js\";\n\nconst graphCache = new Map<string, [string | null, string][]>();\n\nfunction memoizedKey(packages: PackageInfos, scope: string[] = []) {\n return JSON.stringify({ packages, scope });\n}\n\nfunction getPackageGraph(packages: PackageInfos, scope: string[] = []) {\n const internalPackages = new Set(Object.keys(packages));\n const key = memoizedKey(packages, scope);\n\n if (isCachingEnabled() && graphCache.has(key)) {\n return graphCache.get(key)!;\n }\n\n const edges: [string | null, string][] = [];\n\n const visited = new Set<string>();\n const stack: string[] = scope.length > 0 ? [...scope] : Object.keys(packages);\n\n while (stack.length > 0) {\n const pkg = stack.pop()!;\n\n if (visited.has(pkg)) {\n continue;\n }\n\n visited.add(pkg);\n\n const info = packages[pkg];\n const deps = getPackageDependencies(info, internalPackages);\n\n if (deps.length > 0) {\n for (const dep of deps) {\n stack.push(dep);\n edges.push([dep, pkg]);\n }\n } else {\n edges.push([null, pkg]);\n }\n }\n\n graphCache.set(key, edges);\n\n return edges;\n}\n\nexport function getDependentMap(packages: PackageInfos): Map<string, Set<string>> {\n const graph = getPackageGraph(packages);\n const map = new Map<string, Set<string>>();\n for (const [from, to] of graph) {\n if (!map.has(to)) {\n map.set(to, new Set());\n }\n\n if (from) {\n map.get(to)!.add(from);\n }\n }\n\n return map;\n}\n\n/**\n * For a package graph of `a->b->c` (where `b` depends on `a`), transitive consumers of `a` are `b` & `c`\n * and their consumers (or what are the consequences of `a`)\n * @deprecated Do not use\n */\nexport function getTransitiveConsumers(targets: string[], packages: PackageInfos, scope: string[] = []): string[] {\n const graph = getPackageGraph(packages, scope);\n const pkgQueue: string[] = [...targets];\n const visited = new Set<string>();\n\n while (pkgQueue.length > 0) {\n const pkg = pkgQueue.shift()!;\n\n if (!visited.has(pkg)) {\n visited.add(pkg);\n\n for (const [from, to] of graph) {\n if (from === pkg) {\n pkgQueue.push(to);\n }\n }\n }\n }\n\n return [...visited].filter((pkg) => !targets.includes(pkg));\n}\n\n/**\n * For a package graph of `a->b->c` (where `b` depends on `a`), transitive providers of `c` are `a` & `b`\n * and their providers (or what is needed to satisfy `c`)\n *\n * @deprecated Do not use\n */\nexport function getTransitiveProviders(targets: string[], packages: PackageInfos): string[] {\n const graph = getPackageGraph(packages);\n const pkgQueue: string[] = [...targets];\n const visited = new Set<string>();\n\n while (pkgQueue.length > 0) {\n const pkg = pkgQueue.shift()!;\n\n if (!visited.has(pkg)) {\n visited.add(pkg);\n\n for (const [from, to] of graph) {\n if (to === pkg && from) {\n pkgQueue.push(from);\n }\n }\n }\n }\n\n return [...visited].filter((pkg) => !targets.includes(pkg));\n}\n"],"names":["getDependentMap","getTransitiveConsumers","getTransitiveProviders","graphCache","Map","memoizedKey","packages","scope","JSON","stringify","getPackageGraph","internalPackages","Set","Object","keys","key","isCachingEnabled","has","get","edges","visited","stack","length","pkg","pop","add","info","deps","getPackageDependencies","dep","push","set","graph","map","from","to","targets","pkgQueue","shift","filter","includes"],"mappings":";;;;;;;;;;;;;;;;QAkDgBA;eAAAA;;QAqBAC;eAAAA;;QA4BAC;eAAAA;;;wCAlGuB;kCACN;AAEjC,MAAMC,aAAa,IAAIC;AAEvB,SAASC,YAAYC,QAAsB,EAAEC,QAAkB,EAAE;IAC/D,OAAOC,KAAKC,SAAS,CAAC;QAAEH;QAAUC;IAAM;AAC1C;AAEA,SAASG,gBAAgBJ,QAAsB,EAAEC,QAAkB,EAAE;IACnE,MAAMI,mBAAmB,IAAIC,IAAIC,OAAOC,IAAI,CAACR;IAC7C,MAAMS,MAAMV,YAAYC,UAAUC;IAElC,IAAIS,IAAAA,kCAAgB,OAAMb,WAAWc,GAAG,CAACF,MAAM;QAC7C,OAAOZ,WAAWe,GAAG,CAACH;IACxB;IAEA,MAAMI,QAAmC,EAAE;IAE3C,MAAMC,UAAU,IAAIR;IACpB,MAAMS,QAAkBd,MAAMe,MAAM,GAAG,IAAI;WAAIf;KAAM,GAAGM,OAAOC,IAAI,CAACR;IAEpE,MAAOe,MAAMC,MAAM,GAAG,EAAG;QACvB,MAAMC,MAAMF,MAAMG,GAAG;QAErB,IAAIJ,QAAQH,GAAG,CAACM,MAAM;YACpB;QACF;QAEAH,QAAQK,GAAG,CAACF;QAEZ,MAAMG,OAAOpB,QAAQ,CAACiB,IAAI;QAC1B,MAAMI,OAAOC,IAA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E,MAAM0B,QAAQtB,gBAAgBJ;IAC9B,MAAM+B,WAAqB;WAAID;KAAQ;IACvC,MAAMhB,UAAU,IAAIR;IAEpB,MAAOyB,SAASf,MAAM,GAAG,EAAG;QAC1B,MAAMC,MAAMc,SAASC,KAAK;QAE1B,IAAI,CAAClB,QAAQH,GAAG,CAACM,MAAM;YACrBH,QAAQK,GAAG,CAACF;YAEZ,KAAK,MAAM,CAACW,MAAMC,GAAG,IAAIH,MAAO;gBAC9B,IAAIG,OAAOZ,OAAOW,MAAM;oBACtBG,SAASP,IAAI,CAACI;gBAChB;YACF;QACF;IACF;IAEA,OAAO;WAAId;KAAQ,CAACmB,MAAM,CAAC,CAAChB,MAAQ,CAACa,QAAQI,QAAQ,CAACjB;AACxD"}
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ 0 && (module.exports = {
6
+ getPackageInfo: null,
7
+ getPackageInfoAsync: null
8
+ });
5
9
  function _export(target, all) {
6
10
  for(var name in all)Object.defineProperty(target, name, {
7
11
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getPackageInfo.ts"],"sourcesContent":["import fs from \"fs\";\nimport fsPromises from \"fs/promises\";\nimport path from \"path\";\nimport type { PackageInfo } from \"./types/PackageInfo.js\";\nimport { logVerboseWarning } from \"./logging.js\";\n\n/**\n * Read package.json from the given path if it exists.\n *\n * @returns The package info, or undefined if it doesn't exist or can't be read.\n * (Logs verbose warnings instead of throwing on error.)\n */\nexport function getPackageInfo(cwd: string): PackageInfo | undefined {\n const packageJsonPath = path.join(cwd, \"package.json\");\n try {\n if (!fs.existsSync(packageJsonPath)) {\n logVerboseWarning(`File does not exist: ${packageJsonPath}`);\n return undefined;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n return { ...packageJson, packageJsonPath };\n } catch (e) {\n logVerboseWarning(`Error reading or parsing ${packageJsonPath}: ${(e as Error)?.message || e}`);\n }\n}\n\n/**\n * Read package.json from the given path if it exists.\n *\n * @returns The package info, or undefined if it doesn't exist or can't be read.\n * (Logs verbose warnings instead of throwing on error.)\n */\nexport async function getPackageInfoAsync(cwd: string): Promise<PackageInfo | undefined> {\n const packageJsonPath = path.join(cwd, \"package.json\");\n try {\n if (!fs.existsSync(packageJsonPath)) {\n logVerboseWarning(`File does not exist: ${packageJsonPath}`);\n return undefined;\n }\n\n const packageJson = JSON.parse(await fsPromises.readFile(packageJsonPath, \"utf-8\"));\n return { ...packageJson, packageJsonPath };\n } catch (e) {\n logVerboseWarning(`Error reading or parsing ${packageJsonPath}: ${(e as Error)?.message || e}`);\n }\n}\n"],"names":["getPackageInfo","getPackageInfoAsync","cwd","packageJsonPath","path","join","fs","existsSync","logVerboseWarning","undefined","packageJson","JSON","parse","readFileSync","e","message","fsPromises","readFile"],"mappings":";;;;;;;;;;;QAYgBA;eAAAA;;QAqBMC;eAAAA;;;2DAjCP;iEACQ;6DACN;yBAEiB;;;;;;AAQ3B,SAASD,eAAeE,GAAW;IACxC,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACH,KAAK;IACvC,IAAI;QACF,IAAI,CAACI,WAAE,CAACC,UAAU,CAACJ,kBAAkB;YACnCK,IAAAA,0BAAiB,EAAC,CAAC,qBAAqB,EAAEL,iBAAiB;YAC3D,OAAOM;QACT;QAEA,MAAMC,cAAcC,KAAKC,KAAK,CAACN,WAAE,CAACO,YAAY,CAACV,iBAAiB;QAChE,OAAO;YAAE,GAAGO,WAAW;YAAEP;QAAgB;IAC3C,EAAE,OAAOW,GAAG;QACVN,IAAAA,0BAAiB,EAAC,CAAC,yBAAyB,EAAEL,gBAAgB,EAAE,EAAE,AAACW,GAAaC,WAAWD,GAAG;IAChG;AACF;AAQO,eAAeb,oBAAoBC,GAAW;IACnD,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACH,KAAK;IACvC,IAAI;QACF,IAAI,CAACI,WAAE,CAACC,UAAU,CAACJ,kBAAkB;YACnCK,IAAAA,0BAAiB,EAAC,CAAC,qBAAqB,EAAEL,iBAAiB;YAC3D,OAAOM;QACT;QAEA,MAAMC,cAAcC,KAAKC,KAAK,CAAC,MAAMI,iBAAU,CAACC,QAAQ,CAACd,iBAAiB;QAC1E,OAAO;YAAE,GAAGO,WAAW;YAAEP;QAAgB;IAC3C,EAAE,OAAOW,GAAG;QACVN,IAAAA,0BAAiB,EAAC,CAAC,yBAAyB,EAAEL,gBAAgB,EAAE,EAAE,AAACW,GAAaC,WAAWD,GAAG;IAChG;AACF"}
1
+ {"version":3,"sources":["../src/getPackageInfo.ts"],"sourcesContent":["import fs from \"fs\";\nimport fsPromises from \"fs/promises\";\nimport path from \"path\";\nimport type { PackageInfo } from \"./types/PackageInfo.js\";\nimport { logVerboseWarning } from \"./logging.js\";\n\n/**\n * Read package.json from the given path if it exists.\n *\n * @returns The package info, or undefined if it doesn't exist or can't be read.\n * (Logs verbose warnings instead of throwing on error.)\n */\nexport function getPackageInfo(cwd: string): PackageInfo | undefined {\n const packageJsonPath = path.join(cwd, \"package.json\");\n try {\n if (!fs.existsSync(packageJsonPath)) {\n logVerboseWarning(`File does not exist: ${packageJsonPath}`);\n return undefined;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n return { ...packageJson, packageJsonPath };\n } catch (e) {\n logVerboseWarning(`Error reading or parsing ${packageJsonPath}: ${(e as Error)?.message || e}`);\n }\n}\n\n/**\n * Read package.json from the given path if it exists.\n *\n * @returns The package info, or undefined if it doesn't exist or can't be read.\n * (Logs verbose warnings instead of throwing on error.)\n */\nexport async function getPackageInfoAsync(cwd: string): Promise<PackageInfo | undefined> {\n const packageJsonPath = path.join(cwd, \"package.json\");\n try {\n if (!fs.existsSync(packageJsonPath)) {\n logVerboseWarning(`File does not exist: ${packageJsonPath}`);\n return undefined;\n }\n\n const packageJson = JSON.parse(await fsPromises.readFile(packageJsonPath, \"utf-8\"));\n return { ...packageJson, packageJsonPath };\n } catch (e) {\n logVerboseWarning(`Error reading or parsing ${packageJsonPath}: ${(e as Error)?.message || e}`);\n }\n}\n"],"names":["getPackageInfo","getPackageInfoAsync","cwd","packageJsonPath","path","join","fs","existsSync","logVerboseWarning","undefined","packageJson","JSON","parse","readFileSync","e","message","fsPromises","readFile"],"mappings":";;;;;;;;;;;;;;;QAYgBA;eAAAA;;QAqBMC;eAAAA;;;2DAjCP;iEACQ;6DACN;yBAEiB;;;;;;AAQ3B,SAASD,eAAeE,GAAW;IACxC,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACH,KAAK;IACvC,IAAI;QACF,IAAI,CAACI,WAAE,CAACC,UAAU,CAACJ,kBAAkB;YACnCK,IAAAA,0BAAiB,EAAC,CAAC,qBAAqB,EAAEL,iBAAiB;YAC3D,OAAOM;QACT;QAEA,MAAMC,cAAcC,KAAKC,KAAK,CAACN,WAAE,CAACO,YAAY,CAACV,iBAAiB;QAChE,OAAO;YAAE,GAAGO,WAAW;YAAEP;QAAgB;IAC3C,EAAE,OAAOW,GAAG;QACVN,IAAAA,0BAAiB,EAAC,CAAC,yBAAyB,EAAEL,gBAAgB,EAAE,EAAE,AAACW,GAAaC,WAAWD,GAAG;IAChG;AACF;AAQO,eAAeb,oBAAoBC,GAAW;IACnD,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACH,KAAK;IACvC,IAAI;QACF,IAAI,CAACI,WAAE,CAACC,UAAU,CAACJ,kBAAkB;YACnCK,IAAAA,0BAAiB,EAAC,CAAC,qBAAqB,EAAEL,iBAAiB;YAC3D,OAAOM;QACT;QAEA,MAAMC,cAAcC,KAAKC,KAAK,CAAC,MAAMI,iBAAU,CAACC,QAAQ,CAACd,iBAAiB;QAC1E,OAAO;YAAE,GAAGO,WAAW;YAAEP;QAAgB;IAC3C,EAAE,OAAOW,GAAG;QACVN,IAAAA,0BAAiB,EAAC,CAAC,yBAAyB,EAAEL,gBAAgB,EAAE,EAAE,AAACW,GAAaC,WAAWD,GAAG;IAChG;AACF"}
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ 0 && (module.exports = {
6
+ getPackageInfos: null,
7
+ getPackageInfosAsync: null
8
+ });
5
9
  function _export(target, all) {
6
10
  for(var name in all)Object.defineProperty(target, name, {
7
11
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getPackageInfos.ts"],"sourcesContent":["import { type PackageInfos } from \"./types/PackageInfo.js\";\nimport { getWorkspaceInfos, getWorkspaceInfosAsync } from \"./workspaces/getWorkspaceInfos.js\";\nimport { getPackageInfo } from \"./getPackageInfo.js\";\nimport type { WorkspacePackageInfo } from \"./types/WorkspaceInfo.js\";\nimport type { WorkspaceManager } from \"./types/WorkspaceManager.js\";\nimport { findPackageRoot } from \"./paths.js\";\n\n/**\n * Read all the package.json files in a monorepo and return a mapping from package name to info.\n * Only works for monorepos which use a supported workspace/monorepo manager.\n *\n * Notes:\n * - The workspace manager, root, and list of package paths for `cwd` are cached internally,\n * but the package contents are not.\n * - To get an array listing package names, paths, and contents, use `getWorkspaceInfos` instead.\n * - If no workspace config is found, it will return info for the root package.json if one exists.\n * (This is different than `getWorkspaceInfos`.)\n *\n * @param cwd Start looking for the manager config from here\n * @param managerOverride Workspace/monorepo manager to use instead of auto-detecting\n *\n * @returns Mapping from package name to package info.\n * If no workspace config is found, it will return info for the root package.json if one exists.\n * Will be empty on error (it logs verbose warnings instead of throwing).\n */\nexport function getPackageInfos(cwd: string, managerOverride?: WorkspaceManager): PackageInfos {\n const workspacePackages = getWorkspaceInfos(cwd, managerOverride);\n return buildPackageInfos({ cwd, workspacePackages });\n}\n\n/**\n * Read all the package.json files in a monorepo and return a mapping from package name to info.\n * Only works for monorepos which use a supported workspace/monorepo manager.\n *\n * Notes:\n * - **WARNING**: As of writing, this will start promises to read all package.json files in\n * parallel, without direct concurrency control.\n * - The workspace manager, root, and list of package paths for `cwd` are cached internally,\n * but the package contents are not.\n * - To get an array listing package names, paths, and contents, use `getWorkspaceInfos` instead.\n *\n * @param cwd Start looking for the manager config from here\n * @param managerOverride Workspace/monorepo manager to use instead of auto-detecting\n *\n * @returns Mapping from package name to package info.\n * If no workspace config is found, it will return info for the root package.json if one exists.\n * Will be empty on error (it logs verbose warnings instead of throwing).\n */\nexport async function getPackageInfosAsync(cwd: string, managerOverride?: WorkspaceManager): Promise<PackageInfos> {\n const workspacePackages = await getWorkspaceInfosAsync(cwd, managerOverride);\n return buildPackageInfos({ cwd, workspacePackages });\n}\n\n/**\n * Convert an array of workspace package infos into a name-to-packageInfo map.\n * If there are no workspace packages, reads the root package.json instead.\n */\nfunction buildPackageInfos(params: {\n cwd: string;\n workspacePackages: WorkspacePackageInfo[] | undefined;\n}): PackageInfos {\n const { cwd, workspacePackages } = params;\n const packageInfos: PackageInfos = {};\n\n if (workspacePackages?.length) {\n for (const pkg of workspacePackages) {\n packageInfos[pkg.name] = pkg.packageJson;\n }\n } else {\n const packageRoot = findPackageRoot(cwd);\n const rootInfo = packageRoot && getPackageInfo(packageRoot);\n if (rootInfo) {\n packageInfos[rootInfo.name] = rootInfo;\n }\n }\n\n return packageInfos;\n}\n"],"names":["getPackageInfos","getPackageInfosAsync","cwd","managerOverride","workspacePackages","getWorkspaceInfos","buildPackageInfos","getWorkspaceInfosAsync","params","packageInfos","length","pkg","name","packageJson","packageRoot","findPackageRoot","rootInfo","getPackageInfo"],"mappings":";;;;;;;;;;;QAyBgBA;eAAAA;;QAuBMC;eAAAA;;;mCA/CoC;gCAC3B;uBAGC;AAoBzB,SAASD,gBAAgBE,GAAW,EAAEC,eAAkC;IAC7E,MAAMC,oBAAoBC,IAAAA,oCAAiB,EAACH,KAAKC;IACjD,OAAOG,kBAAkB;QAAEJ;QAAKE;IAAkB;AACpD;AAoBO,eAAeH,qBAAqBC,GAAW,EAAEC,eAAkC;IACxF,MAAMC,oBAAoB,MAAMG,IAAAA,yCAAsB,EAACL,KAAKC;IAC5D,OAAOG,kBAAkB;QAAEJ;QAAKE;IAAkB;AACpD;AAEA;;;CAGC,GACD,SAASE,kBAAkBE,MAG1B;IACC,MAAM,EAAEN,GAAG,EAAEE,iBAAiB,EAAE,GAAGI;IACnC,MAAMC,eAA6B,CAAC;IAEpC,IAAIL,mBAAmBM,QAAQ;QAC7B,KAAK,MAAMC,OAAOP,kBAAmB;YACnCK,YAAY,CAACE,IAAIC,IAAI,CAAC,GAAGD,IAAIE,WAAW;QAC1C;IACF,OAAO;QACL,MAAMC,cAAcC,IAAAA,sBAAe,EAACb;QACpC,MAAMc,WAAWF,eAAeG,IAAAA,8BAAc,EAACH;QAC/C,IAAIE,UAAU;YACZP,YAAY,CAACO,SAASJ,IAAI,CAAC,GAAGI;QAChC;IACF;IAEA,OAAOP;AACT"}
1
+ {"version":3,"sources":["../src/getPackageInfos.ts"],"sourcesContent":["import { type PackageInfos } from \"./types/PackageInfo.js\";\nimport { getWorkspaceInfos, getWorkspaceInfosAsync } from \"./workspaces/getWorkspaceInfos.js\";\nimport { getPackageInfo } from \"./getPackageInfo.js\";\nimport type { WorkspacePackageInfo } from \"./types/WorkspaceInfo.js\";\nimport type { WorkspaceManager } from \"./types/WorkspaceManager.js\";\nimport { findPackageRoot } from \"./paths.js\";\n\n/**\n * Read all the package.json files in a monorepo and return a mapping from package name to info.\n * Only works for monorepos which use a supported workspace/monorepo manager.\n *\n * Notes:\n * - The workspace manager, root, and list of package paths for `cwd` are cached internally,\n * but the package contents are not.\n * - To get an array listing package names, paths, and contents, use `getWorkspaceInfos` instead.\n * - If no workspace config is found, it will return info for the root package.json if one exists.\n * (This is different than `getWorkspaceInfos`.)\n *\n * @param cwd Start looking for the manager config from here\n * @param managerOverride Workspace/monorepo manager to use instead of auto-detecting\n *\n * @returns Mapping from package name to package info.\n * If no workspace config is found, it will return info for the root package.json if one exists.\n * Will be empty on error (it logs verbose warnings instead of throwing).\n */\nexport function getPackageInfos(cwd: string, managerOverride?: WorkspaceManager): PackageInfos {\n const workspacePackages = getWorkspaceInfos(cwd, managerOverride);\n return buildPackageInfos({ cwd, workspacePackages });\n}\n\n/**\n * Read all the package.json files in a monorepo and return a mapping from package name to info.\n * Only works for monorepos which use a supported workspace/monorepo manager.\n *\n * Notes:\n * - **WARNING**: As of writing, this will start promises to read all package.json files in\n * parallel, without direct concurrency control.\n * - The workspace manager, root, and list of package paths for `cwd` are cached internally,\n * but the package contents are not.\n * - To get an array listing package names, paths, and contents, use `getWorkspaceInfos` instead.\n *\n * @param cwd Start looking for the manager config from here\n * @param managerOverride Workspace/monorepo manager to use instead of auto-detecting\n *\n * @returns Mapping from package name to package info.\n * If no workspace config is found, it will return info for the root package.json if one exists.\n * Will be empty on error (it logs verbose warnings instead of throwing).\n */\nexport async function getPackageInfosAsync(cwd: string, managerOverride?: WorkspaceManager): Promise<PackageInfos> {\n const workspacePackages = await getWorkspaceInfosAsync(cwd, managerOverride);\n return buildPackageInfos({ cwd, workspacePackages });\n}\n\n/**\n * Convert an array of workspace package infos into a name-to-packageInfo map.\n * If there are no workspace packages, reads the root package.json instead.\n */\nfunction buildPackageInfos(params: {\n cwd: string;\n workspacePackages: WorkspacePackageInfo[] | undefined;\n}): PackageInfos {\n const { cwd, workspacePackages } = params;\n const packageInfos: PackageInfos = {};\n\n if (workspacePackages?.length) {\n for (const pkg of workspacePackages) {\n packageInfos[pkg.name] = pkg.packageJson;\n }\n } else {\n const packageRoot = findPackageRoot(cwd);\n const rootInfo = packageRoot && getPackageInfo(packageRoot);\n if (rootInfo) {\n packageInfos[rootInfo.name] = rootInfo;\n }\n }\n\n return packageInfos;\n}\n"],"names":["getPackageInfos","getPackageInfosAsync","cwd","managerOverride","workspacePackages","getWorkspaceInfos","buildPackageInfos","getWorkspaceInfosAsync","params","packageInfos","length","pkg","name","packageJson","packageRoot","findPackageRoot","rootInfo","getPackageInfo"],"mappings":";;;;;;;;;;;;;;;QAyBgBA;eAAAA;;QAuBMC;eAAAA;;;mCA/CoC;gCAC3B;uBAGC;AAoBzB,SAASD,gBAAgBE,GAAW,EAAEC,eAAkC;IAC7E,MAAMC,oBAAoBC,IAAAA,oCAAiB,EAACH,KAAKC;IACjD,OAAOG,kBAAkB;QAAEJ;QAAKE;IAAkB;AACpD;AAoBO,eAAeH,qBAAqBC,GAAW,EAAEC,eAAkC;IACxF,MAAMC,oBAAoB,MAAMG,IAAAA,yCAAsB,EAACL,KAAKC;IAC5D,OAAOG,kBAAkB;QAAEJ;QAAKE;IAAkB;AACpD;AAEA;;;CAGC,GACD,SAASE,kBAAkBE,MAG1B;IACC,MAAM,EAAEN,GAAG,EAAEE,iBAAiB,EAAE,GAAGI;IACnC,MAAMC,eAA6B,CAAC;IAEpC,IAAIL,mBAAmBM,QAAQ;QAC7B,KAAK,MAAMC,OAAOP,kBAAmB;YACnCK,YAAY,CAACE,IAAIC,IAAI,CAAC,GAAGD,IAAIE,WAAW;QAC1C;IACF,OAAO;QACL,MAAMC,cAAcC,IAAAA,sBAAe,EAACb;QACpC,MAAMc,WAAWF,eAAeG,IAAAA,8BAAc,EAACH;QAC/C,IAAIE,UAAU;YACZP,YAAY,CAACO,SAASJ,IAAI,CAAC,GAAGI;QAChC;IACF;IAEA,OAAOP;AACT"}
@@ -35,7 +35,7 @@ function getDefaultRemote(cwdOrOptions) {
35
35
  const packageJsonPath = _path.default.join(gitRoot, "package.json");
36
36
  try {
37
37
  packageJson = JSON.parse(_fs.default.readFileSync(packageJsonPath, "utf8").trim());
38
- } catch (e) {
38
+ } catch {
39
39
  logOrThrow(`Could not read "${packageJsonPath}"`);
40
40
  }
41
41
  const { repository } = packageJson;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/git/getDefaultRemote.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { findGitRoot } from \"../paths.js\";\nimport { type PackageInfo } from \"../types/PackageInfo.js\";\nimport { getRepositoryName } from \"./getRepositoryName.js\";\nimport { git } from \"./git.js\";\n\nexport type GetDefaultRemoteOptions = {\n /** Get repository info relative to this directory. */\n cwd: string;\n /**\n * If true, throw an error if remote info can't be found, or if a `repository` is not specified\n * in package.json and no matching remote is found.\n */\n strict?: boolean;\n /** If true, log debug messages about how the remote was chosen */\n verbose?: boolean;\n};\n\n/**\n * Get the name of the default remote: the one matching the `repository` field in package.json.\n * Throws if `options.cwd` is not in a git repo or there's no package.json at the repo root.\n *\n * The order of preference for returned remotes is:\n * 1. If `repository` is defined in package.json, the remote with a matching URL (if `options.strict`\n * is true, throws an error if no matching remote exists)\n * 2. `upstream` if defined\n * 3. `origin` if defined\n * 4. The first defined remote\n * 5. If there are no defined remotes: throws an error if `options.strict` is true; otherwise returns `origin`\n *\n * @returns The name of the inferred default remote.\n */\nexport function getDefaultRemote(options: GetDefaultRemoteOptions): string;\n/** @deprecated Use the object param version */\nexport function getDefaultRemote(cwd: string): string;\nexport function getDefaultRemote(cwdOrOptions: string | GetDefaultRemoteOptions): string {\n const options = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n const { cwd, strict, verbose } = options;\n\n const log = (message: string) => verbose && console.log(message);\n const logOrThrow = (message: string) => {\n if (strict) {\n throw new Error(message);\n }\n log(message);\n };\n\n const gitRoot = findGitRoot(cwd);\n\n let packageJson: Partial<PackageInfo> = {};\n const packageJsonPath = path.join(gitRoot, \"package.json\");\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\").trim());\n } catch (e) {\n logOrThrow(`Could not read \"${packageJsonPath}\"`);\n }\n\n const { repository } = packageJson;\n const repositoryUrl = typeof repository === \"string\" ? repository : (repository && repository.url) || \"\";\n if (!repositoryUrl) {\n // This is always logged because it's strongly recommended to fix\n console.log(\n `Valid \"repository\" key not found in \"${packageJsonPath}\". Consider adding this info for more accurate git remote detection.`\n );\n }\n /** Repository full name (owner and repo name) specified in package.json */\n const repositoryName = getRepositoryName(repositoryUrl);\n\n const remotesResult = git([\"remote\", \"-v\"], { cwd });\n if (!remotesResult.success) {\n logOrThrow(`Could not determine available git remotes under \"${cwd}\"`);\n }\n\n /** Mapping from remote URL to full name (owner and repo name) */\n const remotes: { [remoteRepoUrl: string]: string } = {};\n remotesResult.stdout.split(\"\\n\").forEach((line) => {\n const [remoteName, remoteUrl] = line.split(/\\s+/);\n const remoteRepoName = getRepositoryName(remoteUrl);\n if (remoteRepoName) {\n remotes[remoteRepoName] = remoteName;\n }\n });\n\n if (repositoryName) {\n // If the repository name was found in package.json, check for a matching remote\n if (remotes[repositoryName]) {\n return remotes[repositoryName];\n }\n\n // If `strict` is true, and repositoryName is found, there MUST be a matching remote\n logOrThrow(`Could not find remote pointing to repository \"${repositoryName}\".`);\n }\n\n // Default to upstream or origin if available, or the first remote otherwise\n const allRemoteNames = Object.values(remotes);\n const fallbacks = [\"upstream\", \"origin\", ...allRemoteNames];\n for (const fallback of fallbacks) {\n if (allRemoteNames.includes(fallback)) {\n log(`Default to remote \"${fallback}\"`);\n return fallback;\n }\n }\n\n // If we get here, no git remotes were found. This should probably always be an error (since\n // subsequent operations which require a remote likely won't work), but to match old behavior,\n // still default to \"origin\" unless `strict` is true.\n logOrThrow(`Could not find any remotes in git repo at \"${gitRoot}\".`);\n log(`Assuming default remote \"origin\".`);\n return \"origin\";\n}\n"],"names":["getDefaultRemote","cwdOrOptions","options","cwd","strict","verbose","log","message","console","logOrThrow","Error","gitRoot","findGitRoot","packageJson","packageJsonPath","path","join","JSON","parse","fs","readFileSync","trim","e","repository","repositoryUrl","url","repositoryName","getRepositoryName","remotesResult","git","success","remotes","stdout","split","forEach","line","remoteName","remoteUrl","remoteRepoName","allRemoteNames","Object","values","fallbacks","fallback","includes"],"mappings":";;;;+BAoCgBA;;;eAAAA;;;2DApCD;6DACE;uBACW;mCAEM;qBACd;;;;;;AA+Bb,SAASA,iBAAiBC,YAA8C;IAC7E,MAAMC,UAAU,OAAOD,iBAAiB,WAAW;QAAEE,KAAKF;IAAa,IAAIA;IAC3E,MAAM,EAAEE,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IA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FAAgF;QAChF,IAAIK,OAAO,CAACL,eAAe,EAAE;YAC3B,OAAOK,OAAO,CAACL,eAAe;QAChC;QAEA,oFAAoF;QACpFjB,WAAW,CAAC,8CAA8C,EAAEiB,eAAe,EAAE,CAAC;IAChF;IAEA,4EAA4E;IAC5E,MAAMa,iBAAiBC,OAAOC,MAAM,CAACV;IACrC,MAAMW,YAAY;QAAC;QAAY;WAAaH;KAAe;IAC3D,KAAK,MAAMI,YAAYD,UAAW;QAChC,IAAIH,eAAeK,QAAQ,CAACD,WAAW;YACrCrC,IAAI,CAAC,mBAAmB,EAAEqC,SAAS,CAAC,CAAC;YACrC,OAAOA;QACT;IACF;IAEA,4FAA4F;IAC5F,8FAA8F;IAC9F,qDAAqD;IACrDlC,WAAW,CAAC,2CAA2C,EAAEE,QAAQ,EAAE,CAAC;IACpEL,IAAI,CAAC,iCAAiC,CAAC;IACvC,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/git/getDefaultRemote.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { findGitRoot } from \"../paths.js\";\nimport { type PackageInfo } from \"../types/PackageInfo.js\";\nimport { getRepositoryName } from \"./getRepositoryName.js\";\nimport { git } from \"./git.js\";\n\nexport type GetDefaultRemoteOptions = {\n /** Get repository info relative to this directory. */\n cwd: string;\n /**\n * If true, throw an error if remote info can't be found, or if a `repository` is not specified\n * in package.json and no matching remote is found.\n */\n strict?: boolean;\n /** If true, log debug messages about how the remote was chosen */\n verbose?: boolean;\n};\n\n/**\n * Get the name of the default remote: the one matching the `repository` field in package.json.\n * Throws if `options.cwd` is not in a git repo or there's no package.json at the repo root.\n *\n * The order of preference for returned remotes is:\n * 1. If `repository` is defined in package.json, the remote with a matching URL (if `options.strict`\n * is true, throws an error if no matching remote exists)\n * 2. `upstream` if defined\n * 3. `origin` if defined\n * 4. The first defined remote\n * 5. If there are no defined remotes: throws an error if `options.strict` is true; otherwise returns `origin`\n *\n * @returns The name of the inferred default remote.\n */\nexport function getDefaultRemote(options: GetDefaultRemoteOptions): string;\n/** @deprecated Use the object param version */\nexport function getDefaultRemote(cwd: string): string;\nexport function getDefaultRemote(cwdOrOptions: string | GetDefaultRemoteOptions): string {\n const options = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n const { cwd, strict, verbose } = options;\n\n const log = (message: string) => verbose && console.log(message);\n const logOrThrow = (message: string) => {\n if (strict) {\n throw new Error(message);\n }\n log(message);\n };\n\n const gitRoot = findGitRoot(cwd);\n\n let packageJson: Partial<PackageInfo> = {};\n const packageJsonPath = path.join(gitRoot, \"package.json\");\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\").trim());\n } catch {\n logOrThrow(`Could not read \"${packageJsonPath}\"`);\n }\n\n const { repository } = packageJson;\n const repositoryUrl = typeof repository === \"string\" ? repository : (repository && repository.url) || \"\";\n if (!repositoryUrl) {\n // This is always logged because it's strongly recommended to fix\n console.log(\n `Valid \"repository\" key not found in \"${packageJsonPath}\". Consider adding this info for more accurate git remote detection.`\n );\n }\n /** Repository full name (owner and repo name) specified in package.json */\n const repositoryName = getRepositoryName(repositoryUrl);\n\n const remotesResult = git([\"remote\", \"-v\"], { cwd });\n if (!remotesResult.success) {\n logOrThrow(`Could not determine available git remotes under \"${cwd}\"`);\n }\n\n /** Mapping from remote URL to full name (owner and repo name) */\n const remotes: { [remoteRepoUrl: string]: string } = {};\n remotesResult.stdout.split(\"\\n\").forEach((line) => {\n const [remoteName, remoteUrl] = line.split(/\\s+/);\n const remoteRepoName = getRepositoryName(remoteUrl);\n if (remoteRepoName) {\n remotes[remoteRepoName] = remoteName;\n }\n });\n\n if (repositoryName) {\n // If the repository name was found in package.json, check for a matching remote\n if (remotes[repositoryName]) {\n return remotes[repositoryName];\n }\n\n // If `strict` is true, and repositoryName is found, there MUST be a matching remote\n logOrThrow(`Could not find remote pointing to repository \"${repositoryName}\".`);\n }\n\n // Default to upstream or origin if available, or the first remote otherwise\n const allRemoteNames = Object.values(remotes);\n const fallbacks = [\"upstream\", \"origin\", ...allRemoteNames];\n for (const fallback of fallbacks) {\n if (allRemoteNames.includes(fallback)) {\n log(`Default to remote \"${fallback}\"`);\n return fallback;\n }\n }\n\n // If we get here, no git remotes were found. This should probably always be an error (since\n // subsequent operations which require a remote likely won't work), but to match old behavior,\n // still default to \"origin\" unless `strict` is true.\n logOrThrow(`Could not find any remotes in git repo at \"${gitRoot}\".`);\n log(`Assuming default remote \"origin\".`);\n return \"origin\";\n}\n"],"names":["getDefaultRemote","cwdOrOptions","options","cwd","strict","verbose","log","message","console","logOrThrow","Error","gitRoot","findGitRoot","packageJson","packageJsonPath","path","join","JSON","parse","fs","readFileSync","trim","repository","repositoryUrl","url","repositoryName","getRepositoryName","remotesResult","git","success","remotes","stdout","split","forEach","line","remoteName","remoteUrl","remoteRepoName","allRemoteNames","Object","values","fallbacks","fallback","includes"],"mappings":";;;;+BAoCgBA;;;eAAAA;;;2DApCD;6DACE;uBACW;mCAEM;qBACd;;;;;;AA+Bb,SAASA,iBAAiBC,YAA8C;IAC7E,MAAMC,UAAU,OAAOD,iBAAiB,WAAW;QAAEE,KAAKF;IAAa,IAAIA;IAC3E,MAAM,EAAEE,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAEjC,MAAMI,MAAM,CAACC,UAAoBF,WAAWG,QAAQF,GAAG,CAACC;IACxD,MAAME,aAAa,CAACF;QAClB,IAAIH,QAAQ;YACV,MAAM,IAAIM,MAAMH;QAClB;QACAD,IAAIC;IACN;IAEA,MAAMI,UAAUC,IAAAA,kBAAW,EAACT;IAE5B,IAAIU,cAAoC,CAAC;IACzC,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACL,SAAS;IAC3C,IAAI;QACFE,cAAcI,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACN,iBAAiB,QAAQO,IAAI;IACxE,EAAE,OAAM;QACNZ,WAAW,CAAC,gBAAgB,EAAEK,gBAAgB,C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,8FAA8F;IAC9F,qDAAqD;IACrDjC,WAAW,CAAC,2CAA2C,EAAEE,QAAQ,EAAE,CAAC;IACpEL,IAAI,CAAC,iCAAiC,CAAC;IACvC,OAAO;AACT"}
@@ -47,7 +47,7 @@ function getRepositoryName(url) {
47
47
  organization = host.match(/([^.@]+)\.visualstudio\.com$/)?.[1];
48
48
  }
49
49
  return `${organization}/${parsedUrl.owner}/${parsedUrl.name}`;
50
- } catch (err) {
50
+ } catch {
51
51
  return "";
52
52
  }
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/git/getRepositoryName.ts"],"sourcesContent":["import gitUrlParse from \"git-url-parse\";\n\n/**\n * Get a repository full name (owner and repo, plus organization for ADO/VSO) from a repository URL,\n * including special handling for the many ADO/VSO URL formats.\n *\n * Examples:\n * - returns `microsoft/lage` for `https://github.com/microsoft/lage.git`\n * - returns `foo/bar/some-repo` for `https://dev.azure.com/foo/bar/_git/some-repo`\n */\nexport function getRepositoryName(url: string): string {\n try {\n // Mostly use this standard library, but fix some VSO/ADO-specific quirks to account for the\n // fact that all of the following URLs should be considered to point to the same repo:\n // https://foo.visualstudio.com/bar/_git/some-repo\n // https://foo.visualstudio.com/DefaultCollection/bar/_git/some-repo\n // https://user:token@foo.visualstudio.com/DefaultCollection/bar/_git/some-repo\n // https://foo.visualstudio.com/DefaultCollection/bar/_git/_optimized/some-repo\n // foo@vs-ssh.visualstudio.com:v3/foo/bar/some-repo\n // https://dev.azure.com/foo/bar/_git/some-repo\n // https://dev.azure.com/foo/bar/_git/_optimized/some-repo\n // https://user@dev.azure.com/foo/bar/_git/some-repo\n // git@ssh.dev.azure.com:v3/foo/bar/some-repo\n const parsedUrl = gitUrlParse(url.replace(\"/_optimized/\", \"/\").replace(\"/DefaultCollection/\", \"/\"));\n\n // `host` is set in `parse-url` but not documented... https://github.com/IonicaBizau/parse-url/blob/c830d48647f33c054745a916cf7c4c58722f4b25/src/index.js#L28\n const host: string = (parsedUrl as any).host || \"\";\n const isVSO = host.endsWith(\".visualstudio.com\");\n if (!isVSO && host !== \"dev.azure.com\" && host !== \"ssh.dev.azure.com\") {\n return parsedUrl.full_name;\n }\n\n // As of writing, ADO and VSO SSH URLs are parsed completely wrong\n const sshMatch = parsedUrl.full_name.match(\n /(vs-ssh\\.visualstudio\\.com|ssh\\.dev\\.azure\\.com):v\\d+\\/([^/]+)\\/([^/]+)/\n );\n if (sshMatch) {\n return `${sshMatch[2]}/${sshMatch[3]}/${parsedUrl.name}`;\n }\n\n // As of writing, full_name is wrong for enough variants of ADO and VSO URLs that it\n // makes more sense to just build it manually.\n let organization: string | undefined = parsedUrl.organization;\n if (!organization && isVSO) {\n // organization is missing or wrong for VSO\n organization = host.match(/([^.@]+)\\.visualstudio\\.com$/)?.[1];\n }\n return `${organization}/${parsedUrl.owner}/${parsedUrl.name}`;\n } catch (err) {\n return \"\";\n }\n}\n"],"names":["getRepositoryName","url","parsedUrl","gitUrlParse","replace","host","isVSO","endsWith","full_name","sshMatch","match","name","organization","owner","err"],"mappings":";;;;+BAUgBA;;;eAAAA;;;oEAVQ;;;;;;AAUjB,SAASA,kBAAkBC,GAAW;IAC3C,IAAI;QACF,4FAA4F;QAC5F,sFAAsF;QACtF,kDAAkD;QAClD,oEAAoE;QACpE,+EAA+E;QAC/E,+EAA+E;QAC/E,mDAAmD;QACnD,+CAA+C;QAC/C,0DAA0D;QAC1D,oDAAoD;QACpD,6CAA6C;QAC7C,MAAMC,YAAYC,IAAAA,oBAAW,EAACF,IAAIG,OAAO,CAAC,gBAAgB,KAAKA,OAAO,CAAC,uBAAuB;QAE9F,6JAA6J;QAC7J,MAAMC,OAAe,AAACH,UAAkBG,IAAI,IAAI;QAChD,MAAMC,QAAQD,KAAKE,QAAQ,CAAC;QAC5B,IAAI,CAACD,SAASD,SAAS,mBAAmBA,SAAS,qBAAqB;YACtE,OAAOH,UAAUM,SAAS;QAC5B;QAEA,kEAAkE;QAClE,MAAMC,WAAWP,UAAUM,SAAS,CAACE,KAAK,CACxC;QAEF,IAAID,UAAU;YACZ,OAAO,GAAGA,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAEA,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAEP,UAAUS,IAAI,EAAE;QAC1D;QAEA,oFAAoF;QACpF,8CAA8C;QAC9C,IAAIC,eAAmCV,UAAUU,YAAY;QAC7D,IAAI,CAACA,gBAAgBN,OAAO;YAC1B,2CAA2C;YAC3CM,eAAeP,KAAKK,KAAK,CAAC,iCAAiC,CAAC,EAAE;QAChE;QACA,OAAO,GAAGE,aAAa,CAAC,EAAEV,UAAUW,KAAK,CAAC,CAAC,EAAEX,UAAUS,IAAI,EAAE;IAC/D,EAAE,OAAOG,KAAK;QACZ,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../src/git/getRepositoryName.ts"],"sourcesContent":["import gitUrlParse from \"git-url-parse\";\n\n/**\n * Get a repository full name (owner and repo, plus organization for ADO/VSO) from a repository URL,\n * including special handling for the many ADO/VSO URL formats.\n *\n * Examples:\n * - returns `microsoft/lage` for `https://github.com/microsoft/lage.git`\n * - returns `foo/bar/some-repo` for `https://dev.azure.com/foo/bar/_git/some-repo`\n */\nexport function getRepositoryName(url: string): string {\n try {\n // Mostly use this standard library, but fix some VSO/ADO-specific quirks to account for the\n // fact that all of the following URLs should be considered to point to the same repo:\n // https://foo.visualstudio.com/bar/_git/some-repo\n // https://foo.visualstudio.com/DefaultCollection/bar/_git/some-repo\n // https://user:token@foo.visualstudio.com/DefaultCollection/bar/_git/some-repo\n // https://foo.visualstudio.com/DefaultCollection/bar/_git/_optimized/some-repo\n // foo@vs-ssh.visualstudio.com:v3/foo/bar/some-repo\n // https://dev.azure.com/foo/bar/_git/some-repo\n // https://dev.azure.com/foo/bar/_git/_optimized/some-repo\n // https://user@dev.azure.com/foo/bar/_git/some-repo\n // git@ssh.dev.azure.com:v3/foo/bar/some-repo\n const parsedUrl = gitUrlParse(url.replace(\"/_optimized/\", \"/\").replace(\"/DefaultCollection/\", \"/\"));\n\n // `host` is set in `parse-url` but not documented... https://github.com/IonicaBizau/parse-url/blob/c830d48647f33c054745a916cf7c4c58722f4b25/src/index.js#L28\n const host: string = (parsedUrl as any).host || \"\";\n const isVSO = host.endsWith(\".visualstudio.com\");\n if (!isVSO && host !== \"dev.azure.com\" && host !== \"ssh.dev.azure.com\") {\n return parsedUrl.full_name;\n }\n\n // As of writing, ADO and VSO SSH URLs are parsed completely wrong\n const sshMatch = parsedUrl.full_name.match(\n /(vs-ssh\\.visualstudio\\.com|ssh\\.dev\\.azure\\.com):v\\d+\\/([^/]+)\\/([^/]+)/\n );\n if (sshMatch) {\n return `${sshMatch[2]}/${sshMatch[3]}/${parsedUrl.name}`;\n }\n\n // As of writing, full_name is wrong for enough variants of ADO and VSO URLs that it\n // makes more sense to just build it manually.\n let organization: string | undefined = parsedUrl.organization;\n if (!organization && isVSO) {\n // organization is missing or wrong for VSO\n organization = host.match(/([^.@]+)\\.visualstudio\\.com$/)?.[1];\n }\n return `${organization}/${parsedUrl.owner}/${parsedUrl.name}`;\n } catch {\n return \"\";\n }\n}\n"],"names":["getRepositoryName","url","parsedUrl","gitUrlParse","replace","host","isVSO","endsWith","full_name","sshMatch","match","name","organization","owner"],"mappings":";;;;+BAUgBA;;;eAAAA;;;oEAVQ;;;;;;AAUjB,SAASA,kBAAkBC,GAAW;IAC3C,IAAI;QACF,4FAA4F;QAC5F,sFAAsF;QACtF,kDAAkD;QAClD,oEAAoE;QACpE,+EAA+E;QAC/E,+EAA+E;QAC/E,mDAAmD;QACnD,+CAA+C;QAC/C,0DAA0D;QAC1D,oDAAoD;QACpD,6CAA6C;QAC7C,MAAMC,YAAYC,IAAAA,oBAAW,EAACF,IAAIG,OAAO,CAAC,gBAAgB,KAAKA,OAAO,CAAC,uBAAuB;QAE9F,6JAA6J;QAC7J,MAAMC,OAAe,AAACH,UAAkBG,IAAI,IAAI;QAChD,MAAMC,QAAQD,KAAKE,QAAQ,CAAC;QAC5B,IAAI,CAACD,SAASD,SAAS,mBAAmBA,SAAS,qBAAqB;YACtE,OAAOH,UAAUM,SAAS;QAC5B;QAEA,kEAAkE;QAClE,MAAMC,WAAWP,UAAUM,SAAS,CAACE,KAAK,CACxC;QAEF,IAAID,UAAU;YACZ,OAAO,GAAGA,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAEA,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAEP,UAAUS,IAAI,EAAE;QAC1D;QAEA,oFAAoF;QACpF,8CAA8C;QAC9C,IAAIC,eAAmCV,UAAUU,YAAY;QAC7D,IAAI,CAACA,gBAAgBN,OAAO;YAC1B,2CAA2C;YAC3CM,eAAeP,KAAKK,KAAK,CAAC,iCAAiC,CAAC,EAAE;QAChE;QACA,OAAO,GAAGE,aAAa,CAAC,EAAEV,UAAUW,KAAK,CAAC,CAAC,EAAEX,UAAUS,IAAI,EAAE;IAC/D,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
package/lib/git/git.js CHANGED
@@ -5,6 +5,14 @@
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ 0 && (module.exports = {
9
+ GitError: null,
10
+ addGitObserver: null,
11
+ clearGitObservers: null,
12
+ git: null,
13
+ gitFailFast: null,
14
+ processGitOutput: null
15
+ });
8
16
  function _export(target, all) {
9
17
  for(var name in all)Object.defineProperty(target, name, {
10
18
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/git/git.ts"],"sourcesContent":["//\n// Basic git wrappers\n//\n\nimport { spawnSync, type SpawnSyncOptions, type SpawnSyncReturns } from \"child_process\";\nimport { type GitCommonOptions } from \"./types.js\";\n\nexport type GitOptions = Omit<SpawnSyncOptions, \"cwd\"> &\n GitCommonOptions & {\n /** Operation description to be used in error message (formatted as start of sentence) */\n description?: string;\n debug?: boolean;\n };\n\nexport class GitError extends Error {\n public readonly originalError: unknown;\n public readonly gitOutput?: GitProcessOutput;\n\n constructor(message: string, originalError?: unknown, gitOutput?: GitProcessOutput) {\n if (originalError instanceof Error) {\n super(`${message}: ${originalError.message}`);\n } else if (gitOutput?.stderr) {\n super(`${message} -- stderr:\\n${gitOutput.stderr}`);\n } else {\n super(message);\n }\n this.originalError = originalError;\n this.gitOutput = gitOutput;\n }\n}\n\n/**\n * A global maxBuffer override for all git operations.\n * Bumps up the default to 500MB instead of 1MB.\n * Override this value with the `GIT_MAX_BUFFER` environment variable.\n */\nconst defaultMaxBuffer = process.env.GIT_MAX_BUFFER ? parseInt(process.env.GIT_MAX_BUFFER) : 500 * 1024 * 1024;\n\nconst isDebug = !!process.env.GIT_DEBUG;\n\nexport type GitProcessOutput = {\n stderr: string;\n stdout: string;\n success: boolean;\n} & Omit<SpawnSyncReturns<string | Buffer>, \"stdout\" | \"stderr\">;\n\n/** Observes the git operations called from `git()` or `gitFailFast()` */\nexport type GitObserver = (args: string[], output: GitProcessOutput) => void;\nconst observers: GitObserver[] = [];\nlet observing: boolean;\n\n/**\n * Adds an observer for the git operations, e.g. for testing\n * @returns a function to remove the observer\n */\nexport function addGitObserver(observer: GitObserver): () => void {\n observers.push(observer);\n return () => removeGitObserver(observer);\n}\n\n/** Clear all git observers */\nexport function clearGitObservers(): void {\n observers.splice(0, observers.length);\n}\n\n/** Remove a git observer */\nfunction removeGitObserver(observer: GitObserver): void {\n const index = observers.indexOf(observer);\n if (index > -1) {\n observers.splice(index, 1);\n }\n}\n\n/**\n * Runs git command - use this for read-only commands, or if you'd like to explicitly check the\n * result and implement custom error handling.\n *\n * The caller is responsible for validating the input.\n * `shell` will always be set to false.\n */\nexport function git(args: string[], options?: GitOptions): GitProcessOutput {\n if (args.some((arg) => arg.startsWith(\"--upload-pack\"))) {\n // This is a security issue and not needed for any expected usage of this library.\n throw new GitError(\"git command contains --upload-pack, which is not allowed: \" + args.join(\" \"));\n }\n\n const gitDescription = `git ${args.join(\" \")}`;\n const { throwOnError, description = gitDescription, debug = isDebug, ...spawnOptions } = options || {};\n\n debug && console.log(gitDescription);\n\n let results: SpawnSyncReturns<string | Buffer>;\n try {\n // this only throws if git isn't found or other rare cases\n results = spawnSync(\"git\", args, { maxBuffer: defaultMaxBuffer, ...spawnOptions });\n } catch (e) {\n throw new GitError(`${description} failed (while spawning process)`, e);\n }\n\n const output: GitProcessOutput = {\n ...results,\n // these may be undefined if stdio: inherit is set\n stderr: (results.stderr || \"\").toString().trimEnd(),\n stdout: (results.stdout || \"\").toString().trimEnd(),\n success: results.status === 0,\n };\n\n if (debug) {\n console.log(\"exited with code \" + results.status);\n output.stdout && console.log(\"git stdout:\\n\", output.stdout);\n output.stderr && console.warn(\"git stderr:\\n\", output.stderr);\n }\n\n // notify observers, flipping the observing bit to prevent infinite loops\n if (!observing) {\n observing = true;\n for (const observer of observers) {\n observer(args, output);\n }\n observing = false;\n }\n\n if (!output.success && throwOnError) {\n throw new GitError(`${description} failed${output.stderr ? `\\n${output.stderr}` : \"\"}`, undefined, output);\n }\n\n return output;\n}\n\n/**\n * Run a git command. Use this for commands that make critical changes to the filesystem.\n * If it fails, throw an error and set `process.exitCode = 1` (unless `options.noExitCode` is set).\n *\n * The caller is responsible for validating the input.\n * `shell` will always be set to false.\n */\nexport function gitFailFast(args: string[], options?: GitCommonOptions & { noExitCode?: boolean }): void {\n const gitResult = git(args, options);\n if (!gitResult.success) {\n if (!options?.noExitCode) {\n process.exitCode = 1;\n }\n\n throw new GitError(`CRITICAL ERROR: running git command: git ${args.join(\" \")}!\n ${gitResult.stdout?.toString().trimEnd()}\n ${gitResult.stderr?.toString().trimEnd()}`);\n }\n}\n\n/**\n * Processes git command output by splitting it into lines and filtering out empty lines.\n * Also filters out `node_modules` lines if specified in options.\n *\n * If the command failed with stderr output, an error is thrown.\n *\n * @param output - The git command output to process\n * @returns An array of lines (presumably file paths), or an empty array if the command failed\n * without stderr output.\n * @internal\n */\nexport function processGitOutput(output: GitProcessOutput, options?: { excludeNodeModules?: boolean }): string[] {\n if (!output.success) {\n // If the intent was to throw on failure, `throwOnError` should have been set for the git command.\n return [];\n }\n\n return output.stdout\n .split(/\\n/)\n .map((line) => line.trim())\n .filter((line) => !!line && (!options?.excludeNodeModules || !line.includes(\"node_modules\")));\n}\n"],"names":["GitError","addGitObserver","clearGitObservers","git","gitFailFast","processGitOutput","Error","message","originalError","gitOutput","stderr","defaultMaxBuffer","process","env","GIT_MAX_BUFFER","parseInt","isDebug","GIT_DEBUG","observers","observing","observer","push","removeGitObserver","splice","length","index","indexOf","args","options","some","arg","startsWith","join","gitDescription","throwOnError","description","debug","spawnOptions","console","log","results","spawnSync","maxBuffer","e","output","toString","trimEnd","stdout","success","status","warn","undefined","gitResult","noExitCode","exitCode","split","map","line","trim","filter","excludeNodeModules","includes"],"mappings":"AAAA,EAAE;AACF,qBAAqB;AACrB,EAAE;;;;;;;;;;;;QAYWA;eAAAA;;QAyCGC;eAAAA;;QAMAC;eAAAA;;QAmBAC;eAAAA;;QAwDAC;eAAAA;;QAwBAC;eAAAA;;;+BA5JwD;;;;;;;;;;;;;;AAUjE,MAAML,iBAAiBM;IAI5B,YAAYC,OAAe,EAAEC,aAAuB,EAAEC,SAA4B,CAAE;QAClF,IAAID,yBAAyBF,OAAO;YAClC,KAAK,CAAC,GAAGC,QAAQ,EAAE,EAAEC,cAAcD,OAAO,EAAE,GALhD,uBAAgBC,iBAAhB,KAAA,IACA,uBAAgBC,aAAhB,KAAA;QAKE,OAAO,IAAIA,WAAWC,QAAQ;YAC5B,KAAK,CAAC,GAAGH,QAAQ,aAAa,EAAEE,UAAUC,MAAM,EAAE,GAPtD,uBAAgBF,iBAAhB,KAAA,IACA,uBAAgBC,aAAhB,KAAA;QAOE,OAAO;YACL,KAAK,CAACF,UATV,uBAAgBC,iBAAhB,KAAA,IACA,uBAAgBC,aAAhB,KAAA;QASE;QACA,IAAI,CAACD,aAAa,GAAGA;QACrB,IAAI,CAACC,SAAS,GAAGA;IACnB;AACF;AAEA;;;;CAIC,GACD,MAAME,mBAAmBC,QAAQC,GAAG,CAACC,cAAc,GAAGC,SAASH,QAA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CAACC,OAASA,KAAKC,IAAI,IACvBC,MAAM,CAAC,CAACF,OAAS,CAAC,CAACA,QAAS,CAAA,CAAC7B,SAASgC,sBAAsB,CAACH,KAAKI,QAAQ,CAAC,eAAc;AAC9F"}
1
+ {"version":3,"sources":["../../src/git/git.ts"],"sourcesContent":["//\n// Basic git wrappers\n//\n\nimport { spawnSync, type SpawnSyncOptions, type SpawnSyncReturns } from \"child_process\";\nimport { type GitCommonOptions } from \"./types.js\";\n\nexport type GitOptions = Omit<SpawnSyncOptions, \"cwd\"> &\n GitCommonOptions & {\n /** Operation description to be used in error message (formatted as start of sentence) */\n description?: string;\n debug?: boolean;\n };\n\nexport class GitError extends Error {\n public readonly originalError: unknown;\n public readonly gitOutput?: GitProcessOutput;\n\n constructor(message: string, originalError?: unknown, gitOutput?: GitProcessOutput) {\n if (originalError instanceof Error) {\n super(`${message}: ${originalError.message}`);\n } else if (gitOutput?.stderr) {\n super(`${message} -- stderr:\\n${gitOutput.stderr}`);\n } else {\n super(message);\n }\n this.originalError = originalError;\n this.gitOutput = gitOutput;\n }\n}\n\n/**\n * A global maxBuffer override for all git operations.\n * Bumps up the default to 500MB instead of 1MB.\n * Override this value with the `GIT_MAX_BUFFER` environment variable.\n */\nconst defaultMaxBuffer = process.env.GIT_MAX_BUFFER ? parseInt(process.env.GIT_MAX_BUFFER) : 500 * 1024 * 1024;\n\nconst isDebug = !!process.env.GIT_DEBUG;\n\nexport type GitProcessOutput = {\n stderr: string;\n stdout: string;\n success: boolean;\n} & Omit<SpawnSyncReturns<string | Buffer>, \"stdout\" | \"stderr\">;\n\n/** Observes the git operations called from `git()` or `gitFailFast()` */\nexport type GitObserver = (args: string[], output: GitProcessOutput) => void;\nconst observers: GitObserver[] = [];\nlet observing: boolean;\n\n/**\n * Adds an observer for the git operations, e.g. for testing\n * @returns a function to remove the observer\n */\nexport function addGitObserver(observer: GitObserver): () => void {\n observers.push(observer);\n return () => removeGitObserver(observer);\n}\n\n/** Clear all git observers */\nexport function clearGitObservers(): void {\n observers.splice(0, observers.length);\n}\n\n/** Remove a git observer */\nfunction removeGitObserver(observer: GitObserver): void {\n const index = observers.indexOf(observer);\n if (index > -1) {\n observers.splice(index, 1);\n }\n}\n\n/**\n * Runs git command - use this for read-only commands, or if you'd like to explicitly check the\n * result and implement custom error handling.\n *\n * The caller is responsible for validating the input.\n * `shell` will always be set to false.\n */\nexport function git(args: string[], options?: GitOptions): GitProcessOutput {\n if (args.some((arg) => arg.startsWith(\"--upload-pack\"))) {\n // This is a security issue and not needed for any expected usage of this library.\n throw new GitError(\"git command contains --upload-pack, which is not allowed: \" + args.join(\" \"));\n }\n\n const gitDescription = `git ${args.join(\" \")}`;\n const { throwOnError, description = gitDescription, debug = isDebug, ...spawnOptions } = options || {};\n\n debug && console.log(gitDescription);\n\n let results: SpawnSyncReturns<string | Buffer>;\n try {\n // this only throws if git isn't found or other rare cases\n results = spawnSync(\"git\", args, { maxBuffer: defaultMaxBuffer, ...spawnOptions });\n } catch (e) {\n throw new GitError(`${description} failed (while spawning process)`, e);\n }\n\n const output: GitProcessOutput = {\n ...results,\n // these may be undefined if stdio: inherit is set\n stderr: (results.stderr || \"\").toString().trimEnd(),\n stdout: (results.stdout || \"\").toString().trimEnd(),\n success: results.status === 0,\n };\n\n if (debug) {\n console.log(\"exited with code \" + results.status);\n output.stdout && console.log(\"git stdout:\\n\", output.stdout);\n output.stderr && console.warn(\"git stderr:\\n\", output.stderr);\n }\n\n // notify observers, flipping the observing bit to prevent infinite loops\n if (!observing) {\n observing = true;\n for (const observer of observers) {\n observer(args, output);\n }\n observing = false;\n }\n\n if (!output.success && throwOnError) {\n throw new GitError(`${description} failed${output.stderr ? `\\n${output.stderr}` : \"\"}`, undefined, output);\n }\n\n return output;\n}\n\n/**\n * Run a git command. Use this for commands that make critical changes to the filesystem.\n * If it fails, throw an error and set `process.exitCode = 1` (unless `options.noExitCode` is set).\n *\n * The caller is responsible for validating the input.\n * `shell` will always be set to false.\n */\nexport function gitFailFast(args: string[], options?: GitCommonOptions & { noExitCode?: boolean }): void {\n const gitResult = git(args, options);\n if (!gitResult.success) {\n if (!options?.noExitCode) {\n process.exitCode = 1;\n }\n\n throw new GitError(`CRITICAL ERROR: running git command: git ${args.join(\" \")}!\n ${gitResult.stdout?.toString().trimEnd()}\n ${gitResult.stderr?.toString().trimEnd()}`);\n }\n}\n\n/**\n * Processes git command output by splitting it into lines and filtering out empty lines.\n * Also filters out `node_modules` lines if specified in options.\n *\n * If the command failed with stderr output, an error is thrown.\n *\n * @param output - The git command output to process\n * @returns An array of lines (presumably file paths), or an empty array if the command failed\n * without stderr output.\n * @internal\n */\nexport function processGitOutput(output: GitProcessOutput, options?: { excludeNodeModules?: boolean }): string[] {\n if (!output.success) {\n // If the intent was to throw on failure, `throwOnError` should have been set for the git command.\n return [];\n }\n\n return output.stdout\n .split(/\\n/)\n .map((line) => line.trim())\n .filter((line) => !!line && (!options?.excludeNodeModules || !line.includes(\"node_modules\")));\n}\n"],"names":["GitError","addGitObserver","clearGitObservers","git","gitFailFast","processGitOutput","Error","message","originalError","gitOutput","stderr","defaultMaxBuffer","process","env","GIT_MAX_BUFFER","parseInt","isDebug","GIT_DEBUG","observers","observing","observer","push","removeGitObserver","splice","length","index","indexOf","args","options","some","arg","startsWith","join","gitDescription","throwOnError","description","debug","spawnOptions","console","log","results","spawnSync","maxBuffer","e","output","toString","trimEnd","stdout","success","status","warn","undefined","gitResult","noExitCode","exitCode","split","map","line","trim","filter","excludeNodeModules","includes"],"mappings":"AAAA,EAAE;AACF,qBAAqB;AACrB,EAAE;;;;;;;;;;;;;;;;;;;;QAYWA;eAAAA;;QAyCGC;eAAAA;;QAMAC;eAAAA;;QAmBAC;eAAAA;;QAwDAC;eAAAA;;QAwBAC;eAAAA;;;+BA5JwD;;;;;;;;;;;;;;AAUjE,MAAML,iBAAiBM;IAI5B,YAAYC,OAAe,EAAEC,aAAuB,EAAEC,SAA4B,CAAE;QAClF,IAAID,yBAAyBF,OAAO;YAClC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,MAAMwB,YAAYjD,IAAIwB,MAAMC;IAC5B,IAAI,CAACwB,UAAUJ,OAAO,EAAE;QACtB,IAAI,CAACpB,SAASyB,YAAY;YACxBzC,QAAQ0C,QAAQ,GAAG;QACrB;QAEA,MAAM,IAAItD,SAAS,CAAC,yCAAyC,EAAE2B,KAAKK,IAAI,CAAC,KAAK;IAC9E,EAAEoB,UAAUL,MAAM,EAAEF,WAAWC,UAAU;IACzC,EAAEM,UAAU1C,MAAM,EAAEmC,WAAWC,WAAW;IAC5C;AACF;AAaO,SAASzC,iBAAiBuC,MAAwB,EAAEhB,OAA0C;IACnG,IAAI,CAACgB,OAAOI,OAAO,EAAE;QACnB,kGAAkG;QAClG,OAAO,EAAE;IACX;IAEA,OAAOJ,OAAOG,MAAM,CACjBQ,KAAK,CAAC,MACNC,GAAG,CAAC,CAACC,OAASA,KAAKC,IAAI,IACvBC,MAAM,CAAC,CAACF,OAAS,CAAC,CAACA,QAAS,CAAA,CAAC7B,SAASgC,sBAAsB,CAACH,KAAKI,QAAQ,CAAC,eAAc;AAC9F"}
@@ -6,6 +6,33 @@
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
+ 0 && (module.exports = {
10
+ commit: null,
11
+ fetchRemote: null,
12
+ fetchRemoteBranch: null,
13
+ getBranchChanges: null,
14
+ getBranchName: null,
15
+ getChanges: null,
16
+ getChangesBetweenRefs: null,
17
+ getCurrentHash: null,
18
+ getDefaultBranch: null,
19
+ getFileAddedHash: null,
20
+ getFullBranchRef: null,
21
+ getParentBranch: null,
22
+ getRecentCommitMessages: null,
23
+ getRemoteBranch: null,
24
+ getShortBranchName: null,
25
+ getStagedChanges: null,
26
+ getUnstagedChanges: null,
27
+ getUntrackedChanges: null,
28
+ getUserEmail: null,
29
+ init: null,
30
+ listAllTrackedFiles: null,
31
+ parseRemoteBranch: null,
32
+ revertLocalChanges: null,
33
+ stage: null,
34
+ stageAndCommit: null
35
+ });
9
36
  function _export(target, all) {
10
37
  for(var name in all)Object.defineProperty(target, name, {
11
38
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/git/gitUtilities.ts"],"sourcesContent":["//\n// Assorted other git utilities\n// (could be split into separate files later if desired)\n//\n\nimport { getConfigValue } from \"./config.js\";\nimport { git, processGitOutput } from \"./git.js\";\nimport type {\n GetChangesBetweenRefsOptions,\n GitBranchOptions,\n GitCommitOptions,\n GitCommonOptions,\n GitFetchOptions,\n GitInitOptions,\n GitStageOptions,\n ParsedRemoteBranch,\n ParseRemoteBranchOptions,\n} from \"./types.js\";\n\nconst diffArgs = [\"--no-pager\", \"diff\", \"--name-only\", \"--relative\"];\n\n/**\n * Get a list of files with untracked changes.\n * Throws an error on failure by default.\n *\n * @returns An array of file paths with untracked changes\n */\n// TODO: move to getChanges.ts\nexport function getUntrackedChanges(options: GitCommonOptions): string[];\n/** @deprecated Use object params version */\nexport function getUntrackedChanges(cwd: string): string[];\nexport function getUntrackedChanges(cwdOrOptions: string | GitCommonOptions): string[] {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([\"ls-files\", \"--others\", \"--exclude-standard\"], {\n description: \"Gathering information about untracked changes\",\n throwOnError: true,\n ...options,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Fetch from the given remote (and optionally branch) or all remotes.\n * Throws an error on failure by default.\n */\n// TODO: move to fetch.ts\nexport function fetchRemote(options: GitFetchOptions): void;\n/** @deprecated Use object params version */\nexport function fetchRemote(remote: string, cwd: string): void;\nexport function fetchRemote(remoteOrOptions: string | GitFetchOptions, cwd?: string): void {\n const { remote, remoteBranch, options, ...gitOptions } =\n typeof remoteOrOptions === \"string\"\n ? ({ remote: remoteOrOptions, cwd: cwd! } satisfies GitFetchOptions)\n : remoteOrOptions;\n\n if (remoteBranch && !remote) {\n throw new Error('Must provide \"remote\" when using \"remoteBranch\" option');\n }\n\n const fetchArgs = [\n \"fetch\",\n \"--\",\n ...(remote ? [remote] : []),\n ...(remoteBranch ? [remoteBranch] : []),\n ...(options || []),\n ];\n\n git(fetchArgs, {\n description: remote\n ? `Fetching ${remoteBranch ? `branch \"${remoteBranch}\" from ` : \"\"}remote \"${remote}\"`\n : \"Fetching all remotes\",\n throwOnError: true,\n ...gitOptions,\n });\n}\n\n/**\n * Fetch from the given remote and branch. Throws an error on failure.\n * @deprecated Use `fetchRemote({ remote, remoteBranch, cwd })`\n */\n// TODO: move to fetch.ts\nexport function fetchRemoteBranch(remote: string, remoteBranch: string, cwd: string): void {\n fetchRemote({ remote, remoteBranch, cwd, throwOnError: true });\n}\n\n/**\n * Gets file paths with changes that have not been staged yet.\n * Throws an error on failure by default.\n *\n * @returns An array of relative file paths with unstaged changes\n */\n// TODO: move to getChanges.ts\nexport function getUnstagedChanges(options: GitCommonOptions): string[];\n/** @deprecated Use object params version */\nexport function getUnstagedChanges(cwd: string): string[];\nexport function getUnstagedChanges(cwdOrOptions: string | GitCommonOptions): string[] {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git(diffArgs, {\n description: \"Gathering information about unstaged changes\",\n throwOnError: true,\n ...options,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Gets file paths with changes between the current branch and the given branch.\n * Throws an error on failure.\n *\n * @returns An array of relative file paths that have changed\n * @deprecated Use `getBranchChanges({ branch, cwd })`\n */\n// TODO: move to getChanges.ts\nexport function getChanges(branch: string, cwd: string): string[] {\n return getChangesBetweenRefs({ fromRef: branch, cwd, throwOnError: true });\n}\n\n/**\n * Gets file paths with changes between the branch and the merge-base.\n * Throws an error on failure by default.\n *\n * @returns An array of relative file paths that have changed\n */\n// TODO: move to getChanges.ts\nexport function getBranchChanges(options: GitBranchOptions): string[];\n/** @deprecated Use object params version */\nexport function getBranchChanges(branch: string, cwd: string): string[];\nexport function getBranchChanges(branchOrOptions: string | GitBranchOptions, cwd?: string): string[] {\n const { branch, ...options } =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n return getChangesBetweenRefs({ fromRef: branch, throwOnError: true, ...options });\n}\n\n/**\n * Gets file paths with changes between two git references (commits, branches, tags).\n * Throws an error on failure by default.\n *\n * @returns An array of file paths that have changed\n */\n// TODO: move to getChanges.ts\nexport function getChangesBetweenRefs(options: GetChangesBetweenRefsOptions): string[];\n/** @deprecated Use object param version */\nexport function getChangesBetweenRefs(\n fromRef: string,\n toRef: string,\n options: string[],\n pattern: string,\n cwd: string\n): string[];\nexport function getChangesBetweenRefs(\n fromRef: string | GetChangesBetweenRefsOptions,\n toRef?: string,\n options?: string[],\n pattern?: string,\n cwd?: string\n): string[] {\n let gitOptions: GitCommonOptions;\n if (typeof fromRef === \"string\") {\n gitOptions = { cwd: cwd! };\n } else {\n ({ fromRef, toRef, options, pattern, ...gitOptions } = fromRef);\n }\n\n const range = `${fromRef}...${toRef || \"\"}`;\n const results = git([...diffArgs, ...(options || []), range, ...(pattern ? [\"--\", pattern] : [])], {\n description: `Gathering information about changes between refs (${range})`,\n throwOnError: true,\n ...gitOptions,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Gets all files with staged changes (files added to the index).\n * Throws an error on failure by default.\n *\n * @returns An array of relative file paths that have been staged\n */\n// TODO: move to getChanges.ts\nexport function getStagedChanges(options: GitCommonOptions): string[];\n/** @deprecated Use object params version */\nexport function getStagedChanges(cwd: string): string[];\nexport function getStagedChanges(cwdOrOptions: string | GitCommonOptions): string[] {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([...diffArgs, \"--staged\"], {\n description: \"Gathering information about staged changes\",\n throwOnError: true,\n ...options,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Gets recent commit messages between the specified parent branch and HEAD.\n * By default, returns an empty array if the operation fails.\n *\n * @returns An array of commit message strings\n */\n// TODO: move to history.ts\nexport function getRecentCommitMessages(options: GitBranchOptions): string[];\n/** @deprecated Use object params version */\nexport function getRecentCommitMessages(branch: string, cwd: string): string[];\nexport function getRecentCommitMessages(branchOrOptions: string | GitBranchOptions, cwd?: string): string[] {\n const { branch, ...options } =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n const results = git([\"log\", \"--decorate\", \"--pretty=format:%s\", `${branch}..HEAD`], {\n description: `Getting recent commit messages for branch \"${branch}\"`,\n ...options,\n });\n return processGitOutput(results);\n}\n\n/**\n * Gets the user email from the git config.\n * @returns The email string if found, null otherwise\n */\n// TODO: move to config.ts\nexport function getUserEmail(options: GitCommonOptions): string | null;\n/** @deprecated Use object params version */\nexport function getUserEmail(cwd: string): string | null;\nexport function getUserEmail(cwdOrOptions: string | GitCommonOptions): string | null {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n return getConfigValue({ key: \"user.email\", ...options });\n}\n\n/**\n * Gets the current branch name.\n * In detached HEAD state, returns \"HEAD\".\n *\n * @returns The branch name if successful, null otherwise\n */\n// TODO: move to refs.ts\nexport function getBranchName(options: GitCommonOptions): string | null;\n/** @deprecated Use object params version */\nexport function getBranchName(cwd: string): string | null;\nexport function getBranchName(cwdOrOptions: string | GitCommonOptions): string | null {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([\"rev-parse\", \"--abbrev-ref\", \"HEAD\"], {\n description: \"Getting current branch name\",\n ...options,\n });\n return results.success ? results.stdout : null;\n}\n\n/**\n * Gets the full reference path for a given branch.\n * `branch` here is the short branch name, e.g. `branch-name`.\n * @returns The full branch reference (e.g., `refs/heads/branch-name`) if found, null otherwise\n */\n// TODO: move to refs.ts\nexport function getFullBranchRef(options: GitBranchOptions): string | null;\n/** @deprecated Use object params version */\nexport function getFullBranchRef(branch: string, cwd: string): string | null;\nexport function getFullBranchRef(branchOrOptions: string | GitBranchOptions, cwd?: string): string | null {\n const { branch, ...options } =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n const showRefResults = git([\"show-ref\", \"--heads\", branch], options);\n\n return showRefResults.success ? showRefResults.stdout.split(\" \")[1] : null;\n}\n\n/**\n * Gets the short branch name from a full branch reference.\n * @returns The short branch name if successful, null otherwise\n */\n// TODO: move to refs.ts\nexport function getShortBranchName(\n options: {\n /** The full branch reference (e.g., `refs/heads/branch-name`) */\n fullBranchRef: string;\n } & GitCommonOptions\n): string | null;\n/** @deprecated Use object params version */\nexport function getShortBranchName(fullBranchRef: string, cwd: string): string | null;\nexport function getShortBranchName(\n refOrOptions: string | ({ fullBranchRef: string } & GitCommonOptions),\n cwd?: string\n): string | null {\n const { fullBranchRef, ...options } =\n typeof refOrOptions === \"string\" ? { fullBranchRef: refOrOptions, cwd: cwd! } : refOrOptions;\n\n // The original command `git name-rev --name-only` returned unreliable results if multiple\n // named refs point to the same commit as the branch.\n const showRefResults = git([\"rev-parse\", \"--abbrev-ref\", fullBranchRef], options);\n\n return showRefResults.success ? showRefResults.stdout || null : null;\n}\n\n/**\n * Gets the current commit hash (SHA).\n * @returns The hash if successful, null otherwise\n */\n// TODO: move to refs.ts\nexport function getCurrentHash(options: GitCommonOptions): string | null;\n/** @deprecated Use object params version */\nexport function getCurrentHash(cwd: string): string | null;\nexport function getCurrentHash(cwdOrOptions: string | GitCommonOptions): string | null {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([\"rev-parse\", \"HEAD\"], {\n description: \"Getting current git hash\",\n ...options,\n });\n\n return results.success ? results.stdout : null;\n}\n\n/**\n * Get the commit hash in which the file was first added.\n * @returns The commit hash if found, undefined otherwise\n */\n// TODO: move to history.ts\nexport function getFileAddedHash(options: { filename: string } & GitCommonOptions): string | undefined;\n/** @deprecated Use object params version */\nexport function getFileAddedHash(filename: string, cwd: string): string | undefined;\nexport function getFileAddedHash(\n filenameOrOptions: string | ({ filename: string } & GitCommonOptions),\n cwd?: string\n): string | undefined {\n const { filename, ...options } =\n typeof filenameOrOptions === \"string\" ? { filename: filenameOrOptions, cwd: cwd! } : filenameOrOptions;\n\n const results = git([\"rev-list\", \"--max-count=1\", \"HEAD\", filename], options);\n\n return results.success ? results.stdout.trim() : undefined;\n}\n\n/**\n * Run `git init` and verify that the `user.name` and `user.email` configs are set (at any level).\n * Throws an error if `git init` fails.\n *\n * If `user.email` and `user.name` aren't already set globally, and the missing value is provided\n * in params, set it at the repo level. Otherwise, throw an error.\n */\n// TODO: move to init.ts\nexport function init(options: GitInitOptions): void;\n/** @deprecated Use object params version */\nexport function init(cwd: string, email?: string, username?: string): void;\nexport function init(cwdOrOptions: string | GitInitOptions, _email?: string, _username?: string): void {\n const { email, username, ...options } =\n typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions, email: _email, username: _username } : cwdOrOptions;\n\n git([\"init\"], { ...options, throwOnError: true });\n\n if (!getConfigValue({ key: \"user.name\", ...options })) {\n if (!username) {\n throw new Error(\"must include a username when initializing git repo\");\n }\n git([\"config\", \"user.name\", username], options);\n }\n\n if (!getUserEmail(options)) {\n if (!email) {\n throw new Error(\"must include a email when initializing git repo\");\n }\n git([\"config\", \"user.email\", email], options);\n }\n}\n\n/**\n * Stages files matching the given patterns.\n */\n// TODO: move to stageAndCommit.ts\nexport function stage(options: GitStageOptions): void;\n/** @deprecated Use object params version */\nexport function stage(patterns: string[], cwd: string): void;\nexport function stage(patternsOrOptions: string[] | GitStageOptions, cwd?: string): void {\n const { patterns, ...options } = Array.isArray(patternsOrOptions)\n ? { patterns: patternsOrOptions, cwd: cwd! }\n : patternsOrOptions;\n\n for (const pattern of patterns) {\n git([\"add\", pattern], { ...options, description: `Staging changes (git add ${pattern})` });\n }\n}\n\n/**\n * Commit changes. Throws an error on failure by default.\n */\n// TODO: move to stageAndCommit.ts\nexport function commit(options: GitCommitOptions): void;\n/** @deprecated Use object params version */\nexport function commit(message: string, cwd: string, options?: string[]): void;\nexport function commit(messageOrOptions: string | GitCommitOptions, _cwd?: string, _options?: string[]): void {\n const { message, options, ...gitOptions } =\n typeof messageOrOptions === \"string\"\n ? { message: messageOrOptions, cwd: _cwd!, options: _options }\n : messageOrOptions;\n\n git([\"commit\", \"-m\", message, ...(options || [])], {\n throwOnError: true,\n description: \"Committing changes\",\n ...gitOptions,\n });\n}\n\n/**\n * Stages files matching the given patterns and creates a commit with the specified message.\n * Convenience function that combines `stage()` and `commit()`.\n * Throws an error on commit failure by default.\n */\n// TODO: move to stageAndCommit.ts\nexport function stageAndCommit(options: GitStageOptions & GitCommitOptions): void;\n/** @deprecated Use object params version */\nexport function stageAndCommit(patterns: string[], message: string, cwd: string, commitOptions?: string[]): void;\nexport function stageAndCommit(\n patternsOrOptions: string[] | (GitStageOptions & GitCommitOptions),\n message?: string,\n cwd?: string,\n commitOptions?: string[]\n): void {\n const options: GitStageOptions & GitCommitOptions = Array.isArray(patternsOrOptions)\n ? { patterns: patternsOrOptions, message: message!, cwd: cwd!, options: commitOptions }\n : patternsOrOptions;\n\n stage(options);\n commit(options);\n}\n\n/**\n * Reverts all local changes (both staged and unstaged) by stashing them and then dropping the stash.\n * @returns True if the revert was successful, false otherwise. It will also be false if there were\n * no changes to revert. (To distinguish between this case and errors, use the `throwOnError` option.)\n */\n// TODO: move to revertLocalChanges.ts\nexport function revertLocalChanges(options: GitCommonOptions): boolean;\n/** @deprecated Use object params version */\nexport function revertLocalChanges(cwd: string): boolean;\nexport function revertLocalChanges(cwdOrOptions: string | GitCommonOptions): boolean {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const stash = `workspace-tools_${new Date().getTime()}`;\n if (!git([\"stash\", \"push\", \"-u\", \"-m\", stash], options).success) {\n return false;\n }\n\n const results = git([\"stash\", \"list\"], options);\n if (results.success) {\n const matched = results.stdout\n .split(/\\n/)\n .find((line) => line.includes(stash))\n ?.match(/^[^:]+/);\n\n if (matched) {\n git([\"stash\", \"drop\", matched[0]], options);\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Attempts to determine the parent branch of the current branch using `git show-branch`.\n * @returns The parent branch name if found, null otherwise\n * @deprecated Does not appear to be used\n */\nexport function getParentBranch(cwd: string): string | null {\n const branchName = getBranchName({ cwd });\n\n if (!branchName || branchName === \"HEAD\") {\n return null;\n }\n\n const showBranchResult = git([\"show-branch\", \"-a\"], { cwd });\n\n if (showBranchResult.success) {\n const showBranchLines = showBranchResult.stdout.split(/\\n/);\n const parentLine = showBranchLines.find(\n (line) => line.includes(\"*\") && !line.includes(branchName) && !line.includes(\"publish_\")\n );\n\n const matched = parentLine?.match(/\\[(.*)\\]/);\n return matched ? matched[1] : null;\n }\n\n return null;\n}\n\n/**\n * Gets the remote tracking branch for the specified branch.\n *\n * @returns The remote branch name (e.g., `origin/main`) if found, null otherwise\n */\n// TODO: move to refs.ts\nexport function getRemoteBranch(options: GitBranchOptions): string | null;\n/** @deprecated Use object params version */\nexport function getRemoteBranch(branch: string, cwd: string): string | null;\nexport function getRemoteBranch(branchOrOptions: string | GitBranchOptions, cwd?: string): string | null {\n const options: GitBranchOptions =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n const results = git([\"rev-parse\", \"--abbrev-ref\", \"--symbolic-full-name\", `${options.branch}@{u}`], options);\n\n return results.success ? results.stdout.trim() : null;\n}\n\n/**\n * Get the remote and branch name from a full branch name that may include a remote prefix.\n * If the path doesn't start with one of `options.knownRemotes` (but has multiple segments),\n * the actual list of remotes will be fetched to see if one of those matches.\n *\n * NOTE: The additional verification is new in the object params version; the original version\n * incorrectly assumes the first segment before a slash is always a remote.\n */\n// TODO: move to parseRemoteBranch.ts\nexport function parseRemoteBranch(options: ParseRemoteBranchOptions): ParsedRemoteBranch;\n/**\n * @deprecated Use object params version, which does more verification. This version inaccurately\n * assumes the first segment before a slash is always a remote, which could lead to tricky bugs.\n */\nexport function parseRemoteBranch(branch: string): ParsedRemoteBranch;\nexport function parseRemoteBranch(branchOrOptions: string | ParseRemoteBranchOptions): ParsedRemoteBranch {\n if (typeof branchOrOptions === \"string\") {\n const branch = branchOrOptions;\n const firstSlashPos = branch.indexOf(\"/\", 0);\n return {\n remote: branch.substring(0, firstSlashPos),\n remoteBranch: branch.substring(firstSlashPos + 1),\n };\n }\n\n const { branch, knownRemotes = [\"origin\", \"upstream\"], ...options } = branchOrOptions;\n\n if (!branch.includes(\"/\")) {\n return { remote: \"\", remoteBranch: branch };\n }\n\n let remote = knownRemotes.find((r) => branch.startsWith(`${r}/`));\n\n if (!remote) {\n const remotes = git([\"remote\"], options).stdout.trim().split(/\\n/);\n remote = remotes.find((r) => branch.startsWith(`${r}/`));\n }\n\n if (remote) {\n return { remote, remoteBranch: branch.slice(remote.length + 1) };\n }\n return { remote: \"\", remoteBranch: branch };\n}\n\n/**\n * Gets the default branch based on `git config init.defaultBranch`, falling back to `master`.\n */\n// TODO: move to config.ts\nexport function getDefaultBranch(options: GitCommonOptions): string;\n/** @deprecated Use object params version */\nexport function getDefaultBranch(cwd: string): string;\nexport function getDefaultBranch(cwdOrOptions: string | GitCommonOptions): string {\n const options = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n // Default to the legacy 'master' for backwards compat and old git clients\n return getConfigValue({ key: \"init.defaultBranch\", ...options }) || \"master\";\n}\n\n/**\n * Lists all tracked files matching the given patterns.\n * Throws on error by default.\n * @returns An array of file paths, or an empty array if no files are found\n */\n// TODO: move to history.ts\nexport function listAllTrackedFiles(\n options: {\n /** File patterns to match (passed to git ls-files) */\n patterns: string[];\n } & GitCommonOptions\n): string[];\n/** @deprecated Use object params version */\nexport function listAllTrackedFiles(patterns: string[], cwd: string): string[];\nexport function listAllTrackedFiles(\n patternsOrOptions: string[] | ({ patterns: string[] } & GitCommonOptions),\n cwd?: string\n): string[] {\n const { patterns, ...options } = Array.isArray(patternsOrOptions)\n ? { patterns: patternsOrOptions, cwd: cwd! }\n : patternsOrOptions;\n\n const results = git([\"ls-files\", ...patterns], { throwOnError: true, ...options });\n\n return processGitOutput(results);\n}\n"],"names":["commit","fetchRemote","fetchRemoteBranch","getBranchChanges","getBranchName","getChanges","getChangesBetweenRefs","getCurrentHash","getDefaultBranch","getFileAddedHash","getFullBranchRef","getParentBranch","getRecentCommitMessages","getRemoteBranch","getShortBranchName","getStagedChanges","getUnstagedChanges","getUntrackedChanges","getUserEmail","init","listAllTrackedFiles","parseRemoteBranch","revertLocalChanges","stage","stageAndCommit","diffArgs","cwdOrOptions","options","cwd","results","git","description","throwOnError","processGitOutput","excludeNodeModules","remoteOrOptions","remote","remoteBranch","gitOptions","Error","fetchArgs","branch","fromRef","branchOrOptions","toRef","pattern","range","getConfigValue","key","success","stdout","showRefResults","split","refOrOptions","fullBranchRef","filenameOrOptions","filename","trim","undefined","_email","_username","email","username","patternsOrOptions","patterns","Array","isArray","messageOrOptions","_cwd","_options","message","commitOptions","stash","Date","getTime","matched","find","line","includes","match","branchName","showBranchResult","showBranchLines","parentLine","firstSlashPos","indexOf","substring","knownRemotes","r","startsWith","remotes","slice","length"],"mappings":"AAAA,EAAE;AACF,+BAA+B;AAC/B,wDAAwD;AACxD,EAAE;;;;;;;;;;;;QAmYcA;eAAAA;;QApVAC;eAAAA;;QAgCAC;eAAAA;;QA+CAC;eAAAA;;QA+GAC;eAAAA;;QA7HAC;eAAAA;;QAqCAC;eAAAA;;QAuJAC;eAAAA;;QA4PAC;eAAAA;;QAzOAC;eAAAA;;QA/DAC;eAAAA;;QA6MAC;eAAAA;;QAlQAC;eAAAA;;QAiSAC;eAAAA;;QAtNAC;eAAAA;;QAhGAC;eAAAA;;QAzFAC;eAAAA;;QAjEAC;eAAAA;;QAkMAC;eAAAA;;QAwHAC;eAAAA;;QAuOAC;eAAAA;;QAzDAC;eAAAA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,CAACY,IAAM/C,OAAOgD,UAAU,CAAC,GAAGD,EAAE,CAAC,CAAC;IACxD;IAEA,IAAIpD,QAAQ;QACV,OAAO;YAAEA;YAAQC,cAAcI,OAAOkD,KAAK,CAACvD,OAAOwD,MAAM,GAAG;QAAG;IACjE;IACA,OAAO;QAAExD,QAAQ;QAAIC,cAAcI;IAAO;AAC5C;AASO,SAASjC,iBAAiBkB,YAAuC;IACtE,MAAMC,UAAU,OAAOD,iBAAiB,WAAW;QAAEE,KAAKF;IAAa,IAAIA;IAE3E,0EAA0E;IAC1E,OAAOqB,IAAAA,sBAAc,EAAC;QAAEC,KAAK;QAAsB,GAAGrB,OAAO;IAAC,MAAM;AACtE;AAgBO,SAASP,oBACd2C,iBAAyE,EACzEnC,GAAY;IAEZ,MAAM,EAAEoC,QAAQ,EAAE,GAAGrC,SAAS,GAAGsC,MAAMC,OAAO,CAACH,qBAC3C;QAAEC,UAAUD;QAAmBnC,KAAKA;IAAK,IACzCmC;IAEJ,MAAMlC,UAAUC,IAAAA,QAAG,EAAC;QAAC;WAAekC;KAAS,EAAE;QAAEhC,cAAc;QAAM,GAAGL,OAAO;IAAC;IAEhF,OAAOM,IAAAA,qBAAgB,EAACJ;AAC1B"}
1
+ {"version":3,"sources":["../../src/git/gitUtilities.ts"],"sourcesContent":["//\n// Assorted other git utilities\n// (could be split into separate files later if desired)\n//\n\nimport { getConfigValue } from \"./config.js\";\nimport { git, processGitOutput } from \"./git.js\";\nimport type {\n GetChangesBetweenRefsOptions,\n GitBranchOptions,\n GitCommitOptions,\n GitCommonOptions,\n GitFetchOptions,\n GitInitOptions,\n GitStageOptions,\n ParsedRemoteBranch,\n ParseRemoteBranchOptions,\n} from \"./types.js\";\n\nconst diffArgs = [\"--no-pager\", \"diff\", \"--name-only\", \"--relative\"];\n\n/**\n * Get a list of files with untracked changes.\n * Throws an error on failure by default.\n *\n * @returns An array of file paths with untracked changes\n */\n// TODO: move to getChanges.ts\nexport function getUntrackedChanges(options: GitCommonOptions): string[];\n/** @deprecated Use object params version */\nexport function getUntrackedChanges(cwd: string): string[];\nexport function getUntrackedChanges(cwdOrOptions: string | GitCommonOptions): string[] {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([\"ls-files\", \"--others\", \"--exclude-standard\"], {\n description: \"Gathering information about untracked changes\",\n throwOnError: true,\n ...options,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Fetch from the given remote (and optionally branch) or all remotes.\n * Throws an error on failure by default.\n */\n// TODO: move to fetch.ts\nexport function fetchRemote(options: GitFetchOptions): void;\n/** @deprecated Use object params version */\nexport function fetchRemote(remote: string, cwd: string): void;\nexport function fetchRemote(remoteOrOptions: string | GitFetchOptions, cwd?: string): void {\n const { remote, remoteBranch, options, ...gitOptions } =\n typeof remoteOrOptions === \"string\"\n ? ({ remote: remoteOrOptions, cwd: cwd! } satisfies GitFetchOptions)\n : remoteOrOptions;\n\n if (remoteBranch && !remote) {\n throw new Error('Must provide \"remote\" when using \"remoteBranch\" option');\n }\n\n const fetchArgs = [\n \"fetch\",\n \"--\",\n ...(remote ? [remote] : []),\n ...(remoteBranch ? [remoteBranch] : []),\n ...(options || []),\n ];\n\n git(fetchArgs, {\n description: remote\n ? `Fetching ${remoteBranch ? `branch \"${remoteBranch}\" from ` : \"\"}remote \"${remote}\"`\n : \"Fetching all remotes\",\n throwOnError: true,\n ...gitOptions,\n });\n}\n\n/**\n * Fetch from the given remote and branch. Throws an error on failure.\n * @deprecated Use `fetchRemote({ remote, remoteBranch, cwd })`\n */\n// TODO: move to fetch.ts\nexport function fetchRemoteBranch(remote: string, remoteBranch: string, cwd: string): void {\n fetchRemote({ remote, remoteBranch, cwd, throwOnError: true });\n}\n\n/**\n * Gets file paths with changes that have not been staged yet.\n * Throws an error on failure by default.\n *\n * @returns An array of relative file paths with unstaged changes\n */\n// TODO: move to getChanges.ts\nexport function getUnstagedChanges(options: GitCommonOptions): string[];\n/** @deprecated Use object params version */\nexport function getUnstagedChanges(cwd: string): string[];\nexport function getUnstagedChanges(cwdOrOptions: string | GitCommonOptions): string[] {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git(diffArgs, {\n description: \"Gathering information about unstaged changes\",\n throwOnError: true,\n ...options,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Gets file paths with changes between the current branch and the given branch.\n * Throws an error on failure.\n *\n * @returns An array of relative file paths that have changed\n * @deprecated Use `getBranchChanges({ branch, cwd })`\n */\n// TODO: move to getChanges.ts\nexport function getChanges(branch: string, cwd: string): string[] {\n return getChangesBetweenRefs({ fromRef: branch, cwd, throwOnError: true });\n}\n\n/**\n * Gets file paths with changes between the branch and the merge-base.\n * Throws an error on failure by default.\n *\n * @returns An array of relative file paths that have changed\n */\n// TODO: move to getChanges.ts\nexport function getBranchChanges(options: GitBranchOptions): string[];\n/** @deprecated Use object params version */\nexport function getBranchChanges(branch: string, cwd: string): string[];\nexport function getBranchChanges(branchOrOptions: string | GitBranchOptions, cwd?: string): string[] {\n const { branch, ...options } =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n return getChangesBetweenRefs({ fromRef: branch, throwOnError: true, ...options });\n}\n\n/**\n * Gets file paths with changes between two git references (commits, branches, tags).\n * Throws an error on failure by default.\n *\n * @returns An array of file paths that have changed\n */\n// TODO: move to getChanges.ts\nexport function getChangesBetweenRefs(options: GetChangesBetweenRefsOptions): string[];\n/** @deprecated Use object param version */\nexport function getChangesBetweenRefs(\n fromRef: string,\n toRef: string,\n options: string[],\n pattern: string,\n cwd: string\n): string[];\nexport function getChangesBetweenRefs(\n fromRef: string | GetChangesBetweenRefsOptions,\n toRef?: string,\n options?: string[],\n pattern?: string,\n cwd?: string\n): string[] {\n let gitOptions: GitCommonOptions;\n if (typeof fromRef === \"string\") {\n gitOptions = { cwd: cwd! };\n } else {\n ({ fromRef, toRef, options, pattern, ...gitOptions } = fromRef);\n }\n\n const range = `${fromRef}...${toRef || \"\"}`;\n const results = git([...diffArgs, ...(options || []), range, ...(pattern ? [\"--\", pattern] : [])], {\n description: `Gathering information about changes between refs (${range})`,\n throwOnError: true,\n ...gitOptions,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Gets all files with staged changes (files added to the index).\n * Throws an error on failure by default.\n *\n * @returns An array of relative file paths that have been staged\n */\n// TODO: move to getChanges.ts\nexport function getStagedChanges(options: GitCommonOptions): string[];\n/** @deprecated Use object params version */\nexport function getStagedChanges(cwd: string): string[];\nexport function getStagedChanges(cwdOrOptions: string | GitCommonOptions): string[] {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([...diffArgs, \"--staged\"], {\n description: \"Gathering information about staged changes\",\n throwOnError: true,\n ...options,\n });\n return processGitOutput(results, { excludeNodeModules: true });\n}\n\n/**\n * Gets recent commit messages between the specified parent branch and HEAD.\n * By default, returns an empty array if the operation fails.\n *\n * @returns An array of commit message strings\n */\n// TODO: move to history.ts\nexport function getRecentCommitMessages(options: GitBranchOptions): string[];\n/** @deprecated Use object params version */\nexport function getRecentCommitMessages(branch: string, cwd: string): string[];\nexport function getRecentCommitMessages(branchOrOptions: string | GitBranchOptions, cwd?: string): string[] {\n const { branch, ...options } =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n const results = git([\"log\", \"--decorate\", \"--pretty=format:%s\", `${branch}..HEAD`], {\n description: `Getting recent commit messages for branch \"${branch}\"`,\n ...options,\n });\n return processGitOutput(results);\n}\n\n/**\n * Gets the user email from the git config.\n * @returns The email string if found, null otherwise\n */\n// TODO: move to config.ts\nexport function getUserEmail(options: GitCommonOptions): string | null;\n/** @deprecated Use object params version */\nexport function getUserEmail(cwd: string): string | null;\nexport function getUserEmail(cwdOrOptions: string | GitCommonOptions): string | null {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n return getConfigValue({ key: \"user.email\", ...options });\n}\n\n/**\n * Gets the current branch name.\n * In detached HEAD state, returns \"HEAD\".\n *\n * @returns The branch name if successful, null otherwise\n */\n// TODO: move to refs.ts\nexport function getBranchName(options: GitCommonOptions): string | null;\n/** @deprecated Use object params version */\nexport function getBranchName(cwd: string): string | null;\nexport function getBranchName(cwdOrOptions: string | GitCommonOptions): string | null {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([\"rev-parse\", \"--abbrev-ref\", \"HEAD\"], {\n description: \"Getting current branch name\",\n ...options,\n });\n return results.success ? results.stdout : null;\n}\n\n/**\n * Gets the full reference path for a given branch.\n * `branch` here is the short branch name, e.g. `branch-name`.\n * @returns The full branch reference (e.g., `refs/heads/branch-name`) if found, null otherwise\n */\n// TODO: move to refs.ts\nexport function getFullBranchRef(options: GitBranchOptions): string | null;\n/** @deprecated Use object params version */\nexport function getFullBranchRef(branch: string, cwd: string): string | null;\nexport function getFullBranchRef(branchOrOptions: string | GitBranchOptions, cwd?: string): string | null {\n const { branch, ...options } =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n const showRefResults = git([\"show-ref\", \"--heads\", branch], options);\n\n return showRefResults.success ? showRefResults.stdout.split(\" \")[1] : null;\n}\n\n/**\n * Gets the short branch name from a full branch reference.\n * @returns The short branch name if successful, null otherwise\n */\n// TODO: move to refs.ts\nexport function getShortBranchName(\n options: {\n /** The full branch reference (e.g., `refs/heads/branch-name`) */\n fullBranchRef: string;\n } & GitCommonOptions\n): string | null;\n/** @deprecated Use object params version */\nexport function getShortBranchName(fullBranchRef: string, cwd: string): string | null;\nexport function getShortBranchName(\n refOrOptions: string | ({ fullBranchRef: string } & GitCommonOptions),\n cwd?: string\n): string | null {\n const { fullBranchRef, ...options } =\n typeof refOrOptions === \"string\" ? { fullBranchRef: refOrOptions, cwd: cwd! } : refOrOptions;\n\n // The original command `git name-rev --name-only` returned unreliable results if multiple\n // named refs point to the same commit as the branch.\n const showRefResults = git([\"rev-parse\", \"--abbrev-ref\", fullBranchRef], options);\n\n return showRefResults.success ? showRefResults.stdout || null : null;\n}\n\n/**\n * Gets the current commit hash (SHA).\n * @returns The hash if successful, null otherwise\n */\n// TODO: move to refs.ts\nexport function getCurrentHash(options: GitCommonOptions): string | null;\n/** @deprecated Use object params version */\nexport function getCurrentHash(cwd: string): string | null;\nexport function getCurrentHash(cwdOrOptions: string | GitCommonOptions): string | null {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const results = git([\"rev-parse\", \"HEAD\"], {\n description: \"Getting current git hash\",\n ...options,\n });\n\n return results.success ? results.stdout : null;\n}\n\n/**\n * Get the commit hash in which the file was first added.\n * @returns The commit hash if found, undefined otherwise\n */\n// TODO: move to history.ts\nexport function getFileAddedHash(options: { filename: string } & GitCommonOptions): string | undefined;\n/** @deprecated Use object params version */\nexport function getFileAddedHash(filename: string, cwd: string): string | undefined;\nexport function getFileAddedHash(\n filenameOrOptions: string | ({ filename: string } & GitCommonOptions),\n cwd?: string\n): string | undefined {\n const { filename, ...options } =\n typeof filenameOrOptions === \"string\" ? { filename: filenameOrOptions, cwd: cwd! } : filenameOrOptions;\n\n const results = git([\"rev-list\", \"--max-count=1\", \"HEAD\", filename], options);\n\n return results.success ? results.stdout.trim() : undefined;\n}\n\n/**\n * Run `git init` and verify that the `user.name` and `user.email` configs are set (at any level).\n * Throws an error if `git init` fails.\n *\n * If `user.email` and `user.name` aren't already set globally, and the missing value is provided\n * in params, set it at the repo level. Otherwise, throw an error.\n */\n// TODO: move to init.ts\nexport function init(options: GitInitOptions): void;\n/** @deprecated Use object params version */\nexport function init(cwd: string, email?: string, username?: string): void;\nexport function init(cwdOrOptions: string | GitInitOptions, _email?: string, _username?: string): void {\n const { email, username, ...options } =\n typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions, email: _email, username: _username } : cwdOrOptions;\n\n git([\"init\"], { ...options, throwOnError: true });\n\n if (!getConfigValue({ key: \"user.name\", ...options })) {\n if (!username) {\n throw new Error(\"must include a username when initializing git repo\");\n }\n git([\"config\", \"user.name\", username], options);\n }\n\n if (!getUserEmail(options)) {\n if (!email) {\n throw new Error(\"must include a email when initializing git repo\");\n }\n git([\"config\", \"user.email\", email], options);\n }\n}\n\n/**\n * Stages files matching the given patterns.\n */\n// TODO: move to stageAndCommit.ts\nexport function stage(options: GitStageOptions): void;\n/** @deprecated Use object params version */\nexport function stage(patterns: string[], cwd: string): void;\nexport function stage(patternsOrOptions: string[] | GitStageOptions, cwd?: string): void {\n const { patterns, ...options } = Array.isArray(patternsOrOptions)\n ? { patterns: patternsOrOptions, cwd: cwd! }\n : patternsOrOptions;\n\n for (const pattern of patterns) {\n git([\"add\", pattern], { ...options, description: `Staging changes (git add ${pattern})` });\n }\n}\n\n/**\n * Commit changes. Throws an error on failure by default.\n */\n// TODO: move to stageAndCommit.ts\nexport function commit(options: GitCommitOptions): void;\n/** @deprecated Use object params version */\nexport function commit(message: string, cwd: string, options?: string[]): void;\nexport function commit(messageOrOptions: string | GitCommitOptions, _cwd?: string, _options?: string[]): void {\n const { message, options, ...gitOptions } =\n typeof messageOrOptions === \"string\"\n ? { message: messageOrOptions, cwd: _cwd!, options: _options }\n : messageOrOptions;\n\n git([\"commit\", \"-m\", message, ...(options || [])], {\n throwOnError: true,\n description: \"Committing changes\",\n ...gitOptions,\n });\n}\n\n/**\n * Stages files matching the given patterns and creates a commit with the specified message.\n * Convenience function that combines `stage()` and `commit()`.\n * Throws an error on commit failure by default.\n */\n// TODO: move to stageAndCommit.ts\nexport function stageAndCommit(options: GitStageOptions & GitCommitOptions): void;\n/** @deprecated Use object params version */\nexport function stageAndCommit(patterns: string[], message: string, cwd: string, commitOptions?: string[]): void;\nexport function stageAndCommit(\n patternsOrOptions: string[] | (GitStageOptions & GitCommitOptions),\n message?: string,\n cwd?: string,\n commitOptions?: string[]\n): void {\n const options: GitStageOptions & GitCommitOptions = Array.isArray(patternsOrOptions)\n ? { patterns: patternsOrOptions, message: message!, cwd: cwd!, options: commitOptions }\n : patternsOrOptions;\n\n stage(options);\n commit(options);\n}\n\n/**\n * Reverts all local changes (both staged and unstaged) by stashing them and then dropping the stash.\n * @returns True if the revert was successful, false otherwise. It will also be false if there were\n * no changes to revert. (To distinguish between this case and errors, use the `throwOnError` option.)\n */\n// TODO: move to revertLocalChanges.ts\nexport function revertLocalChanges(options: GitCommonOptions): boolean;\n/** @deprecated Use object params version */\nexport function revertLocalChanges(cwd: string): boolean;\nexport function revertLocalChanges(cwdOrOptions: string | GitCommonOptions): boolean {\n const options: GitCommonOptions = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n const stash = `workspace-tools_${new Date().getTime()}`;\n if (!git([\"stash\", \"push\", \"-u\", \"-m\", stash], options).success) {\n return false;\n }\n\n const results = git([\"stash\", \"list\"], options);\n if (results.success) {\n const matched = results.stdout\n .split(/\\n/)\n .find((line) => line.includes(stash))\n ?.match(/^[^:]+/);\n\n if (matched) {\n git([\"stash\", \"drop\", matched[0]], options);\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Attempts to determine the parent branch of the current branch using `git show-branch`.\n * @returns The parent branch name if found, null otherwise\n * @deprecated Does not appear to be used\n */\nexport function getParentBranch(cwd: string): string | null {\n const branchName = getBranchName({ cwd });\n\n if (!branchName || branchName === \"HEAD\") {\n return null;\n }\n\n const showBranchResult = git([\"show-branch\", \"-a\"], { cwd });\n\n if (showBranchResult.success) {\n const showBranchLines = showBranchResult.stdout.split(/\\n/);\n const parentLine = showBranchLines.find(\n (line) => line.includes(\"*\") && !line.includes(branchName) && !line.includes(\"publish_\")\n );\n\n const matched = parentLine?.match(/\\[(.*)\\]/);\n return matched ? matched[1] : null;\n }\n\n return null;\n}\n\n/**\n * Gets the remote tracking branch for the specified branch.\n *\n * @returns The remote branch name (e.g., `origin/main`) if found, null otherwise\n */\n// TODO: move to refs.ts\nexport function getRemoteBranch(options: GitBranchOptions): string | null;\n/** @deprecated Use object params version */\nexport function getRemoteBranch(branch: string, cwd: string): string | null;\nexport function getRemoteBranch(branchOrOptions: string | GitBranchOptions, cwd?: string): string | null {\n const options: GitBranchOptions =\n typeof branchOrOptions === \"string\" ? { branch: branchOrOptions, cwd: cwd! } : branchOrOptions;\n\n const results = git([\"rev-parse\", \"--abbrev-ref\", \"--symbolic-full-name\", `${options.branch}@{u}`], options);\n\n return results.success ? results.stdout.trim() : null;\n}\n\n/**\n * Get the remote and branch name from a full branch name that may include a remote prefix.\n * If the path doesn't start with one of `options.knownRemotes` (but has multiple segments),\n * the actual list of remotes will be fetched to see if one of those matches.\n *\n * NOTE: The additional verification is new in the object params version; the original version\n * incorrectly assumes the first segment before a slash is always a remote.\n */\n// TODO: move to parseRemoteBranch.ts\nexport function parseRemoteBranch(options: ParseRemoteBranchOptions): ParsedRemoteBranch;\n/**\n * @deprecated Use object params version, which does more verification. This version inaccurately\n * assumes the first segment before a slash is always a remote, which could lead to tricky bugs.\n */\nexport function parseRemoteBranch(branch: string): ParsedRemoteBranch;\nexport function parseRemoteBranch(branchOrOptions: string | ParseRemoteBranchOptions): ParsedRemoteBranch {\n if (typeof branchOrOptions === \"string\") {\n const branch = branchOrOptions;\n const firstSlashPos = branch.indexOf(\"/\", 0);\n return {\n remote: branch.substring(0, firstSlashPos),\n remoteBranch: branch.substring(firstSlashPos + 1),\n };\n }\n\n const { branch, knownRemotes = [\"origin\", \"upstream\"], ...options } = branchOrOptions;\n\n if (!branch.includes(\"/\")) {\n return { remote: \"\", remoteBranch: branch };\n }\n\n let remote = knownRemotes.find((r) => branch.startsWith(`${r}/`));\n\n if (!remote) {\n const remotes = git([\"remote\"], options).stdout.trim().split(/\\n/);\n remote = remotes.find((r) => branch.startsWith(`${r}/`));\n }\n\n if (remote) {\n return { remote, remoteBranch: branch.slice(remote.length + 1) };\n }\n return { remote: \"\", remoteBranch: branch };\n}\n\n/**\n * Gets the default branch based on `git config init.defaultBranch`, falling back to `master`.\n */\n// TODO: move to config.ts\nexport function getDefaultBranch(options: GitCommonOptions): string;\n/** @deprecated Use object params version */\nexport function getDefaultBranch(cwd: string): string;\nexport function getDefaultBranch(cwdOrOptions: string | GitCommonOptions): string {\n const options = typeof cwdOrOptions === \"string\" ? { cwd: cwdOrOptions } : cwdOrOptions;\n\n // Default to the legacy 'master' for backwards compat and old git clients\n return getConfigValue({ key: \"init.defaultBranch\", ...options }) || \"master\";\n}\n\n/**\n * Lists all tracked files matching the given patterns.\n * Throws on error by default.\n * @returns An array of file paths, or an empty array if no files are found\n */\n// TODO: move to history.ts\nexport function listAllTrackedFiles(\n options: {\n /** File patterns to match (passed to git ls-files) */\n patterns: string[];\n } & GitCommonOptions\n): string[];\n/** @deprecated Use object params version */\nexport function listAllTrackedFiles(patterns: string[], cwd: string): string[];\nexport function listAllTrackedFiles(\n patternsOrOptions: string[] | ({ patterns: string[] } & GitCommonOptions),\n cwd?: string\n): string[] {\n const { patterns, ...options } = Array.isArray(patternsOrOptions)\n ? { patterns: patternsOrOptions, cwd: cwd! }\n : patternsOrOptions;\n\n const results = git([\"ls-files\", ...patterns], { throwOnError: true, ...options });\n\n return processGitOutput(results);\n}\n"],"names":["commit","fetchRemote","fetchRemoteBranch","getBranchChanges","getBranchName","getChanges","getChangesBetweenRefs","getCurrentHash","getDefaultBranch","getFileAddedHash","getFullBranchRef","getParentBranch","getRecentCommitMessages","getRemoteBranch","getShortBranchName","getStagedChanges","getUnstagedChanges","getUntrackedChanges","getUserEmail","init","listAllTrackedFiles","parseRemoteBranch","revertLocalChanges","stage","stageAndCommit","diffArgs","cwdOrOptions","options","cwd","results","git","description","throwOnError","processGitOutput","excludeNodeModules","remoteOrOptions","remote","remoteBranch","gitOptions","Error","fetchArgs","branch","fromRef","branchOrOptions","toRef","pattern","range","getConfigValue","key","success","stdout","showRefResults","split","refOrOptions","fullBranchRef","filenameOrOptions","filename","trim","undefined","_email","_username","email","username","patternsOrOptions","patterns","Array","isArray","messageOrOptions","_cwd","_options","message","commitOptions","stash","Date","getTime","matched","find","line","includes","match","branchName","showBranchResult","showBranchLines","parentLine","firstSlashPos","indexOf","substring","knownRemotes","r","startsWith","remotes","slice","length"],"mappings":"AAAA,EAAE;AACF,+BAA+B;AAC/B,wDAAwD;AACxD,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAmYcA;eAAAA;;QApVAC;eAAAA;;QAgCAC;eAAAA;;QA+CAC;eAAAA;;QA+GAC;eAAAA;;QA7HAC;eAAAA;;QAqCAC;eAAAA;;QAuJAC;eAAAA;;QA4PAC;eAAAA;;QAzOAC;eAAAA;;QA/DAC;eAAAA;;QA6MAC;eAAAA;;QAlQAC;eAAAA;;QAiSAC;eAAAA;;QAtNAC;eAAAA;;QAhGAC;eAAAA;;QAzFAC;eAAAA;;QAjEAC;eAAAA;;QAkMAC;eAAAA;;QAwHAC;eAAAA;;QAuOAC;eAAAA;;QAzDAC;eAAAA;;QApFAC;eAAAA;;QA9DAC;eAAAA;;QAuCAC;eAAAA;;;wBAvZe;qBACO;AAatC,MAAMC,WAAW;IAAC;IAAc;IAAQ;IAAe;CAAa;AAY7D,SAASR,oBAAoBS,YAAuC;IACzE,MAAMC,UAA4B,OAAOD,iBAAiB,WAAW;QAAEE,KAAKF;IAAa,IAAIA;IAE7F,MAAMG,UAAUC,IAAAA,QAAG,EAAC;QAAC;QAAY;QAAY;KAAqB,EAAE;QAClEC,aAAa;QACbC,cAAc;QACd,GAAGL,OAAO;IACZ;IACA,OAAOM,IAAAA,qBAAgB,EAACJ,SAAS;QAAEK,oBAAoB;IAAK;AAC9D;AAUO,SAASjC,YAAYkC,eAAyC,EAAEP,GAAY;IACjF,MAAM,EAAEQ,MAAM,EAAEC,YAAY,EAA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oC,QAAQ,EAAE,GAAGrC,SAAS,GAAGsC,MAAMC,OAAO,CAACH,qBAC3C;QAAEC,UAAUD;QAAmBnC,KAAKA;IAAK,IACzCmC;IAEJ,MAAMlC,UAAUC,IAAAA,QAAG,EAAC;QAAC;WAAekC;KAAS,EAAE;QAAEhC,cAAc;QAAM,GAAGL,OAAO;IAAC;IAEhF,OAAOM,IAAAA,qBAAgB,EAACJ;AAC1B"}
package/lib/git/index.js CHANGED
@@ -2,6 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ 0 && (module.exports = {
6
+ addGitObserver: null,
7
+ clearGitObservers: null,
8
+ getConfigValue: null,
9
+ getDefaultRemote: null,
10
+ getDefaultRemoteBranch: null,
11
+ git: null,
12
+ gitFailFast: null
13
+ });
5
14
  function _export(target, all) {
6
15
  for(var name in all)Object.defineProperty(target, name, {
7
16
  enumerable: true,
@@ -31,6 +40,7 @@ _export(exports, {
31
40
  return _git.gitFailFast;
32
41
  }
33
42
  });
43
+ 0 && __export(require("./gitUtilities.js"));
34
44
  const _git = require("./git.js");
35
45
  const _config = require("./config.js");
36
46
  const _getDefaultRemote = require("./getDefaultRemote.js");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/git/index.ts"],"sourcesContent":["export {\n type GitError,\n type GitObserver,\n type GitOptions,\n type GitProcessOutput,\n addGitObserver,\n clearGitObservers,\n git,\n gitFailFast,\n} from \"./git.js\";\nexport { getConfigValue } from \"./config.js\";\nexport { type GetDefaultRemoteOptions, getDefaultRemote } from \"./getDefaultRemote.js\";\nexport { type GetDefaultRemoteBranchOptions, getDefaultRemoteBranch } from \"./getDefaultRemoteBranch.js\";\nexport * from \"./gitUtilities.js\";\n// getRepositoryName is not currently exported; could be changed if it would be useful externally\n"],"names":["addGitObserver","clearGitObservers","getConfigValue","getDefaultRemote","getDefaultRemoteBranch","git","gitFailFast"],"mappings":";;;;;;;;;;;QAKEA;eAAAA,mBAAc;;QACdC;eAAAA,sBAAiB;;QAIVC;eAAAA,sBAAc;;QACgBC;eAAAA,kCAAgB;;QACVC;eAAAA,8CAAsB;;QALjEC;eAAAA,QAAG;;QACHC;eAAAA,gBAAW;;;qBACN;wBACwB;kCACgC;wCACY;qBAC7D;;;;;;;;;;;;;;CACd,iGAAiG"}
1
+ {"version":3,"sources":["../../src/git/index.ts"],"sourcesContent":["export {\n type GitError,\n type GitObserver,\n type GitOptions,\n type GitProcessOutput,\n addGitObserver,\n clearGitObservers,\n git,\n gitFailFast,\n} from \"./git.js\";\nexport { getConfigValue } from \"./config.js\";\nexport { type GetDefaultRemoteOptions, getDefaultRemote } from \"./getDefaultRemote.js\";\nexport { type GetDefaultRemoteBranchOptions, getDefaultRemoteBranch } from \"./getDefaultRemoteBranch.js\";\nexport * from \"./gitUtilities.js\";\n// getRepositoryName is not currently exported; could be changed if it would be useful externally\n"],"names":["addGitObserver","clearGitObservers","getConfigValue","getDefaultRemote","getDefaultRemoteBranch","git","gitFailFast"],"mappings":";;;;;;;;;;;;;;;;;;;;QAKEA;eAAAA,mBAAc;;QACdC;eAAAA,sBAAiB;;QAIVC;eAAAA,sBAAc;;QACgBC;eAAAA,kCAAgB;;QACVC;eAAAA,8CAAsB;;QALjEC;eAAAA,QAAG;;QACHC;eAAAA,gBAAW;;;;qBACN;wBACwB;kCACgC;wCACY;qBAC7D;;;;;;;;;;;;;;CACd,iGAAiG"}
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "getDependentMap", {
8
8
  return getDependentMap;
9
9
  }
10
10
  });
11
+ 0 && __export(require("./createPackageGraph.js")) && __export(require("./createDependencyMap.js")) && __export(require("./getPackageDependencies.js"));
11
12
  _export_star(require("./createPackageGraph.js"), exports);
12
13
  const _createDependencyMap = _export_star(require("./createDependencyMap.js"), exports);
13
14
  _export_star(require("./getPackageDependencies.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/graph/index.ts"],"sourcesContent":["export * from \"./createPackageGraph.js\";\nexport * from \"./createDependencyMap.js\";\nexport * from \"./getPackageDependencies.js\";\nimport { type PackageInfos } from \"../types/PackageInfo.js\";\nimport { createDependencyMap } from \"./createDependencyMap.js\";\n\n/**\n * @deprecated - use createDependencyMap() instead\n *\n * Gets a map that has the package name as key, and its dependencies as values\n */\nexport function getDependentMap(packages: PackageInfos): Map<string, Set<string>> {\n return createDependencyMap(packages).dependencies;\n}\n"],"names":["getDependentMap","packages","createDependencyMap","dependencies"],"mappings":";;;;+BAWgBA;;;eAAAA;;;qBAXF;kDACA;qBACA;;;;;;;;;;;;;;AASP,SAASA,gBAAgBC,QAAsB;IACpD,OAAOC,IAAAA,wCAAmB,EAACD,UAAUE,YAAY;AACnD"}
1
+ {"version":3,"sources":["../../src/graph/index.ts"],"sourcesContent":["export * from \"./createPackageGraph.js\";\nexport * from \"./createDependencyMap.js\";\nexport * from \"./getPackageDependencies.js\";\nimport { type PackageInfos } from \"../types/PackageInfo.js\";\nimport { createDependencyMap } from \"./createDependencyMap.js\";\n\n/**\n * @deprecated - use createDependencyMap() instead\n *\n * Gets a map that has the package name as key, and its dependencies as values\n */\nexport function getDependentMap(packages: PackageInfos): Map<string, Set<string>> {\n return createDependencyMap(packages).dependencies;\n}\n"],"names":["getDependentMap","packages","createDependencyMap","dependencies"],"mappings":";;;;+BAWgBA;;;eAAAA;;;;qBAXF;kDACA;qBACA;;;;;;;;;;;;;;AASP,SAASA,gBAAgBC,QAAsB;IACpD,OAAOC,IAAAA,wCAAmB,EAACD,UAAUE,YAAY;AACnD"}
package/lib/index.js CHANGED
@@ -2,6 +2,44 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ 0 && (module.exports = {
6
+ catalogsToYaml: null,
7
+ findGitRoot: null,
8
+ findPackageRoot: null,
9
+ findProjectRoot: null,
10
+ findWorkspacePath: null,
11
+ getAllPackageJsonFiles: null,
12
+ getAllPackageJsonFilesAsync: null,
13
+ getCatalogVersion: null,
14
+ getCatalogs: null,
15
+ getChangedPackages: null,
16
+ getChangedPackagesBetweenRefs: null,
17
+ getInternalDeps: null,
18
+ getPackageInfo: null,
19
+ getPackageInfoAsync: null,
20
+ getPackageInfos: null,
21
+ getPackageInfosAsync: null,
22
+ getPackagesByFiles: null,
23
+ getScopedPackages: null,
24
+ getTransitiveConsumers: null,
25
+ getTransitiveDependencies: null,
26
+ getTransitiveDependents: null,
27
+ getTransitiveProviders: null,
28
+ getWorkspaceInfos: null,
29
+ getWorkspaceInfosAsync: null,
30
+ getWorkspaceManagerAndRoot: null,
31
+ getWorkspaceManagerRoot: null,
32
+ getWorkspacePackagePaths: null,
33
+ getWorkspacePackagePathsAsync: null,
34
+ getWorkspacePatterns: null,
35
+ isCatalogVersion: null,
36
+ isChildOf: null,
37
+ nameAtVersion: null,
38
+ parseLockFile: null,
39
+ queryLockFile: null,
40
+ searchUp: null,
41
+ setCachingEnabled: null
42
+ });
5
43
  function _export(target, all) {
6
44
  for(var name in all)Object.defineProperty(target, name, {
7
45
  enumerable: true,
@@ -118,6 +156,7 @@ _export(exports, {
118
156
  return _isCachingEnabled.setCachingEnabled;
119
157
  }
120
158
  });
159
+ 0 && __export(require("./git/index.js")) && __export(require("./graph/index.js"));
121
160
  const _index = require("./dependencies/index.js");
122
161
  const _getPackageInfos = require("./getPackageInfos.js");
123
162
  _export_star(require("./git/index.js"), exports);