@shell-shock/preset-cli 0.9.12 → 0.9.14
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/dist/_virtual/_rolldown/runtime.mjs +1 -4
- package/dist/components/banner-builtin.cjs +3 -3
- package/dist/components/banner-builtin.mjs +3 -3
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +1 -0
- package/dist/components/command-entry.mjs +1 -0
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +1 -0
- package/dist/components/virtual-command-entry.mjs +1 -0
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.cjs +8 -0
- package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.mjs +8 -0
- package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.cjs +14 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.mjs +15 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.cjs +655 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.mjs +651 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.mjs.map +1 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.cjs +48 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.mjs +47 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.mjs.map +1 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.cjs +24 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.mjs +24 -0
- package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.mjs.map +1 -0
- package/dist/node_modules/.pnpm/string-width@8.2.0/node_modules/string-width/index.cjs +65 -0
- package/dist/node_modules/.pnpm/string-width@8.2.0/node_modules/string-width/index.mjs +66 -0
- package/dist/node_modules/.pnpm/string-width@8.2.0/node_modules/string-width/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.cjs +12 -0
- package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.mjs +13 -0
- package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.cjs +290 -3
- package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.mjs +287 -1
- package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.mjs.map +1 -1
- package/dist/packages/plugin-changelog/dist/components/changelog-command.cjs +4 -4
- package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs +4 -4
- package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs.map +1 -1
- package/dist/packages/unified/dist/html-Dw6VvFHa.cjs +612 -0
- package/dist/packages/unified/dist/html-Dw6VvFHa.mjs +613 -0
- package/dist/packages/unified/dist/html-Dw6VvFHa.mjs.map +1 -0
- package/dist/packages/unified/dist/markdown/index.cjs +1 -1
- package/dist/packages/unified/dist/markdown/index.mjs +1 -1
- package/dist/packages/unified/dist/{markdown-OuY_JOk0.cjs → markdown-BGGlzivq.cjs} +14 -50
- package/dist/packages/unified/dist/{markdown-OuY_JOk0.mjs → markdown-BGGlzivq.mjs} +16 -52
- package/dist/packages/unified/dist/markdown-BGGlzivq.mjs.map +1 -0
- package/package.json +19 -19
- package/dist/node_modules/.pnpm/chalk-string@4.0.0/node_modules/chalk-string/build/src/args.cjs +0 -36
- package/dist/node_modules/.pnpm/chalk-string@4.0.0/node_modules/chalk-string/build/src/args.mjs +0 -36
- package/dist/node_modules/.pnpm/chalk-string@4.0.0/node_modules/chalk-string/build/src/args.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chalk-string@4.0.0/node_modules/chalk-string/build/src/main.cjs +0 -32
- package/dist/node_modules/.pnpm/chalk-string@4.0.0/node_modules/chalk-string/build/src/main.mjs +0 -33
- package/dist/node_modules/.pnpm/chalk-string@4.0.0/node_modules/chalk-string/build/src/main.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.cjs +0 -133
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.mjs +0 -134
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.cjs +0 -32
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.mjs +0 -31
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.cjs +0 -169
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.mjs +0 -167
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.cjs +0 -98
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.mjs +0 -95
- package/dist/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/colors-option@6.1.2/node_modules/colors-option/build/src/main.cjs +0 -23
- package/dist/node_modules/.pnpm/colors-option@6.1.2/node_modules/colors-option/build/src/main.mjs +0 -23
- package/dist/node_modules/.pnpm/colors-option@6.1.2/node_modules/colors-option/build/src/main.mjs.map +0 -1
- package/dist/node_modules/.pnpm/colors-option@6.1.2/node_modules/colors-option/build/src/options.cjs +0 -36
- package/dist/node_modules/.pnpm/colors-option@6.1.2/node_modules/colors-option/build/src/options.mjs +0 -36
- package/dist/node_modules/.pnpm/colors-option@6.1.2/node_modules/colors-option/build/src/options.mjs.map +0 -1
- package/dist/node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.cjs +0 -10
- package/dist/node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.mjs +0 -10
- package/dist/node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.mjs.map +0 -1
- package/dist/packages/unified/dist/html-Di3_LwV3.cjs +0 -337
- package/dist/packages/unified/dist/html-Di3_LwV3.mjs +0 -338
- package/dist/packages/unified/dist/html-Di3_LwV3.mjs.map +0 -1
- package/dist/packages/unified/dist/markdown-OuY_JOk0.mjs.map +0 -1
|
@@ -1,17 +1,303 @@
|
|
|
1
|
+
import stripAnsi from "../../../strip-ansi@7.2.0/node_modules/strip-ansi/index.mjs";
|
|
2
|
+
import stringWidth from "../../../string-width@8.2.0/node_modules/string-width/index.mjs";
|
|
1
3
|
import ansiStyles from "../../../ansi-styles@6.2.3/node_modules/ansi-styles/index.mjs";
|
|
2
4
|
|
|
3
5
|
//#region ../../node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.js
|
|
6
|
+
const ANSI_ESCAPE = "\x1B";
|
|
7
|
+
const ANSI_ESCAPE_CSI = "";
|
|
8
|
+
const ESCAPES = new Set([ANSI_ESCAPE, ANSI_ESCAPE_CSI]);
|
|
9
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
4
10
|
const ANSI_CSI = "[";
|
|
5
11
|
const ANSI_OSC = "]";
|
|
6
12
|
const ANSI_SGR_TERMINATOR = "m";
|
|
7
13
|
const ANSI_SGR_RESET = 0;
|
|
14
|
+
const ANSI_SGR_RESET_FOREGROUND = 39;
|
|
15
|
+
const ANSI_SGR_RESET_BACKGROUND = 49;
|
|
16
|
+
const ANSI_SGR_RESET_UNDERLINE_COLOR = 59;
|
|
17
|
+
const ANSI_SGR_FOREGROUND_EXTENDED = 38;
|
|
18
|
+
const ANSI_SGR_BACKGROUND_EXTENDED = 48;
|
|
19
|
+
const ANSI_SGR_UNDERLINE_COLOR_EXTENDED = 58;
|
|
20
|
+
const ANSI_SGR_COLOR_MODE_256 = 5;
|
|
21
|
+
const ANSI_SGR_COLOR_MODE_RGB = 2;
|
|
8
22
|
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
9
23
|
const ANSI_ESCAPE_REGEX = new RegExp(`^\\u001B(?:\\${ANSI_CSI}(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}|${ANSI_ESCAPE_LINK}(?<uri>[^\\u0007\\u001B]*)(?:\\u0007|\\u001B\\\\))`);
|
|
10
24
|
const ANSI_ESCAPE_CSI_REGEX = new RegExp(`^\\u009B(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}`);
|
|
11
25
|
const ANSI_SGR_MODIFIER_CLOSE_CODES = new Set(ansiStyles.codes.values());
|
|
12
26
|
ANSI_SGR_MODIFIER_CLOSE_CODES.delete(ANSI_SGR_RESET);
|
|
13
27
|
const segmenter = new Intl.Segmenter();
|
|
28
|
+
const getGraphemes = (string) => Array.from(segmenter.segment(string), ({ segment }) => segment);
|
|
29
|
+
const TAB_SIZE = 8;
|
|
30
|
+
const wrapAnsiCode = (code) => `${ANSI_ESCAPE}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
31
|
+
const wrapAnsiHyperlink = (url) => `${ANSI_ESCAPE}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
32
|
+
const getSgrTokens = (sgrParameters) => {
|
|
33
|
+
const codes = sgrParameters.split(";").map((sgrParameter) => sgrParameter === "" ? ANSI_SGR_RESET : Number.parseInt(sgrParameter, 10));
|
|
34
|
+
const sgrTokens = [];
|
|
35
|
+
for (let index = 0; index < codes.length; index++) {
|
|
36
|
+
const code = codes[index];
|
|
37
|
+
if (!Number.isFinite(code)) continue;
|
|
38
|
+
if (code === ANSI_SGR_FOREGROUND_EXTENDED || code === ANSI_SGR_BACKGROUND_EXTENDED || code === ANSI_SGR_UNDERLINE_COLOR_EXTENDED) {
|
|
39
|
+
if (index + 1 >= codes.length) break;
|
|
40
|
+
const mode = codes[index + 1];
|
|
41
|
+
if (mode === ANSI_SGR_COLOR_MODE_256 && Number.isFinite(codes[index + 2])) {
|
|
42
|
+
sgrTokens.push([
|
|
43
|
+
code,
|
|
44
|
+
mode,
|
|
45
|
+
codes[index + 2]
|
|
46
|
+
]);
|
|
47
|
+
index += 2;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const red = codes[index + 2];
|
|
51
|
+
const green = codes[index + 3];
|
|
52
|
+
const blue = codes[index + 4];
|
|
53
|
+
if (mode === ANSI_SGR_COLOR_MODE_RGB && Number.isFinite(red) && Number.isFinite(green) && Number.isFinite(blue)) {
|
|
54
|
+
sgrTokens.push([
|
|
55
|
+
code,
|
|
56
|
+
mode,
|
|
57
|
+
red,
|
|
58
|
+
green,
|
|
59
|
+
blue
|
|
60
|
+
]);
|
|
61
|
+
index += 4;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
sgrTokens.push([code]);
|
|
67
|
+
}
|
|
68
|
+
return sgrTokens;
|
|
69
|
+
};
|
|
70
|
+
const removeActiveStyle = (activeStyles, family) => {
|
|
71
|
+
const activeStyleIndex = activeStyles.findIndex((activeStyle) => activeStyle.family === family);
|
|
72
|
+
if (activeStyleIndex !== -1) activeStyles.splice(activeStyleIndex, 1);
|
|
73
|
+
};
|
|
74
|
+
const upsertActiveStyle = (activeStyles, nextActiveStyle) => {
|
|
75
|
+
removeActiveStyle(activeStyles, nextActiveStyle.family);
|
|
76
|
+
activeStyles.push(nextActiveStyle);
|
|
77
|
+
};
|
|
78
|
+
const removeModifierStylesByClose = (activeStyles, closeCode) => {
|
|
79
|
+
for (let index = activeStyles.length - 1; index >= 0; index--) {
|
|
80
|
+
const activeStyle = activeStyles[index];
|
|
81
|
+
if (activeStyle.family.startsWith("modifier-") && activeStyle.close === closeCode) activeStyles.splice(index, 1);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const getColorStyle = (code, sgrToken) => {
|
|
85
|
+
if (code >= 30 && code <= 37 || code >= 90 && code <= 97 || code === ANSI_SGR_FOREGROUND_EXTENDED && sgrToken.length > 1) return {
|
|
86
|
+
family: "foreground",
|
|
87
|
+
open: sgrToken.join(";"),
|
|
88
|
+
close: ANSI_SGR_RESET_FOREGROUND
|
|
89
|
+
};
|
|
90
|
+
if (code >= 40 && code <= 47 || code >= 100 && code <= 107 || code === ANSI_SGR_BACKGROUND_EXTENDED && sgrToken.length > 1) return {
|
|
91
|
+
family: "background",
|
|
92
|
+
open: sgrToken.join(";"),
|
|
93
|
+
close: ANSI_SGR_RESET_BACKGROUND
|
|
94
|
+
};
|
|
95
|
+
if (code === ANSI_SGR_UNDERLINE_COLOR_EXTENDED && sgrToken.length > 1) return {
|
|
96
|
+
family: "underlineColor",
|
|
97
|
+
open: sgrToken.join(";"),
|
|
98
|
+
close: ANSI_SGR_RESET_UNDERLINE_COLOR
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const applySgrResetCode = (code, activeStyles) => {
|
|
102
|
+
if (code === ANSI_SGR_RESET) {
|
|
103
|
+
activeStyles.length = 0;
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
if (code === ANSI_SGR_RESET_FOREGROUND) {
|
|
107
|
+
removeActiveStyle(activeStyles, "foreground");
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (code === ANSI_SGR_RESET_BACKGROUND) {
|
|
111
|
+
removeActiveStyle(activeStyles, "background");
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
if (code === ANSI_SGR_RESET_UNDERLINE_COLOR) {
|
|
115
|
+
removeActiveStyle(activeStyles, "underlineColor");
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
if (ANSI_SGR_MODIFIER_CLOSE_CODES.has(code)) {
|
|
119
|
+
removeModifierStylesByClose(activeStyles, code);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
124
|
+
const applySgrToken = (sgrToken, activeStyles) => {
|
|
125
|
+
const [code] = sgrToken;
|
|
126
|
+
if (applySgrResetCode(code, activeStyles)) return;
|
|
127
|
+
const colorStyle = getColorStyle(code, sgrToken);
|
|
128
|
+
if (colorStyle) {
|
|
129
|
+
upsertActiveStyle(activeStyles, colorStyle);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const close = ansiStyles.codes.get(code);
|
|
133
|
+
if (close !== void 0 && close !== ANSI_SGR_RESET) upsertActiveStyle(activeStyles, {
|
|
134
|
+
family: `modifier-${code}`,
|
|
135
|
+
open: sgrToken.join(";"),
|
|
136
|
+
close
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const applySgrParameters = (sgrParameters, activeStyles) => {
|
|
140
|
+
for (const sgrToken of getSgrTokens(sgrParameters)) applySgrToken(sgrToken, activeStyles);
|
|
141
|
+
};
|
|
142
|
+
const applySgrResets = (sgrParameters, activeStyles) => {
|
|
143
|
+
for (const sgrToken of getSgrTokens(sgrParameters)) {
|
|
144
|
+
const [code] = sgrToken;
|
|
145
|
+
applySgrResetCode(code, activeStyles);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const applyLeadingSgrResets = (string, activeStyles) => {
|
|
149
|
+
let remainder = string;
|
|
150
|
+
while (remainder.length > 0) {
|
|
151
|
+
if (remainder.startsWith(ANSI_ESCAPE) && remainder[1] !== "\\") {
|
|
152
|
+
const match = ANSI_ESCAPE_REGEX.exec(remainder);
|
|
153
|
+
if (!match) break;
|
|
154
|
+
if (match.groups.sgr !== void 0) applySgrResets(match.groups.sgr, activeStyles);
|
|
155
|
+
remainder = remainder.slice(match[0].length);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (remainder.startsWith(ANSI_ESCAPE_CSI)) {
|
|
159
|
+
const match = ANSI_ESCAPE_CSI_REGEX.exec(remainder);
|
|
160
|
+
if (!match || match.groups.sgr === void 0) break;
|
|
161
|
+
applySgrResets(match.groups.sgr, activeStyles);
|
|
162
|
+
remainder = remainder.slice(match[0].length);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const getClosingSgrSequence = (activeStyles) => [...activeStyles].reverse().map((activeStyle) => wrapAnsiCode(activeStyle.close)).join("");
|
|
169
|
+
const getOpeningSgrSequence = (activeStyles) => activeStyles.map((activeStyle) => wrapAnsiCode(activeStyle.open)).join("");
|
|
170
|
+
const wordLengths = (string) => string.split(" ").map((word) => stringWidth(word));
|
|
171
|
+
const wrapWord = (rows, word, columns) => {
|
|
172
|
+
const characters = getGraphemes(word);
|
|
173
|
+
let isInsideEscape = false;
|
|
174
|
+
let isInsideLinkEscape = false;
|
|
175
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
176
|
+
for (const [index, character] of characters.entries()) {
|
|
177
|
+
const characterLength = stringWidth(character);
|
|
178
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
179
|
+
else {
|
|
180
|
+
rows.push(character);
|
|
181
|
+
visible = 0;
|
|
182
|
+
}
|
|
183
|
+
if (ESCAPES.has(character) && !(isInsideLinkEscape && character === ANSI_ESCAPE && characters[index + 1] === "\\")) {
|
|
184
|
+
isInsideEscape = true;
|
|
185
|
+
isInsideLinkEscape = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("") === ANSI_ESCAPE_LINK;
|
|
186
|
+
}
|
|
187
|
+
if (isInsideEscape) {
|
|
188
|
+
if (isInsideLinkEscape) {
|
|
189
|
+
if (character === ANSI_ESCAPE_BELL || character === "\\" && index > 0 && characters[index - 1] === ANSI_ESCAPE) {
|
|
190
|
+
isInsideEscape = false;
|
|
191
|
+
isInsideLinkEscape = false;
|
|
192
|
+
}
|
|
193
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
visible += characterLength;
|
|
197
|
+
if (visible === columns && index < characters.length - 1) {
|
|
198
|
+
rows.push("");
|
|
199
|
+
visible = 0;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
203
|
+
};
|
|
204
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
205
|
+
const words = string.split(" ");
|
|
206
|
+
let last = words.length;
|
|
207
|
+
while (last > 0) {
|
|
208
|
+
if (stringWidth(words[last - 1]) > 0) break;
|
|
209
|
+
last--;
|
|
210
|
+
}
|
|
211
|
+
if (last === words.length) return string;
|
|
212
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
213
|
+
};
|
|
214
|
+
const expandTabs = (line) => {
|
|
215
|
+
if (!line.includes(" ")) return line;
|
|
216
|
+
const segments = line.split(" ");
|
|
217
|
+
let visible = 0;
|
|
218
|
+
let expandedLine = "";
|
|
219
|
+
for (const [index, segment] of segments.entries()) {
|
|
220
|
+
expandedLine += segment;
|
|
221
|
+
visible += stringWidth(segment);
|
|
222
|
+
if (index < segments.length - 1) {
|
|
223
|
+
const spaces = TAB_SIZE - visible % TAB_SIZE;
|
|
224
|
+
expandedLine += " ".repeat(spaces);
|
|
225
|
+
visible += spaces;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return expandedLine;
|
|
229
|
+
};
|
|
230
|
+
const exec = (string, columns, options = {}) => {
|
|
231
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
232
|
+
let returnValue = "";
|
|
233
|
+
let escapeUrl;
|
|
234
|
+
const activeStyles = [];
|
|
235
|
+
const lengths = wordLengths(string);
|
|
236
|
+
let rows = [""];
|
|
237
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
238
|
+
if (options.trim !== false) rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
239
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
240
|
+
if (index !== 0) {
|
|
241
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
242
|
+
rows.push("");
|
|
243
|
+
rowLength = 0;
|
|
244
|
+
}
|
|
245
|
+
if (rowLength > 0 || options.trim === false) {
|
|
246
|
+
rows[rows.length - 1] += " ";
|
|
247
|
+
rowLength++;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (options.hard && options.wordWrap !== false && lengths[index] > columns) {
|
|
251
|
+
const remainingColumns = columns - rowLength;
|
|
252
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
253
|
+
if (Math.floor((lengths[index] - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
254
|
+
wrapWord(rows, word, columns);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
258
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
259
|
+
wrapWord(rows, word, columns);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
rows.push("");
|
|
263
|
+
}
|
|
264
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
265
|
+
wrapWord(rows, word, columns);
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
rows[rows.length - 1] += word;
|
|
269
|
+
}
|
|
270
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
271
|
+
const preString = rows.join("\n");
|
|
272
|
+
const pre = getGraphemes(preString);
|
|
273
|
+
let preStringIndex = 0;
|
|
274
|
+
for (const [index, character] of pre.entries()) {
|
|
275
|
+
returnValue += character;
|
|
276
|
+
if (character === ANSI_ESCAPE && pre[index + 1] !== "\\") {
|
|
277
|
+
const { groups } = ANSI_ESCAPE_REGEX.exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
278
|
+
if (groups.sgr !== void 0) applySgrParameters(groups.sgr, activeStyles);
|
|
279
|
+
else if (groups.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
280
|
+
} else if (character === ANSI_ESCAPE_CSI) {
|
|
281
|
+
const { groups } = ANSI_ESCAPE_CSI_REGEX.exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
282
|
+
if (groups.sgr !== void 0) applySgrParameters(groups.sgr, activeStyles);
|
|
283
|
+
}
|
|
284
|
+
if (pre[index + 1] === "\n") {
|
|
285
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
286
|
+
returnValue += getClosingSgrSequence(activeStyles);
|
|
287
|
+
} else if (character === "\n") {
|
|
288
|
+
const openingStyles = [...activeStyles];
|
|
289
|
+
applyLeadingSgrResets(preString.slice(preStringIndex + 1), openingStyles);
|
|
290
|
+
returnValue += getOpeningSgrSequence(openingStyles);
|
|
291
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
292
|
+
}
|
|
293
|
+
preStringIndex += character.length;
|
|
294
|
+
}
|
|
295
|
+
return returnValue;
|
|
296
|
+
};
|
|
297
|
+
function wrapAnsi(string, columns, options) {
|
|
298
|
+
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(expandTabs(line), columns, options)).join("\n");
|
|
299
|
+
}
|
|
14
300
|
|
|
15
301
|
//#endregion
|
|
16
|
-
export {
|
|
302
|
+
export { wrapAnsi as default };
|
|
17
303
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.js"],"sourcesContent":["import stringWidth from 'string-width';\nimport stripAnsi from 'strip-ansi';\nimport ansiStyles from 'ansi-styles';\n\nconst ANSI_ESCAPE = '\\u001B';\nconst ANSI_ESCAPE_CSI = '\\u009B';\nconst ESCAPES = new Set([\n\tANSI_ESCAPE,\n\tANSI_ESCAPE_CSI,\n]);\n\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_SGR_RESET = 0;\nconst ANSI_SGR_RESET_FOREGROUND = 39;\nconst ANSI_SGR_RESET_BACKGROUND = 49;\nconst ANSI_SGR_RESET_UNDERLINE_COLOR = 59;\nconst ANSI_SGR_FOREGROUND_EXTENDED = 38;\nconst ANSI_SGR_BACKGROUND_EXTENDED = 48;\nconst ANSI_SGR_UNDERLINE_COLOR_EXTENDED = 58;\nconst ANSI_SGR_COLOR_MODE_256 = 5;\nconst ANSI_SGR_COLOR_MODE_RGB = 2;\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst ANSI_ESCAPE_REGEX = new RegExp(`^\\\\u001B(?:\\\\${ANSI_CSI}(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}|${ANSI_ESCAPE_LINK}(?<uri>[^\\\\u0007\\\\u001B]*)(?:\\\\u0007|\\\\u001B\\\\\\\\))`);\nconst ANSI_ESCAPE_CSI_REGEX = new RegExp(`^\\\\u009B(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}`);\nconst ANSI_SGR_MODIFIER_CLOSE_CODES = new Set(ansiStyles.codes.values());\nANSI_SGR_MODIFIER_CLOSE_CODES.delete(ANSI_SGR_RESET);\n\nconst segmenter = new Intl.Segmenter();\nconst getGraphemes = string => Array.from(segmenter.segment(string), ({segment}) => segment);\nconst TAB_SIZE = 8;\n\nconst wrapAnsiCode = code => `${ANSI_ESCAPE}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = url => `${ANSI_ESCAPE}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\n\nconst getSgrTokens = sgrParameters => {\n\tconst codes = sgrParameters.split(';').map(sgrParameter => sgrParameter === '' ? ANSI_SGR_RESET : Number.parseInt(sgrParameter, 10));\n\tconst sgrTokens = [];\n\n\tfor (let index = 0; index < codes.length; index++) {\n\t\tconst code = codes[index];\n\n\t\tif (!Number.isFinite(code)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\t(\n\t\t\t\tcode === ANSI_SGR_FOREGROUND_EXTENDED\n\t\t\t\t|| code === ANSI_SGR_BACKGROUND_EXTENDED\n\t\t\t\t|| code === ANSI_SGR_UNDERLINE_COLOR_EXTENDED\n\t\t\t)\n\t\t) {\n\t\t\tif (index + 1 >= codes.length) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst mode = codes[index + 1];\n\n\t\t\tif (mode === ANSI_SGR_COLOR_MODE_256 && Number.isFinite(codes[index + 2])) {\n\t\t\t\tsgrTokens.push([code, mode, codes[index + 2]]);\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst red = codes[index + 2];\n\t\t\tconst green = codes[index + 3];\n\t\t\tconst blue = codes[index + 4];\n\t\t\tif (\n\t\t\t\tmode === ANSI_SGR_COLOR_MODE_RGB\n\t\t\t\t&& Number.isFinite(red)\n\t\t\t\t&& Number.isFinite(green)\n\t\t\t\t&& Number.isFinite(blue)\n\t\t\t) {\n\t\t\t\tsgrTokens.push([code, mode, red, green, blue]);\n\t\t\t\tindex += 4;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tsgrTokens.push([code]);\n\t}\n\n\treturn sgrTokens;\n};\n\nconst removeActiveStyle = (activeStyles, family) => {\n\tconst activeStyleIndex = activeStyles.findIndex(activeStyle => activeStyle.family === family);\n\n\tif (activeStyleIndex !== -1) {\n\t\tactiveStyles.splice(activeStyleIndex, 1);\n\t}\n};\n\nconst upsertActiveStyle = (activeStyles, nextActiveStyle) => {\n\tremoveActiveStyle(activeStyles, nextActiveStyle.family);\n\tactiveStyles.push(nextActiveStyle);\n};\n\nconst removeModifierStylesByClose = (activeStyles, closeCode) => {\n\tfor (let index = activeStyles.length - 1; index >= 0; index--) {\n\t\tconst activeStyle = activeStyles[index];\n\t\tif (activeStyle.family.startsWith('modifier-') && activeStyle.close === closeCode) {\n\t\t\tactiveStyles.splice(index, 1);\n\t\t}\n\t}\n};\n\nconst getColorStyle = (code, sgrToken) => {\n\tif ((code >= 30 && code <= 37) || (code >= 90 && code <= 97) || (code === ANSI_SGR_FOREGROUND_EXTENDED && sgrToken.length > 1)) {\n\t\treturn {\n\t\t\tfamily: 'foreground',\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose: ANSI_SGR_RESET_FOREGROUND,\n\t\t};\n\t}\n\n\tif ((code >= 40 && code <= 47) || (code >= 100 && code <= 107) || (code === ANSI_SGR_BACKGROUND_EXTENDED && sgrToken.length > 1)) {\n\t\treturn {\n\t\t\tfamily: 'background',\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose: ANSI_SGR_RESET_BACKGROUND,\n\t\t};\n\t}\n\n\tif (code === ANSI_SGR_UNDERLINE_COLOR_EXTENDED && sgrToken.length > 1) {\n\t\treturn {\n\t\t\tfamily: 'underlineColor',\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose: ANSI_SGR_RESET_UNDERLINE_COLOR,\n\t\t};\n\t}\n};\n\nconst applySgrResetCode = (code, activeStyles) => {\n\tif (code === ANSI_SGR_RESET) {\n\t\tactiveStyles.length = 0;\n\t\treturn true;\n\t}\n\n\tif (code === ANSI_SGR_RESET_FOREGROUND) {\n\t\tremoveActiveStyle(activeStyles, 'foreground');\n\t\treturn true;\n\t}\n\n\tif (code === ANSI_SGR_RESET_BACKGROUND) {\n\t\tremoveActiveStyle(activeStyles, 'background');\n\t\treturn true;\n\t}\n\n\tif (code === ANSI_SGR_RESET_UNDERLINE_COLOR) {\n\t\tremoveActiveStyle(activeStyles, 'underlineColor');\n\t\treturn true;\n\t}\n\n\tif (ANSI_SGR_MODIFIER_CLOSE_CODES.has(code)) {\n\t\tremoveModifierStylesByClose(activeStyles, code);\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nconst applySgrToken = (sgrToken, activeStyles) => {\n\tconst [code] = sgrToken;\n\n\tif (applySgrResetCode(code, activeStyles)) {\n\t\treturn;\n\t}\n\n\tconst colorStyle = getColorStyle(code, sgrToken);\n\tif (colorStyle) {\n\t\tupsertActiveStyle(activeStyles, colorStyle);\n\t\treturn;\n\t}\n\n\tconst close = ansiStyles.codes.get(code);\n\tif (close !== undefined && close !== ANSI_SGR_RESET) {\n\t\tupsertActiveStyle(activeStyles, {\n\t\t\tfamily: `modifier-${code}`,\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose,\n\t\t});\n\t}\n};\n\nconst applySgrParameters = (sgrParameters, activeStyles) => {\n\tfor (const sgrToken of getSgrTokens(sgrParameters)) {\n\t\tapplySgrToken(sgrToken, activeStyles);\n\t}\n};\n\nconst applySgrResets = (sgrParameters, activeStyles) => {\n\tfor (const sgrToken of getSgrTokens(sgrParameters)) {\n\t\tconst [code] = sgrToken;\n\t\tapplySgrResetCode(code, activeStyles);\n\t}\n};\n\nconst applyLeadingSgrResets = (string, activeStyles) => {\n\tlet remainder = string;\n\n\twhile (remainder.length > 0) {\n\t\tif (remainder.startsWith(ANSI_ESCAPE) && remainder[1] !== '\\\\') {\n\t\t\tconst match = ANSI_ESCAPE_REGEX.exec(remainder);\n\t\t\tif (!match) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (match.groups.sgr !== undefined) {\n\t\t\t\tapplySgrResets(match.groups.sgr, activeStyles);\n\t\t\t}\n\n\t\t\tremainder = remainder.slice(match[0].length);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (remainder.startsWith(ANSI_ESCAPE_CSI)) {\n\t\t\tconst match = ANSI_ESCAPE_CSI_REGEX.exec(remainder);\n\t\t\tif (!match || match.groups.sgr === undefined) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tapplySgrResets(match.groups.sgr, activeStyles);\n\t\t\tremainder = remainder.slice(match[0].length);\n\t\t\tcontinue;\n\t\t}\n\n\t\tbreak;\n\t}\n};\n\nconst getClosingSgrSequence = activeStyles => [...activeStyles].reverse().map(activeStyle => wrapAnsiCode(activeStyle.close)).join('');\nconst getOpeningSgrSequence = activeStyles => activeStyles.map(activeStyle => wrapAnsiCode(activeStyle.open)).join('');\n\n// Calculate the length of words split on ' ', ignoring\n// the extra characters added by ANSI escape codes\nconst wordLengths = string => string.split(' ').map(word => stringWidth(word));\n\n// Wrap a long word across multiple rows\n// ANSI escape codes do not count towards length\nconst wrapWord = (rows, word, columns) => {\n\tconst characters = getGraphemes(word);\n\n\tlet isInsideEscape = false;\n\tlet isInsideLinkEscape = false;\n\tlet visible = stringWidth(stripAnsi(rows.at(-1)));\n\n\tfor (const [index, character] of characters.entries()) {\n\t\tconst characterLength = stringWidth(character);\n\n\t\tif (visible + characterLength <= columns) {\n\t\t\trows[rows.length - 1] += character;\n\t\t} else {\n\t\t\trows.push(character);\n\t\t\tvisible = 0;\n\t\t}\n\n\t\tif (ESCAPES.has(character) && !(isInsideLinkEscape && character === ANSI_ESCAPE && characters[index + 1] === '\\\\')) {\n\t\t\tisInsideEscape = true;\n\n\t\t\tconst ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join('');\n\t\t\tisInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;\n\t\t}\n\n\t\tif (isInsideEscape) {\n\t\t\tif (isInsideLinkEscape) {\n\t\t\t\tif (\n\t\t\t\t\tcharacter === ANSI_ESCAPE_BELL\n\t\t\t\t\t|| (character === '\\\\' && index > 0 && characters[index - 1] === ANSI_ESCAPE) // ST terminator (ESC \\)\n\t\t\t\t) {\n\t\t\t\t\tisInsideEscape = false;\n\t\t\t\t\tisInsideLinkEscape = false;\n\t\t\t\t}\n\t\t\t} else if (character === ANSI_SGR_TERMINATOR) {\n\t\t\t\tisInsideEscape = false;\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tvisible += characterLength;\n\n\t\tif (visible === columns && index < characters.length - 1) {\n\t\t\trows.push('');\n\t\t\tvisible = 0;\n\t\t}\n\t}\n\n\t// It's possible that the last row we copy over is only\n\t// ANSI escape characters, handle this edge-case\n\tif (!visible && rows.at(-1).length > 0 && rows.length > 1) {\n\t\trows[rows.length - 2] += rows.pop();\n\t}\n};\n\n// Trims spaces from a string ignoring invisible sequences\nconst stringVisibleTrimSpacesRight = string => {\n\tconst words = string.split(' ');\n\tlet last = words.length;\n\n\twhile (last > 0) {\n\t\tif (stringWidth(words[last - 1]) > 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\tlast--;\n\t}\n\n\tif (last === words.length) {\n\t\treturn string;\n\t}\n\n\treturn words.slice(0, last).join(' ') + words.slice(last).join('');\n};\n\nconst expandTabs = line => {\n\tif (!line.includes('\\t')) {\n\t\treturn line;\n\t}\n\n\tconst segments = line.split('\\t');\n\tlet visible = 0;\n\tlet expandedLine = '';\n\n\tfor (const [index, segment] of segments.entries()) {\n\t\texpandedLine += segment;\n\t\tvisible += stringWidth(segment);\n\n\t\tif (index < segments.length - 1) {\n\t\t\tconst spaces = TAB_SIZE - (visible % TAB_SIZE);\n\t\t\texpandedLine += ' '.repeat(spaces);\n\t\t\tvisible += spaces;\n\t\t}\n\t}\n\n\treturn expandedLine;\n};\n\n// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode.\n//\n// 'hard' will never allow a string to take up more than columns characters.\n//\n// 'soft' allows long words to expand past the column length.\nconst exec = (string, columns, options = {}) => {\n\tif (options.trim !== false && string.trim() === '') {\n\t\treturn '';\n\t}\n\n\tlet returnValue = '';\n\tlet escapeUrl;\n\tconst activeStyles = [];\n\n\tconst lengths = wordLengths(string);\n\tlet rows = [''];\n\n\tfor (const [index, word] of string.split(' ').entries()) {\n\t\tif (options.trim !== false) {\n\t\t\trows[rows.length - 1] = rows.at(-1).trimStart();\n\t\t}\n\n\t\tlet rowLength = stringWidth(rows.at(-1));\n\n\t\tif (index !== 0) {\n\t\t\tif (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {\n\t\t\t\t// If we start with a new word but the current row length equals the length of the columns, add a new row\n\t\t\t\trows.push('');\n\t\t\t\trowLength = 0;\n\t\t\t}\n\n\t\t\tif (rowLength > 0 || options.trim === false) {\n\t\t\t\trows[rows.length - 1] += ' ';\n\t\t\t\trowLength++;\n\t\t\t}\n\t\t}\n\n\t\t// In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'\n\t\tif (options.hard && options.wordWrap !== false && lengths[index] > columns) {\n\t\t\tconst remainingColumns = columns - rowLength;\n\t\t\tconst breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n\t\t\tconst breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n\t\t\tif (breaksStartingNextLine < breaksStartingThisLine) {\n\t\t\t\trows.push('');\n\t\t\t}\n\n\t\t\twrapWord(rows, word, columns);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {\n\t\t\tif (options.wordWrap === false && rowLength < columns) {\n\t\t\t\twrapWord(rows, word, columns);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\trows.push('');\n\t\t}\n\n\t\tif (rowLength + lengths[index] > columns && options.wordWrap === false) {\n\t\t\twrapWord(rows, word, columns);\n\t\t\tcontinue;\n\t\t}\n\n\t\trows[rows.length - 1] += word;\n\t}\n\n\tif (options.trim !== false) {\n\t\trows = rows.map(row => stringVisibleTrimSpacesRight(row));\n\t}\n\n\tconst preString = rows.join('\\n');\n\tconst pre = getGraphemes(preString);\n\n\t// We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of grapheme clusters.\n\tlet preStringIndex = 0;\n\n\tfor (const [index, character] of pre.entries()) {\n\t\treturnValue += character;\n\n\t\tif (character === ANSI_ESCAPE && pre[index + 1] !== '\\\\') {\n\t\t\tconst {groups} = ANSI_ESCAPE_REGEX.exec(preString.slice(preStringIndex)) || {groups: {}};\n\t\t\tif (groups.sgr !== undefined) {\n\t\t\t\tapplySgrParameters(groups.sgr, activeStyles);\n\t\t\t} else if (groups.uri !== undefined) {\n\t\t\t\tescapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n\t\t\t}\n\t\t} else if (character === ANSI_ESCAPE_CSI) {\n\t\t\tconst {groups} = ANSI_ESCAPE_CSI_REGEX.exec(preString.slice(preStringIndex)) || {groups: {}};\n\t\t\tif (groups.sgr !== undefined) {\n\t\t\t\tapplySgrParameters(groups.sgr, activeStyles);\n\t\t\t}\n\t\t}\n\n\t\tif (pre[index + 1] === '\\n') {\n\t\t\tif (escapeUrl) {\n\t\t\t\treturnValue += wrapAnsiHyperlink('');\n\t\t\t}\n\n\t\t\treturnValue += getClosingSgrSequence(activeStyles);\n\t\t} else if (character === '\\n') {\n\t\t\tconst openingStyles = [...activeStyles];\n\t\t\tapplyLeadingSgrResets(preString.slice(preStringIndex + 1), openingStyles);\n\t\t\treturnValue += getOpeningSgrSequence(openingStyles);\n\n\t\t\tif (escapeUrl) {\n\t\t\t\treturnValue += wrapAnsiHyperlink(escapeUrl);\n\t\t\t}\n\t\t}\n\n\t\tpreStringIndex += character.length;\n\t}\n\n\treturn returnValue;\n};\n\n// For each newline, invoke the method separately\nexport default function wrapAnsi(string, columns, options) {\n\treturn String(string)\n\t\t.normalize()\n\t\t.replaceAll('\\r\\n', '\\n')\n\t\t.split('\\n')\n\t\t.map(line => exec(expandTabs(line), columns, options))\n\t\t.join('\\n');\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AAYA,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AASvB,MAAM,mBAAmB,GAAG,SAAS;AACrC,MAAM,oBAAoB,IAAI,OAAO,gBAAgB,SAAS,iBAAiB,oBAAoB,GAAG,iBAAiB,oDAAoD;AAC3K,MAAM,wBAAwB,IAAI,OAAO,0BAA0B,sBAAsB;AACzF,MAAM,gCAAgC,IAAI,IAAI,WAAW,MAAM,QAAQ,CAAC;AACxE,8BAA8B,OAAO,eAAe;AAEpD,MAAM,YAAY,IAAI,KAAK,WAAW"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.js"],"sourcesContent":["import stringWidth from 'string-width';\nimport stripAnsi from 'strip-ansi';\nimport ansiStyles from 'ansi-styles';\n\nconst ANSI_ESCAPE = '\\u001B';\nconst ANSI_ESCAPE_CSI = '\\u009B';\nconst ESCAPES = new Set([\n\tANSI_ESCAPE,\n\tANSI_ESCAPE_CSI,\n]);\n\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_SGR_RESET = 0;\nconst ANSI_SGR_RESET_FOREGROUND = 39;\nconst ANSI_SGR_RESET_BACKGROUND = 49;\nconst ANSI_SGR_RESET_UNDERLINE_COLOR = 59;\nconst ANSI_SGR_FOREGROUND_EXTENDED = 38;\nconst ANSI_SGR_BACKGROUND_EXTENDED = 48;\nconst ANSI_SGR_UNDERLINE_COLOR_EXTENDED = 58;\nconst ANSI_SGR_COLOR_MODE_256 = 5;\nconst ANSI_SGR_COLOR_MODE_RGB = 2;\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst ANSI_ESCAPE_REGEX = new RegExp(`^\\\\u001B(?:\\\\${ANSI_CSI}(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}|${ANSI_ESCAPE_LINK}(?<uri>[^\\\\u0007\\\\u001B]*)(?:\\\\u0007|\\\\u001B\\\\\\\\))`);\nconst ANSI_ESCAPE_CSI_REGEX = new RegExp(`^\\\\u009B(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}`);\nconst ANSI_SGR_MODIFIER_CLOSE_CODES = new Set(ansiStyles.codes.values());\nANSI_SGR_MODIFIER_CLOSE_CODES.delete(ANSI_SGR_RESET);\n\nconst segmenter = new Intl.Segmenter();\nconst getGraphemes = string => Array.from(segmenter.segment(string), ({segment}) => segment);\nconst TAB_SIZE = 8;\n\nconst wrapAnsiCode = code => `${ANSI_ESCAPE}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = url => `${ANSI_ESCAPE}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\n\nconst getSgrTokens = sgrParameters => {\n\tconst codes = sgrParameters.split(';').map(sgrParameter => sgrParameter === '' ? ANSI_SGR_RESET : Number.parseInt(sgrParameter, 10));\n\tconst sgrTokens = [];\n\n\tfor (let index = 0; index < codes.length; index++) {\n\t\tconst code = codes[index];\n\n\t\tif (!Number.isFinite(code)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\t(\n\t\t\t\tcode === ANSI_SGR_FOREGROUND_EXTENDED\n\t\t\t\t|| code === ANSI_SGR_BACKGROUND_EXTENDED\n\t\t\t\t|| code === ANSI_SGR_UNDERLINE_COLOR_EXTENDED\n\t\t\t)\n\t\t) {\n\t\t\tif (index + 1 >= codes.length) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst mode = codes[index + 1];\n\n\t\t\tif (mode === ANSI_SGR_COLOR_MODE_256 && Number.isFinite(codes[index + 2])) {\n\t\t\t\tsgrTokens.push([code, mode, codes[index + 2]]);\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst red = codes[index + 2];\n\t\t\tconst green = codes[index + 3];\n\t\t\tconst blue = codes[index + 4];\n\t\t\tif (\n\t\t\t\tmode === ANSI_SGR_COLOR_MODE_RGB\n\t\t\t\t&& Number.isFinite(red)\n\t\t\t\t&& Number.isFinite(green)\n\t\t\t\t&& Number.isFinite(blue)\n\t\t\t) {\n\t\t\t\tsgrTokens.push([code, mode, red, green, blue]);\n\t\t\t\tindex += 4;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tsgrTokens.push([code]);\n\t}\n\n\treturn sgrTokens;\n};\n\nconst removeActiveStyle = (activeStyles, family) => {\n\tconst activeStyleIndex = activeStyles.findIndex(activeStyle => activeStyle.family === family);\n\n\tif (activeStyleIndex !== -1) {\n\t\tactiveStyles.splice(activeStyleIndex, 1);\n\t}\n};\n\nconst upsertActiveStyle = (activeStyles, nextActiveStyle) => {\n\tremoveActiveStyle(activeStyles, nextActiveStyle.family);\n\tactiveStyles.push(nextActiveStyle);\n};\n\nconst removeModifierStylesByClose = (activeStyles, closeCode) => {\n\tfor (let index = activeStyles.length - 1; index >= 0; index--) {\n\t\tconst activeStyle = activeStyles[index];\n\t\tif (activeStyle.family.startsWith('modifier-') && activeStyle.close === closeCode) {\n\t\t\tactiveStyles.splice(index, 1);\n\t\t}\n\t}\n};\n\nconst getColorStyle = (code, sgrToken) => {\n\tif ((code >= 30 && code <= 37) || (code >= 90 && code <= 97) || (code === ANSI_SGR_FOREGROUND_EXTENDED && sgrToken.length > 1)) {\n\t\treturn {\n\t\t\tfamily: 'foreground',\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose: ANSI_SGR_RESET_FOREGROUND,\n\t\t};\n\t}\n\n\tif ((code >= 40 && code <= 47) || (code >= 100 && code <= 107) || (code === ANSI_SGR_BACKGROUND_EXTENDED && sgrToken.length > 1)) {\n\t\treturn {\n\t\t\tfamily: 'background',\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose: ANSI_SGR_RESET_BACKGROUND,\n\t\t};\n\t}\n\n\tif (code === ANSI_SGR_UNDERLINE_COLOR_EXTENDED && sgrToken.length > 1) {\n\t\treturn {\n\t\t\tfamily: 'underlineColor',\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose: ANSI_SGR_RESET_UNDERLINE_COLOR,\n\t\t};\n\t}\n};\n\nconst applySgrResetCode = (code, activeStyles) => {\n\tif (code === ANSI_SGR_RESET) {\n\t\tactiveStyles.length = 0;\n\t\treturn true;\n\t}\n\n\tif (code === ANSI_SGR_RESET_FOREGROUND) {\n\t\tremoveActiveStyle(activeStyles, 'foreground');\n\t\treturn true;\n\t}\n\n\tif (code === ANSI_SGR_RESET_BACKGROUND) {\n\t\tremoveActiveStyle(activeStyles, 'background');\n\t\treturn true;\n\t}\n\n\tif (code === ANSI_SGR_RESET_UNDERLINE_COLOR) {\n\t\tremoveActiveStyle(activeStyles, 'underlineColor');\n\t\treturn true;\n\t}\n\n\tif (ANSI_SGR_MODIFIER_CLOSE_CODES.has(code)) {\n\t\tremoveModifierStylesByClose(activeStyles, code);\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nconst applySgrToken = (sgrToken, activeStyles) => {\n\tconst [code] = sgrToken;\n\n\tif (applySgrResetCode(code, activeStyles)) {\n\t\treturn;\n\t}\n\n\tconst colorStyle = getColorStyle(code, sgrToken);\n\tif (colorStyle) {\n\t\tupsertActiveStyle(activeStyles, colorStyle);\n\t\treturn;\n\t}\n\n\tconst close = ansiStyles.codes.get(code);\n\tif (close !== undefined && close !== ANSI_SGR_RESET) {\n\t\tupsertActiveStyle(activeStyles, {\n\t\t\tfamily: `modifier-${code}`,\n\t\t\topen: sgrToken.join(';'),\n\t\t\tclose,\n\t\t});\n\t}\n};\n\nconst applySgrParameters = (sgrParameters, activeStyles) => {\n\tfor (const sgrToken of getSgrTokens(sgrParameters)) {\n\t\tapplySgrToken(sgrToken, activeStyles);\n\t}\n};\n\nconst applySgrResets = (sgrParameters, activeStyles) => {\n\tfor (const sgrToken of getSgrTokens(sgrParameters)) {\n\t\tconst [code] = sgrToken;\n\t\tapplySgrResetCode(code, activeStyles);\n\t}\n};\n\nconst applyLeadingSgrResets = (string, activeStyles) => {\n\tlet remainder = string;\n\n\twhile (remainder.length > 0) {\n\t\tif (remainder.startsWith(ANSI_ESCAPE) && remainder[1] !== '\\\\') {\n\t\t\tconst match = ANSI_ESCAPE_REGEX.exec(remainder);\n\t\t\tif (!match) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (match.groups.sgr !== undefined) {\n\t\t\t\tapplySgrResets(match.groups.sgr, activeStyles);\n\t\t\t}\n\n\t\t\tremainder = remainder.slice(match[0].length);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (remainder.startsWith(ANSI_ESCAPE_CSI)) {\n\t\t\tconst match = ANSI_ESCAPE_CSI_REGEX.exec(remainder);\n\t\t\tif (!match || match.groups.sgr === undefined) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tapplySgrResets(match.groups.sgr, activeStyles);\n\t\t\tremainder = remainder.slice(match[0].length);\n\t\t\tcontinue;\n\t\t}\n\n\t\tbreak;\n\t}\n};\n\nconst getClosingSgrSequence = activeStyles => [...activeStyles].reverse().map(activeStyle => wrapAnsiCode(activeStyle.close)).join('');\nconst getOpeningSgrSequence = activeStyles => activeStyles.map(activeStyle => wrapAnsiCode(activeStyle.open)).join('');\n\n// Calculate the length of words split on ' ', ignoring\n// the extra characters added by ANSI escape codes\nconst wordLengths = string => string.split(' ').map(word => stringWidth(word));\n\n// Wrap a long word across multiple rows\n// ANSI escape codes do not count towards length\nconst wrapWord = (rows, word, columns) => {\n\tconst characters = getGraphemes(word);\n\n\tlet isInsideEscape = false;\n\tlet isInsideLinkEscape = false;\n\tlet visible = stringWidth(stripAnsi(rows.at(-1)));\n\n\tfor (const [index, character] of characters.entries()) {\n\t\tconst characterLength = stringWidth(character);\n\n\t\tif (visible + characterLength <= columns) {\n\t\t\trows[rows.length - 1] += character;\n\t\t} else {\n\t\t\trows.push(character);\n\t\t\tvisible = 0;\n\t\t}\n\n\t\tif (ESCAPES.has(character) && !(isInsideLinkEscape && character === ANSI_ESCAPE && characters[index + 1] === '\\\\')) {\n\t\t\tisInsideEscape = true;\n\n\t\t\tconst ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join('');\n\t\t\tisInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;\n\t\t}\n\n\t\tif (isInsideEscape) {\n\t\t\tif (isInsideLinkEscape) {\n\t\t\t\tif (\n\t\t\t\t\tcharacter === ANSI_ESCAPE_BELL\n\t\t\t\t\t|| (character === '\\\\' && index > 0 && characters[index - 1] === ANSI_ESCAPE) // ST terminator (ESC \\)\n\t\t\t\t) {\n\t\t\t\t\tisInsideEscape = false;\n\t\t\t\t\tisInsideLinkEscape = false;\n\t\t\t\t}\n\t\t\t} else if (character === ANSI_SGR_TERMINATOR) {\n\t\t\t\tisInsideEscape = false;\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tvisible += characterLength;\n\n\t\tif (visible === columns && index < characters.length - 1) {\n\t\t\trows.push('');\n\t\t\tvisible = 0;\n\t\t}\n\t}\n\n\t// It's possible that the last row we copy over is only\n\t// ANSI escape characters, handle this edge-case\n\tif (!visible && rows.at(-1).length > 0 && rows.length > 1) {\n\t\trows[rows.length - 2] += rows.pop();\n\t}\n};\n\n// Trims spaces from a string ignoring invisible sequences\nconst stringVisibleTrimSpacesRight = string => {\n\tconst words = string.split(' ');\n\tlet last = words.length;\n\n\twhile (last > 0) {\n\t\tif (stringWidth(words[last - 1]) > 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\tlast--;\n\t}\n\n\tif (last === words.length) {\n\t\treturn string;\n\t}\n\n\treturn words.slice(0, last).join(' ') + words.slice(last).join('');\n};\n\nconst expandTabs = line => {\n\tif (!line.includes('\\t')) {\n\t\treturn line;\n\t}\n\n\tconst segments = line.split('\\t');\n\tlet visible = 0;\n\tlet expandedLine = '';\n\n\tfor (const [index, segment] of segments.entries()) {\n\t\texpandedLine += segment;\n\t\tvisible += stringWidth(segment);\n\n\t\tif (index < segments.length - 1) {\n\t\t\tconst spaces = TAB_SIZE - (visible % TAB_SIZE);\n\t\t\texpandedLine += ' '.repeat(spaces);\n\t\t\tvisible += spaces;\n\t\t}\n\t}\n\n\treturn expandedLine;\n};\n\n// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode.\n//\n// 'hard' will never allow a string to take up more than columns characters.\n//\n// 'soft' allows long words to expand past the column length.\nconst exec = (string, columns, options = {}) => {\n\tif (options.trim !== false && string.trim() === '') {\n\t\treturn '';\n\t}\n\n\tlet returnValue = '';\n\tlet escapeUrl;\n\tconst activeStyles = [];\n\n\tconst lengths = wordLengths(string);\n\tlet rows = [''];\n\n\tfor (const [index, word] of string.split(' ').entries()) {\n\t\tif (options.trim !== false) {\n\t\t\trows[rows.length - 1] = rows.at(-1).trimStart();\n\t\t}\n\n\t\tlet rowLength = stringWidth(rows.at(-1));\n\n\t\tif (index !== 0) {\n\t\t\tif (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {\n\t\t\t\t// If we start with a new word but the current row length equals the length of the columns, add a new row\n\t\t\t\trows.push('');\n\t\t\t\trowLength = 0;\n\t\t\t}\n\n\t\t\tif (rowLength > 0 || options.trim === false) {\n\t\t\t\trows[rows.length - 1] += ' ';\n\t\t\t\trowLength++;\n\t\t\t}\n\t\t}\n\n\t\t// In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'\n\t\tif (options.hard && options.wordWrap !== false && lengths[index] > columns) {\n\t\t\tconst remainingColumns = columns - rowLength;\n\t\t\tconst breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n\t\t\tconst breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n\t\t\tif (breaksStartingNextLine < breaksStartingThisLine) {\n\t\t\t\trows.push('');\n\t\t\t}\n\n\t\t\twrapWord(rows, word, columns);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {\n\t\t\tif (options.wordWrap === false && rowLength < columns) {\n\t\t\t\twrapWord(rows, word, columns);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\trows.push('');\n\t\t}\n\n\t\tif (rowLength + lengths[index] > columns && options.wordWrap === false) {\n\t\t\twrapWord(rows, word, columns);\n\t\t\tcontinue;\n\t\t}\n\n\t\trows[rows.length - 1] += word;\n\t}\n\n\tif (options.trim !== false) {\n\t\trows = rows.map(row => stringVisibleTrimSpacesRight(row));\n\t}\n\n\tconst preString = rows.join('\\n');\n\tconst pre = getGraphemes(preString);\n\n\t// We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of grapheme clusters.\n\tlet preStringIndex = 0;\n\n\tfor (const [index, character] of pre.entries()) {\n\t\treturnValue += character;\n\n\t\tif (character === ANSI_ESCAPE && pre[index + 1] !== '\\\\') {\n\t\t\tconst {groups} = ANSI_ESCAPE_REGEX.exec(preString.slice(preStringIndex)) || {groups: {}};\n\t\t\tif (groups.sgr !== undefined) {\n\t\t\t\tapplySgrParameters(groups.sgr, activeStyles);\n\t\t\t} else if (groups.uri !== undefined) {\n\t\t\t\tescapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n\t\t\t}\n\t\t} else if (character === ANSI_ESCAPE_CSI) {\n\t\t\tconst {groups} = ANSI_ESCAPE_CSI_REGEX.exec(preString.slice(preStringIndex)) || {groups: {}};\n\t\t\tif (groups.sgr !== undefined) {\n\t\t\t\tapplySgrParameters(groups.sgr, activeStyles);\n\t\t\t}\n\t\t}\n\n\t\tif (pre[index + 1] === '\\n') {\n\t\t\tif (escapeUrl) {\n\t\t\t\treturnValue += wrapAnsiHyperlink('');\n\t\t\t}\n\n\t\t\treturnValue += getClosingSgrSequence(activeStyles);\n\t\t} else if (character === '\\n') {\n\t\t\tconst openingStyles = [...activeStyles];\n\t\t\tapplyLeadingSgrResets(preString.slice(preStringIndex + 1), openingStyles);\n\t\t\treturnValue += getOpeningSgrSequence(openingStyles);\n\n\t\t\tif (escapeUrl) {\n\t\t\t\treturnValue += wrapAnsiHyperlink(escapeUrl);\n\t\t\t}\n\t\t}\n\n\t\tpreStringIndex += character.length;\n\t}\n\n\treturn returnValue;\n};\n\n// For each newline, invoke the method separately\nexport default function wrapAnsi(string, columns, options) {\n\treturn String(string)\n\t\t.normalize()\n\t\t.replaceAll('\\r\\n', '\\n')\n\t\t.split('\\n')\n\t\t.map(line => exec(expandTabs(line), columns, options))\n\t\t.join('\\n');\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAIA,MAAM,cAAc;AACpB,MAAM,kBAAkB;AACxB,MAAM,UAAU,IAAI,IAAI,CACvB,aACA,gBACA,CAAC;AAEF,MAAM,mBAAmB;AACzB,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AACvB,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,iCAAiC;AACvC,MAAM,+BAA+B;AACrC,MAAM,+BAA+B;AACrC,MAAM,oCAAoC;AAC1C,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,mBAAmB,GAAG,SAAS;AACrC,MAAM,oBAAoB,IAAI,OAAO,gBAAgB,SAAS,iBAAiB,oBAAoB,GAAG,iBAAiB,oDAAoD;AAC3K,MAAM,wBAAwB,IAAI,OAAO,0BAA0B,sBAAsB;AACzF,MAAM,gCAAgC,IAAI,IAAI,WAAW,MAAM,QAAQ,CAAC;AACxE,8BAA8B,OAAO,eAA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AAO,KAAK,aAAa;;AAI9C,MAAI,IAAI,QAAQ,OAAO,MAAM;AAC5B,OAAI,UACH,gBAAe,kBAAkB,GAAG;AAGrC,kBAAe,sBAAsB,aAAa;aACxC,cAAc,MAAM;GAC9B,MAAM,gBAAgB,CAAC,GAAG,aAAa;AACvC,yBAAsB,UAAU,MAAM,iBAAiB,EAAE,EAAE,cAAc;AACzE,kBAAe,sBAAsB,cAAc;AAEnD,OAAI,UACH,gBAAe,kBAAkB,UAAU;;AAI7C,oBAAkB,UAAU;;AAG7B,QAAO;;AAIR,SAAwB,SAAS,QAAQ,SAAS,SAAS;AAC1D,QAAO,OAAO,OAAO,CACnB,WAAW,CACX,WAAW,QAAQ,KAAK,CACxB,MAAM,KAAK,CACX,KAAI,SAAQ,KAAK,WAAW,KAAK,EAAE,SAAS,QAAQ,CAAC,CACrD,KAAK,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_runtime = require('../../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_markdown_BGGlzivq = require('../../../unified/dist/markdown-BGGlzivq.cjs');
|
|
3
3
|
require('../../../unified/dist/markdown/index.cjs');
|
|
4
4
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
@@ -21,7 +21,7 @@ function ChangelogCommand() {
|
|
|
21
21
|
const result = (0, _alloy_js_core.createResource)(async () => {
|
|
22
22
|
const content = await context.fs.read(context.config.changelog.file);
|
|
23
23
|
if (!content) return null;
|
|
24
|
-
return
|
|
24
|
+
return require_markdown_BGGlzivq.g(content);
|
|
25
25
|
});
|
|
26
26
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
27
27
|
get path() {
|
|
@@ -111,11 +111,11 @@ function ChangelogCommand() {
|
|
|
111
111
|
get children() {
|
|
112
112
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
113
113
|
get when() {
|
|
114
|
-
return !!result.data
|
|
114
|
+
return !!result.data;
|
|
115
115
|
},
|
|
116
116
|
fallback: _alloy_js_core.code` return warn("There is no changelog available for display."); `,
|
|
117
117
|
get children() {
|
|
118
|
-
return result.data
|
|
118
|
+
return result.data;
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g } from "../../../unified/dist/markdown-BGGlzivq.mjs";
|
|
2
2
|
import "../../../unified/dist/markdown/index.mjs";
|
|
3
3
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { Show, code, createResource } from "@alloy-js/core";
|
|
@@ -20,7 +20,7 @@ function ChangelogCommand() {
|
|
|
20
20
|
const result = createResource(async () => {
|
|
21
21
|
const content = await context.fs.read(context.config.changelog.file);
|
|
22
22
|
if (!content) return null;
|
|
23
|
-
return
|
|
23
|
+
return g(content);
|
|
24
24
|
});
|
|
25
25
|
return createComponent(TypescriptFile, {
|
|
26
26
|
get path() {
|
|
@@ -110,11 +110,11 @@ function ChangelogCommand() {
|
|
|
110
110
|
get children() {
|
|
111
111
|
return createComponent(Show, {
|
|
112
112
|
get when() {
|
|
113
|
-
return !!result.data
|
|
113
|
+
return !!result.data;
|
|
114
114
|
},
|
|
115
115
|
fallback: code` return warn("There is no changelog available for display."); `,
|
|
116
116
|
get children() {
|
|
117
|
-
return result.data
|
|
117
|
+
return result.data;
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog-command.mjs","names":["renderMarkdown"],"sources":["../../../../../../plugin-changelog/dist/components/changelog-command.mjs"],"sourcesContent":["import { createComponent } from \"@alloy-js/core/jsx-runtime\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { Show, code, createResource } from \"@alloy-js/core\";\nimport { FunctionDeclaration, InterfaceDeclaration } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { InterfaceMember, TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { TSDoc, TSDocDefaultValue, TSDocParam } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { renderMarkdown } from \"@shell-shock/unified/markdown\";\nimport { joinPaths } from \"@stryke/path\";\n\n//#region src/components/changelog-command.tsx\n/**\n* The Changelog command's handler wrapper for the Shell Shock project.\n*/\nfunction ChangelogCommand() {\n\tconst context = usePowerlines();\n\tconst result = createResource(async () => {\n\t\tconst content = await context.fs.read(context.config.changelog.file);\n\t\tif (!content) return null;\n\t\treturn renderMarkdown(content);\n\t});\n\treturn createComponent(TypescriptFile, {\n\t\tget path() {\n\t\t\treturn joinPaths(context.entryPath, \"changelog\", \"command.ts\");\n\t\t},\n\t\timports: {\n\t\t\t\"node:os\": \"os\",\n\t\t\t\"node:fs/promises\": [\"readFile\", \"writeFile\"]\n\t\t},\n\t\tbuiltinImports: { console: [\n\t\t\t\"textColors\",\n\t\t\t\"bold\",\n\t\t\t\"writeLine\",\n\t\t\t\"error\",\n\t\t\t\"warn\"\n\t\t] },\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(TSDoc, { heading: \"Options for the Changelog command.\" }),\n\t\t\t\tcreateComponent(InterfaceDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\tname: \"ChangelogOptions\",\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tcreateComponent(TSDoc, { heading: \"An optional starting version for the changelog. The command will attempt to display changes starting from the specified version. The version should be a valid semantic version string. If not specified, the changelog will start from the earliest version available.\" }),\n\t\t\t\t\t\t\tcreateComponent(InterfaceMember, {\n\t\t\t\t\t\t\t\tname: \"start\",\n\t\t\t\t\t\t\t\toptional: true,\n\t\t\t\t\t\t\t\ttype: \"string\"\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\t\t\t\tcreateComponent(TSDoc, {\n\t\t\t\t\t\t\t\theading: \"An optional ending version for the changelog. The command will attempt to display changes up to the specified version. The version should be a valid semantic version string. If not specified, the changelog will display changes up to the latest version available.\",\n\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\treturn createComponent(TSDocDefaultValue, {\n\t\t\t\t\t\t\t\t\t\tget type() {\n\t\t\t\t\t\t\t\t\t\t\treturn ReflectionKind.string;\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tdefaultValue: \"latest\"\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(InterfaceMember, {\n\t\t\t\t\t\t\t\tname: \"end\",\n\t\t\t\t\t\t\t\toptional: true,\n\t\t\t\t\t\t\t\ttype: \"string\"\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(TSDoc, {\n\t\t\t\t\tget heading() {\n\t\t\t\t\t\treturn `Display the ${getAppTitle(context)} changelog.`;\n\t\t\t\t\t},\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn createComponent(TSDocParam, {\n\t\t\t\t\t\t\tname: \"options\",\n\t\t\t\t\t\t\tchildren: code`An object containing options for displaying the changelog.`\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(FunctionDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\t\"default\": true,\n\t\t\t\t\tasync: true,\n\t\t\t\t\tname: \"handler\",\n\t\t\t\t\tparameters: [{\n\t\t\t\t\t\tname: \"options\",\n\t\t\t\t\t\ttype: \"ChangelogOptions\"\n\t\t\t\t\t}],\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\treturn !result.loading && !result.error;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget fallback() {\n\t\t\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\t\t\treturn !!result.error;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\t\treturn code` return error(\\`Failed to load changelog: ${result.error.message.replaceAll(/`/g, \"\\\\`\")}\\`); `;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\t\t\treturn !!result.data
|
|
1
|
+
{"version":3,"file":"changelog-command.mjs","names":["renderMarkdown"],"sources":["../../../../../../plugin-changelog/dist/components/changelog-command.mjs"],"sourcesContent":["import { createComponent } from \"@alloy-js/core/jsx-runtime\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { Show, code, createResource } from \"@alloy-js/core\";\nimport { FunctionDeclaration, InterfaceDeclaration } from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { InterfaceMember, TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { TSDoc, TSDocDefaultValue, TSDocParam } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { renderMarkdown } from \"@shell-shock/unified/markdown\";\nimport { joinPaths } from \"@stryke/path\";\n\n//#region src/components/changelog-command.tsx\n/**\n* The Changelog command's handler wrapper for the Shell Shock project.\n*/\nfunction ChangelogCommand() {\n\tconst context = usePowerlines();\n\tconst result = createResource(async () => {\n\t\tconst content = await context.fs.read(context.config.changelog.file);\n\t\tif (!content) return null;\n\t\treturn renderMarkdown(content);\n\t});\n\treturn createComponent(TypescriptFile, {\n\t\tget path() {\n\t\t\treturn joinPaths(context.entryPath, \"changelog\", \"command.ts\");\n\t\t},\n\t\timports: {\n\t\t\t\"node:os\": \"os\",\n\t\t\t\"node:fs/promises\": [\"readFile\", \"writeFile\"]\n\t\t},\n\t\tbuiltinImports: { console: [\n\t\t\t\"textColors\",\n\t\t\t\"bold\",\n\t\t\t\"writeLine\",\n\t\t\t\"error\",\n\t\t\t\"warn\"\n\t\t] },\n\t\tget children() {\n\t\t\treturn [\n\t\t\t\tcreateComponent(TSDoc, { heading: \"Options for the Changelog command.\" }),\n\t\t\t\tcreateComponent(InterfaceDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\tname: \"ChangelogOptions\",\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tcreateComponent(TSDoc, { heading: \"An optional starting version for the changelog. The command will attempt to display changes starting from the specified version. The version should be a valid semantic version string. If not specified, the changelog will start from the earliest version available.\" }),\n\t\t\t\t\t\t\tcreateComponent(InterfaceMember, {\n\t\t\t\t\t\t\t\tname: \"start\",\n\t\t\t\t\t\t\t\toptional: true,\n\t\t\t\t\t\t\t\ttype: \"string\"\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\t\t\t\tcreateComponent(TSDoc, {\n\t\t\t\t\t\t\t\theading: \"An optional ending version for the changelog. The command will attempt to display changes up to the specified version. The version should be a valid semantic version string. If not specified, the changelog will display changes up to the latest version available.\",\n\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\treturn createComponent(TSDocDefaultValue, {\n\t\t\t\t\t\t\t\t\t\tget type() {\n\t\t\t\t\t\t\t\t\t\t\treturn ReflectionKind.string;\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tdefaultValue: \"latest\"\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcreateComponent(InterfaceMember, {\n\t\t\t\t\t\t\t\tname: \"end\",\n\t\t\t\t\t\t\t\toptional: true,\n\t\t\t\t\t\t\t\ttype: \"string\"\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(Spacing, {}),\n\t\t\t\tcreateComponent(TSDoc, {\n\t\t\t\t\tget heading() {\n\t\t\t\t\t\treturn `Display the ${getAppTitle(context)} changelog.`;\n\t\t\t\t\t},\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn createComponent(TSDocParam, {\n\t\t\t\t\t\t\tname: \"options\",\n\t\t\t\t\t\t\tchildren: code`An object containing options for displaying the changelog.`\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcreateComponent(FunctionDeclaration, {\n\t\t\t\t\t\"export\": true,\n\t\t\t\t\t\"default\": true,\n\t\t\t\t\tasync: true,\n\t\t\t\t\tname: \"handler\",\n\t\t\t\t\tparameters: [{\n\t\t\t\t\t\tname: \"options\",\n\t\t\t\t\t\ttype: \"ChangelogOptions\"\n\t\t\t\t\t}],\n\t\t\t\t\tget children() {\n\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\treturn !result.loading && !result.error;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget fallback() {\n\t\t\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\t\t\treturn !!result.error;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\t\treturn code` return error(\\`Failed to load changelog: ${result.error.message.replaceAll(/`/g, \"\\\\`\")}\\`); `;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\treturn createComponent(Show, {\n\t\t\t\t\t\t\t\t\tget when() {\n\t\t\t\t\t\t\t\t\t\treturn !!result.data;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tfallback: code` return warn(\"There is no changelog available for display.\"); `,\n\t\t\t\t\t\t\t\t\tget children() {\n\t\t\t\t\t\t\t\t\t\treturn result.data;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t];\n\t\t}\n\t});\n}\n\n//#endregion\nexport { ChangelogCommand };\n//# sourceMappingURL=changelog-command.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,SAAS,mBAAmB;CAC3B,MAAM,UAAU,eAAe;CAC/B,MAAM,SAAS,eAAe,YAAY;EACzC,MAAM,UAAU,MAAM,QAAQ,GAAG,KAAK,QAAQ,OAAO,UAAU,KAAK;AACpE,MAAI,CAAC,QAAS,QAAO;AACrB,SAAOA,EAAe,QAAQ;GAC7B;AACF,QAAO,gBAAgB,gBAAgB;EACtC,IAAI,OAAO;AACV,UAAO,UAAU,QAAQ,WAAW,aAAa,aAAa;;EAE/D,SAAS;GACR,WAAW;GACX,oBAAoB,CAAC,YAAY,YAAY;GAC7C;EACD,gBAAgB,EAAE,SAAS;GAC1B;GACA;GACA;GACA;GACA;GACA,EAAE;EACH,IAAI,WAAW;AACd,UAAO;IACN,gBAAgB,OAAO,EAAE,SAAS,sCAAsC,CAAC;IACzE,gBAAgB,sBAAsB;KACrC,UAAU;KACV,MAAM;KACN,IAAI,WAAW;AACd,aAAO;OAC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