|
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', |
13 | | - __unstable__onBeforeSetActive: '__internal_onBeforeSetActive', |
14 | 7 | __unstable__onAfterSetActive: '__internal_onAfterSetActive', |
15 | | -}; |
| 8 | + __unstable__onBeforeRequest: '__internal_onBeforeRequest', |
| 9 | + __unstable__onBeforeSetActive: '__internal_onBeforeSetActive', |
| 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 |
|
17 | 17 | const REMOVED_PROPS = new Set([ |
18 | 18 | '__unstable_manageBillingUrl', |
@@ -52,10 +52,10 @@ module.exports = function transformAlignExperimentalUnstablePrefixes({ source }, |
52 | 52 | let dirty = false; |
53 | 53 |
|
54 | 54 | const maybeRename = name => { |
55 | | - if (!name || REMOVED_PROPS.has(name)) { |
| 55 | + if (!name || REMOVED_PROPS.has(name) || !Object.hasOwn(SPECIFIC_RENAMES, name)) { |
56 | 56 | return null; |
57 | 57 | } |
58 | | - return SPECIFIC_RENAMES[name] ?? null; |
| 58 | + return SPECIFIC_RENAMES[name]; |
59 | 59 | }; |
60 | 60 |
|
61 | 61 | const renameIdentifier = node => { |
@@ -206,9 +206,12 @@ module.exports = function transformAlignExperimentalUnstablePrefixes({ source }, |
206 | 206 | }); |
207 | 207 | }); |
208 | 208 |
|
209 | | - root.find(j.Identifier).forEach(path => { |
210 | | - renameIdentifier(path.node); |
211 | | - }); |
| 209 | + root |
| 210 | + .find(j.Identifier) |
| 211 | + .filter(path => maybeRename(path.node.name)) |
| 212 | + .forEach(path => { |
| 213 | + renameIdentifier(path.node); |
| 214 | + }); |
212 | 215 |
|
213 | 216 | root.find(j.JSXOpeningElement).forEach(path => { |
214 | 217 | const attributes = path.node.attributes || []; |
|
0 commit comments