styled-components-to-stylex-codemod 0.0.30 → 0.0.32
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/index.d.mts +1 -1
- package/dist/index.mjs +2 -1
- package/dist/{logger-BQnWs1On.d.mts → logger-BFrY6Nmv.d.mts} +29 -0
- package/dist/transform.d.mts +1 -1
- package/dist/transform.mjs +14264 -14093
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -202,7 +202,8 @@ async function runTransform(options) {
|
|
|
202
202
|
resolveValue: resolveValueWithLogging,
|
|
203
203
|
resolveCall: resolveCallWithLogging,
|
|
204
204
|
resolveSelector: resolveSelectorWithLogging,
|
|
205
|
-
resolveBaseComponent: adapterInput.resolveBaseComponent ? resolveBaseComponentWithLogging : void 0
|
|
205
|
+
resolveBaseComponent: adapterInput.resolveBaseComponent ? resolveBaseComponentWithLogging : void 0,
|
|
206
|
+
resolveThemeCall: resolvedAdapter.resolveThemeCall
|
|
206
207
|
};
|
|
207
208
|
const transformPath = (() => {
|
|
208
209
|
const adjacent = join(__dirname, "transform.mjs");
|
|
@@ -139,6 +139,22 @@ type CallResolveContext = {
|
|
|
139
139
|
*/
|
|
140
140
|
cssProperty?: string;
|
|
141
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* Context for `adapter.resolveThemeCall(...)`.
|
|
144
|
+
*
|
|
145
|
+
* This handles patterns like `props.theme.highlightVariant(props.theme.color.bgBorderSolid)`
|
|
146
|
+
* where a method on the theme object is called with theme-dependent arguments.
|
|
147
|
+
*/
|
|
148
|
+
type ThemeCallResolveContext = {
|
|
149
|
+
/** Absolute path of the file being transformed. */callSiteFilePath: string; /** The method name on the theme object (e.g., "highlightVariant"). */
|
|
150
|
+
methodName: string; /** Call arguments (same format as CallResolveContext.args). */
|
|
151
|
+
args: CallResolveContext["args"]; /** Source location of the call. */
|
|
152
|
+
loc?: {
|
|
153
|
+
line: number;
|
|
154
|
+
column: number;
|
|
155
|
+
}; /** CSS property being set (when available). */
|
|
156
|
+
cssProperty?: string;
|
|
157
|
+
};
|
|
142
158
|
/**
|
|
143
159
|
* Context for `adapter.resolveValue(...)` (theme + css variables + imported values).
|
|
144
160
|
*
|
|
@@ -600,6 +616,18 @@ interface Adapter {
|
|
|
600
616
|
* ```
|
|
601
617
|
*/
|
|
602
618
|
styleMerger: StyleMergerConfig | null;
|
|
619
|
+
/**
|
|
620
|
+
* Optional resolver for theme method calls like `props.theme.highlightVariant(...)`.
|
|
621
|
+
*
|
|
622
|
+
* Called when the codemod encounters a call expression on the theme object that
|
|
623
|
+
* cannot be resolved via simple theme property access.
|
|
624
|
+
*
|
|
625
|
+
* Return:
|
|
626
|
+
* - `{ preserveRuntimeCall: true }` to preserve the call at runtime
|
|
627
|
+
* - `{ expr, imports }` to resolve to a static StyleX value
|
|
628
|
+
* - `undefined` to bail (theme method call is not supported)
|
|
629
|
+
*/
|
|
630
|
+
resolveThemeCall?: (context: ThemeCallResolveContext) => CallResolveResult | undefined;
|
|
603
631
|
/**
|
|
604
632
|
* Optional theme hook import/call customization for wrapper code that needs runtime theme access.
|
|
605
633
|
*
|
|
@@ -641,6 +669,7 @@ interface AdapterInput {
|
|
|
641
669
|
* in `runTransform()`).
|
|
642
670
|
*/
|
|
643
671
|
externalInterface: "auto" | Adapter["externalInterface"];
|
|
672
|
+
resolveThemeCall?: Adapter["resolveThemeCall"];
|
|
644
673
|
styleMerger: Adapter["styleMerger"];
|
|
645
674
|
themeHook?: Adapter["themeHook"];
|
|
646
675
|
useSxProp: Adapter["useSxProp"];
|
package/dist/transform.d.mts
CHANGED