@entur/typography 1.10.0-beta.6 → 1.10.0-beta.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/typography",
|
|
3
|
-
"version": "1.10.0-beta.
|
|
3
|
+
"version": "1.10.0-beta.8",
|
|
4
4
|
"license": "SEE LICENSE IN README.md",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/typography.esm.js",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"dts-cli": "2.0.5"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "75f853e86839313d80d1ea5aa89fb133f42102de"
|
|
46
46
|
}
|
|
@@ -551,12 +551,46 @@ function updateImports(content) {
|
|
|
551
551
|
let updatedContent = content;
|
|
552
552
|
let changes = 0;
|
|
553
553
|
|
|
554
|
+
// First, update import paths
|
|
554
555
|
IMPORT_PATTERNS.forEach(pattern => {
|
|
555
556
|
const matches = content.match(pattern) || [];
|
|
556
557
|
changes += matches.length;
|
|
557
558
|
updatedContent = updatedContent.replace(pattern, `from '${BETA_IMPORT}'`);
|
|
558
559
|
});
|
|
559
560
|
|
|
561
|
+
// Then, update destructured import names - only within @entur/typography imports
|
|
562
|
+
// Find all import statements from @entur/typography and update component names
|
|
563
|
+
const importRegex =
|
|
564
|
+
/import\s*{([^}]+)}\s*from\s*['"']@entur\/typography['"']/g;
|
|
565
|
+
|
|
566
|
+
updatedContent = updatedContent.replace(importRegex, (match, importList) => {
|
|
567
|
+
let updatedImportList = importList;
|
|
568
|
+
let hasChanges = false;
|
|
569
|
+
const uniqueComponents = new Set();
|
|
570
|
+
|
|
571
|
+
// Check each component in the import list
|
|
572
|
+
Object.entries(COMPONENT_MAPPING).forEach(([oldComponent, mapping]) => {
|
|
573
|
+
const componentRegex = new RegExp(`\\b${oldComponent}\\b`, 'g');
|
|
574
|
+
if (componentRegex.test(updatedImportList)) {
|
|
575
|
+
updatedImportList = updatedImportList.replace(
|
|
576
|
+
componentRegex,
|
|
577
|
+
mapping.component,
|
|
578
|
+
);
|
|
579
|
+
uniqueComponents.add(mapping.component);
|
|
580
|
+
hasChanges = true;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
if (hasChanges) {
|
|
585
|
+
changes++;
|
|
586
|
+
// Deduplicate components and create clean import statement
|
|
587
|
+
const finalImportList = Array.from(uniqueComponents).join(', ');
|
|
588
|
+
return `import {${finalImportList}} from '${BETA_IMPORT}'`;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
return match;
|
|
592
|
+
});
|
|
593
|
+
|
|
560
594
|
return { content: updatedContent, changes };
|
|
561
595
|
}
|
|
562
596
|
|