@miphamai/cli 0.85.35 → 0.85.37

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.
@@ -6,10 +6,15 @@ export function stripIndent(strings: TemplateStringsArray, ...values: unknown[])
6
6
  let result = strings.reduce((acc, s, i) => acc + s + (values[i] ?? ''), '')
7
7
  // Remove leading newline
8
8
  result = result.replace(/^\n/, '')
9
- // Find minimum indent
10
- const match = result.match(/^( +)/m)
11
- if (match?.[1]) {
12
- const indent = match[1].length
9
+ // Minimum indent across non-empty lines. Taking the FIRST line's indent (the
10
+ // old behaviour) chops characters off every interpolated line that was
11
+ // indented less — `join('\n')` values lost their first letters on lines 2..n.
12
+ const indents = result
13
+ .split('\n')
14
+ .filter((line) => line.trim() !== '')
15
+ .map((line) => line.match(/^ */)![0].length)
16
+ const indent = indents.length > 0 ? Math.min(...indents) : 0
17
+ if (indent > 0) {
13
18
  result = result
14
19
  .split('\n')
15
20
  .map((line) => line.slice(indent))