@zokugun/artifact 0.5.2 → 0.6.1
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.
- package/bin/artifact +1 -1
- package/lib/cli.d.ts +1 -0
- package/lib/cli.js +12 -4
- package/lib/commands/add.d.ts +6 -0
- package/lib/commands/add.js +47 -36
- package/lib/commands/index.d.ts +4 -0
- package/lib/commands/index.js +9 -7
- package/lib/commands/list.d.ts +1 -0
- package/lib/commands/list.js +13 -8
- package/lib/commands/remove.d.ts +6 -0
- package/lib/commands/remove.js +79 -0
- package/lib/commands/update.d.ts +5 -0
- package/lib/commands/update.js +43 -39
- package/lib/compositors/compose.d.ts +7 -0
- package/lib/compositors/compose.js +13 -13
- package/lib/compositors/fork.d.ts +3 -0
- package/lib/compositors/fork.js +4 -4
- package/lib/compositors/index.d.ts +6 -0
- package/lib/compositors/index.js +12 -12
- package/lib/compositors/json.d.ts +2 -0
- package/lib/compositors/json.js +14 -12
- package/lib/compositors/map-sort.d.ts +2 -0
- package/lib/compositors/map-sort.js +2 -2
- package/lib/compositors/rc.d.ts +2 -0
- package/lib/compositors/rc.js +13 -10
- package/lib/compositors/yaml.d.ts +2 -0
- package/lib/compositors/yaml.js +8 -11
- package/lib/configs/index.d.ts +3 -0
- package/lib/configs/index.js +3 -2
- package/lib/configs/install/index.d.ts +3 -0
- package/lib/configs/install/index.js +6 -6
- package/lib/configs/install/read-install-config.d.ts +6 -0
- package/lib/configs/install/read-install-config.js +128 -81
- package/lib/configs/install/update-install-config.d.ts +2 -0
- package/lib/configs/install/write-install-config.d.ts +5 -0
- package/lib/configs/install/write-install-config.js +25 -10
- package/lib/configs/package/index.d.ts +1 -0
- package/lib/configs/package/index.js +2 -2
- package/lib/configs/package/read-package-config.d.ts +3 -0
- package/lib/configs/package/read-package-config.js +160 -40
- package/lib/configs/uninstall/index.d.ts +1 -0
- package/lib/configs/uninstall/index.js +5 -0
- package/lib/configs/uninstall/update-uninstall-config.d.ts +2 -0
- package/lib/configs/uninstall/update-uninstall-config.js +6 -0
- package/lib/configs/utils/constants.d.ts +11 -0
- package/lib/configs/utils/constants.js +24 -0
- package/lib/configs/utils/is-transform.d.ts +2 -0
- package/lib/configs/utils/is-transform.js +16 -0
- package/lib/configs/utils/merge-upsert-property.d.ts +3 -0
- package/lib/configs/utils/merge-upsert-property.js +78 -0
- package/lib/configs/utils/normalize-file-always.d.ts +3 -0
- package/lib/configs/utils/normalize-file-always.js +29 -0
- package/lib/configs/utils/normalize-file-uninstall.d.ts +3 -0
- package/lib/configs/utils/normalize-file-uninstall.js +32 -0
- package/lib/configs/utils/normalize-file-upsert.d.ts +3 -0
- package/lib/configs/utils/normalize-file-upsert.js +55 -0
- package/lib/journeys/commitlint/index.d.ts +2 -0
- package/lib/journeys/commitlint/index.js +15 -15
- package/lib/journeys/config.ts/index.d.ts +2 -0
- package/lib/journeys/config.ts/index.js +5 -5
- package/lib/journeys/default/index.d.ts +2 -0
- package/lib/journeys/default/index.js +11 -14
- package/lib/journeys/fixpack/index.d.ts +2 -0
- package/lib/journeys/fixpack/index.js +13 -13
- package/lib/journeys/gitignore/index.d.ts +2 -0
- package/lib/journeys/gitignore/index.js +5 -5
- package/lib/journeys/ignore/index.d.ts +2 -0
- package/lib/journeys/ignore/index.js +5 -5
- package/lib/journeys/index.d.ts +2 -0
- package/lib/journeys/index.js +20 -20
- package/lib/journeys/npmignore/index.d.ts +2 -0
- package/lib/journeys/npmignore/index.js +5 -5
- package/lib/journeys/package/index.d.ts +2 -0
- package/lib/journeys/package/index.js +27 -30
- package/lib/journeys/rc/index.d.ts +2 -0
- package/lib/journeys/rc/index.js +12 -12
- package/lib/journeys/tsconfig/index.d.ts +2 -0
- package/lib/journeys/tsconfig/index.js +13 -16
- package/lib/parsers/json.d.ts +2 -0
- package/lib/parsers/jsonc/index.d.ts +2 -0
- package/lib/parsers/jsonc/index.js +4 -4
- package/lib/parsers/jsonc/parse.d.ts +5 -0
- package/lib/parsers/jsonc/parse.js +1 -13
- package/lib/parsers/jsonc/stringify.d.ts +2 -0
- package/lib/parsers/jsonc/stringify.js +2 -2
- package/lib/parsers/jsonc/transform.d.ts +10 -0
- package/lib/parsers/yaml.d.ts +2 -0
- package/lib/routes/command.d.ts +4 -0
- package/lib/routes/command.js +10 -10
- package/lib/routes/index.d.ts +8 -0
- package/lib/routes/index.js +17 -15
- package/lib/routes/lines-concat.d.ts +4 -0
- package/lib/routes/lines-concat.js +7 -7
- package/lib/routes/list-concat.d.ts +4 -0
- package/lib/routes/list-concat.js +3 -7
- package/lib/routes/list-sort-concat.d.ts +4 -0
- package/lib/routes/list-sort-concat.js +1 -1
- package/lib/routes/map-concat.d.ts +4 -0
- package/lib/routes/map-concat.js +1 -1
- package/lib/routes/map-delete.d.ts +4 -0
- package/lib/routes/map-delete.js +32 -0
- package/lib/routes/overwrite.d.ts +4 -0
- package/lib/routes/overwrite.js +2 -2
- package/lib/routes/primitive.d.ts +4 -0
- package/lib/routes/primitive.js +3 -3
- package/lib/steps/apply-formatting.d.ts +8 -0
- package/lib/steps/apply-formatting.js +50 -25
- package/lib/steps/configure-branches.d.ts +3 -0
- package/lib/steps/configure-branches.js +8 -5
- package/lib/steps/configure-install-file-actions.d.ts +3 -0
- package/lib/steps/configure-install-file-actions.js +59 -94
- package/lib/steps/configure-uninstall-file-actions.d.ts +3 -0
- package/lib/steps/configure-uninstall-file-actions.js +57 -0
- package/lib/steps/configure-update-file-actions.d.ts +3 -0
- package/lib/steps/configure-update-file-actions.js +65 -102
- package/lib/steps/copy-binary-files.d.ts +3 -0
- package/lib/steps/copy-binary-files.js +24 -11
- package/lib/steps/execute-first-block.d.ts +3 -0
- package/lib/steps/execute-first-block.js +35 -14
- package/lib/steps/execute-next-block.d.ts +3 -0
- package/lib/steps/execute-next-block.js +8 -3
- package/lib/steps/index.d.ts +54 -0
- package/lib/steps/index.js +76 -54
- package/lib/steps/insert-final-new-line.d.ts +6 -0
- package/lib/steps/insert-final-new-line.js +13 -1
- package/lib/steps/merge-text-files.d.ts +3 -0
- package/lib/steps/merge-text-files.js +47 -28
- package/lib/steps/read-editor-config.d.ts +3 -0
- package/lib/steps/read-editor-config.js +21 -26
- package/lib/steps/read-files.d.ts +3 -0
- package/lib/steps/read-files.js +26 -10
- package/lib/steps/read-incoming-config.d.ts +3 -0
- package/lib/steps/read-incoming-config.js +7 -5
- package/lib/steps/read-incoming-package.d.ts +3 -0
- package/lib/steps/read-incoming-package.js +12 -7
- package/lib/steps/remove-files.d.ts +3 -0
- package/lib/steps/remove-files.js +10 -4
- package/lib/steps/rename-files.d.ts +3 -0
- package/lib/steps/rename-files.js +25 -0
- package/lib/steps/replace-templates.d.ts +3 -0
- package/lib/steps/replace-templates.js +19 -5
- package/lib/steps/transform-untouched-files.d.ts +3 -0
- package/lib/steps/transform-untouched-files.js +64 -0
- package/lib/steps/unmerge-text-files.d.ts +3 -0
- package/lib/steps/unmerge-text-files.js +64 -0
- package/lib/steps/validate-newer-package.d.ts +3 -0
- package/lib/steps/validate-newer-package.js +4 -2
- package/lib/steps/validate-not-present-package.d.ts +3 -0
- package/lib/steps/validate-not-present-package.js +7 -4
- package/lib/steps/validate-present-package.d.ts +3 -0
- package/lib/steps/validate-present-package.js +24 -0
- package/lib/steps/write-text-files.d.ts +3 -0
- package/lib/steps/write-text-files.js +16 -7
- package/lib/types/binary-file.d.ts +4 -0
- package/lib/types/command.d.ts +5 -0
- package/lib/types/config.d.ts +59 -0
- package/lib/types/context.d.ts +62 -0
- package/lib/types/context.js +4 -0
- package/lib/types/format.d.ts +14 -0
- package/lib/types/step.d.ts +3 -0
- package/lib/types/travel.d.ts +14 -0
- package/lib/utils/apply-transforms.d.ts +2 -0
- package/lib/utils/apply-transforms.js +48 -0
- package/lib/utils/build-journey-plan.d.ts +2 -0
- package/lib/utils/build-route.d.ts +3 -0
- package/lib/utils/build-route.js +92 -0
- package/lib/utils/build-travel-plan.d.ts +2 -0
- package/lib/utils/build-travel.d.ts +3 -0
- package/lib/utils/build-travel.js +32 -0
- package/lib/utils/command/dedupe-strings.d.ts +1 -0
- package/lib/utils/command/index.d.ts +8 -0
- package/lib/utils/command/index.js +14 -14
- package/lib/utils/command/join-command.d.ts +2 -0
- package/lib/utils/command/merge-and-chains.d.ts +1 -0
- package/lib/utils/command/merge-and-chains.js +21 -21
- package/lib/utils/command/merge-command-records.d.ts +2 -0
- package/lib/utils/command/merge-command-records.js +43 -22
- package/lib/utils/command/merge-flag-tokens.d.ts +1 -0
- package/lib/utils/command/merge-flag-tokens.js +1 -1
- package/lib/utils/command/merge-flags-as-string.d.ts +4 -0
- package/lib/utils/command/merge-flags-as-string.js +4 -4
- package/lib/utils/command/merge-or-segments.d.ts +1 -0
- package/lib/utils/command/merge-or-segments.js +28 -28
- package/lib/utils/command/merge-parts-by-prefix.d.ts +1 -0
- package/lib/utils/command/merge-parts-by-prefix.js +6 -6
- package/lib/utils/command/merge-semicolon-segments.d.ts +1 -0
- package/lib/utils/command/merge-semicolon-segments.js +35 -35
- package/lib/utils/command/merge-with-semicolon-mix.d.ts +1 -0
- package/lib/utils/command/merge-with-semicolon-mix.js +12 -12
- package/lib/utils/command/prefix-of-command.d.ts +1 -0
- package/lib/utils/command/prefix-of-command.js +2 -2
- package/lib/utils/command/split-chain.d.ts +1 -0
- package/lib/utils/command/split-command.d.ts +2 -0
- package/lib/utils/command/split-command.js +8 -8
- package/lib/utils/command/split-prefix-and-flags.d.ts +4 -0
- package/lib/utils/command/split-prefix-and-flags.js +5 -5
- package/lib/utils/command/split-segments.d.ts +1 -0
- package/lib/utils/detect-indent.d.ts +2 -0
- package/lib/utils/detect-indent.js +63 -0
- package/lib/utils/flow.d.ts +3 -0
- package/lib/utils/flow.js +12 -0
- package/lib/utils/get-format.d.ts +2 -0
- package/lib/utils/get-format.js +19 -0
- package/lib/utils/has-final-new-line.d.ts +1 -0
- package/lib/utils/has-final-new-line.js +7 -0
- package/lib/utils/read-buffer.d.ts +2 -0
- package/lib/utils/resolve-request.d.ts +3 -0
- package/lib/utils/resolve-request.js +4 -3
- package/lib/utils/template.d.ts +17 -0
- package/lib/utils/template.js +79 -57
- package/lib/utils/to-lines.d.ts +1 -0
- package/lib/utils/trim-final-newline.d.ts +1 -0
- package/lib/utils/try-json.d.ts +1 -0
- package/lib/utils/try-json.js +2 -2
- package/package.json +74 -51
- package/lib/types/text-file.js +0 -2
- package/lib/utils/dev-null.js +0 -7
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeAndChains = mergeAndChains;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const dedupe_strings_js_1 = require("./dedupe-strings.js");
|
|
5
|
+
const merge_flags_as_string_js_1 = require("./merge-flags-as-string.js");
|
|
6
|
+
const merge_parts_by_prefix_js_1 = require("./merge-parts-by-prefix.js");
|
|
7
|
+
const prefix_of_command_js_1 = require("./prefix-of-command.js");
|
|
8
|
+
const split_chain_js_1 = require("./split-chain.js");
|
|
9
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
10
|
+
const split_segments_js_1 = require("./split-segments.js");
|
|
11
11
|
function mergeAndChains(current, incoming) {
|
|
12
12
|
if (!(incoming.includes('&&') && current.includes('&&'))) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const currentMain = (current.split(';')[0] || '').trim();
|
|
16
16
|
const incomingMain = (incoming.split(';')[0] || '').trim();
|
|
17
|
-
const currentAnd = (0,
|
|
18
|
-
const incomingAnd = (0,
|
|
17
|
+
const currentAnd = (0, split_chain_js_1.splitChain)(currentMain, '&&');
|
|
18
|
+
const incomingAnd = (0, split_chain_js_1.splitChain)(incomingMain, '&&');
|
|
19
19
|
// Consider positional match primarily by the first segment's prefix
|
|
20
20
|
const firstCurrent = currentAnd[0] || '';
|
|
21
21
|
const firstIncoming = incomingAnd[0] || '';
|
|
22
|
-
const positionalMatch = (0,
|
|
22
|
+
const positionalMatch = (0, prefix_of_command_js_1.prefixOfCommand)(firstCurrent) === (0, prefix_of_command_js_1.prefixOfCommand)(firstIncoming);
|
|
23
23
|
if (!positionalMatch) {
|
|
24
24
|
// Merge by matching prefixes across current segments, append unmatched incoming segments.
|
|
25
|
-
const merged = (0,
|
|
25
|
+
const merged = (0, merge_parts_by_prefix_js_1.mergePartsByPrefix)(currentAnd, incomingAnd);
|
|
26
26
|
return merged.join('; ');
|
|
27
27
|
}
|
|
28
28
|
// Positional merge: iterate positions, merge flags when prefixes equal, otherwise
|
|
29
29
|
// decide ordering: if incoming's semicolon tail contains current segment, prefer incoming in chain and move current to tail;
|
|
30
30
|
// else keep current in chain then append incoming segment after it.
|
|
31
|
-
const incomingTail = (0,
|
|
32
|
-
const currentTail = (0,
|
|
31
|
+
const incomingTail = (0, split_segments_js_1.splitSegments)(incoming).slice(1);
|
|
32
|
+
const currentTail = (0, split_segments_js_1.splitSegments)(current).slice(1);
|
|
33
33
|
const maxLength = Math.max(currentAnd.length, incomingAnd.length);
|
|
34
34
|
const chainResult = [];
|
|
35
35
|
const tailResult = [];
|
|
@@ -37,14 +37,14 @@ function mergeAndChains(current, incoming) {
|
|
|
37
37
|
const currentPart = currentAnd[i];
|
|
38
38
|
const incomingPart = incomingAnd[i];
|
|
39
39
|
if (currentPart && incomingPart) {
|
|
40
|
-
const cPref = (0,
|
|
41
|
-
const nPref = (0,
|
|
40
|
+
const cPref = (0, prefix_of_command_js_1.prefixOfCommand)(currentPart);
|
|
41
|
+
const nPref = (0, prefix_of_command_js_1.prefixOfCommand)(incomingPart);
|
|
42
42
|
if (cPref && nPref && cPref === nPref) {
|
|
43
43
|
if (incomingTail.length > 0) {
|
|
44
|
-
chainResult.push((0,
|
|
44
|
+
chainResult.push((0, merge_flags_as_string_js_1.mergeFlagsAsString)(incomingPart, (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(currentPart)));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
chainResult.push((0,
|
|
47
|
+
chainResult.push((0, merge_flags_as_string_js_1.mergeFlagsAsString)(currentPart, (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(incomingPart)));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
@@ -57,7 +57,7 @@ function mergeAndChains(current, incoming) {
|
|
|
57
57
|
else {
|
|
58
58
|
const currentAppearsLaterInIncoming = incomingAnd
|
|
59
59
|
.slice(i + 1)
|
|
60
|
-
.some((later) => (0,
|
|
60
|
+
.some((later) => (0, prefix_of_command_js_1.prefixOfCommand)(later) === cPref);
|
|
61
61
|
if (currentAppearsLaterInIncoming) {
|
|
62
62
|
// Incoming inserted a step before current and shifted current to the right.
|
|
63
63
|
chainResult.push(incomingPart, currentPart);
|
|
@@ -80,12 +80,12 @@ function mergeAndChains(current, incoming) {
|
|
|
80
80
|
chainResult.push(incomingPart);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const dedupedChain = (0,
|
|
83
|
+
const dedupedChain = (0, dedupe_strings_js_1.dedupeStrings)(chainResult);
|
|
84
84
|
// Append any remaining semicolon tails from current and incoming (preserve incoming tail order)
|
|
85
85
|
// remove any tail entries that are already present in the chainResult (by prefix)
|
|
86
|
-
const chainPrefixes = new Set(dedupedChain.map(
|
|
86
|
+
const chainPrefixes = new Set(dedupedChain.map(prefix_of_command_js_1.prefixOfCommand).filter(Boolean));
|
|
87
87
|
const combined = [...tailResult, ...currentTail, ...incomingTail].filter((t) => {
|
|
88
|
-
const tp = (0,
|
|
88
|
+
const tp = (0, prefix_of_command_js_1.prefixOfCommand)(t) || t;
|
|
89
89
|
return !chainPrefixes.has(tp);
|
|
90
90
|
});
|
|
91
91
|
const seen = new Set();
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeCommandRecords = mergeCommandRecords;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
function mergeCommandRecords(currentCommand, incomingCommand, currentString) {
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
const list_concat_js_1 = require("../../routes/list-concat.js");
|
|
6
|
+
async function mergeCommandRecords(currentCommand, incomingCommand, currentString) {
|
|
7
7
|
const result = {};
|
|
8
8
|
// Start with current commands to preserve ordering
|
|
9
9
|
for (const [name, instances] of Object.entries(currentCommand)) {
|
|
10
|
-
result[name] = instances
|
|
10
|
+
result[name] = [...instances];
|
|
11
11
|
}
|
|
12
12
|
// Merge incoming into existing result, preserving order
|
|
13
13
|
for (const [name, instances] of Object.entries(incomingCommand)) {
|
|
14
14
|
if (result[name]) {
|
|
15
|
-
for (const [
|
|
16
|
-
if (result[name][
|
|
17
|
-
const currentInstance = result[name][
|
|
15
|
+
for (const [index, instance] of instances.entries()) {
|
|
16
|
+
if (result[name][index]) {
|
|
17
|
+
const currentInstance = result[name][index];
|
|
18
18
|
const hasFlags = (array) => array.some((a) => a.startsWith('-') || a.includes('='));
|
|
19
19
|
const getPrefix = (array) => {
|
|
20
20
|
const ii = array.findIndex((a) => a.startsWith('-'));
|
|
@@ -28,9 +28,9 @@ function mergeCommandRecords(currentCommand, incomingCommand, currentString) {
|
|
|
28
28
|
const shouldMerge = currentPrefix && incomingPrefix && currentPrefix === incomingPrefix && (hasFlags(currentInstance.args) || hasFlags(instance.args) || (currentInstance.env.length > 0) || (instance.env.length > 0));
|
|
29
29
|
if (shouldMerge) {
|
|
30
30
|
// replace with merged instance
|
|
31
|
-
result[name][
|
|
32
|
-
args: (0,
|
|
33
|
-
env: (0,
|
|
31
|
+
result[name][index] = {
|
|
32
|
+
args: await (0, list_concat_js_1.listConcat)({ current: currentInstance.args, incoming: instance.args }),
|
|
33
|
+
env: await (0, list_concat_js_1.listConcat)({ current: currentInstance.env, incoming: instance.env }),
|
|
34
34
|
separator: instance.separator ?? currentInstance.separator,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -38,26 +38,39 @@ function mergeCommandRecords(currentCommand, incomingCommand, currentString) {
|
|
|
38
38
|
// If incoming instance is empty (no args/env), skip it to avoid duplicates
|
|
39
39
|
if ((instance.args.length === 0) && (instance.env.length === 0)) {
|
|
40
40
|
// keep current as-is
|
|
41
|
-
result[name][
|
|
41
|
+
result[name][index] = currentInstance;
|
|
42
42
|
}
|
|
43
|
-
else if ((0,
|
|
43
|
+
else if ((0, lodash_es_1.isEqual)(currentInstance.env, instance.env)
|
|
44
44
|
&& instance.args.length > 0
|
|
45
45
|
&& instance.args.every((arg) => currentInstance.args.includes(arg))) {
|
|
46
46
|
// Incoming is a strict subset of current args for the same command/env.
|
|
47
|
-
result[name][
|
|
47
|
+
result[name][index] = currentInstance;
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
// avoid inserting exact duplicate instances
|
|
51
|
-
const duplicateExists = result[name].some((r) => (0,
|
|
51
|
+
const duplicateExists = result[name].some((r) => (0, lodash_es_1.isEqual)(r.args, instance.args) && (0, lodash_es_1.isEqual)(r.env, instance.env));
|
|
52
52
|
if (duplicateExists) {
|
|
53
53
|
// nothing to do, keep current ordering
|
|
54
|
-
result[name][
|
|
54
|
+
result[name][index] = currentInstance;
|
|
55
|
+
}
|
|
56
|
+
else if (!hasFlags(currentInstance.args)
|
|
57
|
+
&& !hasFlags(instance.args)
|
|
58
|
+
&& currentInstance.env.length === 0
|
|
59
|
+
&& instance.env.length === 0
|
|
60
|
+
&& currentPrefix !== incomingPrefix) {
|
|
61
|
+
// Different singleton-like invocations of the same command should not be interleaved.
|
|
62
|
+
const lastIndex = result[name].length - 1;
|
|
63
|
+
const last = result[name][lastIndex];
|
|
64
|
+
if (last && !last.separator) {
|
|
65
|
+
last.separator = currentString.includes('&&') ? '&&' : ';';
|
|
66
|
+
}
|
|
67
|
+
result[name].push(instance);
|
|
55
68
|
}
|
|
56
69
|
else {
|
|
57
70
|
// insert incoming as separate after current
|
|
58
|
-
const
|
|
59
|
-
result[name][
|
|
60
|
-
result[name].splice(
|
|
71
|
+
const currentWithSeparator = { ...currentInstance, separator: currentInstance.separator ?? (currentString.includes('&&') ? '&&' : ';') };
|
|
72
|
+
result[name][index] = currentWithSeparator;
|
|
73
|
+
result[name].splice(index + 1, 0, instance);
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
76
|
}
|
|
@@ -69,14 +82,22 @@ function mergeCommandRecords(currentCommand, incomingCommand, currentString) {
|
|
|
69
82
|
}
|
|
70
83
|
else {
|
|
71
84
|
// incoming-only: append
|
|
72
|
-
|
|
85
|
+
const previousNames = Object.keys(result);
|
|
86
|
+
const previousName = previousNames.at(-1);
|
|
87
|
+
const isPlainSequence = !currentString.includes('&&') && !currentString.includes('||') && !currentString.includes(';');
|
|
88
|
+
if (isPlainSequence && previousName) {
|
|
89
|
+
const previousInstances = result[previousName];
|
|
90
|
+
const lastPrevious = previousInstances.at(-1);
|
|
91
|
+
if (lastPrevious && !lastPrevious.separator) {
|
|
92
|
+
lastPrevious.separator = ';';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
result[name] = [...instances];
|
|
73
96
|
}
|
|
74
97
|
}
|
|
75
98
|
// Include current-only entries that weren't present in incoming
|
|
76
99
|
for (const [name, instances] of Object.entries(currentCommand)) {
|
|
77
|
-
|
|
78
|
-
result[name] = instances;
|
|
79
|
-
}
|
|
100
|
+
result[name] ||= instances;
|
|
80
101
|
}
|
|
81
102
|
return result;
|
|
82
103
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeFlagTokens(currentFlags: string[], incomingFlags: string[]): string[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeFlagTokens = mergeFlagTokens;
|
|
4
4
|
function mergeFlagTokens(currentFlags, incomingFlags) {
|
|
5
|
-
const mergedFlags = currentFlags
|
|
5
|
+
const mergedFlags = [...currentFlags];
|
|
6
6
|
for (const flag of incomingFlags) {
|
|
7
7
|
const name = flag.split(/\s+/)[0];
|
|
8
8
|
const exists = mergedFlags.some((existing) => existing.split(/\s+/)[0] === name);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeFlagsAsString = mergeFlagsAsString;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const merge_flag_tokens_js_1 = require("./merge-flag-tokens.js");
|
|
5
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
6
6
|
function mergeFlagsAsString(current, incoming) {
|
|
7
|
-
const currentPrefix = (0,
|
|
8
|
-
const mergedFlags = (0,
|
|
7
|
+
const currentPrefix = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(current);
|
|
8
|
+
const mergedFlags = (0, merge_flag_tokens_js_1.mergeFlagTokens)(currentPrefix.flags, incoming.flags);
|
|
9
9
|
return currentPrefix.prefix + (mergedFlags.length > 0 ? ' ' + mergedFlags.join(' ') : '');
|
|
10
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeOrSegments(current: string, incoming: string): string;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeOrSegments = mergeOrSegments;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const dedupe_strings_js_1 = require("./dedupe-strings.js");
|
|
5
|
+
const merge_flags_as_string_js_1 = require("./merge-flags-as-string.js");
|
|
6
|
+
const merge_semicolon_segments_js_1 = require("./merge-semicolon-segments.js");
|
|
7
|
+
const prefix_of_command_js_1 = require("./prefix-of-command.js");
|
|
8
|
+
const split_chain_js_1 = require("./split-chain.js");
|
|
9
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
10
|
+
const split_segments_js_1 = require("./split-segments.js");
|
|
11
11
|
function mergeOrSegments(current, incoming) {
|
|
12
|
-
const currentSegments = (0,
|
|
13
|
-
const incomingSegments = (0,
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return (0,
|
|
12
|
+
const currentSegments = (0, split_segments_js_1.splitSegments)(current);
|
|
13
|
+
const incomingSegments = (0, split_segments_js_1.splitSegments)(incoming);
|
|
14
|
+
const currentOrIndex = currentSegments.findIndex((s) => s.includes('||'));
|
|
15
|
+
const incomingOrIndex = incomingSegments.findIndex((s) => s.includes('||'));
|
|
16
|
+
if (currentOrIndex === -1 || incomingOrIndex === -1) {
|
|
17
|
+
return (0, merge_semicolon_segments_js_1.mergeSemicolonSegments)(current, incoming);
|
|
18
18
|
}
|
|
19
|
-
const currentParts = (0,
|
|
20
|
-
const incomingParts = (0,
|
|
21
|
-
const currentTail = currentSegments.filter((_,
|
|
22
|
-
const incomingTail = incomingSegments.filter((_,
|
|
19
|
+
const currentParts = (0, split_chain_js_1.splitChain)(currentSegments[currentOrIndex], '||');
|
|
20
|
+
const incomingParts = (0, split_chain_js_1.splitChain)(incomingSegments[incomingOrIndex], '||');
|
|
21
|
+
const currentTail = currentSegments.filter((_, index) => index !== currentOrIndex);
|
|
22
|
+
const incomingTail = incomingSegments.filter((_, index) => index !== incomingOrIndex);
|
|
23
23
|
const maxLength = Math.max(currentParts.length, incomingParts.length);
|
|
24
24
|
const chainResult = [];
|
|
25
25
|
const movedToTail = [];
|
|
@@ -27,14 +27,14 @@ function mergeOrSegments(current, incoming) {
|
|
|
27
27
|
const currentPart = currentParts[i];
|
|
28
28
|
const incomingPart = incomingParts[i];
|
|
29
29
|
if (currentPart && incomingPart) {
|
|
30
|
-
const cPref = (0,
|
|
31
|
-
const nPref = (0,
|
|
30
|
+
const cPref = (0, prefix_of_command_js_1.prefixOfCommand)(currentPart);
|
|
31
|
+
const nPref = (0, prefix_of_command_js_1.prefixOfCommand)(incomingPart);
|
|
32
32
|
if (cPref && nPref && cPref === nPref) {
|
|
33
33
|
if (incomingTail.length > 0) {
|
|
34
|
-
chainResult.push((0,
|
|
34
|
+
chainResult.push((0, merge_flags_as_string_js_1.mergeFlagsAsString)(incomingPart, (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(currentPart)));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
chainResult.push((0,
|
|
37
|
+
chainResult.push((0, merge_flags_as_string_js_1.mergeFlagsAsString)(currentPart, (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(incomingPart)));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
else if (incomingTail.some((t) => t === currentPart || t.startsWith(`${currentPart} `))) {
|
|
@@ -64,22 +64,22 @@ function mergeOrSegments(current, incoming) {
|
|
|
64
64
|
}
|
|
65
65
|
const chainParts = new Set(dedupedChain);
|
|
66
66
|
const rawTail = [...currentTail, ...movedToTail, ...incomingTail];
|
|
67
|
-
const filteredTail = rawTail.filter((tail,
|
|
67
|
+
const filteredTail = rawTail.filter((tail, index) => {
|
|
68
68
|
if (chainParts.has(tail)) {
|
|
69
69
|
return false;
|
|
70
70
|
}
|
|
71
71
|
// Keep only the most specific tail when two tails share a prefix.
|
|
72
|
-
return !rawTail.some((other,
|
|
72
|
+
return !rawTail.some((other, otherIndex) => otherIndex !== index && other.startsWith(`${tail} `));
|
|
73
73
|
});
|
|
74
74
|
const mergedChain = dedupedChain.join(' || ');
|
|
75
|
-
const chainPrefixes = new Set(dedupedChain.map(
|
|
75
|
+
const chainPrefixes = new Set(dedupedChain.map(prefix_of_command_js_1.prefixOfCommand).filter(Boolean));
|
|
76
76
|
const mergedSegs = currentSegments
|
|
77
|
-
.map((seg,
|
|
78
|
-
.filter((seg,
|
|
79
|
-
for (const tail of (0,
|
|
77
|
+
.map((seg, index) => (index === currentOrIndex ? mergedChain : seg))
|
|
78
|
+
.filter((seg, index) => index === currentOrIndex || !chainPrefixes.has((0, prefix_of_command_js_1.prefixOfCommand)(seg)));
|
|
79
|
+
for (const tail of (0, dedupe_strings_js_1.dedupeStrings)(filteredTail)) {
|
|
80
80
|
if (!mergedSegs.includes(tail)) {
|
|
81
81
|
mergedSegs.push(tail);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
return (0,
|
|
84
|
+
return (0, dedupe_strings_js_1.dedupeStrings)(mergedSegs).join('; ');
|
|
85
85
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergePartsByPrefix(currentParts: string[], incomingParts: string[]): string[];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergePartsByPrefix = mergePartsByPrefix;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const merge_flag_tokens_js_1 = require("./merge-flag-tokens.js");
|
|
5
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
6
6
|
function mergePartsByPrefix(currentParts, incomingParts) {
|
|
7
|
-
const result = currentParts
|
|
7
|
+
const result = [...currentParts];
|
|
8
8
|
for (const incomingPart of incomingParts) {
|
|
9
|
-
const incomingPrefix = (0,
|
|
9
|
+
const incomingPrefix = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(incomingPart);
|
|
10
10
|
let merged = false;
|
|
11
11
|
for (let k = 0; k < result.length; k++) {
|
|
12
|
-
const currentPrefix = (0,
|
|
12
|
+
const currentPrefix = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(result[k]);
|
|
13
13
|
if (currentPrefix.prefix && incomingPrefix.prefix && currentPrefix.prefix === incomingPrefix.prefix) {
|
|
14
|
-
const mergedFlags = (0,
|
|
14
|
+
const mergedFlags = (0, merge_flag_tokens_js_1.mergeFlagTokens)(currentPrefix.flags, incomingPrefix.flags);
|
|
15
15
|
result[k] = currentPrefix.prefix + (mergedFlags.length > 0 ? ' ' + mergedFlags.join(' ') : '');
|
|
16
16
|
merged = true;
|
|
17
17
|
break;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeSemicolonSegments(current: string, incoming: string): string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeSemicolonSegments = mergeSemicolonSegments;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const merge_flag_tokens_js_1 = require("./merge-flag-tokens.js");
|
|
5
|
+
const merge_flags_as_string_js_1 = require("./merge-flags-as-string.js");
|
|
6
|
+
const merge_parts_by_prefix_js_1 = require("./merge-parts-by-prefix.js");
|
|
7
|
+
const prefix_of_command_js_1 = require("./prefix-of-command.js");
|
|
8
|
+
const split_chain_js_1 = require("./split-chain.js");
|
|
9
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
10
|
+
const split_segments_js_1 = require("./split-segments.js");
|
|
11
11
|
function mergeSemicolonSegments(current, incoming) {
|
|
12
|
-
let currentSegments = (0,
|
|
13
|
-
const incomingSegments = (0,
|
|
12
|
+
let currentSegments = (0, split_segments_js_1.splitSegments)(current);
|
|
13
|
+
const incomingSegments = (0, split_segments_js_1.splitSegments)(incoming);
|
|
14
14
|
for (const incomingSegment of incomingSegments) {
|
|
15
15
|
// If the incoming segment is itself a chain (&& or ||), merge subparts accordingly
|
|
16
16
|
if (incomingSegment.includes('||')) {
|
|
@@ -18,12 +18,12 @@ function mergeSemicolonSegments(current, incoming) {
|
|
|
18
18
|
let mergedIntoCurrent = false;
|
|
19
19
|
for (let j = 0; j < currentSegments.length; j++) {
|
|
20
20
|
if (currentSegments[j].includes('||')) {
|
|
21
|
-
const currentParts = (0,
|
|
22
|
-
const newParts = (0,
|
|
21
|
+
const currentParts = (0, split_chain_js_1.splitChain)(currentSegments[j], '||');
|
|
22
|
+
const newParts = (0, merge_parts_by_prefix_js_1.mergePartsByPrefix)(currentParts, incomingParts);
|
|
23
23
|
currentSegments[j] = newParts.join(' || ');
|
|
24
24
|
// remove duplicates that were absorbed
|
|
25
|
-
currentSegments = currentSegments.filter((s,
|
|
26
|
-
if (
|
|
25
|
+
currentSegments = currentSegments.filter((s, index) => {
|
|
26
|
+
if (index === j) {
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
29
29
|
for (const np of newParts) {
|
|
@@ -43,48 +43,48 @@ function mergeSemicolonSegments(current, incoming) {
|
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
45
|
if (incomingSegment.includes('&&')) {
|
|
46
|
-
const incomingParts = (0,
|
|
46
|
+
const incomingParts = (0, split_chain_js_1.splitChain)(incomingSegment, '&&');
|
|
47
47
|
let mergedIntoCurrent = false;
|
|
48
48
|
for (let j = 0; j < currentSegments.length; j++) {
|
|
49
49
|
if (currentSegments[j].includes('&&')) {
|
|
50
|
-
const currentParts = (0,
|
|
50
|
+
const currentParts = (0, split_chain_js_1.splitChain)(currentSegments[j], '&&');
|
|
51
51
|
// If first prefixes align, do positional merge preferring incoming flags first
|
|
52
52
|
let newParts = [];
|
|
53
|
-
if (currentParts.length > 0 && incomingParts.length > 0 && (0,
|
|
53
|
+
if (currentParts.length > 0 && incomingParts.length > 0 && (0, prefix_of_command_js_1.prefixOfCommand)(currentParts[0]) === (0, prefix_of_command_js_1.prefixOfCommand)(incomingParts[0])) {
|
|
54
54
|
const maxLength = Math.max(currentParts.length, incomingParts.length);
|
|
55
55
|
for (let i = 0; i < maxLength; i++) {
|
|
56
|
-
const
|
|
56
|
+
const currentPart = currentParts[i];
|
|
57
57
|
const incPart = incomingParts[i];
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
const incP = (0,
|
|
61
|
-
if (
|
|
58
|
+
if (currentPart && incPart) {
|
|
59
|
+
const currentP = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(currentPart);
|
|
60
|
+
const incP = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(incPart);
|
|
61
|
+
if (currentP.prefix && incP.prefix && currentP.prefix === incP.prefix) {
|
|
62
62
|
// keep current flags first, then append incoming flags if missing
|
|
63
|
-
const mergedFlags = (0,
|
|
64
|
-
newParts.push(
|
|
63
|
+
const mergedFlags = (0, merge_flag_tokens_js_1.mergeFlagTokens)(currentP.flags, incP.flags);
|
|
64
|
+
newParts.push(currentP.prefix + (mergedFlags.length > 0 ? ' ' + mergedFlags.join(' ') : ''));
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
if (
|
|
69
|
-
newParts.push(
|
|
68
|
+
if (currentPart) {
|
|
69
|
+
newParts.push(currentPart);
|
|
70
70
|
}
|
|
71
|
-
if (!
|
|
71
|
+
if (!currentPart && incPart) {
|
|
72
72
|
newParts.push(incPart);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
currentSegments[j] = newParts.join(' && ');
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
|
-
newParts = (0,
|
|
78
|
+
newParts = (0, merge_parts_by_prefix_js_1.mergePartsByPrefix)(currentParts, incomingParts);
|
|
79
79
|
currentSegments[j] = newParts.join(' && ');
|
|
80
80
|
}
|
|
81
81
|
// remove duplicates that were absorbed — compare by prefix to avoid formatting mismatches
|
|
82
|
-
const newPrefixes = new Set(newParts.map(
|
|
83
|
-
currentSegments = currentSegments.filter((s,
|
|
84
|
-
if (
|
|
82
|
+
const newPrefixes = new Set(newParts.map(prefix_of_command_js_1.prefixOfCommand).filter(Boolean));
|
|
83
|
+
currentSegments = currentSegments.filter((s, index) => {
|
|
84
|
+
if (index === j) {
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
87
|
-
const sp = (0,
|
|
87
|
+
const sp = (0, prefix_of_command_js_1.prefixOfCommand)(s);
|
|
88
88
|
if (sp && newPrefixes.has(sp)) {
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
@@ -99,12 +99,12 @@ function mergeSemicolonSegments(current, incoming) {
|
|
|
99
99
|
}
|
|
100
100
|
continue;
|
|
101
101
|
}
|
|
102
|
-
const incomingPartsObject = (0,
|
|
102
|
+
const incomingPartsObject = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(incomingSegment);
|
|
103
103
|
let matched = false;
|
|
104
104
|
for (let i = 0; i < currentSegments.length; i++) {
|
|
105
|
-
const currentPartsObject = (0,
|
|
105
|
+
const currentPartsObject = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(currentSegments[i]);
|
|
106
106
|
if (currentPartsObject.prefix && incomingPartsObject.prefix && currentPartsObject.prefix === incomingPartsObject.prefix) {
|
|
107
|
-
currentSegments[i] = (0,
|
|
107
|
+
currentSegments[i] = (0, merge_flags_as_string_js_1.mergeFlagsAsString)(currentSegments[i], incomingPartsObject);
|
|
108
108
|
matched = true;
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
@@ -117,7 +117,7 @@ function mergeSemicolonSegments(current, incoming) {
|
|
|
117
117
|
const seen = [];
|
|
118
118
|
const deduped = [];
|
|
119
119
|
for (const s of currentSegments) {
|
|
120
|
-
const p = (0,
|
|
120
|
+
const p = (0, prefix_of_command_js_1.prefixOfCommand)(s) || s;
|
|
121
121
|
if (!seen.includes(p)) {
|
|
122
122
|
seen.push(p);
|
|
123
123
|
deduped.push(s);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeWithSemicolonMix(current: string, incoming: string): string | undefined;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeWithSemicolonMix = mergeWithSemicolonMix;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const merge_flags_as_string_js_1 = require("./merge-flags-as-string.js");
|
|
5
|
+
const split_chain_js_1 = require("./split-chain.js");
|
|
6
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
7
7
|
function mergeWithSemicolonMix(current, incoming) {
|
|
8
8
|
if (!(incoming.includes('&&') && current.includes(';'))) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
const allSegments = current.split(/;|&&/).map((s) => s.trim()).filter(Boolean);
|
|
12
12
|
const chainPart = current.split(';')[0] || '';
|
|
13
|
-
const chainCount = chainPart ? (0,
|
|
13
|
+
const chainCount = chainPart ? (0, split_chain_js_1.splitChain)(chainPart, '&&').length : 0;
|
|
14
14
|
const currentChain = allSegments.slice(0, chainCount);
|
|
15
15
|
const tail = allSegments.slice(chainCount);
|
|
16
|
-
const incomingAnd = (0,
|
|
17
|
-
const chainResult = currentChain
|
|
16
|
+
const incomingAnd = (0, split_chain_js_1.splitChain)(incoming, '&&');
|
|
17
|
+
const chainResult = [...currentChain];
|
|
18
18
|
const appendedTailIdxs = [];
|
|
19
19
|
for (const incomingSegment of incomingAnd) {
|
|
20
|
-
const incomingParts = (0,
|
|
20
|
+
const incomingParts = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(incomingSegment);
|
|
21
21
|
let matched = false;
|
|
22
22
|
for (const [i, allSegment] of allSegments.entries()) {
|
|
23
|
-
const currentParts = (0,
|
|
23
|
+
const currentParts = (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(allSegment);
|
|
24
24
|
if (currentParts.prefix && incomingParts.prefix && currentParts.prefix === incomingParts.prefix) {
|
|
25
25
|
if (i < chainCount) {
|
|
26
26
|
// merge into existing chain position
|
|
27
|
-
const
|
|
28
|
-
chainResult[
|
|
27
|
+
const index = i;
|
|
28
|
+
chainResult[index] = (0, merge_flags_as_string_js_1.mergeFlagsAsString)(chainResult[index], incomingParts);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
// append matching tail segment into chain if not already appended
|
|
32
32
|
if (!appendedTailIdxs.includes(i)) {
|
|
33
|
-
chainResult.push((0,
|
|
33
|
+
chainResult.push((0, merge_flags_as_string_js_1.mergeFlagsAsString)(allSegment, incomingParts));
|
|
34
34
|
appendedTailIdxs.push(i);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -43,6 +43,6 @@ function mergeWithSemicolonMix(current, incoming) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
// Build remaining tail excluding appended indices
|
|
46
|
-
const remainingTail = tail.filter((_,
|
|
46
|
+
const remainingTail = tail.filter((_, index) => !appendedTailIdxs.includes(chainCount + index));
|
|
47
47
|
return chainResult.join(' && ') + (remainingTail.length > 0 ? '; ' + remainingTail.join('; ') : '');
|
|
48
48
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prefixOfCommand(command: string): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prefixOfCommand = prefixOfCommand;
|
|
4
|
-
const
|
|
4
|
+
const split_prefix_and_flags_js_1 = require("./split-prefix-and-flags.js");
|
|
5
5
|
function prefixOfCommand(command) {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, split_prefix_and_flags_js_1.splitPrefixAndFlags)(command).prefix;
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function splitChain(s: string, operator: '&&' | '||'): string[];
|