@tailor-platform/sdk-codemod 0.2.5 → 0.2.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tailor-platform/sdk-codemod
2
2
 
3
+ ## 0.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1380](https://github.com/tailor-platform/sdk/pull/1380) [`2ed1344`](https://github.com/tailor-platform/sdk/commit/2ed1344e5ffff6e78d74ef3a0297fcff4a6201e7) Thanks [@dqn](https://github.com/dqn)! - Internal refactoring: replace mutating array methods (`sort`/`reverse`/`splice`) with non-mutating ES2023 equivalents (`toSorted`/`toReversed`/`toSpliced`). No user-facing behavior change.
8
+
3
9
  ## 0.2.5
4
10
 
5
11
  ### Patch Changes
@@ -106,13 +106,13 @@ function transform(source) {
106
106
  if (new RegExp(`import\\s*\\{[^}]*\\b${functionName}\\b[^}]*\\}`, "m").test(result)) continue;
107
107
  importLines.push(line);
108
108
  }
109
- importLines.sort();
110
- if (importLines.length === 0) return result;
109
+ const sortedImportLines = importLines.toSorted();
110
+ if (sortedImportLines.length === 0) return result;
111
111
  const match = /^(import\s+.*from\s+["']@tailor-platform\/sdk["'];?)$/m.exec(result);
112
112
  if (match) {
113
113
  const insertPos = (match.index ?? 0) + match[0].length;
114
- result = result.slice(0, insertPos) + "\n" + importLines.join("\n") + result.slice(insertPos);
115
- } else result = importLines.join("\n") + "\n" + result;
114
+ result = result.slice(0, insertPos) + "\n" + sortedImportLines.join("\n") + result.slice(insertPos);
115
+ } else result = sortedImportLines.join("\n") + "\n" + result;
116
116
  }
117
117
  return result;
118
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk-codemod",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Codemod runner for Tailor Platform SDK upgrades",
5
5
  "license": "MIT",
6
6
  "repository": {