@clerk/upgrade 2.0.0-snapshot.v20251203203405 → 2.0.0-snapshot.v20251204143242

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.
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url';
3
3
  import { globby } from 'globby';
4
4
  import { run } from 'jscodeshift/src/Runner.js';
5
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
6
- export async function runCodemod(transform = 'transform-async-request', glob, options) {
6
+ export async function runCodemod(transform = 'transform-async-request', glob, options = {}) {
7
7
  if (!transform) {
8
8
  throw new Error('No transform provided');
9
9
  }
@@ -16,10 +16,17 @@ export async function runCodemod(transform = 'transform-async-request', glob, op
16
16
  '**/*.(css|scss|sass|less|styl)+' // common style files
17
17
  ]
18
18
  });
19
- return await run(resolvedPath, paths ?? [], {
19
+ const clerkUpgradeStats = options.clerkUpgradeStats ?? {};
20
+ const result = await run(resolvedPath, paths ?? [], {
20
21
  dry: false,
21
22
  ...options,
23
+ // expose a mutable stats bag so individual transforms can record structured information
24
+ clerkUpgradeStats,
22
25
  // we must silence stdout to prevent output from interfering with ink CLI
23
26
  silent: true
24
27
  });
28
+ return {
29
+ ...result,
30
+ clerkUpgradeStats
31
+ };
25
32
  }
@@ -23,7 +23,7 @@ module.exports = function transformDeprecatedProps({
23
23
  source
24
24
  }, {
25
25
  jscodeshift: j
26
- }) {
26
+ }, options = {}) {
27
27
  const root = j(source);
28
28
  let dirty = false;
29
29
  const {
@@ -42,11 +42,16 @@ module.exports = function transformDeprecatedProps({
42
42
  }
43
43
  }
44
44
  if (COMPONENTS_WITH_USER_BUTTON_REMOVALS.has(canonicalName)) {
45
+ let removedCount = 0;
45
46
  for (const attrName of COMPONENTS_WITH_USER_BUTTON_REMOVALS.get(canonicalName)) {
46
47
  if (removeJsxAttribute(j, jsxNode, attrName)) {
47
48
  dirty = true;
49
+ removedCount += 1;
48
50
  }
49
51
  }
52
+ if (removedCount > 0 && options.clerkUpgradeStats) {
53
+ options.clerkUpgradeStats.userbuttonAfterSignOutPropsRemoved = (options.clerkUpgradeStats.userbuttonAfterSignOutPropsRemoved || 0) + removedCount;
54
+ }
50
55
  }
51
56
  if (COMPONENT_RENAMES.has(canonicalName)) {
52
57
  const renameMap = COMPONENT_RENAMES.get(canonicalName);
@@ -77,7 +77,21 @@ export function Codemod(props) {
77
77
  color: "yellow"
78
78
  }, result.skip ?? 0, " skipped"), /*#__PURE__*/React.createElement(Text, {
79
79
  color: "gray"
80
- }, result.nochange ?? 0, " unmodified"), result.timeElapsed && /*#__PURE__*/React.createElement(Text, null, "Time elapsed: ", result.timeElapsed), /*#__PURE__*/React.createElement(Newline, null)), error && /*#__PURE__*/React.createElement(Text, {
80
+ }, result.nochange ?? 0, " unmodified"), result.timeElapsed && /*#__PURE__*/React.createElement(Text, null, "Time elapsed: ", result.timeElapsed), transform === 'transform-remove-deprecated-props' && result.clerkUpgradeStats?.userbuttonAfterSignOutPropsRemoved > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, {
81
+ color: "yellow"
82
+ }, "Found and removed ", result.clerkUpgradeStats.userbuttonAfterSignOutPropsRemoved, " usage(s) of", /*#__PURE__*/React.createElement(Text, {
83
+ bold: true
84
+ }, " UserButton"), " sign-out redirect props (", /*#__PURE__*/React.createElement(Text, {
85
+ italic: true
86
+ }, "afterSignOutUrl"), " /", ' ', /*#__PURE__*/React.createElement(Text, {
87
+ italic: true
88
+ }, "afterMultiSessionSingleSignOutUrl"), ")."), /*#__PURE__*/React.createElement(Text, {
89
+ color: "gray"
90
+ }, "In Core 3, these props have been removed. Configure sign-out redirects globally via", /*#__PURE__*/React.createElement(Text, {
91
+ italic: true
92
+ }, " ClerkProvider afterSignOutUrl"), " (or the corresponding environment variable) or use", /*#__PURE__*/React.createElement(Text, {
93
+ italic: true
94
+ }, " SignOutButton redirectUrl"), " for one-off flows.")), /*#__PURE__*/React.createElement(Newline, null)), error && /*#__PURE__*/React.createElement(Text, {
81
95
  color: "red"
82
96
  }, error.message));
83
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerk/upgrade",
3
- "version": "2.0.0-snapshot.v20251203203405",
3
+ "version": "2.0.0-snapshot.v20251204143242",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/clerk/javascript.git",