@entur/typography 1.10.0-beta.11 → 1.10.0-beta.12

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.11",
3
+ "version": "1.10.0-beta.12",
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": "43d0a9514cbaeb6c8e319c4286bed9bd3ea21b22"
45
+ "gitHead": "2a01de420517ee321602ced4e534eada22e2a10c"
46
46
  }
@@ -658,7 +658,23 @@ function updateImports(content) {
658
658
  let hasChanges = false;
659
659
  const uniqueComponents = new Set();
660
660
 
661
- // Check each component in the import list
661
+ // First, collect all existing components that should be preserved
662
+ const existingComponents = importList
663
+ .split(',')
664
+ .map(comp => comp.trim())
665
+ .filter(comp => {
666
+ // Keep components that are:
667
+ // 1. Not in the migration mapping (old components), OR
668
+ // 2. Are the target components (new beta components)
669
+ const isOldComponent = Object.keys(COMPONENT_MAPPING).includes(comp);
670
+ const isTargetComponent = Object.values(COMPONENT_MAPPING).some(
671
+ mapping => mapping.component === comp,
672
+ );
673
+
674
+ return !isOldComponent || isTargetComponent;
675
+ });
676
+
677
+ // Then, update components that need migration
662
678
  Object.entries(COMPONENT_MAPPING).forEach(([oldComponent, mapping]) => {
663
679
  const componentRegex = new RegExp(`\\b${oldComponent}\\b`, 'g');
664
680
  if (componentRegex.test(updatedImportList)) {
@@ -673,8 +689,12 @@ function updateImports(content) {
673
689
 
674
690
  if (hasChanges) {
675
691
  changes++;
676
- // Deduplicate components and create clean import statement
677
- const finalImportList = Array.from(uniqueComponents).join(', ');
692
+ // Combine existing components with migrated components
693
+ const allComponents = [
694
+ ...existingComponents,
695
+ ...Array.from(uniqueComponents),
696
+ ];
697
+ const finalImportList = allComponents.join(', ');
678
698
  return `import {${finalImportList}} from '${BETA_IMPORT}'`;
679
699
  }
680
700