@ethlete/cdk 5.0.0-next.4 → 5.0.0-next.40

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.
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
3
1
  import { getProjects, logger, visitNotIgnoredFiles } from '@nx/devkit';
4
2
  import * as ts from 'typescript';
5
3
  // Symbol mappings
@@ -327,14 +327,14 @@ export function migrateEtLet(tree) {
327
327
  if (variable !== originalVariable) {
328
328
  // Pattern 1: Attribute values - match the full pattern [attr]="value"
329
329
  // and only replace the variable in the value part, never in attribute names
330
- innerContent = innerContent.replace(/\[([^\]]+)\]="([^"]*)"/g, (match, attrName, attrValue) => {
330
+ innerContent = innerContent.replace(/\[([^\]]+)\]="([^"]*)"/g, (_match, attrName, attrValue) => {
331
331
  // Don't rename the attribute name, only references in the value
332
332
  const pattern = new RegExp(`\\b${originalVariable}\\b`, 'g');
333
333
  const newValue = attrValue.replace(pattern, variable);
334
334
  return `[${attrName}]="${newValue}"`;
335
335
  });
336
336
  // Pattern 2: Event bindings like (click)="method(variable)"
337
- innerContent = innerContent.replace(/\(([^)]+)\)="([^"]*)"/g, (match, eventName, eventHandler) => {
337
+ innerContent = innerContent.replace(/\(([^)]+)\)="([^"]*)"/g, (_match, eventName, eventHandler) => {
338
338
  const pattern = new RegExp(`\\b${originalVariable}\\b`, 'g');
339
339
  const newHandler = eventHandler.replace(pattern, variable);
340
340
  return `(${eventName})="${newHandler}"`;
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
1
  import { formatFiles, getProjects, logger, visitNotIgnoredFiles } from '@nx/devkit';
3
2
  import * as ts from 'typescript';
4
3
  const STRATEGY_MAP = {
@@ -201,7 +200,7 @@ function processFile(filePath, content) {
201
200
  bodyCode = func.body.getText(sourceFile);
202
201
  }
203
202
  // Transform the body - replace builder.DEFAULTS.X with strategy calls
204
- const { code: transformedBody, usesMergeConfigs, strategiesUsed, } = transformBuilderBodyForDefaults(bodyCode, builderParamName, sourceFile);
203
+ const { code: transformedBody, usesMergeConfigs, strategiesUsed, } = transformBuilderBodyForDefaults(bodyCode, builderParamName);
205
204
  if (usesMergeConfigs) {
206
205
  importsToAdd.add('mergeOverlayBreakpointConfigs');
207
206
  }
@@ -482,7 +481,7 @@ function transformNodeTextForDefaults(node, sourceFile) {
482
481
  text = text.replace(defaultsPattern, `${varName}.build()`);
483
482
  });
484
483
  // Now handle mergeConfigs - do this AFTER replacing DEFAULTS
485
- Object.entries(STRATEGY_INJECT_MAP).forEach(([strategyName, injectFn]) => {
484
+ Object.entries(STRATEGY_INJECT_MAP).forEach(([_strategyName, injectFn]) => {
486
485
  const varName = getStrategyVariableName(injectFn);
487
486
  // Pattern: overlayService.positions.mergeConfigs(dialogStrategy.build(), ...args)
488
487
  // We want to extract just the args after the first argument and comma
@@ -608,14 +607,6 @@ function updateImportsInContent(content, importsToAdd, importsToRemove) {
608
607
  return content.replace(importRegex, newImportStatement);
609
608
  }
610
609
  // Type guards
611
- function isInjectOverlayServiceCall(node) {
612
- return (ts.isCallExpression(node) &&
613
- ts.isIdentifier(node.expression) &&
614
- node.expression.text === 'inject' &&
615
- node.arguments.length === 1 &&
616
- ts.isIdentifier(node.arguments[0]) &&
617
- node.arguments[0].text === 'OverlayService');
618
- }
619
610
  function isPositionMethodCall(node) {
620
611
  return (ts.isCallExpression(node) &&
621
612
  ts.isPropertyAccessExpression(node.expression) &&
@@ -627,37 +618,6 @@ function isOverlayBreakpointConfigEntryType(node) {
627
618
  ts.isIdentifier(node.typeName) &&
628
619
  node.typeName.text === 'OverlayBreakpointConfigEntry');
629
620
  }
630
- // Helper functions
631
- function checkIfOverlayRelated(node) {
632
- // First check: Are we inside createOverlayHandler call?
633
- if (isInsideOverlayHandlerCall(node)) {
634
- return true;
635
- }
636
- // Check for overlay-related patterns that need migration using AST
637
- let isOverlayRelated = false;
638
- function visit(n) {
639
- if (isOverlayRelated)
640
- return;
641
- if (isPositionMethodCall(n)) {
642
- isOverlayRelated = true;
643
- return;
644
- }
645
- if (isDefaultsUsage(n)) {
646
- isOverlayRelated = true;
647
- return;
648
- }
649
- if (ts.isCallExpression(n)) {
650
- const callText = n.getText();
651
- if (callText.includes('getConfig') || callText.includes('getPositions') || callText.includes('getStrategies')) {
652
- isOverlayRelated = true;
653
- return;
654
- }
655
- }
656
- ts.forEachChild(n, visit);
657
- }
658
- visit(node);
659
- return isOverlayRelated;
660
- }
661
621
  function isDefaultsUsage(node) {
662
622
  return (ts.isPropertyAccessExpression(node) &&
663
623
  ts.isPropertyAccessExpression(node.expression) &&
@@ -760,7 +720,7 @@ function isInsideOverlayHandlerCall(node) {
760
720
  }
761
721
  return false;
762
722
  }
763
- function transformBuilderBodyForDefaults(bodyCode, builderParamName, sourceFile) {
723
+ function transformBuilderBodyForDefaults(bodyCode, builderParamName) {
764
724
  let code = bodyCode;
765
725
  let usesMergeConfigs = false;
766
726
  const strategiesUsed = new Set();
@@ -780,7 +740,7 @@ function transformBuilderBodyForDefaults(bodyCode, builderParamName, sourceFile)
780
740
  }
781
741
  });
782
742
  // Replace builder.mergeConfigs(Xstrategy.build(), ...args) with Xstrategy.build(mergeOverlayBreakpointConfigs(...args))
783
- Object.entries(STRATEGY_INJECT_MAP).forEach(([strategyName, injectFn]) => {
743
+ Object.entries(STRATEGY_INJECT_MAP).forEach(([_strategyName, injectFn]) => {
784
744
  const varName = getStrategyVariableName(injectFn);
785
745
  // Pattern: builder.mergeConfigs(dialogStrategy.build(), {...})
786
746
  const pattern = new RegExp(`${builderParamName}\\.mergeConfigs\\(\\s*${varName}\\.build\\(\\)\\s*,\\s*`, 'g');