@clerk/upgrade 2.0.0-canary.v20251209150846 → 2.0.0-canary.v20251209192855
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/dist/codemods/__tests__/__fixtures__/transform-align-experimental-unstable-prefixes.fixtures.js +24 -0
- package/dist/codemods/__tests__/transform-align-experimental-unstable-prefixes.test.js +1 -1
- package/dist/codemods/transform-align-experimental-unstable-prefixes.cjs +12 -12
- package/package.json +1 -1
|
@@ -65,4 +65,28 @@ createClerkClient();
|
|
|
65
65
|
output: `
|
|
66
66
|
<OrganizationProfile />;
|
|
67
67
|
`
|
|
68
|
+
}, {
|
|
69
|
+
name: 'Does not rename class constructors',
|
|
70
|
+
source: `
|
|
71
|
+
export class AppError extends Error {
|
|
72
|
+
constructor(
|
|
73
|
+
message: string,
|
|
74
|
+
public readonly code: string,
|
|
75
|
+
public readonly statusCode: number = 500
|
|
76
|
+
) {
|
|
77
|
+
super(message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`,
|
|
81
|
+
output: `
|
|
82
|
+
export class AppError extends Error {
|
|
83
|
+
constructor(
|
|
84
|
+
message: string,
|
|
85
|
+
public readonly code: string,
|
|
86
|
+
public readonly statusCode: number = 500
|
|
87
|
+
) {
|
|
88
|
+
super(message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`
|
|
68
92
|
}];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const SPECIFIC_RENAMES = {
|
|
2
|
-
experimental_createTheme: 'createTheme',
|
|
1
|
+
const SPECIFIC_RENAMES = Object.freeze({
|
|
3
2
|
__experimental_createTheme: 'createTheme',
|
|
4
|
-
experimental__simple: 'simple',
|
|
5
3
|
__experimental_simple: 'simple',
|
|
6
4
|
__unstable__createClerkClient: 'createClerkClient',
|
|
7
|
-
__unstable_invokeMiddlewareOnAuthStateChange: '__internal_invokeMiddlewareOnAuthStateChange',
|
|
8
5
|
__unstable__environment: '__internal_environment',
|
|
9
|
-
__unstable__updateProps: '__internal_updateProps',
|
|
10
|
-
__unstable__setEnvironment: '__internal_setEnvironment',
|
|
11
|
-
__unstable__onBeforeRequest: '__internal_onBeforeRequest',
|
|
12
6
|
__unstable__onAfterResponse: '__internal_onAfterResponse',
|
|
7
|
+
__unstable__onAfterSetActive: '__internal_onAfterSetActive',
|
|
8
|
+
__unstable__onBeforeRequest: '__internal_onBeforeRequest',
|
|
13
9
|
__unstable__onBeforeSetActive: '__internal_onBeforeSetActive',
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
__unstable__setEnvironment: '__internal_setEnvironment',
|
|
11
|
+
__unstable__updateProps: '__internal_updateProps',
|
|
12
|
+
__unstable_invokeMiddlewareOnAuthStateChange: '__internal_invokeMiddlewareOnAuthStateChange',
|
|
13
|
+
experimental__simple: 'simple',
|
|
14
|
+
experimental_createTheme: 'createTheme'
|
|
15
|
+
});
|
|
16
16
|
const REMOVED_PROPS = new Set(['__unstable_manageBillingUrl', '__unstable_manageBillingLabel', '__unstable_manageBillingMembersLimit', 'experimental__forceOauthFirst']);
|
|
17
17
|
const UI_THEME_NAMES = new Set(['createTheme', 'simple', 'experimental_createTheme', '__experimental_createTheme', 'experimental__simple', '__experimental_simple']);
|
|
18
18
|
const UI_THEME_SOURCE = '@clerk/ui/themes/experimental';
|
|
@@ -40,10 +40,10 @@ module.exports = function transformAlignExperimentalUnstablePrefixes({
|
|
|
40
40
|
const root = j(source);
|
|
41
41
|
let dirty = false;
|
|
42
42
|
const maybeRename = name => {
|
|
43
|
-
if (!name || REMOVED_PROPS.has(name)) {
|
|
43
|
+
if (!name || REMOVED_PROPS.has(name) || !Object.hasOwn(SPECIFIC_RENAMES, name)) {
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
|
-
return SPECIFIC_RENAMES[name]
|
|
46
|
+
return SPECIFIC_RENAMES[name];
|
|
47
47
|
};
|
|
48
48
|
const renameIdentifier = node => {
|
|
49
49
|
const newName = maybeRename(node.name);
|
|
@@ -176,7 +176,7 @@ module.exports = function transformAlignExperimentalUnstablePrefixes({
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
|
-
root.find(j.Identifier).forEach(path => {
|
|
179
|
+
root.find(j.Identifier).filter(path => maybeRename(path.node.name)).forEach(path => {
|
|
180
180
|
renameIdentifier(path.node);
|
|
181
181
|
});
|
|
182
182
|
root.find(j.JSXOpeningElement).forEach(path => {
|