@mxpicture/build-api 0.2.56 → 0.2.57

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 (143) hide show
  1. package/dist/barrel/Barrel.d.ts +66 -0
  2. package/dist/barrel/Barrel.d.ts.map +1 -1
  3. package/dist/barrel/Barrel.js +66 -2
  4. package/dist/barrel/Barrel.js.map +1 -1
  5. package/dist/cleanup/Cleanup.d.ts +70 -0
  6. package/dist/cleanup/Cleanup.d.ts.map +1 -1
  7. package/dist/cleanup/Cleanup.js +70 -0
  8. package/dist/cleanup/Cleanup.js.map +1 -1
  9. package/dist/code/code.common.d.ts +37 -4
  10. package/dist/code/code.common.d.ts.map +1 -1
  11. package/dist/code/code.common.js +37 -4
  12. package/dist/code/code.common.js.map +1 -1
  13. package/dist/code/code.exports.d.ts +25 -0
  14. package/dist/code/code.exports.d.ts.map +1 -1
  15. package/dist/code/code.exports.js +25 -1
  16. package/dist/code/code.exports.js.map +1 -1
  17. package/dist/code/code.format.d.ts +23 -0
  18. package/dist/code/code.format.d.ts.map +1 -1
  19. package/dist/code/code.format.js +23 -0
  20. package/dist/code/code.format.js.map +1 -1
  21. package/dist/common/common.fs.d.ts +22 -0
  22. package/dist/common/common.fs.d.ts.map +1 -1
  23. package/dist/common/common.fs.js +22 -0
  24. package/dist/common/common.fs.js.map +1 -1
  25. package/dist/common/common.json.d.ts +27 -0
  26. package/dist/common/common.json.d.ts.map +1 -1
  27. package/dist/common/common.json.js +27 -0
  28. package/dist/common/common.json.js.map +1 -1
  29. package/dist/deps/FixWorkspaceDeps.d.ts +132 -0
  30. package/dist/deps/FixWorkspaceDeps.d.ts.map +1 -1
  31. package/dist/deps/FixWorkspaceDeps.js +120 -2
  32. package/dist/deps/FixWorkspaceDeps.js.map +1 -1
  33. package/dist/git/GitChanges.d.ts +60 -13
  34. package/dist/git/GitChanges.d.ts.map +1 -1
  35. package/dist/git/GitChanges.js +60 -13
  36. package/dist/git/GitChanges.js.map +1 -1
  37. package/dist/git/git.util.d.ts +58 -3
  38. package/dist/git/git.util.d.ts.map +1 -1
  39. package/dist/git/git.util.js +58 -3
  40. package/dist/git/git.util.js.map +1 -1
  41. package/dist/logger/Logger.d.ts +74 -0
  42. package/dist/logger/Logger.d.ts.map +1 -1
  43. package/dist/logger/Logger.js +49 -0
  44. package/dist/logger/Logger.js.map +1 -1
  45. package/dist/npmPublish/NpmPublisher.d.ts +36 -0
  46. package/dist/npmPublish/NpmPublisher.d.ts.map +1 -1
  47. package/dist/npmPublish/NpmPublisher.js +36 -0
  48. package/dist/npmPublish/NpmPublisher.js.map +1 -1
  49. package/dist/osInfo/osInfo.common.d.ts +45 -1
  50. package/dist/osInfo/osInfo.common.d.ts.map +1 -1
  51. package/dist/osInfo/osInfo.common.js +45 -1
  52. package/dist/osInfo/osInfo.common.js.map +1 -1
  53. package/dist/pkg/Pkg.d.ts +69 -0
  54. package/dist/pkg/Pkg.d.ts.map +1 -1
  55. package/dist/pkg/Pkg.js +69 -0
  56. package/dist/pkg/Pkg.js.map +1 -1
  57. package/dist/pkg/SyncPkgVersion.d.ts +35 -0
  58. package/dist/pkg/SyncPkgVersion.d.ts.map +1 -1
  59. package/dist/pkg/SyncPkgVersion.js +35 -0
  60. package/dist/pkg/SyncPkgVersion.js.map +1 -1
  61. package/dist/pkg/UpdatePackages.d.ts +36 -0
  62. package/dist/pkg/UpdatePackages.d.ts.map +1 -1
  63. package/dist/pkg/UpdatePackages.js +36 -0
  64. package/dist/pkg/UpdatePackages.js.map +1 -1
  65. package/dist/pkg/pkg.common.d.ts +73 -0
  66. package/dist/pkg/pkg.common.d.ts.map +1 -1
  67. package/dist/pkg/pkg.common.js +73 -0
  68. package/dist/pkg/pkg.common.js.map +1 -1
  69. package/dist/pkg/pkg.fs.d.ts +53 -0
  70. package/dist/pkg/pkg.fs.d.ts.map +1 -1
  71. package/dist/pkg/pkg.fs.js +53 -0
  72. package/dist/pkg/pkg.fs.js.map +1 -1
  73. package/dist/types/types.barrel.d.ts +28 -0
  74. package/dist/types/types.barrel.d.ts.map +1 -1
  75. package/dist/types/types.barrel.js.map +1 -1
  76. package/dist/types/types.changelog.d.ts +28 -0
  77. package/dist/types/types.changelog.d.ts.map +1 -1
  78. package/dist/types/types.changelog.js +9 -0
  79. package/dist/types/types.changelog.js.map +1 -1
  80. package/dist/types/types.cleanup.d.ts +19 -0
  81. package/dist/types/types.cleanup.d.ts.map +1 -1
  82. package/dist/types/types.cleanup.js.map +1 -1
  83. package/dist/types/types.code.d.ts +36 -0
  84. package/dist/types/types.code.d.ts.map +1 -1
  85. package/dist/types/types.code.js.map +1 -1
  86. package/dist/types/types.deps.d.ts +27 -0
  87. package/dist/types/types.deps.d.ts.map +1 -1
  88. package/dist/types/types.deps.js +10 -0
  89. package/dist/types/types.deps.js.map +1 -1
  90. package/dist/types/types.documents.d.ts +9 -0
  91. package/dist/types/types.documents.d.ts.map +1 -1
  92. package/dist/types/types.documents.js.map +1 -1
  93. package/dist/types/types.git.d.ts +25 -0
  94. package/dist/types/types.git.d.ts.map +1 -1
  95. package/dist/types/types.git.js.map +1 -1
  96. package/dist/types/types.npm.d.ts +7 -0
  97. package/dist/types/types.npm.d.ts.map +1 -1
  98. package/dist/types/types.npm.js.map +1 -1
  99. package/dist/types/types.os.d.ts +8 -0
  100. package/dist/types/types.os.d.ts.map +1 -1
  101. package/dist/types/types.os.js.map +1 -1
  102. package/dist/types/types.package.d.ts +48 -0
  103. package/dist/types/types.package.d.ts.map +1 -1
  104. package/dist/types/types.package.js.map +1 -1
  105. package/dist/types/types.run.d.ts +4 -0
  106. package/dist/types/types.run.d.ts.map +1 -1
  107. package/dist/types/types.run.js.map +1 -1
  108. package/dist/types/types.vscode.d.ts +46 -0
  109. package/dist/types/types.vscode.d.ts.map +1 -1
  110. package/dist/types/types.vscode.js.map +1 -1
  111. package/dist/types/types.workspace.d.ts +18 -0
  112. package/dist/types/types.workspace.d.ts.map +1 -1
  113. package/dist/types/types.workspace.js +6 -0
  114. package/dist/types/types.workspace.js.map +1 -1
  115. package/dist/vscode/vscode.config.d.ts +18 -0
  116. package/dist/vscode/vscode.config.d.ts.map +1 -1
  117. package/dist/vscode/vscode.config.js +18 -0
  118. package/dist/vscode/vscode.config.js.map +1 -1
  119. package/dist/vscode/vscode.profiles.d.ts +37 -0
  120. package/dist/vscode/vscode.profiles.d.ts.map +1 -1
  121. package/dist/vscode/vscode.profiles.js +37 -0
  122. package/dist/vscode/vscode.profiles.js.map +1 -1
  123. package/dist/vscode/vscode.settings.d.ts +26 -1
  124. package/dist/vscode/vscode.settings.d.ts.map +1 -1
  125. package/dist/vscode/vscode.settings.js +26 -1
  126. package/dist/vscode/vscode.settings.js.map +1 -1
  127. package/dist/vscode/vscode.storage.d.ts +21 -1
  128. package/dist/vscode/vscode.storage.d.ts.map +1 -1
  129. package/dist/vscode/vscode.storage.js +21 -1
  130. package/dist/vscode/vscode.storage.js.map +1 -1
  131. package/dist/vscode/vscode.workspace.d.ts +17 -0
  132. package/dist/vscode/vscode.workspace.d.ts.map +1 -1
  133. package/dist/vscode/vscode.workspace.js +17 -0
  134. package/dist/vscode/vscode.workspace.js.map +1 -1
  135. package/dist/workspace/Workspace.d.ts +85 -0
  136. package/dist/workspace/Workspace.d.ts.map +1 -1
  137. package/dist/workspace/Workspace.js +85 -0
  138. package/dist/workspace/Workspace.js.map +1 -1
  139. package/dist/workspace/workspace.common.d.ts +42 -1
  140. package/dist/workspace/workspace.common.d.ts.map +1 -1
  141. package/dist/workspace/workspace.common.js +42 -1
  142. package/dist/workspace/workspace.common.js.map +1 -1
  143. package/package.json +1 -1
@@ -1,7 +1,80 @@
1
1
  import { BumpParams, PackageVersion } from "../types/types.package.js";
2
+ /**
3
+ * Parses a semver version string into its constituent parts.
4
+ *
5
+ * @remarks
6
+ * Accepts versions with or without a `v` prefix (e.g. `"v1.2.3"` or `"1.2.3"`).
7
+ * Throws if any of the major, minor, or patch segments are not valid numbers.
8
+ *
9
+ * @param version - A semver version string such as `"1.2.3"` or `"v1.2.3"`.
10
+ * @returns A {@link PackageVersion} object with numeric `major`, `minor`, `patch` and an optional `prefix`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * splitVersion("v1.2.3"); // { major: 1, minor: 2, patch: 3, prefix: "v" }
15
+ * splitVersion("0.5.10"); // { major: 0, minor: 5, patch: 10, prefix: null }
16
+ * ```
17
+ */
2
18
  export declare const splitVersion: (version: string) => PackageVersion;
19
+ /**
20
+ * Concatenates a {@link PackageVersion} object back into a version string.
21
+ *
22
+ * @remarks
23
+ * Includes the prefix (e.g. `"v"`) when present. Minor and patch segments are
24
+ * only appended when they are truthy (non-zero).
25
+ *
26
+ * @param version - The parsed version object to concatenate.
27
+ * @returns The formatted version string, e.g. `"v1.2.3"` or `"1.0"`.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * concatVersion({ major: 1, minor: 2, patch: 3, prefix: "v" }); // "v1.2.3"
32
+ * concatVersion({ major: 2, minor: 0, patch: 0, prefix: null }); // "2"
33
+ * ```
34
+ */
3
35
  export declare const concatVersion: (version: PackageVersion) => string;
36
+ /**
37
+ * Compares two semantic versions numerically.
38
+ *
39
+ * @remarks
40
+ * Accepts either a version string or a {@link PackageVersion} object for each operand.
41
+ * Comparison proceeds from major → minor → patch, returning `0` when components
42
+ * that exist are equal, and short-circuiting when a component is `null`.
43
+ *
44
+ * @param a - The first version to compare.
45
+ * @param b - The second version to compare.
46
+ * @returns A negative number if `a` is less than `b`, a positive number if greater, or `0` if equal.
47
+ */
4
48
  export declare const compareVersions: (a: PackageVersion | string, b: PackageVersion | string) => number;
49
+ /**
50
+ * Checks whether version `a` is strictly greater than version `b`.
51
+ *
52
+ * @param a - The first version to compare.
53
+ * @param b - The second version to compare.
54
+ * @returns `true` if `a` is greater than `b`, otherwise `false`.
55
+ */
5
56
  export declare const compareVersionsGT: (a: PackageVersion | string, b: PackageVersion | string) => boolean;
57
+ /**
58
+ * Increments a semantic version according to the specified bump parameters.
59
+ *
60
+ * @remarks
61
+ * Only one of `major`, `minor`, or `patch` should be set in the bump params.
62
+ * When bumping `major`, `minor` and `patch` are reset to `0`.
63
+ * When bumping `minor`, `patch` is reset to `0`.
64
+ * The original version object is not mutated.
65
+ *
66
+ * @param version - The current version to bump.
67
+ * @param bump - An object indicating which semver component to increment.
68
+ * @returns A new {@link PackageVersion} with the bumped values.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * bumpVersion({ major: 1, minor: 2, patch: 3, prefix: null }, { patch: true });
73
+ * // { major: 1, minor: 2, patch: 4, prefix: null }
74
+ *
75
+ * bumpVersion({ major: 1, minor: 2, patch: 3, prefix: null }, { major: true });
76
+ * // { major: 2, minor: 0, patch: 0, prefix: null }
77
+ * ```
78
+ */
6
79
  export declare const bumpVersion: (version: PackageVersion, bump: BumpParams) => PackageVersion;
7
80
  //# sourceMappingURL=pkg.common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pkg.common.d.ts","sourceRoot":"","sources":["../../src/pkg/pkg.common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,cA+B9C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,KAAG,MAMvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,GAAG,cAAc,GAAG,MAAM,EAC1B,GAAG,cAAc,GAAG,MAAM,KACzB,MASF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,GAAG,cAAc,GAAG,MAAM,EAC1B,GAAG,cAAc,GAAG,MAAM,KACzB,OAAoC,CAAC;AAExC,eAAO,MAAM,WAAW,GACtB,SAAS,cAAc,EACvB,MAAM,UAAU,KACf,cAaF,CAAC"}
1
+ {"version":3,"file":"pkg.common.d.ts","sourceRoot":"","sources":["../../src/pkg/pkg.common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,cA+B9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,KAAG,MAMvD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAC1B,GAAG,cAAc,GAAG,MAAM,EAC1B,GAAG,cAAc,GAAG,MAAM,KACzB,MASF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,GAAG,cAAc,GAAG,MAAM,EAC1B,GAAG,cAAc,GAAG,MAAM,KACzB,OAAoC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,cAAc,EACvB,MAAM,UAAU,KACf,cAaF,CAAC"}
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Parses a semver version string into its constituent parts.
3
+ *
4
+ * @remarks
5
+ * Accepts versions with or without a `v` prefix (e.g. `"v1.2.3"` or `"1.2.3"`).
6
+ * Throws if any of the major, minor, or patch segments are not valid numbers.
7
+ *
8
+ * @param version - A semver version string such as `"1.2.3"` or `"v1.2.3"`.
9
+ * @returns A {@link PackageVersion} object with numeric `major`, `minor`, `patch` and an optional `prefix`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * splitVersion("v1.2.3"); // { major: 1, minor: 2, patch: 3, prefix: "v" }
14
+ * splitVersion("0.5.10"); // { major: 0, minor: 5, patch: 10, prefix: null }
15
+ * ```
16
+ */
1
17
  export const splitVersion = (version) => {
2
18
  const parts = version.split(".");
3
19
  const majorStr = parts.shift();
@@ -18,6 +34,22 @@ export const splitVersion = (version) => {
18
34
  prefix,
19
35
  };
20
36
  };
37
+ /**
38
+ * Concatenates a {@link PackageVersion} object back into a version string.
39
+ *
40
+ * @remarks
41
+ * Includes the prefix (e.g. `"v"`) when present. Minor and patch segments are
42
+ * only appended when they are truthy (non-zero).
43
+ *
44
+ * @param version - The parsed version object to concatenate.
45
+ * @returns The formatted version string, e.g. `"v1.2.3"` or `"1.0"`.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * concatVersion({ major: 1, minor: 2, patch: 3, prefix: "v" }); // "v1.2.3"
50
+ * concatVersion({ major: 2, minor: 0, patch: 0, prefix: null }); // "2"
51
+ * ```
52
+ */
21
53
  export const concatVersion = (version) => {
22
54
  let result = version.major.toString();
23
55
  if (version.prefix)
@@ -28,6 +60,18 @@ export const concatVersion = (version) => {
28
60
  result += "." + version.patch.toString();
29
61
  return result;
30
62
  };
63
+ /**
64
+ * Compares two semantic versions numerically.
65
+ *
66
+ * @remarks
67
+ * Accepts either a version string or a {@link PackageVersion} object for each operand.
68
+ * Comparison proceeds from major → minor → patch, returning `0` when components
69
+ * that exist are equal, and short-circuiting when a component is `null`.
70
+ *
71
+ * @param a - The first version to compare.
72
+ * @param b - The second version to compare.
73
+ * @returns A negative number if `a` is less than `b`, a positive number if greater, or `0` if equal.
74
+ */
31
75
  export const compareVersions = (a, b) => {
32
76
  a = typeof a === "string" ? splitVersion(a) : a;
33
77
  b = typeof b === "string" ? splitVersion(b) : b;
@@ -43,7 +87,36 @@ export const compareVersions = (a, b) => {
43
87
  return a.patch - b.patch;
44
88
  return 0;
45
89
  };
90
+ /**
91
+ * Checks whether version `a` is strictly greater than version `b`.
92
+ *
93
+ * @param a - The first version to compare.
94
+ * @param b - The second version to compare.
95
+ * @returns `true` if `a` is greater than `b`, otherwise `false`.
96
+ */
46
97
  export const compareVersionsGT = (a, b) => compareVersions(a, b) > 0;
98
+ /**
99
+ * Increments a semantic version according to the specified bump parameters.
100
+ *
101
+ * @remarks
102
+ * Only one of `major`, `minor`, or `patch` should be set in the bump params.
103
+ * When bumping `major`, `minor` and `patch` are reset to `0`.
104
+ * When bumping `minor`, `patch` is reset to `0`.
105
+ * The original version object is not mutated.
106
+ *
107
+ * @param version - The current version to bump.
108
+ * @param bump - An object indicating which semver component to increment.
109
+ * @returns A new {@link PackageVersion} with the bumped values.
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * bumpVersion({ major: 1, minor: 2, patch: 3, prefix: null }, { patch: true });
114
+ * // { major: 1, minor: 2, patch: 4, prefix: null }
115
+ *
116
+ * bumpVersion({ major: 1, minor: 2, patch: 3, prefix: null }, { major: true });
117
+ * // { major: 2, minor: 0, patch: 0, prefix: null }
118
+ * ```
119
+ */
47
120
  export const bumpVersion = (version, bump) => {
48
121
  const result = { ...version };
49
122
  if (bump.major) {
@@ -1 +1 @@
1
- {"version":3,"file":"pkg.common.js","sourceRoot":"","sources":["../../src/pkg/pkg.common.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAkB,EAAE;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;IAChC,MAAM,MAAM,GAAkB,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAEpC,IAAI,KAAK,CAAC,KAAK,CAAC;QACd,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,8DAA8D,CAClF,CAAC;IAEJ,IAAI,KAAK,CAAC,KAAK,CAAC;QACd,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,8DA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AC,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { BumpParams, PackageVersion } from \"../types/types.package.js\";\n\nexport const splitVersion = (version: string): PackageVersion => {\n const parts = version.split(\".\");\n\n const majorStr = parts.shift()!;\n const prefix: string | null = majorStr.startsWith(\"v\") ? \"v\" : null;\n\n const major = Number(prefix ? majorStr.substring(prefix.length) : majorStr);\n const minor = Number(parts.shift());\n const patch = Number(parts.shift());\n\n if (isNaN(major))\n throw new Error(\n `Version \"${version}\" does not match pattern \"/^v?major\\.minor\\.patch$/\" (major)`,\n );\n\n if (isNaN(minor))\n throw new Error(\n `Version \"${version}\" does not match pattern \"/^v?major\\.minor\\.patch$/\" (minor)`,\n );\n\n if (isNaN(patch))\n throw new Error(\n `Version \"${version}\" does not match pattern \"/^v?major\\.minor\\.patch$/\" (patch)`,\n );\n\n return {\n major,\n minor,\n patch,\n prefix,\n };\n};\n\nexport const concatVersion = (version: PackageVersion): string => {\n let result: string = version.major.toString();\n if (version.prefix) result = version.prefix + result;\n if (version.minor) result += \".\" + version.minor.toString();\n if (version.patch) result += \".\" + version.patch.toString();\n return result;\n};\n\nexport const compareVersions = (\n a: PackageVersion | string,\n b: PackageVersion | string,\n): number => {\n a = typeof a === \"string\" ? splitVersion(a) : a;\n b = typeof b === \"string\" ? splitVersion(b) : b;\n if (a.major !== b.major) return a.major - b.major;\n if (a.minor === null || b.minor === null) return 0;\n if (a.minor !== b.minor) return a.minor - b.minor;\n if (a.patch === null || b.patch === null) return 0;\n if (a.patch !== b.patch) return a.patch - b.patch;\n return 0;\n};\n\nexport const compareVersionsGT = (\n a: PackageVersion | string,\n b: PackageVersion | string,\n): boolean => compareVersions(a, b) > 0;\n\nexport const bumpVersion = (\n version: PackageVersion,\n bump: BumpParams,\n): PackageVersion => {\n const result: PackageVersion = { ...version };\n if (bump.major) {\n result.major = result.major ? result.major + 1 : 1;\n result.minor = 0;\n result.patch = 0;\n } else if (bump.minor) {\n result.minor = result.minor ? result.minor + 1 : 1;\n result.patch = 0;\n } else if (bump.patch) {\n result.patch = result.patch ? result.patch + 1 : 1;\n }\n return result;\n};\n"]}
1
+ {"version":3,"file":"pkg.common.js","sourceRoot":"","sources":["../../src/pkg/pkg.common.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAkB,EAAE;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;IAChC,MAAM,MAAM,GAAkB,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAEpC,IAAI,KAAK,CAAC,KAAK,CAAC;QACd,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,8DAA8D,CAClF,CAAC;IAEJ,IAAI,KAAK,CAAC,KAAK,CAAC;QACd,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,8DAA8D,CAClF,CAAC;IAEJ,IAAI,KAAK,CAAC,KAAK,CAAC;QACd,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,8DAA8D,CAClF,CAAC;IAEJ,OAAO;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,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parses a semver version string into its constituent parts.\n *\n * @remarks\n * Accepts versions with or without a `v` prefix (e.g. `\"v1.2.3\"` or `\"1.2.3\"`).\n * Throws if any of the major, minor, or patch segments are not valid numbers.\n *\n * @param version - A semver version string such as `\"1.2.3\"` or `\"v1.2.3\"`.\n * @returns A {@link PackageVersion} object with numeric `major`, `minor`, `patch` and an optional `prefix`.\n *\n * @example\n * ```ts\n * splitVersion(\"v1.2.3\"); // { major: 1, minor: 2, patch: 3, prefix: \"v\" }\n * splitVersion(\"0.5.10\"); // { major: 0, minor: 5, patch: 10, prefix: null }\n * ```\n */\nexport const splitVersion = (version: string): PackageVersion => {\n const parts = version.split(\".\");\n\n const majorStr = parts.shift()!;\n const prefix: string | null = majorStr.startsWith(\"v\") ? \"v\" : null;\n\n const major = Number(prefix ? majorStr.substring(prefix.length) : majorStr);\n const minor = Number(parts.shift());\n const patch = Number(parts.shift());\n\n if (isNaN(major))\n throw new Error(\n `Version \"${version}\" does not match pattern \"/^v?major\\.minor\\.patch$/\" (major)`,\n );\n\n if (isNaN(minor))\n throw new Error(\n `Version \"${version}\" does not match pattern \"/^v?major\\.minor\\.patch$/\" (minor)`,\n );\n\n if (isNaN(patch))\n throw new Error(\n `Version \"${version}\" does not match pattern \"/^v?major\\.minor\\.patch$/\" (patch)`,\n );\n\n return {\n major,\n minor,\n patch,\n prefix,\n };\n};\n\n/**\n * Concatenates a {@link PackageVersion} object back into a version string.\n *\n * @remarks\n * Includes the prefix (e.g. `\"v\"`) when present. Minor and patch segments are\n * only appended when they are truthy (non-zero).\n *\n * @param version - The parsed version object to concatenate.\n * @returns The formatted version string, e.g. `\"v1.2.3\"` or `\"1.0\"`.\n *\n * @example\n * ```ts\n * concatVersion({ major: 1, minor: 2, patch: 3, prefix: \"v\" }); // \"v1.2.3\"\n * concatVersion({ major: 2, minor: 0, patch: 0, prefix: null }); // \"2\"\n * ```\n */\nexport const concatVersion = (version: PackageVersion): string => {\n let result: string = version.major.toString();\n if (version.prefix) result = version.prefix + result;\n if (version.minor) result += \".\" + version.minor.toString();\n if (version.patch) result += \".\" + version.patch.toString();\n return result;\n};\n\n/**\n * Compares two semantic versions numerically.\n *\n * @remarks\n * Accepts either a version string or a {@link PackageVersion} object for each operand.\n * Comparison proceeds from major → minor → patch, returning `0` when components\n * that exist are equal, and short-circuiting when a component is `null`.\n *\n * @param a - The first version to compare.\n * @param b - The second version to compare.\n * @returns A negative number if `a` is less than `b`, a positive number if greater, or `0` if equal.\n */\nexport const compareVersions = (\n a: PackageVersion | string,\n b: PackageVersion | string,\n): number => {\n a = typeof a === \"string\" ? splitVersion(a) : a;\n b = typeof b === \"string\" ? splitVersion(b) : b;\n if (a.major !== b.major) return a.major - b.major;\n if (a.minor === null || b.minor === null) return 0;\n if (a.minor !== b.minor) return a.minor - b.minor;\n if (a.patch === null || b.patch === null) return 0;\n if (a.patch !== b.patch) return a.patch - b.patch;\n return 0;\n};\n\n/**\n * Checks whether version `a` is strictly greater than version `b`.\n *\n * @param a - The first version to compare.\n * @param b - The second version to compare.\n * @returns `true` if `a` is greater than `b`, otherwise `false`.\n */\nexport const compareVersionsGT = (\n a: PackageVersion | string,\n b: PackageVersion | string,\n): boolean => compareVersions(a, b) > 0;\n\n/**\n * Increments a semantic version according to the specified bump parameters.\n *\n * @remarks\n * Only one of `major`, `minor`, or `patch` should be set in the bump params.\n * When bumping `major`, `minor` and `patch` are reset to `0`.\n * When bumping `minor`, `patch` is reset to `0`.\n * The original version object is not mutated.\n *\n * @param version - The current version to bump.\n * @param bump - An object indicating which semver component to increment.\n * @returns A new {@link PackageVersion} with the bumped values.\n *\n * @example\n * ```ts\n * bumpVersion({ major: 1, minor: 2, patch: 3, prefix: null }, { patch: true });\n * // { major: 1, minor: 2, patch: 4, prefix: null }\n *\n * bumpVersion({ major: 1, minor: 2, patch: 3, prefix: null }, { major: true });\n * // { major: 2, minor: 0, patch: 0, prefix: null }\n * ```\n */\nexport const bumpVersion = (\n version: PackageVersion,\n bump: BumpParams,\n): PackageVersion => {\n const result: PackageVersion = { ...version };\n if (bump.major) {\n result.major = result.major ? result.major + 1 : 1;\n result.minor = 0;\n result.patch = 0;\n } else if (bump.minor) {\n result.minor = result.minor ? result.minor + 1 : 1;\n result.patch = 0;\n } else if (bump.patch) {\n result.patch = result.patch ? result.patch + 1 : 1;\n }\n return result;\n};\n"]}
@@ -1,6 +1,59 @@
1
1
  import { PackageJson } from "../types/types.package.js";
2
+ /**
3
+ * Reads and parses a `package.json` file asynchronously.
4
+ *
5
+ * @remarks
6
+ * Uses JSON5 for parsing, so comments and trailing commas are permitted.
7
+ * If the path is a directory, `/package.json` is automatically appended.
8
+ *
9
+ * @param dirOrFilepath - An absolute path to either a directory containing `package.json` or the file itself.
10
+ * @returns A promise resolving to the parsed {@link PackageJson} contents.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const pkg = await readPackageJson("/path/to/my-package");
15
+ * console.log(pkg.name);
16
+ * ```
17
+ */
2
18
  export declare const readPackageJson: (dirOrFilepath: string) => Promise<PackageJson>;
19
+ /**
20
+ * Reads and parses a `package.json` file synchronously.
21
+ *
22
+ * @remarks
23
+ * Uses JSON5 for parsing, so comments and trailing commas are permitted.
24
+ * If the path is a directory, `/package.json` is automatically appended.
25
+ *
26
+ * @param dirOrFilepath - An absolute path to either a directory containing `package.json` or the file itself.
27
+ * @returns The parsed {@link PackageJson} contents.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const pkg = readPackageJsonSync("/path/to/my-package");
32
+ * console.log(pkg.version);
33
+ * ```
34
+ */
3
35
  export declare const readPackageJsonSync: (dirOrFilepath: string) => PackageJson;
36
+ /**
37
+ * Writes a {@link PackageJson} object to disk as formatted JSON.
38
+ *
39
+ * @remarks
40
+ * The output is stringified via JSON5 and then formatted with the project's
41
+ * standard JSON formatter before being written.
42
+ *
43
+ * @param jsonPath - The absolute file path to write the `package.json` to.
44
+ * @param content - The package JSON content to serialize and write.
45
+ * @returns A promise that resolves when the file has been written.
46
+ */
4
47
  export declare const writePackageJson: (jsonPath: string, content: PackageJson) => Promise<void>;
48
+ /**
49
+ * Ensures a path ends with `/package.json`.
50
+ *
51
+ * @remarks
52
+ * If the path already ends with `/package.json` it is returned as-is;
53
+ * otherwise `package.json` is appended via `path.join`.
54
+ *
55
+ * @param dirOrFilepath - A directory path or a path already pointing to `package.json`.
56
+ * @returns The path guaranteed to end with `/package.json`.
57
+ */
5
58
  export declare const ensurePkgJsonPath: (dirOrFilepath: string) => string;
6
59
  //# sourceMappingURL=pkg.fs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pkg.fs.d.ts","sourceRoot":"","sources":["../../src/pkg/pkg.fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAKxD,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,KACpB,OAAO,CAAC,WAAW,CACiD,CAAC;AAExE,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,KAAG,WACS,CAAC;AAEtE,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,SAAS,WAAW,KACnB,OAAO,CAAC,IAAI,CAC2D,CAAC;AAE3E,eAAO,MAAM,iBAAiB,GAAI,eAAe,MAAM,KAAG,MAGjB,CAAC"}
1
+ {"version":3,"file":"pkg.fs.d.ts","sourceRoot":"","sources":["../../src/pkg/pkg.fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAKxD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,KACpB,OAAO,CAAC,WAAW,CACiD,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,KAAG,WACS,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,SAAS,WAAW,KACnB,OAAO,CAAC,IAAI,CAC2D,CAAC;AAE3E;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,eAAe,MAAM,KAAG,MAGjB,CAAC"}
@@ -3,9 +3,62 @@ import { readFile, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { formatJsonStringify } from "../code/code.format.js";
5
5
  import { readFileSync } from "node:fs";
6
+ /**
7
+ * Reads and parses a `package.json` file asynchronously.
8
+ *
9
+ * @remarks
10
+ * Uses JSON5 for parsing, so comments and trailing commas are permitted.
11
+ * If the path is a directory, `/package.json` is automatically appended.
12
+ *
13
+ * @param dirOrFilepath - An absolute path to either a directory containing `package.json` or the file itself.
14
+ * @returns A promise resolving to the parsed {@link PackageJson} contents.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const pkg = await readPackageJson("/path/to/my-package");
19
+ * console.log(pkg.name);
20
+ * ```
21
+ */
6
22
  export const readPackageJson = async (dirOrFilepath) => json5.parse(await readFile(ensurePkgJsonPath(dirOrFilepath), "utf8"));
23
+ /**
24
+ * Reads and parses a `package.json` file synchronously.
25
+ *
26
+ * @remarks
27
+ * Uses JSON5 for parsing, so comments and trailing commas are permitted.
28
+ * If the path is a directory, `/package.json` is automatically appended.
29
+ *
30
+ * @param dirOrFilepath - An absolute path to either a directory containing `package.json` or the file itself.
31
+ * @returns The parsed {@link PackageJson} contents.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const pkg = readPackageJsonSync("/path/to/my-package");
36
+ * console.log(pkg.version);
37
+ * ```
38
+ */
7
39
  export const readPackageJsonSync = (dirOrFilepath) => json5.parse(readFileSync(ensurePkgJsonPath(dirOrFilepath), "utf8"));
40
+ /**
41
+ * Writes a {@link PackageJson} object to disk as formatted JSON.
42
+ *
43
+ * @remarks
44
+ * The output is stringified via JSON5 and then formatted with the project's
45
+ * standard JSON formatter before being written.
46
+ *
47
+ * @param jsonPath - The absolute file path to write the `package.json` to.
48
+ * @param content - The package JSON content to serialize and write.
49
+ * @returns A promise that resolves when the file has been written.
50
+ */
8
51
  export const writePackageJson = async (jsonPath, content) => writeFile(jsonPath, await formatJsonStringify(json5.stringify(content)));
52
+ /**
53
+ * Ensures a path ends with `/package.json`.
54
+ *
55
+ * @remarks
56
+ * If the path already ends with `/package.json` it is returned as-is;
57
+ * otherwise `package.json` is appended via `path.join`.
58
+ *
59
+ * @param dirOrFilepath - A directory path or a path already pointing to `package.json`.
60
+ * @returns The path guaranteed to end with `/package.json`.
61
+ */
9
62
  export const ensurePkgJsonPath = (dirOrFilepath) => dirOrFilepath.endsWith("/package.json")
10
63
  ? dirOrFilepath
11
64
  : join(dirOrFilepath, "package.json");
@@ -1 +1 @@
1
- {"version":3,"file":"pkg.fs.js","sourceRoot":"","sources":["../../src/pkg/pkg.fs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,aAAqB,EACC,EAAE,CACxB,KAAK,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAqB,EAAe,EAAE,CACxE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,QAAgB,EAChB,OAAoB,EACL,EAAE,CACjB,SAAS,CAAC,QAAQ,EAAE,MAAM,mBAAmB,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,aAAqB,EAAU,EAAE,CACjE,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;IACrC,CAAC,CAAC,aAAa;IACf,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import json5 from \"json5\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { PackageJson } from \"../types/types.package.js\";\nimport { join } from \"node:path\";\nimport { formatJsonStringify } from \"../code/code.format.js\";\nimport { readFileSync } from \"node:fs\";\n\nexport const readPackageJson = async (\n dirOrFilepath: string,\n): Promise<PackageJson> =>\n json5.parse(await readFile(ensurePkgJsonPath(dirOrFilepath), \"utf8\"));\n\nexport const readPackageJsonSync = (dirOrFilepath: string): PackageJson =>\n json5.parse(readFileSync(ensurePkgJsonPath(dirOrFilepath), \"utf8\"));\n\nexport const writePackageJson = async (\n jsonPath: string,\n content: PackageJson,\n): Promise<void> =>\n writeFile(jsonPath, await formatJsonStringify(json5.stringify(content)));\n\nexport const ensurePkgJsonPath = (dirOrFilepath: string): string =>\n dirOrFilepath.endsWith(\"/package.json\")\n ? dirOrFilepath\n : join(dirOrFilepath, \"package.json\");\n"]}
1
+ {"version":3,"file":"pkg.fs.js","sourceRoot":"","sources":["../../src/pkg/pkg.fs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,aAAqB,EACC,EAAE,CACxB,KAAK,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAqB,EAAe,EAAE,CACxE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,QAAgB,EAChB,OAAoB,EACL,EAAE,CACjB,SAAS,CAAC,QAAQ,EAAE,MAAM,mBAAmB,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,aAAqB,EAAU,EAAE,CACjE,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;IACrC,CAAC,CAAC,aAAa;IACf,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import json5 from \"json5\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { PackageJson } from \"../types/types.package.js\";\nimport { join } from \"node:path\";\nimport { formatJsonStringify } from \"../code/code.format.js\";\nimport { readFileSync } from \"node:fs\";\n\n/**\n * Reads and parses a `package.json` file asynchronously.\n *\n * @remarks\n * Uses JSON5 for parsing, so comments and trailing commas are permitted.\n * If the path is a directory, `/package.json` is automatically appended.\n *\n * @param dirOrFilepath - An absolute path to either a directory containing `package.json` or the file itself.\n * @returns A promise resolving to the parsed {@link PackageJson} contents.\n *\n * @example\n * ```ts\n * const pkg = await readPackageJson(\"/path/to/my-package\");\n * console.log(pkg.name);\n * ```\n */\nexport const readPackageJson = async (\n dirOrFilepath: string,\n): Promise<PackageJson> =>\n json5.parse(await readFile(ensurePkgJsonPath(dirOrFilepath), \"utf8\"));\n\n/**\n * Reads and parses a `package.json` file synchronously.\n *\n * @remarks\n * Uses JSON5 for parsing, so comments and trailing commas are permitted.\n * If the path is a directory, `/package.json` is automatically appended.\n *\n * @param dirOrFilepath - An absolute path to either a directory containing `package.json` or the file itself.\n * @returns The parsed {@link PackageJson} contents.\n *\n * @example\n * ```ts\n * const pkg = readPackageJsonSync(\"/path/to/my-package\");\n * console.log(pkg.version);\n * ```\n */\nexport const readPackageJsonSync = (dirOrFilepath: string): PackageJson =>\n json5.parse(readFileSync(ensurePkgJsonPath(dirOrFilepath), \"utf8\"));\n\n/**\n * Writes a {@link PackageJson} object to disk as formatted JSON.\n *\n * @remarks\n * The output is stringified via JSON5 and then formatted with the project's\n * standard JSON formatter before being written.\n *\n * @param jsonPath - The absolute file path to write the `package.json` to.\n * @param content - The package JSON content to serialize and write.\n * @returns A promise that resolves when the file has been written.\n */\nexport const writePackageJson = async (\n jsonPath: string,\n content: PackageJson,\n): Promise<void> =>\n writeFile(jsonPath, await formatJsonStringify(json5.stringify(content)));\n\n/**\n * Ensures a path ends with `/package.json`.\n *\n * @remarks\n * If the path already ends with `/package.json` it is returned as-is;\n * otherwise `package.json` is appended via `path.join`.\n *\n * @param dirOrFilepath - A directory path or a path already pointing to `package.json`.\n * @returns The path guaranteed to end with `/package.json`.\n */\nexport const ensurePkgJsonPath = (dirOrFilepath: string): string =>\n dirOrFilepath.endsWith(\"/package.json\")\n ? dirOrFilepath\n : join(dirOrFilepath, \"package.json\");\n"]}
@@ -1,24 +1,52 @@
1
1
  import type { Pkg } from "../pkg/Pkg.js";
2
2
  import { SourceFile } from "./types.code.js";
3
3
  import { RunRepoRootParams } from "./types.run.js";
4
+ /**
5
+ * A group of files within a directory that share a common barrel file.
6
+ *
7
+ * @remarks
8
+ * Represents one directory's barrel-file context, including the files
9
+ * that should be re-exported and whether the barrel already exists on disk.
10
+ */
4
11
  export interface BarrelGroup {
12
+ /** Absolute path to the directory containing the barrel file. */
5
13
  dirPath: string;
14
+ /** Absolute path to the barrel (index) file itself. */
6
15
  barrelFilePath: string;
16
+ /** Whether the barrel file already exists on disk. */
7
17
  barrelExists: boolean;
18
+ /** List of file paths to be re-exported through the barrel. */
8
19
  files: string[];
20
+ /** The package that owns this barrel group. */
9
21
  pkg: Pkg;
10
22
  }
23
+ /**
24
+ * The result of a barrel-file generation operation for a single package.
25
+ */
11
26
  export interface BarrelResult {
27
+ /** Directories in which barrel files were generated or updated. */
12
28
  barrelDirs: string[];
29
+ /** The package for which barrels were generated. */
13
30
  pkg: Pkg;
14
31
  }
32
+ /**
33
+ * Parameters for running barrel-file generation across a repository.
34
+ */
15
35
  export interface BarrelParams extends RunRepoRootParams {
36
+ /** Regular expressions used to exclude files or directories from barrel generation. */
16
37
  excludes?: RegExp[];
38
+ /** A header comment to prepend to each generated barrel file. */
17
39
  fileHeader?: string;
40
+ /** When `true`, use the TypeScript Compiler API to resolve exports. */
18
41
  useCompilerApi?: boolean;
19
42
  }
43
+ /**
44
+ * Parameters for persisting a barrel file to disk.
45
+ */
20
46
  export interface BarrelPersistParams {
47
+ /** The barrel group to persist. */
21
48
  group: BarrelGroup;
49
+ /** Optional pre-built source-file map to avoid redundant parsing. */
22
50
  sourceFileMap?: Map<string, SourceFile>;
23
51
  }
24
52
  //# sourceMappingURL=types.barrel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.barrel.d.ts","sourceRoot":"","sources":["../../src/types/types.barrel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,GA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cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,KAAK,EAAE,WAAW,CAAC;IACnB,qEAAqE;IACrE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.barrel.js","sourceRoot":"","sources":["../../src/types/types.barrel.ts"],"names":[],"mappings":"","sourcesContent":["import type { Pkg } from \"../pkg/Pkg.js\";\nimport { SourceFile } from \"./types.code.js\";\nimport { RunRepoRootParams } from \"./types.run.js\";\n\nexport interface BarrelGroup {\n dirPath: string;\n barrelFilePath: string;\n barrelExists: boolean;\n files: string[];\n pkg: Pkg;\n}\n\nexport interface BarrelResult {\n barrelDirs: string[];\n pkg: Pkg;\n}\n\nexport interface BarrelParams extends RunRepoRootParams {\n excludes?: RegExp[];\n fileHeader?: string;\n useCompilerApi?: boolean;\n}\n\nexport interface BarrelPersistParams {\n group: BarrelGroup;\n sourceFileMap?: Map<string, SourceFile>;\n}\n"]}
1
+ {"version":3,"file":"types.barrel.js","sourceRoot":"","sources":["../../src/types/types.barrel.ts"],"names":[],"mappings":"","sourcesContent":["import type { Pkg } from \"../pkg/Pkg.js\";\nimport { SourceFile } from \"./types.code.js\";\nimport { RunRepoRootParams } from \"./types.run.js\";\n\n/**\n * A group of files within a directory that share a common barrel file.\n *\n * @remarks\n * Represents one directory's barrel-file context, including the files\n * that should be re-exported and whether the barrel already exists on disk.\n */\nexport interface BarrelGroup {\n /** Absolute path to the directory containing the barrel file. */\n dirPath: string;\n /** Absolute path to the barrel (index) file itself. */\n barrelFilePath: string;\n /** Whether the barrel file already exists on disk. */\n barrelExists: boolean;\n /** List of file paths to be re-exported through the barrel. */\n files: string[];\n /** The package that owns this barrel group. */\n pkg: Pkg;\n}\n\n/**\n * The result of a barrel-file generation operation for a single package.\n */\nexport interface BarrelResult {\n /** Directories in which barrel files were generated or updated. */\n barrelDirs: string[];\n /** The package for which barrels were generated. */\n pkg: Pkg;\n}\n\n/**\n * Parameters for running barrel-file generation across a repository.\n */\nexport interface BarrelParams extends RunRepoRootParams {\n /** Regular expressions used to exclude files or directories from barrel generation. */\n excludes?: RegExp[];\n /** A header comment to prepend to each generated barrel file. */\n fileHeader?: string;\n /** When `true`, use the TypeScript Compiler API to resolve exports. */\n useCompilerApi?: boolean;\n}\n\n/**\n * Parameters for persisting a barrel file to disk.\n */\nexport interface BarrelPersistParams {\n /** The barrel group to persist. */\n group: BarrelGroup;\n /** Optional pre-built source-file map to avoid redundant parsing. */\n sourceFileMap?: Map<string, SourceFile>;\n}\n"]}
@@ -1,14 +1,42 @@
1
1
  import { DocumentData } from "./types.documents.js";
2
+ /**
3
+ * Enumeration of change-watch source types.
4
+ *
5
+ * @remarks
6
+ * Determines how file changes are detected — either via a changelog file
7
+ * or by inspecting git history.
8
+ */
2
9
  export declare enum ChangeWatchType {
10
+ /** Watch for changes recorded in a changelog file. */
3
11
  changelog = "changelog",
12
+ /** Watch for changes derived from git commit history. */
4
13
  gitHistory = "gitHistory"
5
14
  }
15
+ /**
16
+ * Configuration for a single change-watch rule.
17
+ */
6
18
  export interface ChangeWatch {
19
+ /** Glob pattern that identifies the files to watch. */
7
20
  pattern: string;
21
+ /** The source type used to detect changes. */
8
22
  type: ChangeWatchType;
9
23
  }
24
+ /**
25
+ * Callback invoked when watched files change.
26
+ *
27
+ * @typeParam T - The document data shape returned by the handler.
28
+ * @param paths - Absolute paths of the files that changed.
29
+ * @param watch - The change-watch rule that triggered this event.
30
+ * @returns A promise resolving to the resulting document data, or `null` if no data was produced.
31
+ */
10
32
  export type ChangeEventHandler<T extends DocumentData> = (paths: string[], watch: ChangeWatch) => Promise<T | null>;
33
+ /**
34
+ * A change-watch rule paired with its event handler.
35
+ *
36
+ * @typeParam T - The document data shape returned by the handler.
37
+ */
11
38
  export interface ChangeWatchHandler<T extends DocumentData> extends ChangeWatch {
39
+ /** The handler function to invoke when matching files change. */
12
40
  handler: ChangeEventHandler<T>;
13
41
  }
14
42
  //# sourceMappingURL=types.changelog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.changelog.d.ts","sourceRoot":"","sources":["../../src/types/types.changelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,oBAAY,eAAe;IACzB,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,YAAY,IAAI,CACvD,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,EAAE,WAAW,KACf,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAEvB,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,YAAY,CACtB,SAAQ,WAAW;IACnB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAChC"}
1
+ {"version":3,"file":"types.changelog.d.ts","sourceRoot":"","sources":["../../src/types/types.changelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,sDAAsD;IACtD,SAAS,cAAc;IACvB,yDAAyD;IACzD,UAAU,eAAe;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,YAAY,IAAI,CACvD,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,EAAE,WAAW,KACf,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAEvB;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,YAAY,CACtB,SAAQ,WAAW;IACnB,iEAAiE;IACjE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAChC"}
@@ -1,6 +1,15 @@
1
+ /**
2
+ * Enumeration of change-watch source types.
3
+ *
4
+ * @remarks
5
+ * Determines how file changes are detected — either via a changelog file
6
+ * or by inspecting git history.
7
+ */
1
8
  export var ChangeWatchType;
2
9
  (function (ChangeWatchType) {
10
+ /** Watch for changes recorded in a changelog file. */
3
11
  ChangeWatchType["changelog"] = "changelog";
12
+ /** Watch for changes derived from git commit history. */
4
13
  ChangeWatchType["gitHistory"] = "gitHistory";
5
14
  })(ChangeWatchType || (ChangeWatchType = {}));
6
15
  //# sourceMappingURL=types.changelog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.changelog.js","sourceRoot":"","sources":["../../src/types/types.changelog.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,4CAAyB,CAAA;AAC3B,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["import { DocumentData } from \"./types.documents.js\";\n\nexport enum ChangeWatchType {\n changelog = \"changelog\",\n gitHistory = \"gitHistory\",\n}\n\nexport interface ChangeWatch {\n pattern: string;\n type: ChangeWatchType;\n}\n\nexport type ChangeEventHandler<T extends DocumentData> = (\n paths: string[],\n watch: ChangeWatch,\n) => Promise<T | null>;\n\nexport interface ChangeWatchHandler<\n T extends DocumentData,\n> extends ChangeWatch {\n handler: ChangeEventHandler<T>;\n}\n"]}
1
+ {"version":3,"file":"types.changelog.js","sourceRoot":"","sources":["../../src/types/types.changelog.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sDAAsD;IACtD,0CAAuB,CAAA;IACvB,yDAAyD;IACzD,4CAAyB,CAAA;AAC3B,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["import { DocumentData } from \"./types.documents.js\";\n\n/**\n * Enumeration of change-watch source types.\n *\n * @remarks\n * Determines how file changes are detected — either via a changelog file\n * or by inspecting git history.\n */\nexport enum ChangeWatchType {\n /** Watch for changes recorded in a changelog file. */\n changelog = \"changelog\",\n /** Watch for changes derived from git commit history. */\n gitHistory = \"gitHistory\",\n}\n\n/**\n * Configuration for a single change-watch rule.\n */\nexport interface ChangeWatch {\n /** Glob pattern that identifies the files to watch. */\n pattern: string;\n /** The source type used to detect changes. */\n type: ChangeWatchType;\n}\n\n/**\n * Callback invoked when watched files change.\n *\n * @typeParam T - The document data shape returned by the handler.\n * @param paths - Absolute paths of the files that changed.\n * @param watch - The change-watch rule that triggered this event.\n * @returns A promise resolving to the resulting document data, or `null` if no data was produced.\n */\nexport type ChangeEventHandler<T extends DocumentData> = (\n paths: string[],\n watch: ChangeWatch,\n) => Promise<T | null>;\n\n/**\n * A change-watch rule paired with its event handler.\n *\n * @typeParam T - The document data shape returned by the handler.\n */\nexport interface ChangeWatchHandler<\n T extends DocumentData,\n> extends ChangeWatch {\n /** The handler function to invoke when matching files change. */\n handler: ChangeEventHandler<T>;\n}\n"]}
@@ -1,13 +1,32 @@
1
1
  import { RunRepoRootParams } from "./types.run.js";
2
+ /**
3
+ * Describes an item that is scheduled for deletion.
4
+ */
2
5
  export interface ToBeDeleted {
6
+ /** Name (file or directory) to delete. */
3
7
  name: string;
8
+ /** Optional suffix appended to the name when moving instead of deleting. */
4
9
  moveSuffix?: string;
5
10
  }
11
+ /**
12
+ * A resolved cleanup target with full path information.
13
+ *
14
+ * @remarks
15
+ * Extends {@link ToBeDeleted} with absolute path details so the cleanup
16
+ * operation knows exactly where to find the item and, optionally, where
17
+ * to move it.
18
+ */
6
19
  export interface ToCleanup extends ToBeDeleted {
20
+ /** Absolute path of the item to clean up. */
7
21
  path: string;
22
+ /** Absolute destination path when moving rather than deleting. */
8
23
  moveTo?: string;
9
24
  }
25
+ /**
26
+ * Parameters for running a cleanup operation across a repository.
27
+ */
10
28
  export interface CleanupParams extends RunRepoRootParams {
29
+ /** Items to delete or move during cleanup. */
11
30
  toBeDeleted?: ToBeDeleted[];
12
31
  }
13
32
  //# sourceMappingURL=types.cleanup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.cleanup.d.ts","sourceRoot":"","sources":["../../src/types/types.cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;CAC7B"}
1
+ {"version":3,"file":"types.cleanup.d.ts","sourceRoot":"","sources":["../../src/types/types.cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,8CAA8C;IAC9C,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cleanup.js","sourceRoot":"","sources":["../../src/types/types.cleanup.ts"],"names":[],"mappings":"","sourcesContent":["import { RunRepoRootParams } from \"./types.run.js\";\n\nexport interface ToBeDeleted {\n name: string;\n moveSuffix?: string;\n}\n\nexport interface ToCleanup extends ToBeDeleted {\n path: string;\n moveTo?: string;\n}\n\nexport interface CleanupParams extends RunRepoRootParams {\n toBeDeleted?: ToBeDeleted[];\n}\n"]}
1
+ {"version":3,"file":"types.cleanup.js","sourceRoot":"","sources":["../../src/types/types.cleanup.ts"],"names":[],"mappings":"","sourcesContent":["import { RunRepoRootParams } from \"./types.run.js\";\n\n/**\n * Describes an item that is scheduled for deletion.\n */\nexport interface ToBeDeleted {\n /** Name (file or directory) to delete. */\n name: string;\n /** Optional suffix appended to the name when moving instead of deleting. */\n moveSuffix?: string;\n}\n\n/**\n * A resolved cleanup target with full path information.\n *\n * @remarks\n * Extends {@link ToBeDeleted} with absolute path details so the cleanup\n * operation knows exactly where to find the item and, optionally, where\n * to move it.\n */\nexport interface ToCleanup extends ToBeDeleted {\n /** Absolute path of the item to clean up. */\n path: string;\n /** Absolute destination path when moving rather than deleting. */\n moveTo?: string;\n}\n\n/**\n * Parameters for running a cleanup operation across a repository.\n */\nexport interface CleanupParams extends RunRepoRootParams {\n /** Items to delete or move during cleanup. */\n toBeDeleted?: ToBeDeleted[];\n}\n"]}
@@ -1,28 +1,64 @@
1
1
  import ts from "typescript";
2
+ /**
3
+ * A parsed TypeScript source file together with its type checker.
4
+ *
5
+ * @remarks
6
+ * Bundles the file path, the compiler's {@link ts.SourceFile} AST node,
7
+ * and the {@link ts.TypeChecker} so that downstream consumers can perform
8
+ * type-aware analysis without re-creating a program.
9
+ */
2
10
  export interface SourceFile {
11
+ /** Absolute path to the TypeScript source file. */
3
12
  filePath: string;
13
+ /** The TypeScript type checker associated with this file's program. */
4
14
  checker: ts.TypeChecker;
15
+ /** The parsed AST representation of the source file. */
5
16
  sourceFile: ts.SourceFile;
6
17
  }
18
+ /**
19
+ * Metadata for a single exported symbol within a source file.
20
+ */
7
21
  export interface SourceExportItem {
22
+ /** Export name (e.g. `"foo"`, `"default"`). */
8
23
  name: string;
24
+ /** Human-readable kind of the export (e.g. `"function"`, `"class"`, `"type"`). */
9
25
  kind: string;
26
+ /** Whether TypeScript considers this export type-only. */
10
27
  isTypeOnly: boolean;
28
+ /** Whether the export originates from another module via `export … from` or `export *`. */
11
29
  isReExport: boolean;
30
+ /** Declaration kind strings useful for debugging (e.g. `["FunctionDeclaration"]`). */
12
31
  declarations: string[];
13
32
  }
33
+ /**
34
+ * The complete set of exports discovered in a single source file.
35
+ */
14
36
  export interface SourceExport {
37
+ /** Individual export items found in the file. */
15
38
  items: SourceExportItem[];
39
+ /** Whether the file uses selective (named) exports rather than `export *`. */
16
40
  selectiveExport: boolean;
17
41
  }
42
+ /**
43
+ * Parameters for extracting exports from a TypeScript file.
44
+ */
18
45
  export interface FileExportsParams {
46
+ /** Absolute path to the file whose exports should be extracted. */
19
47
  filePath: string;
48
+ /**
49
+ * Optional flags that control which exports are included in the result.
50
+ */
20
51
  opts?: {
52
+ /** Include type-only exports (e.g. `export type { Foo }`). */
21
53
  includeTypeOnly?: boolean;
54
+ /** Include re-exports originating from other modules. */
22
55
  includeReExports?: boolean;
56
+ /** Include the `default` export. */
23
57
  includeDefault?: boolean;
58
+ /** Include exports marked as private by convention. */
24
59
  includePrivate?: boolean;
25
60
  };
61
+ /** A pre-built {@link SourceFile} to reuse, avoiding redundant parsing. */
26
62
  preBuiltSource?: SourceFile;
27
63
  }
28
64
  //# sourceMappingURL=types.code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.code.d.ts","sourceRoot":"","sources":["../../src/types/types.code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;IACxB,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC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