tnp-helpers 21.0.12 → 21.0.16

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.
@@ -1483,6 +1483,8 @@ var UtilsTypescript;
1483
1483
  return (void 0);
1484
1484
  }
1485
1485
  UtilsTypescript.transformFlatImports = transformFlatImports;
1486
+ //#endregion
1487
+ //#region clear require cache recursive
1486
1488
  UtilsTypescript.clearRequireCacheRecursive = (modulePath, seen = new Set()) => {
1487
1489
  /* */
1488
1490
  /* */
@@ -1500,6 +1502,245 @@ var UtilsTypescript;
1500
1502
  /* */
1501
1503
  return (void 0);
1502
1504
  };
1505
+ //#endregion
1506
+ //#region add or update import if not exists
1507
+ UtilsTypescript.addOrUpdateImportIfNotExists = (tsFileContent, identifiers, fromModule) => {
1508
+ const idents = Array.isArray(identifiers) ? identifiers : [identifiers];
1509
+ const impRegex = new RegExp(`${'imp' + 'ort'}\\s*\\{([^}]*)\\}\\s*from\\s*['"]${fromModule}['"];?`, 'm');
1510
+ const match = tsFileContent.match(impRegex);
1511
+ // ----------------------------------------------------
1512
+ // 1. Import exists → merge identifiers
1513
+ // ----------------------------------------------------
1514
+ if (match) {
1515
+ const existing = match[1]
1516
+ .split(',')
1517
+ .map(s => s.trim())
1518
+ .filter(Boolean);
1519
+ const merged = Array.from(new Set([...existing, ...idents])).sort();
1520
+ const updatedImport = `import { ${merged.join(', ')} } from '${fromModule}';`;
1521
+ return tsFileContent.replace(match[0], updatedImport);
1522
+ }
1523
+ // ----------------------------------------------------
1524
+ // 2. Import does NOT exist → insert into //#region imports
1525
+ // ----------------------------------------------------
1526
+ const newImport = `${'imp' + 'ort'} { ${idents.join(', ')} } from '${fromModule}';\n`;
1527
+ const regRegex = new RegExp(`\\/\\/\\#${'reg' + 'ion'} imports\\s*\\n([\\s\\S]*?)\\/\\/\\#${'endr' + 'egion'}`, 'm');
1528
+ const regionMatch = tsFileContent.match(regRegex);
1529
+ if (regionMatch) {
1530
+ const regStart = regionMatch.index + regionMatch[0].indexOf('\n') + 1;
1531
+ return (tsFileContent.slice(0, regStart) +
1532
+ newImport +
1533
+ tsFileContent.slice(regStart));
1534
+ }
1535
+ // ----------------------------------------------------
1536
+ // 3. Fallback → insert at very top (after 'use strict')
1537
+ // ----------------------------------------------------
1538
+ const useStrictMatch = tsFileContent.match(/^(['"])use strict\1;\s*/m);
1539
+ if (useStrictMatch) {
1540
+ const idx = useStrictMatch.index + useStrictMatch[0].length;
1541
+ return tsFileContent.slice(0, idx) + newImport + tsFileContent.slice(idx);
1542
+ }
1543
+ return newImport + tsFileContent;
1544
+ };
1545
+ //#endregion
1546
+ //#region migrate from ng modules to standalone v21
1547
+ UtilsTypescript.migrateFromNgModulesToStandaloneV21 = (tsFileContent, projectName) => {
1548
+ /* */
1549
+ /* */
1550
+ /* */
1551
+ /* */
1552
+ /* */
1553
+ /* */
1554
+ /* */
1555
+ /* */
1556
+ /* */
1557
+ /* */
1558
+ /* */
1559
+ /* */
1560
+ /* */
1561
+ /* */
1562
+ /* */
1563
+ /* */
1564
+ /* */
1565
+ /* */
1566
+ /* */
1567
+ /* */
1568
+ /* */
1569
+ /* */
1570
+ /* */
1571
+ /* */
1572
+ /* */
1573
+ /* */
1574
+ /* */
1575
+ /* */
1576
+ /* */
1577
+ /* */
1578
+ /* */
1579
+ /* */
1580
+ /* */
1581
+ /* */
1582
+ /* */
1583
+ /* */
1584
+ /* */
1585
+ /* */
1586
+ /* */
1587
+ /* */
1588
+ /* */
1589
+ /* */
1590
+ /* */
1591
+ /* */
1592
+ /* */
1593
+ /* */
1594
+ /* */
1595
+ /* */
1596
+ /* */
1597
+ /* */
1598
+ /* */
1599
+ /* */
1600
+ /* */
1601
+ /* */
1602
+ /* */
1603
+ /* */
1604
+ /* */
1605
+ /* */
1606
+ /* */
1607
+ /* */
1608
+ /* */
1609
+ /* */
1610
+ /* */
1611
+ /* */
1612
+ /* */
1613
+ /* */
1614
+ /* */
1615
+ /* */
1616
+ /* */
1617
+ /* */
1618
+ /* */
1619
+ /* */
1620
+ /* */
1621
+ /* */
1622
+ /* */
1623
+ /* */
1624
+ /* */
1625
+ /* */
1626
+ /* */
1627
+ /* */
1628
+ /* */
1629
+ /* */
1630
+ /* */
1631
+ /* */
1632
+ /* */
1633
+ /* */
1634
+ /* */
1635
+ /* */
1636
+ /* */
1637
+ /* */
1638
+ /* */
1639
+ /* */
1640
+ /* */
1641
+ /* */
1642
+ /* */
1643
+ /* */
1644
+ /* */
1645
+ /* */
1646
+ /* */
1647
+ /* */
1648
+ /* */
1649
+ /* */
1650
+ /* */
1651
+ /* */
1652
+ /* */
1653
+ /* */
1654
+ /* */
1655
+ /* */
1656
+ /* */
1657
+ /* */
1658
+ /* */
1659
+ /* */
1660
+ /* */
1661
+ /* */
1662
+ /* */
1663
+ /* */
1664
+ /* */
1665
+ /* */
1666
+ /* */
1667
+ /* */
1668
+ /* */
1669
+ /* */
1670
+ /* */
1671
+ /* */
1672
+ /* */
1673
+ /* */
1674
+ /* */
1675
+ /* */
1676
+ /* */
1677
+ /* */
1678
+ /* */
1679
+ /* */
1680
+ /* */
1681
+ /* */
1682
+ /* */
1683
+ /* */
1684
+ /* */
1685
+ /* */
1686
+ /* */
1687
+ /* */
1688
+ /* */
1689
+ /* */
1690
+ /* */
1691
+ /* */
1692
+ /* */
1693
+ /* */
1694
+ /* */
1695
+ /* */
1696
+ /* */
1697
+ /* */
1698
+ /* */
1699
+ /* */
1700
+ /* */
1701
+ /* */
1702
+ /* */
1703
+ /* */
1704
+ /* */
1705
+ /* */
1706
+ /* */
1707
+ /* */
1708
+ /* */
1709
+ /* */
1710
+ /* */
1711
+ /* */
1712
+ /* */
1713
+ /* */
1714
+ /* */
1715
+ /* */
1716
+ /* */
1717
+ /* */
1718
+ /* */
1719
+ /* */
1720
+ /* */
1721
+ /* */
1722
+ /* */
1723
+ /* */
1724
+ /* */
1725
+ /* */
1726
+ /* */
1727
+ /* */
1728
+ /* */
1729
+ /* */
1730
+ /* */
1731
+ /* */
1732
+ /* */
1733
+ /* */
1734
+ /* */
1735
+ /* */
1736
+ /* */
1737
+ /* */
1738
+ /* */
1739
+ /* */
1740
+ /* */
1741
+ return (void 0);
1742
+ };
1743
+ //#endregion
1503
1744
  })(UtilsTypescript || (UtilsTypescript = {}));
1504
1745
  //#endregion
1505
1746
  //#region utils http
@@ -7644,7 +7885,7 @@ const PROJECT_NPM_NAME = 'tnp-helpers';
7644
7885
  /**
7645
7886
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
7646
7887
  */
7647
- const CURRENT_PACKAGE_VERSION = '21.0.12';
7888
+ const CURRENT_PACKAGE_VERSION = '21.0.16';
7648
7889
  // THIS FILE IS GENERATED - DO NOT MODIFY
7649
7890
 
7650
7891
  //#endregion
@@ -16052,16 +16293,37 @@ class BaseGlobalCommandLine extends BaseCommandLineFeature {
16052
16293
  /* */
16053
16294
  return (void 0);
16054
16295
  }
16296
+ async upapiAll() {
16297
+ /* */
16298
+ /* */
16299
+ return (void 0);
16300
+ }
16055
16301
  async apiup() {
16056
16302
  /* */
16057
16303
  /* */
16058
16304
  return (void 0);
16059
16305
  }
16306
+ async apiupall() {
16307
+ /* */
16308
+ /* */
16309
+ return (void 0);
16310
+ }
16060
16311
  async apiUpdate() {
16061
16312
  /* */
16062
16313
  /* */
16063
16314
  /* */
16064
16315
  /* */
16316
+ /* */
16317
+ /* */
16318
+ /* */
16319
+ /* */
16320
+ /* */
16321
+ /* */
16322
+ /* */
16323
+ /* */
16324
+ return (void 0);
16325
+ }
16326
+ async apiUpdateAll() {
16065
16327
  /* */
16066
16328
  /* */
16067
16329
  /* */
@@ -17409,6 +17671,23 @@ class BaseGlobalCommandLine extends BaseCommandLineFeature {
17409
17671
  return (void 0);
17410
17672
  }
17411
17673
  //#endregion
17674
+ //#region commands / struct all
17675
+ /**
17676
+ * init parent and first level children
17677
+ */
17678
+ async structAll() {
17679
+ /* */
17680
+ /* */
17681
+ /* */
17682
+ /* */
17683
+ /* */
17684
+ /* */
17685
+ /* */
17686
+ /* */
17687
+ /* */
17688
+ return (void 0);
17689
+ }
17690
+ //#endregion
17412
17691
  //#region commands / struct
17413
17692
  /**
17414
17693
  * TODO move somewhere