@entur/typography 1.10.0-beta.7 → 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
|
}
|
|
@@ -558,15 +558,37 @@ function updateImports(content) {
|
|
|
558
558
|
updatedContent = updatedContent.replace(pattern, `from '${BETA_IMPORT}'`);
|
|
559
559
|
});
|
|
560
560
|
|
|
561
|
-
// Then, update destructured import names
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
+
});
|
|
565
583
|
|
|
566
|
-
if (
|
|
584
|
+
if (hasChanges) {
|
|
567
585
|
changes++;
|
|
568
|
-
|
|
586
|
+
// Deduplicate components and create clean import statement
|
|
587
|
+
const finalImportList = Array.from(uniqueComponents).join(', ');
|
|
588
|
+
return `import {${finalImportList}} from '${BETA_IMPORT}'`;
|
|
569
589
|
}
|
|
590
|
+
|
|
591
|
+
return match;
|
|
570
592
|
});
|
|
571
593
|
|
|
572
594
|
return { content: updatedContent, changes };
|