@lerna-lite/core 0.3.0

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 (183) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +16 -0
  3. package/dist/child-process.d.ts +13 -0
  4. package/dist/child-process.js +129 -0
  5. package/dist/child-process.js.map +1 -0
  6. package/dist/command.d.ts +37 -0
  7. package/dist/command.js +269 -0
  8. package/dist/command.js.map +1 -0
  9. package/dist/conventional-commits/constants.d.ts +4 -0
  10. package/dist/conventional-commits/constants.js +13 -0
  11. package/dist/conventional-commits/constants.js.map +1 -0
  12. package/dist/conventional-commits/get-changelog-config.d.ts +12 -0
  13. package/dist/conventional-commits/get-changelog-config.js +92 -0
  14. package/dist/conventional-commits/get-changelog-config.js.map +1 -0
  15. package/dist/conventional-commits/index.d.ts +6 -0
  16. package/dist/conventional-commits/index.js +19 -0
  17. package/dist/conventional-commits/index.js.map +1 -0
  18. package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -0
  19. package/dist/conventional-commits/make-bump-only-filter.js +23 -0
  20. package/dist/conventional-commits/make-bump-only-filter.js.map +1 -0
  21. package/dist/conventional-commits/read-existing-changelog.d.ts +7 -0
  22. package/dist/conventional-commits/read-existing-changelog.js +33 -0
  23. package/dist/conventional-commits/read-existing-changelog.js.map +1 -0
  24. package/dist/conventional-commits/recommend-version.d.ts +10 -0
  25. package/dist/conventional-commits/recommend-version.js +87 -0
  26. package/dist/conventional-commits/recommend-version.js.map +1 -0
  27. package/dist/conventional-commits/update-changelog.d.ts +11 -0
  28. package/dist/conventional-commits/update-changelog.js +84 -0
  29. package/dist/conventional-commits/update-changelog.js.map +1 -0
  30. package/dist/git-clients/github-client.d.ts +6 -0
  31. package/dist/git-clients/github-client.js +41 -0
  32. package/dist/git-clients/github-client.js.map +1 -0
  33. package/dist/git-clients/gitlab-client.d.ts +5 -0
  34. package/dist/git-clients/gitlab-client.js +53 -0
  35. package/dist/git-clients/gitlab-client.js.map +1 -0
  36. package/dist/git-clients/index.d.ts +2 -0
  37. package/dist/git-clients/index.js +15 -0
  38. package/dist/git-clients/index.js.map +1 -0
  39. package/dist/index.d.ts +12 -0
  40. package/dist/index.js +27 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/models/index.d.ts +97 -0
  43. package/dist/models/index.js +3 -0
  44. package/dist/models/index.js.map +1 -0
  45. package/dist/otplease.d.ts +13 -0
  46. package/dist/otplease.js +110 -0
  47. package/dist/otplease.js.map +1 -0
  48. package/dist/package-graph/index.d.ts +2 -0
  49. package/dist/package-graph/index.js +15 -0
  50. package/dist/package-graph/index.js.map +1 -0
  51. package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +41 -0
  52. package/dist/package-graph/lib/cyclic-package-graph-node.js +101 -0
  53. package/dist/package-graph/lib/cyclic-package-graph-node.js.map +1 -0
  54. package/dist/package-graph/lib/index.d.ts +3 -0
  55. package/dist/package-graph/lib/index.js +16 -0
  56. package/dist/package-graph/lib/index.js.map +1 -0
  57. package/dist/package-graph/lib/package-graph-node.d.ts +35 -0
  58. package/dist/package-graph/lib/package-graph-node.js +61 -0
  59. package/dist/package-graph/lib/package-graph-node.js.map +1 -0
  60. package/dist/package-graph/lib/report-cycles.d.ts +1 -0
  61. package/dist/package-graph/lib/report-cycles.js +20 -0
  62. package/dist/package-graph/lib/report-cycles.js.map +1 -0
  63. package/dist/package-graph/package-graph.d.ts +78 -0
  64. package/dist/package-graph/package-graph.js +256 -0
  65. package/dist/package-graph/package-graph.js.map +1 -0
  66. package/dist/package.d.ts +96 -0
  67. package/dist/package.js +260 -0
  68. package/dist/package.js.map +1 -0
  69. package/dist/project/index.d.ts +2 -0
  70. package/dist/project/index.js +15 -0
  71. package/dist/project/index.js.map +1 -0
  72. package/dist/project/lib/apply-extends.d.ts +6 -0
  73. package/dist/project/lib/apply-extends.js +38 -0
  74. package/dist/project/lib/apply-extends.js.map +1 -0
  75. package/dist/project/lib/index.d.ts +3 -0
  76. package/dist/project/lib/index.js +16 -0
  77. package/dist/project/lib/index.js.map +1 -0
  78. package/dist/project/lib/make-file-finder.d.ts +2 -0
  79. package/dist/project/lib/make-file-finder.js +72 -0
  80. package/dist/project/lib/make-file-finder.js.map +1 -0
  81. package/dist/project/lib/shallow-extend.d.ts +5 -0
  82. package/dist/project/lib/shallow-extend.js +25 -0
  83. package/dist/project/lib/shallow-extend.js.map +1 -0
  84. package/dist/project/project.d.ts +50 -0
  85. package/dist/project/project.js +193 -0
  86. package/dist/project/project.js.map +1 -0
  87. package/dist/prompt.d.ts +5 -0
  88. package/dist/prompt.js +65 -0
  89. package/dist/prompt.js.map +1 -0
  90. package/dist/utils/check-working-tree.d.ts +8 -0
  91. package/dist/utils/check-working-tree.js +42 -0
  92. package/dist/utils/check-working-tree.js.map +1 -0
  93. package/dist/utils/clean-stack.d.ts +5 -0
  94. package/dist/utils/clean-stack.js +19 -0
  95. package/dist/utils/clean-stack.js.map +1 -0
  96. package/dist/utils/collect-dependents.d.ts +11 -0
  97. package/dist/utils/collect-dependents.js +46 -0
  98. package/dist/utils/collect-dependents.js.map +1 -0
  99. package/dist/utils/collect-uncommitted.d.ts +19 -0
  100. package/dist/utils/collect-uncommitted.js +46 -0
  101. package/dist/utils/collect-uncommitted.js.map +1 -0
  102. package/dist/utils/collect-updates/collect-updates.d.ts +25 -0
  103. package/dist/utils/collect-updates/collect-updates.js +100 -0
  104. package/dist/utils/collect-updates/collect-updates.js.map +1 -0
  105. package/dist/utils/collect-updates/index.d.ts +2 -0
  106. package/dist/utils/collect-updates/index.js +15 -0
  107. package/dist/utils/collect-updates/index.js.map +1 -0
  108. package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -0
  109. package/dist/utils/collect-updates/lib/collect-packages.js +34 -0
  110. package/dist/utils/collect-updates/lib/collect-packages.js.map +1 -0
  111. package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -0
  112. package/dist/utils/collect-updates/lib/get-packages-for-option.js +31 -0
  113. package/dist/utils/collect-updates/lib/get-packages-for-option.js.map +1 -0
  114. package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -0
  115. package/dist/utils/collect-updates/lib/has-tags.js +27 -0
  116. package/dist/utils/collect-updates/lib/has-tags.js.map +1 -0
  117. package/dist/utils/collect-updates/lib/index.d.ts +4 -0
  118. package/dist/utils/collect-updates/lib/index.js +17 -0
  119. package/dist/utils/collect-updates/lib/index.js.map +1 -0
  120. package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +6 -0
  121. package/dist/utils/collect-updates/lib/make-diff-predicate.js +65 -0
  122. package/dist/utils/collect-updates/lib/make-diff-predicate.js.map +1 -0
  123. package/dist/utils/conf.d.ts +23 -0
  124. package/dist/utils/conf.js +256 -0
  125. package/dist/utils/conf.js.map +1 -0
  126. package/dist/utils/defaults.d.ts +1 -0
  127. package/dist/utils/defaults.js +182 -0
  128. package/dist/utils/defaults.js.map +1 -0
  129. package/dist/utils/describe-ref.d.ts +24 -0
  130. package/dist/utils/describe-ref.js +81 -0
  131. package/dist/utils/describe-ref.js.map +1 -0
  132. package/dist/utils/env-replace.d.ts +1 -0
  133. package/dist/utils/env-replace.js +23 -0
  134. package/dist/utils/env-replace.js.map +1 -0
  135. package/dist/utils/find-prefix.d.ts +2 -0
  136. package/dist/utils/find-prefix.js +49 -0
  137. package/dist/utils/find-prefix.js.map +1 -0
  138. package/dist/utils/format-error.d.ts +7 -0
  139. package/dist/utils/format-error.js +20 -0
  140. package/dist/utils/format-error.js.map +1 -0
  141. package/dist/utils/index.d.ts +23 -0
  142. package/dist/utils/index.js +36 -0
  143. package/dist/utils/index.js.map +1 -0
  144. package/dist/utils/log-package-error.d.ts +5 -0
  145. package/dist/utils/log-package-error.js +36 -0
  146. package/dist/utils/log-package-error.js.map +1 -0
  147. package/dist/utils/nerf-dart.d.ts +1 -0
  148. package/dist/utils/nerf-dart.js +19 -0
  149. package/dist/utils/nerf-dart.js.map +1 -0
  150. package/dist/utils/npm-conf.d.ts +2 -0
  151. package/dist/utils/npm-conf.js +54 -0
  152. package/dist/utils/npm-conf.js.map +1 -0
  153. package/dist/utils/parse-field.d.ts +1 -0
  154. package/dist/utils/parse-field.js +66 -0
  155. package/dist/utils/parse-field.js.map +1 -0
  156. package/dist/utils/prerelease-id-from-version.d.ts +5 -0
  157. package/dist/utils/prerelease-id-from-version.js +16 -0
  158. package/dist/utils/prerelease-id-from-version.js.map +1 -0
  159. package/dist/utils/pulse-till-done.d.ts +1 -0
  160. package/dist/utils/pulse-till-done.js +41 -0
  161. package/dist/utils/pulse-till-done.js.map +1 -0
  162. package/dist/utils/query-graph.d.ts +36 -0
  163. package/dist/utils/query-graph.js +78 -0
  164. package/dist/utils/query-graph.js.map +1 -0
  165. package/dist/utils/run-lifecycle.d.ts +10 -0
  166. package/dist/utils/run-lifecycle.js +109 -0
  167. package/dist/utils/run-lifecycle.js.map +1 -0
  168. package/dist/utils/run-topologically.d.ts +12 -0
  169. package/dist/utils/run-topologically.js +37 -0
  170. package/dist/utils/run-topologically.js.map +1 -0
  171. package/dist/utils/types.d.ts +128 -0
  172. package/dist/utils/types.js +138 -0
  173. package/dist/utils/types.js.map +1 -0
  174. package/dist/utils/warn-if-hanging.d.ts +1 -0
  175. package/dist/utils/warn-if-hanging.js +18 -0
  176. package/dist/utils/warn-if-hanging.js.map +1 -0
  177. package/dist/utils/write-log-file.d.ts +1 -0
  178. package/dist/utils/write-log-file.js +33 -0
  179. package/dist/utils/write-log-file.js.map +1 -0
  180. package/dist/validation-error.d.ts +4 -0
  181. package/dist/validation-error.js +19 -0
  182. package/dist/validation-error.js.map +1 -0
  183. package/package.json +110 -0
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * @callback LocalDependentVisitor
4
+ * @param {import("@lerna/package-graph").PackageGraphNode} dependentNode
5
+ * @param {string} dependentName
6
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} siblingDependents
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.collectDependents = void 0;
10
+ /**
11
+ * Build a set of nodes that are dependents of the input set.
12
+ * @param {Set<import("@lerna/package-graph").PackageGraphNode>} nodes
13
+ */
14
+ function collectDependents(nodes) {
15
+ /** @type {typeof nodes} */
16
+ const collected = new Set();
17
+ nodes.forEach((currentNode) => {
18
+ if (currentNode.localDependents.size === 0) {
19
+ // no point diving into a non-existent tree
20
+ return;
21
+ }
22
+ // breadth-first search
23
+ const queue = [currentNode];
24
+ const seen = new Set();
25
+ /** @type {LocalDependentVisitor} */
26
+ const visit = (dependentNode, dependentName, siblingDependents) => {
27
+ if (seen.has(dependentNode)) {
28
+ return;
29
+ }
30
+ seen.add(dependentNode);
31
+ if (dependentNode === currentNode || siblingDependents.has(currentNode.name)) {
32
+ // a direct or transitive cycle, skip it
33
+ return;
34
+ }
35
+ collected.add(dependentNode);
36
+ queue.push(dependentNode);
37
+ };
38
+ while (queue.length) {
39
+ const node = queue.shift();
40
+ node.localDependents.forEach(visit);
41
+ }
42
+ });
43
+ return collected;
44
+ }
45
+ exports.collectDependents = collectDependents;
46
+ //# sourceMappingURL=collect-dependents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-dependents.js","sourceRoot":"","sources":["../../src/utils/collect-dependents.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAK;IACrC,2BAA2B;IAC3B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;IAE5B,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QAC5B,IAAI,WAAW,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,EAAE;YAC1C,2CAA2C;YAC3C,OAAO;SACR;QAED,uBAAuB;QACvB,MAAM,KAAK,GAAG,CAAC,WAAW,CAAC,CAAC;QAC5B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvB,oCAAoC;QACpC,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE;YAChE,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;gBAC3B,OAAO;aACR;YAED,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAExB,IAAI,aAAa,KAAK,WAAW,IAAI,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;gBAC5E,wCAAwC;gBACxC,OAAO;aACR;YAED,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEF,OAAO,KAAK,CAAC,MAAM,EAAE;YACnB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAE3B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAvCD,8CAuCC"}
@@ -0,0 +1,19 @@
1
+ import npmlog from 'npmlog';
2
+ /**
3
+ * Report uncommitted files. (async)
4
+ * @param {UncommittedConfig} options
5
+ * @returns {Promise<string[]>} A list of uncommitted files
6
+ */
7
+ export declare function collectUncommitted({ cwd, log }: {
8
+ cwd: any;
9
+ log?: npmlog.Logger | undefined;
10
+ }, gitDryRun?: boolean): any;
11
+ /**
12
+ * Report uncommitted files. (sync)
13
+ * @param {UncommittedConfig} options
14
+ * @returns {string[]} A list of uncommitted files
15
+ */
16
+ export declare function collectUncommittedSync({ cwd, log }: {
17
+ cwd: any;
18
+ log?: npmlog.Logger | undefined;
19
+ }, gitDryRun?: boolean): any;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.collectUncommittedSync = exports.collectUncommitted = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const npmlog_1 = __importDefault(require("npmlog"));
9
+ const child_process_1 = require("../child-process");
10
+ /**
11
+ * @typedef {object} UncommittedConfig
12
+ * @property {string} cwd
13
+ * @property {typeof npmlog} [log]
14
+ */
15
+ const maybeColorize = (colorize) => (s) => (s !== ' ' ? colorize(s) : s);
16
+ const cRed = maybeColorize(chalk_1.default.red);
17
+ const cGreen = maybeColorize(chalk_1.default.green);
18
+ const replaceStatus = (_, maybeGreen, maybeRed) => `${cGreen(maybeGreen)}${cRed(maybeRed)}`;
19
+ const colorizeStats = (stats) => stats.replace(/^([^U]| )([A-Z]| )/gm, replaceStatus).replace(/^\?{2}|U{2}/gm, cRed('$&'));
20
+ const splitOnNewLine = (str) => str.split('\n');
21
+ const filterEmpty = (lines) => lines.filter((line) => line.length);
22
+ const o = (l, r) => (x) => l(r(x));
23
+ const transformOutput = o(filterEmpty, o(splitOnNewLine, colorizeStats));
24
+ /**
25
+ * Report uncommitted files. (async)
26
+ * @param {UncommittedConfig} options
27
+ * @returns {Promise<string[]>} A list of uncommitted files
28
+ */
29
+ function collectUncommitted({ cwd, log = npmlog_1.default }, gitDryRun = false) {
30
+ log.silly('collect-uncommitted', 'git status --porcelain (async)');
31
+ return (0, child_process_1.exec)('git', ['status', '--porcelain'], { cwd }, gitDryRun)
32
+ .then(({ stdout }) => transformOutput(stdout));
33
+ }
34
+ exports.collectUncommitted = collectUncommitted;
35
+ /**
36
+ * Report uncommitted files. (sync)
37
+ * @param {UncommittedConfig} options
38
+ * @returns {string[]} A list of uncommitted files
39
+ */
40
+ function collectUncommittedSync({ cwd, log = npmlog_1.default }, gitDryRun = false) {
41
+ log.silly('collect-uncommitted', 'git status --porcelain (sync)');
42
+ const stdout = (0, child_process_1.execSync)('git', ['status', '--porcelain'], { cwd }, gitDryRun);
43
+ return transformOutput(stdout);
44
+ }
45
+ exports.collectUncommittedSync = collectUncommittedSync;
46
+ //# sourceMappingURL=collect-uncommitted.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C,CAAC,WAAW,EAAE,CAAC,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC;AAEzE;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,gBAAM,EAAE,EAAE,SAAS,GAAG,KAAK;IACzE,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE,gCAAgC,CAAC,CAAC;IAEnE,OAAO,IAAA,oBAAI,EAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,SAAS,CAAC;SAC9D,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC;AALD,gDAKC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,gBAAM,EAAE,EAAE,SAAS,GAAG,KAAK;IAC7E,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE,+BAA+B,CAAC,CAAC;IAElE,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;IAC9E,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AALD,wDAKC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @typedef {object} UpdateCollectorOptions
3
+ * @property {string} [bump] The semver bump keyword (patch/minor/major) or explicit version used
4
+ * @property {boolean} [canary] Whether or not to use a "nightly" range (`ref^..ref`) for commits
5
+ * @property {string[]} [ignoreChanges]
6
+ * A list of globs that match files/directories whose changes
7
+ * should not be considered when identifying changed packages
8
+ * @property {boolean} [includeMergedTags]
9
+ * Whether or not to include the --first-parent flag when calling `git describe`
10
+ * (awkwardly, pass `true` to _omit_ the flag, the default is to include it)
11
+ * @property {boolean | string[]} [forcePublish] Which packages, if any, to always include
12
+ * Force all packages to be versioned with `true`, or pass a list of globs that match package names
13
+ * @property {string} [since] Ref to use when querying git, defaults to most recent annotated tag
14
+ * @property {boolean} [conventionalCommits]
15
+ * @property {boolean} [conventionalGraduate]
16
+ * @property {boolean} [excludeDependents]
17
+ */
18
+ /**
19
+ * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise.
20
+ * @param {import("@lerna/package").Package[]} filteredPackages
21
+ * @param {import("@lerna/package-graph").PackageGraph} packageGraph
22
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
23
+ * @param {UpdateCollectorOptions} commandOptions
24
+ */
25
+ export declare function collectUpdates(filteredPackages: any, packageGraph: any, execOpts: any, commandOptions: any, gitDryRun?: boolean): import("../..").PackageGraphNode[];
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.collectUpdates = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const describe_ref_1 = require("../describe-ref");
9
+ const collect_packages_1 = require("./lib/collect-packages");
10
+ const get_packages_for_option_1 = require("./lib/get-packages-for-option");
11
+ const has_tags_1 = require("./lib/has-tags");
12
+ const make_diff_predicate_1 = require("./lib/make-diff-predicate");
13
+ /**
14
+ * @typedef {object} UpdateCollectorOptions
15
+ * @property {string} [bump] The semver bump keyword (patch/minor/major) or explicit version used
16
+ * @property {boolean} [canary] Whether or not to use a "nightly" range (`ref^..ref`) for commits
17
+ * @property {string[]} [ignoreChanges]
18
+ * A list of globs that match files/directories whose changes
19
+ * should not be considered when identifying changed packages
20
+ * @property {boolean} [includeMergedTags]
21
+ * Whether or not to include the --first-parent flag when calling `git describe`
22
+ * (awkwardly, pass `true` to _omit_ the flag, the default is to include it)
23
+ * @property {boolean | string[]} [forcePublish] Which packages, if any, to always include
24
+ * Force all packages to be versioned with `true`, or pass a list of globs that match package names
25
+ * @property {string} [since] Ref to use when querying git, defaults to most recent annotated tag
26
+ * @property {boolean} [conventionalCommits]
27
+ * @property {boolean} [conventionalGraduate]
28
+ * @property {boolean} [excludeDependents]
29
+ */
30
+ /**
31
+ * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise.
32
+ * @param {import("@lerna/package").Package[]} filteredPackages
33
+ * @param {import("@lerna/package-graph").PackageGraph} packageGraph
34
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
35
+ * @param {UpdateCollectorOptions} commandOptions
36
+ */
37
+ function collectUpdates(filteredPackages, packageGraph, execOpts, commandOptions, gitDryRun = false) {
38
+ const { forcePublish, conventionalCommits, conventionalGraduate, excludeDependents } = commandOptions;
39
+ // If --conventional-commits and --conventional-graduate are both set, ignore --force-publish
40
+ const useConventionalGraduate = conventionalCommits && conventionalGraduate;
41
+ const forced = (0, get_packages_for_option_1.getPackagesForOption)(useConventionalGraduate ? conventionalGraduate : forcePublish);
42
+ const packages = filteredPackages.length === packageGraph.size
43
+ ? packageGraph
44
+ : new Map(filteredPackages.map(({ name }) => [name, packageGraph.get(name)]));
45
+ let committish = commandOptions.since;
46
+ if ((0, has_tags_1.hasTags)(execOpts)) {
47
+ // describe the last annotated tag in the current branch
48
+ const { sha, refCount, lastTagName } = (0, describe_ref_1.describeRefSync)(execOpts, commandOptions.includeMergedTags, gitDryRun);
49
+ // TODO: warn about dirty tree?
50
+ if (refCount === '0' && forced.size === 0 && !committish) {
51
+ // no commits since previous release
52
+ npmlog_1.default.notice('', 'Current HEAD is already released, skipping change detection.');
53
+ return [];
54
+ }
55
+ if (commandOptions.canary) {
56
+ // if it's a merge commit, it will return all the commits that were part of the merge
57
+ // ex: If `ab7533e` had 2 commits, ab7533e^..ab7533e would contain 2 commits + the merge commit
58
+ committish = `${sha}^..${sha}`;
59
+ }
60
+ else if (!committish) {
61
+ // if no tags found, this will be undefined and we'll use the initial commit
62
+ committish = lastTagName;
63
+ }
64
+ }
65
+ if (forced.size) {
66
+ // "warn" might seem a bit loud, but it is appropriate for logging anything _forced_
67
+ npmlog_1.default.warn(useConventionalGraduate ? 'conventional-graduate' : 'force-publish', forced.has('*') ? 'all packages' : Array.from(forced.values()).join('\n'));
68
+ }
69
+ if (useConventionalGraduate) {
70
+ // --conventional-commits --conventional-graduate
71
+ if (forced.has('*')) {
72
+ npmlog_1.default.info('', 'Graduating all prereleased packages');
73
+ }
74
+ else {
75
+ npmlog_1.default.info('', 'Graduating prereleased packages');
76
+ }
77
+ }
78
+ else if (!committish || forced.has('*')) {
79
+ // --force-publish or no tag
80
+ npmlog_1.default.info('', 'Assuming all packages changed');
81
+ return (0, collect_packages_1.collectPackages)(packages, {
82
+ onInclude: (name) => npmlog_1.default.verbose('updated', name),
83
+ excludeDependents,
84
+ });
85
+ }
86
+ npmlog_1.default.info('', `Looking for changed packages since ${committish}`);
87
+ const hasDiff = (0, make_diff_predicate_1.makeDiffPredicate)(committish, execOpts, commandOptions.ignoreChanges);
88
+ const needsBump = !commandOptions.bump || commandOptions.bump.startsWith('pre')
89
+ ? () => false
90
+ : /* skip packages that have not been previously prereleased */
91
+ (node) => node.prereleaseId;
92
+ const isForced = (node, name) => (forced.has('*') || forced.has(name)) && (useConventionalGraduate ? node.prereleaseId : true);
93
+ return (0, collect_packages_1.collectPackages)(packages, {
94
+ isCandidate: (node, name) => isForced(node, name) || needsBump(node) || hasDiff(node),
95
+ onInclude: (name) => npmlog_1.default.verbose('updated', name),
96
+ excludeDependents,
97
+ });
98
+ }
99
+ exports.collectUpdates = collectUpdates;
100
+ //# sourceMappingURL=collect-updates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-updates.js","sourceRoot":"","sources":["../../../src/utils/collect-updates/collect-updates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAyB;AAEzB,kDAAkD;AAClD,6DAAyD;AACzD,2EAAqE;AACrE,6CAAyC;AACzC,mEAA8D;AAE9D;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;G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IAAI,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3D,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;QACb,CAAC,CAAC,6DAA6D;YAC/D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC;IAChC,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAC9B,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEhG,OAAO,IAAA,kCAAe,EAAC,QAAQ,EAAE;QAC/B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;QACrF,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAG,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC;QACjD,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC;AA7ED,wCA6EC"}
@@ -0,0 +1,2 @@
1
+ export * from './collect-updates';
2
+ export * from './lib';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./collect-updates"), exports);
14
+ __exportStar(require("./lib"), exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/collect-updates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,wCAAsB"}
@@ -0,0 +1,13 @@
1
+ import { PackageGraphNode } from '../../../package-graph/lib/package-graph-node';
2
+ interface PackageCollectorOptions {
3
+ isCandidate?: (node: PackageGraphNode, name: string) => boolean;
4
+ onInclude?: (name: string) => void;
5
+ excludeDependents?: boolean;
6
+ }
7
+ /**
8
+ * Build a list of graph nodes, possibly including dependents, using predicate if available.
9
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} packages
10
+ * @param {PackageCollectorOptions} options
11
+ */
12
+ export declare function collectPackages(packages: any, { isCandidate, onInclude, excludeDependents }?: PackageCollectorOptions): PackageGraphNode[];
13
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectPackages = void 0;
4
+ const collect_dependents_1 = require("../../../utils/collect-dependents");
5
+ /**
6
+ * Build a list of graph nodes, possibly including dependents, using predicate if available.
7
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} packages
8
+ * @param {PackageCollectorOptions} options
9
+ */
10
+ function collectPackages(packages, { isCandidate = () => true, onInclude, excludeDependents } = {}) {
11
+ /** @type {Set<import("@lerna/package-graph").PackageGraphNode>} */
12
+ const candidates = new Set();
13
+ packages.forEach((node, name) => {
14
+ if (isCandidate(node, name)) {
15
+ candidates.add(node);
16
+ }
17
+ });
18
+ if (!excludeDependents) {
19
+ (0, collect_dependents_1.collectDependents)(candidates).forEach((node) => candidates.add(node));
20
+ }
21
+ // The result should always be in the same order as the input
22
+ const updates = [];
23
+ packages.forEach((node, name) => {
24
+ if (candidates.has(node)) {
25
+ if (onInclude) {
26
+ onInclude(name);
27
+ }
28
+ updates.push(node);
29
+ }
30
+ });
31
+ return updates;
32
+ }
33
+ exports.collectPackages = collectPackages;
34
+ //# sourceMappingURL=collect-packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-packages.js","sourceRoot":"","sources":["../../../../src/utils/collect-updates/lib/collect-packages.ts"],"names":[],"mappings":";;;AACA,0EAAsE;AAQtE;;;;GAIG;AACH,SAAgB,eAAe,CAAC,QAAQ,EAAE,EAAE,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,iBAAiB,KAAK,EAA6B;IAClI,mEAAmE;IACnE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAE7B,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;YAC3B,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iBAAiB,EAAE;QACtB,IAAA,sCAAiB,EAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;KACvE;IAED,6DAA6D;IAC7D,MAAM,OAAO,GAAuB,EAAE,CAAC;IAEvC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,SAAS,EAAE;gBACb,SAAS,CAAC,IAAI,CAAC,CAAC;aACjB;YACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AA3BD,0CA2BC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {boolean|string|string[]} option
3
+ * @returns {Set<string>} A set of package names (or wildcard) derived from option value.
4
+ */
5
+ export declare function getPackagesForOption(option: boolean | string | string[]): Set<string>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPackagesForOption = void 0;
4
+ /**
5
+ * @param {boolean|string|string[]} option
6
+ * @returns {Set<string>} A set of package names (or wildcard) derived from option value.
7
+ */
8
+ function getPackagesForOption(option) {
9
+ // new Set(null) is equivalent to new Set([])
10
+ // i.e., an empty Set
11
+ let inputs = null;
12
+ if (option === true) {
13
+ // option passed without specific packages, eg. --force-publish
14
+ inputs = ['*'];
15
+ }
16
+ else if (typeof option === 'string') {
17
+ // option passed with one or more comma separated package names, eg.:
18
+ // --force-publish=*
19
+ // --force-publish=foo
20
+ // --force-publish=foo,bar
21
+ inputs = option.split(',');
22
+ }
23
+ else if (Array.isArray(option)) {
24
+ // option passed multiple times with individual package names
25
+ // --force-publish foo --force-publish baz
26
+ inputs = [...option];
27
+ }
28
+ return new Set(inputs);
29
+ }
30
+ exports.getPackagesForOption = getPackagesForOption;
31
+ //# sourceMappingURL=get-packages-for-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-packages-for-option.js","sourceRoot":"","sources":["../../../../src/utils/collect-updates/lib/get-packages-for-option.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,MAAmC;IACtE,6CAA6C;IAC7C,qBAAqB;IACrB,IAAI,MAAM,GAAoB,IAAI,CAAC;IAEnC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,+DAA+D;QAC/D,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;KAChB;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACrC,qEAAqE;QACrE,oBAAoB;QACpB,sBAAsB;QACtB,0BAA0B;QAC1B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAC5B;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAChC,6DAA6D;QAC7D,0CAA0C;QAC1C,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;KACtB;IAED,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AArBD,oDAqBC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Determine if any git tags are reachable.
3
+ * @param {import("@lerna/child-process").ExecOpts} opts
4
+ */
5
+ export declare function hasTags(opts: any): boolean;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.hasTags = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const child_process_1 = require("../../../child-process");
9
+ /**
10
+ * Determine if any git tags are reachable.
11
+ * @param {import("@lerna/child-process").ExecOpts} opts
12
+ */
13
+ function hasTags(opts) {
14
+ npmlog_1.default.silly('hasTags', '');
15
+ let result = false;
16
+ try {
17
+ result = !!(0, child_process_1.execSync)('git', ['tag'], opts);
18
+ }
19
+ catch (err) {
20
+ npmlog_1.default.warn('ENOTAGS', 'No git tags were reachable from this branch!');
21
+ npmlog_1.default.verbose('hasTags error', err);
22
+ }
23
+ npmlog_1.default.verbose('hasTags', result.toString());
24
+ return result;
25
+ }
26
+ exports.hasTags = hasTags;
27
+ //# sourceMappingURL=has-tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-tags.js","sourceRoot":"","sources":["../../../../src/utils/collect-updates/lib/has-tags.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAyB;AAEzB,0DAAkD;AAElD;;;GAGG;AACH,SAAgB,OAAO,CAAC,IAAI;IAC1B,gBAAG,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACzB,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,IAAI;QACF,MAAM,GAAG,CAAC,CAAC,IAAA,wBAAQ,EAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAQ,EAAE;QACjB,gBAAG,CAAC,IAAI,CAAC,SAAS,EAAE,8CAA8C,CAAC,CAAC;QACpE,gBAAG,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;KACnC;IAED,gBAAG,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE1C,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,0BAcC"}
@@ -0,0 +1,4 @@
1
+ export * from './collect-packages';
2
+ export * from './get-packages-for-option';
3
+ export * from './has-tags';
4
+ export * from './make-diff-predicate';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./collect-packages"), exports);
14
+ __exportStar(require("./get-packages-for-option"), exports);
15
+ __exportStar(require("./has-tags"), exports);
16
+ __exportStar(require("./make-diff-predicate"), exports);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/collect-updates/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,4DAA0C;AAC1C,6CAA2B;AAC3B,wDAAsC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {string} committish
3
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
4
+ * @param {string[]} ignorePatterns
5
+ */
6
+ export declare function makeDiffPredicate(committish: any, execOpts: any, ignorePatterns?: never[]): (node: any) => boolean;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.makeDiffPredicate = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const minimatch_1 = __importDefault(require("minimatch"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const slash_1 = __importDefault(require("slash"));
11
+ const child_process_1 = require("../../../child-process");
12
+ /**
13
+ * @param {string} committish
14
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
15
+ * @param {string[]} ignorePatterns
16
+ */
17
+ function makeDiffPredicate(committish, execOpts, ignorePatterns = []) {
18
+ const ignoreFilters = new Set(ignorePatterns.map((p) => minimatch_1.default.filter(`!${p}`, {
19
+ matchBase: true,
20
+ // dotfiles inside ignored directories should also match
21
+ dot: true,
22
+ })));
23
+ if (ignoreFilters.size) {
24
+ npmlog_1.default.info('ignoring diff in paths matching', ignorePatterns.join(' '));
25
+ }
26
+ return function hasDiffSinceThatIsntIgnored(
27
+ /** @type {import("@lerna/package-graph").PackageGraphNode} */ node) {
28
+ const diff = diffSinceIn(committish, node.location, execOpts);
29
+ if (diff === '') {
30
+ npmlog_1.default.silly('', 'no diff found in %s', node.name);
31
+ return false;
32
+ }
33
+ npmlog_1.default.silly('found diff in', diff);
34
+ let changedFiles = diff.split('\n');
35
+ if (ignoreFilters.size) {
36
+ for (const ignored of ignoreFilters) {
37
+ changedFiles = changedFiles.filter(ignored);
38
+ }
39
+ }
40
+ if (changedFiles.length) {
41
+ npmlog_1.default.verbose('filtered diff', changedFiles.join(' '));
42
+ }
43
+ else {
44
+ npmlog_1.default.verbose('', 'no diff found in %s (after filtering)', node.name);
45
+ }
46
+ return changedFiles.length > 0;
47
+ };
48
+ }
49
+ exports.makeDiffPredicate = makeDiffPredicate;
50
+ /**
51
+ * @param {string} committish
52
+ * @param {string} location
53
+ * @param {import("@lerna/child-process").ExecOpts} opts
54
+ */
55
+ function diffSinceIn(committish, location, opts) {
56
+ const args = ['diff', '--name-only', committish];
57
+ const formattedLocation = (0, slash_1.default)(path_1.default.relative(opts.cwd, location));
58
+ if (formattedLocation) {
59
+ // avoid same-directory path.relative() === ""
60
+ args.push('--', formattedLocation);
61
+ }
62
+ npmlog_1.default.silly('checking diff', formattedLocation);
63
+ return (0, child_process_1.execSync)('git', args, opts);
64
+ }
65
+ //# sourceMappingURL=make-diff-predicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-diff-predicate.js","sourceRoot":"","sources":["../../../../src/utils/collect-updates/lib/make-diff-predicate.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAyB;AACzB,0DAAkC;AAClC,gDAAwB;AACxB,kDAA0B;AAE1B,0DAAkD;AAElD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAU,EAAE,QAAQ,EAAE,cAAc,GAAG,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACvB,mBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE;QACxB,SAAS,EAAE,IAAI;QACf,wDAAwD;QACxD,GAAG,EAAE,IAAI;KACV,CAAC,CACH,CACF,CAAC;IAEF,IAAI,aAAa,CAAC,IAAI,EAAE;QACtB,gBAAG,CAAC,IAAI,CAAC,iCAAiC,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACvE;IAED,OAAO,SAAS,2BAA2B;IACzC,8DAA8D,CAAC,IAAI;QAEnE,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,C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AC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { ConfigChain } from 'config-chain';
2
+ export declare class Conf extends ConfigChain {
3
+ _await: any;
4
+ addString: any;
5
+ del: any;
6
+ get: any;
7
+ set: any;
8
+ globalPrefix: string;
9
+ localPrefix: string;
10
+ root: any;
11
+ sources: any;
12
+ push: any;
13
+ list: any;
14
+ constructor(base: any);
15
+ add(data: any, marker: any): any;
16
+ addFile(file: string, name?: string): this;
17
+ addEnv(env?: any): any;
18
+ loadPrefix(): any;
19
+ loadCAFile(file: string): void;
20
+ loadUser(): void;
21
+ getCredentialsByURI(uri: string): any;
22
+ setCredentialsByURI(uri: any, c: any): void;
23
+ }