@forsakringskassan/vite-lib-config 4.1.3 → 4.1.4

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.
@@ -9272,6 +9272,7 @@ function createDedent(options) {
9272
9272
  function dedent2(strings, ...values) {
9273
9273
  const raw = typeof strings === "string" ? [strings] : strings.raw;
9274
9274
  const {
9275
+ alignValues = false,
9275
9276
  escapeSpecialCharacters = Array.isArray(strings),
9276
9277
  trimWhitespace = true
9277
9278
  } = options;
@@ -9283,7 +9284,8 @@ function createDedent(options) {
9283
9284
  }
9284
9285
  result += next;
9285
9286
  if (i < values.length) {
9286
- result += values[i];
9287
+ const value = alignValues ? alignValue(values[i], result) : values[i];
9288
+ result += value;
9287
9289
  }
9288
9290
  }
9289
9291
  const lines = result.split("\n");
@@ -9312,6 +9314,19 @@ function createDedent(options) {
9312
9314
  return result;
9313
9315
  }
9314
9316
  }
9317
+ function alignValue(value, precedingText) {
9318
+ if (typeof value !== "string" || !value.includes("\n")) {
9319
+ return value;
9320
+ }
9321
+ const currentLine = precedingText.slice(precedingText.lastIndexOf("\n") + 1);
9322
+ const indentMatch = currentLine.match(/^(\s+)/);
9323
+ if (indentMatch) {
9324
+ const indent = indentMatch[1];
9325
+ return value.replace(/\n/g, `
9326
+ ${indent}`);
9327
+ }
9328
+ return value;
9329
+ }
9315
9330
 
9316
9331
  // src/utils/extract-augmentations.ts
9317
9332
  function extractAugmentations(content) {
@@ -11542,6 +11542,7 @@ function createDedent(options) {
11542
11542
  function dedent2(strings, ...values) {
11543
11543
  const raw = typeof strings === "string" ? [strings] : strings.raw;
11544
11544
  const {
11545
+ alignValues = false,
11545
11546
  escapeSpecialCharacters = Array.isArray(strings),
11546
11547
  trimWhitespace = true
11547
11548
  } = options;
@@ -11553,7 +11554,8 @@ function createDedent(options) {
11553
11554
  }
11554
11555
  result += next;
11555
11556
  if (i < values.length) {
11556
- result += values[i];
11557
+ const value = alignValues ? alignValue(values[i], result) : values[i];
11558
+ result += value;
11557
11559
  }
11558
11560
  }
11559
11561
  const lines = result.split("\n");
@@ -11582,6 +11584,19 @@ function createDedent(options) {
11582
11584
  return result;
11583
11585
  }
11584
11586
  }
11587
+ function alignValue(value, precedingText) {
11588
+ if (typeof value !== "string" || !value.includes("\n")) {
11589
+ return value;
11590
+ }
11591
+ const currentLine = precedingText.slice(precedingText.lastIndexOf("\n") + 1);
11592
+ const indentMatch = currentLine.match(/^(\s+)/);
11593
+ if (indentMatch) {
11594
+ const indent = indentMatch[1];
11595
+ return value.replace(/\n/g, `
11596
+ ${indent}`);
11597
+ }
11598
+ return value;
11599
+ }
11585
11600
 
11586
11601
  // src/utils/pretty-list.ts
11587
11602
  function prettyList(deps, predicate) {
@@ -11532,6 +11532,7 @@ function createDedent(options) {
11532
11532
  function dedent2(strings, ...values) {
11533
11533
  const raw = typeof strings === "string" ? [strings] : strings.raw;
11534
11534
  const {
11535
+ alignValues = false,
11535
11536
  escapeSpecialCharacters = Array.isArray(strings),
11536
11537
  trimWhitespace = true
11537
11538
  } = options;
@@ -11543,7 +11544,8 @@ function createDedent(options) {
11543
11544
  }
11544
11545
  result += next;
11545
11546
  if (i < values.length) {
11546
- result += values[i];
11547
+ const value = alignValues ? alignValue(values[i], result) : values[i];
11548
+ result += value;
11547
11549
  }
11548
11550
  }
11549
11551
  const lines = result.split("\n");
@@ -11572,6 +11574,19 @@ function createDedent(options) {
11572
11574
  return result;
11573
11575
  }
11574
11576
  }
11577
+ function alignValue(value, precedingText) {
11578
+ if (typeof value !== "string" || !value.includes("\n")) {
11579
+ return value;
11580
+ }
11581
+ const currentLine = precedingText.slice(precedingText.lastIndexOf("\n") + 1);
11582
+ const indentMatch = currentLine.match(/^(\s+)/);
11583
+ if (indentMatch) {
11584
+ const indent = indentMatch[1];
11585
+ return value.replace(/\n/g, `
11586
+ ${indent}`);
11587
+ }
11588
+ return value;
11589
+ }
11575
11590
 
11576
11591
  // src/utils/pretty-list.ts
11577
11592
  function prettyList(deps, predicate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vite-lib-config",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "Försäkringskassan toolchain to build libraries with Vite",
5
5
  "keywords": [
6
6
  "vite"