styled-components-to-stylex-codemod 0.0.45 → 0.0.47
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/{bridge-consumer-patcher-DNsxze1l.mjs → bridge-consumer-patcher-CjR2kIOd.mjs} +2 -2
- package/dist/{compute-leaf-set-Be5Cgxnr.mjs → compute-leaf-set-90UrZ9WP.mjs} +1 -1
- package/dist/{extract-external-interface-B61N1a6q.mjs → extract-external-interface-CvkkJZb1.mjs} +2 -1
- package/dist/{forwarded-as-consumer-patcher-DoVqLOgw.mjs → forwarded-as-consumer-patcher-CaLmjoiP.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +14 -9
- package/dist/{path-utils-BIpoL4Ue.mjs → path-utils-BC4U8X_q.mjs} +26 -2
- package/dist/prop-usage-Bz3z0V2F.mjs +65 -0
- package/dist/{run-prepass-COJ2IOPl.mjs → run-prepass-1yZOVT3P.mjs} +6 -11
- package/dist/selector-context-heuristic-LVizWWOR.mjs +114 -0
- package/dist/{sx-surface-DBy6tOUv.mjs → sx-surface-BzqO3hcC.mjs} +2 -2
- package/dist/{transform-types-CQjiY4Yp.d.mts → transform-types-Bshr_dBf.d.mts} +36 -2
- package/dist/transform.d.mts +1 -1
- package/dist/transform.mjs +2692 -392
- package/dist/{transient-prop-consumer-patcher-BX-LeC2B.mjs → transient-prop-consumer-patcher-DGSFnxSo.mjs} +1 -1
- package/dist/{typescript-analysis-UWX_ePX0.mjs → typescript-analysis-C_25uBrt.mjs} +250 -42
- package/package.json +2 -2
- package/dist/prop-usage-B6z4WOPr.mjs +0 -136
- package/dist/selector-context-heuristic-CGggN74M.mjs +0 -38
- package/dist/typescript-metadata-Dubr-x2i.mjs +0 -49
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as toRealPath } from "./path-utils-BC4U8X_q.mjs";
|
|
2
2
|
import { r as escapeRegex } from "./string-utils-DD9wdRHW.mjs";
|
|
3
|
-
import { t as isSelectorContext } from "./selector-context-heuristic-
|
|
3
|
+
import { t as isSelectorContext } from "./selector-context-heuristic-LVizWWOR.mjs";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
//#region src/internal/bridge-consumer-patcher.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as resolveBarrelReExportBinding, r as findImportSource } from "./extract-external-interface-
|
|
1
|
+
import { o as resolveBarrelReExportBinding, r as findImportSource } from "./extract-external-interface-CvkkJZb1.mjs";
|
|
2
2
|
//#region src/internal/prepass/compute-leaf-set.ts
|
|
3
3
|
/**
|
|
4
4
|
* Computes which styled-component bindings are "leaves" for leaves-only mode:
|
package/dist/{extract-external-interface-B61N1a6q.mjs → extract-external-interface-CvkkJZb1.mjs}
RENAMED
|
@@ -5,6 +5,7 @@ import { readFileSync } from "node:fs";
|
|
|
5
5
|
* Logger and warning types for transform diagnostics.
|
|
6
6
|
* Core concepts: severity classification and source context reporting.
|
|
7
7
|
*/
|
|
8
|
+
const UNSUPPORTED_SHOULD_FORWARD_PROP_WARNING = "Unsupported shouldForwardProp pattern (only !prop.startsWith(), ![].includes(prop), and prop !== are supported)";
|
|
8
9
|
/**
|
|
9
10
|
* When fileCount <= this threshold, warnings are printed per-file inline and
|
|
10
11
|
* the summary is skipped. Above the threshold only the summary is printed.
|
|
@@ -379,4 +380,4 @@ function getFileImportsFromRes(name) {
|
|
|
379
380
|
return cached;
|
|
380
381
|
}
|
|
381
382
|
//#endregion
|
|
382
|
-
export { resolveBarrelReExport as a, getReExportedSourceName as i, fileImportsFrom as n, resolveBarrelReExportBinding as o, findImportSource as r, Logger as s, fileExports as t };
|
|
383
|
+
export { resolveBarrelReExport as a, UNSUPPORTED_SHOULD_FORWARD_PROP_WARNING as c, getReExportedSourceName as i, fileImportsFrom as n, resolveBarrelReExportBinding as o, findImportSource as r, Logger as s, fileExports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as toRealPath } from "./path-utils-BC4U8X_q.mjs";
|
|
2
2
|
import { r as escapeRegex } from "./string-utils-DD9wdRHW.mjs";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
//#region src/internal/forwarded-as-consumer-patcher.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CollectedWarning, c as MarkerFileContext, l as defineAdapter, n as TransformMode, o as AdapterInput, s as ImportSource } from "./transform-types-
|
|
1
|
+
import { a as CollectedWarning, c as MarkerFileContext, l as defineAdapter, n as TransformMode, o as AdapterInput, s as ImportSource } from "./transform-types-Bshr_dBf.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/run.d.ts
|
|
4
4
|
interface RunTransformOptions {
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as describeValue, i as defineAdapter, n as mergeMarkerDeclarations, s as assertValidAdapterInput, t as transformedComponentAcceptsSx } from "./sx-surface-
|
|
2
|
-
import { a as resolveBarrelReExport, s as Logger } from "./extract-external-interface-
|
|
3
|
-
import { r as extractStyledDefBasesFromSource } from "./compute-leaf-set-
|
|
4
|
-
import {
|
|
1
|
+
import { c as describeValue, i as defineAdapter, n as mergeMarkerDeclarations, s as assertValidAdapterInput, t as transformedComponentAcceptsSx } from "./sx-surface-BzqO3hcC.mjs";
|
|
2
|
+
import { a as resolveBarrelReExport, s as Logger } from "./extract-external-interface-CvkkJZb1.mjs";
|
|
3
|
+
import { r as extractStyledDefBasesFromSource } from "./compute-leaf-set-90UrZ9WP.mjs";
|
|
4
|
+
import { r as toRealPath } from "./path-utils-BC4U8X_q.mjs";
|
|
5
5
|
import jscodeshift from "jscodeshift";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -149,7 +149,7 @@ async function runTransform(options) {
|
|
|
149
149
|
const { createModuleResolver } = await import("./resolve-imports-DgSAddIF.mjs").then((n) => n.n);
|
|
150
150
|
const sharedResolver = createModuleResolver();
|
|
151
151
|
filePaths = orderFilesByLocalImportDependencies(filePaths, sharedResolver, toRealPath);
|
|
152
|
-
const { runPrepass } = await import("./run-prepass-
|
|
152
|
+
const { runPrepass } = await import("./run-prepass-1yZOVT3P.mjs");
|
|
153
153
|
const absoluteFiles = filePaths.map((f) => resolve(f));
|
|
154
154
|
const absoluteConsumers = consumerFilePaths.map((f) => resolve(f));
|
|
155
155
|
let prepassResult;
|
|
@@ -252,7 +252,12 @@ async function runTransform(options) {
|
|
|
252
252
|
const autoInterfaceNames = ctx.importedName === "default" ? [ctx.localName, ctx.importedName] : [ctx.importedName];
|
|
253
253
|
const styledDefinitionNames = getStyledDefinitionNames(definitionSourcePath);
|
|
254
254
|
const sourceComponentNames = ctx.importedName === "default" ? [ctx.localName, getDefaultExportedName(definitionSourcePath)].filter((name) => typeof name === "string") : [ctx.importedName];
|
|
255
|
-
|
|
255
|
+
const typedComponent = findTypedComponentMetadata(prepassResult.typeScriptMetadata, definitionSourcePath, sourceComponentNames);
|
|
256
|
+
if (typedComponent?.supportsSxProp === true) return {
|
|
257
|
+
acceptsSx: true,
|
|
258
|
+
sxExcludedProperties: typedComponent.sxExcludedProperties,
|
|
259
|
+
sxAllowedProperties: typedComponent.sxAllowedProperties
|
|
260
|
+
};
|
|
256
261
|
if (transformedComponentAcceptsSx({
|
|
257
262
|
absolutePath: definitionSourcePath,
|
|
258
263
|
componentNames: sourceComponentNames,
|
|
@@ -343,7 +348,7 @@ async function runTransform(options) {
|
|
|
343
348
|
const result = await runTransformSequentially(transformModule, filePaths, runnerOptions);
|
|
344
349
|
if (sidecarFiles.size > 0 && !dryRun) for (const [sidecarPath, content] of sidecarFiles) await writeFile(sidecarPath, mergeSidecarContent(sidecarPath, content), "utf-8");
|
|
345
350
|
if (bridgeResults.size > 0 && !dryRun) {
|
|
346
|
-
const { buildConsumerReplacements, patchConsumerFile } = await import("./bridge-consumer-patcher-
|
|
351
|
+
const { buildConsumerReplacements, patchConsumerFile } = await import("./bridge-consumer-patcher-CjR2kIOd.mjs");
|
|
347
352
|
const consumerReplacements = buildConsumerReplacements(crossFilePrepassResult.selectorUsages, bridgeResults, transformedFiles);
|
|
348
353
|
const patchedFiles = [];
|
|
349
354
|
for (const [consumerPath, replacements] of consumerReplacements) {
|
|
@@ -356,7 +361,7 @@ async function runTransform(options) {
|
|
|
356
361
|
if (formatterCommands && patchedFiles.length > 0) await runFormatters(formatterCommands, patchedFiles);
|
|
357
362
|
}
|
|
358
363
|
if (prepassResult.forwardedAsConsumers.size > 0 && !dryRun) {
|
|
359
|
-
const { buildForwardedAsReplacements, patchConsumerForwardedAs } = await import("./forwarded-as-consumer-patcher-
|
|
364
|
+
const { buildForwardedAsReplacements, patchConsumerForwardedAs } = await import("./forwarded-as-consumer-patcher-CaLmjoiP.mjs");
|
|
360
365
|
const forwardedAsReplacements = buildForwardedAsReplacements(prepassResult.forwardedAsConsumers, transformedFiles);
|
|
361
366
|
const patchedFiles = [];
|
|
362
367
|
for (const [consumerPath, entries] of forwardedAsReplacements) {
|
|
@@ -369,7 +374,7 @@ async function runTransform(options) {
|
|
|
369
374
|
if (formatterCommands && patchedFiles.length > 0) await runFormatters(formatterCommands, patchedFiles);
|
|
370
375
|
}
|
|
371
376
|
if (transientPropRenames.size > 0 && !dryRun) {
|
|
372
|
-
const { collectTransientPropPatches } = await import("./transient-prop-consumer-patcher-
|
|
377
|
+
const { collectTransientPropPatches } = await import("./transient-prop-consumer-patcher-DGSFnxSo.mjs");
|
|
373
378
|
const patches = collectTransientPropPatches({
|
|
374
379
|
transientPropRenames,
|
|
375
380
|
consumerFilePaths: consumerFilePaths.map((p) => resolve(p)),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import { realpathSync } from "node:fs";
|
|
2
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
3
3
|
//#region src/internal/utilities/path-utils.ts
|
|
4
4
|
/**
|
|
5
5
|
* Shared path utilities for symlink resolution and path normalization.
|
|
@@ -26,5 +26,29 @@ function toRealPath(filePath) {
|
|
|
26
26
|
function isRelativeSpecifier(specifier) {
|
|
27
27
|
return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith(".\\") || specifier.startsWith("..\\");
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a source file path to an existing implementation file when possible,
|
|
31
|
+
* accepting extensionless imports and index modules before resolving symlinks.
|
|
32
|
+
*/
|
|
33
|
+
function resolveExistingFilePath(filePath) {
|
|
34
|
+
const resolved = resolveExistingSourceFilePath(filePath);
|
|
35
|
+
return existsSync(resolved) ? toRealPath(resolved) : resolved;
|
|
36
|
+
}
|
|
37
|
+
function resolveExistingSourceFilePath(filePath) {
|
|
38
|
+
const resolved = resolve(filePath);
|
|
39
|
+
if (existsSync(resolved)) return resolved;
|
|
40
|
+
for (const extension of [
|
|
41
|
+
".tsx",
|
|
42
|
+
".ts",
|
|
43
|
+
".jsx",
|
|
44
|
+
".js",
|
|
45
|
+
"/index.tsx",
|
|
46
|
+
"/index.ts"
|
|
47
|
+
]) {
|
|
48
|
+
const candidate = `${resolved}${extension}`;
|
|
49
|
+
if (existsSync(candidate)) return candidate;
|
|
50
|
+
}
|
|
51
|
+
return resolved;
|
|
52
|
+
}
|
|
29
53
|
//#endregion
|
|
30
|
-
export {
|
|
54
|
+
export { resolveExistingFilePath as n, toRealPath as r, isRelativeSpecifier as t };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/internal/utilities/jsx-static-literal.ts
|
|
2
|
+
function readStaticJsxLiteral(attr) {
|
|
3
|
+
if (!isObjectRecord(attr) || attr.type !== "JSXAttribute") return;
|
|
4
|
+
if (!("value" in attr) || attr.value == null) return true;
|
|
5
|
+
const directLiteral = readLiteralNodeValue(attr.value);
|
|
6
|
+
if (directLiteral !== void 0) return directLiteral;
|
|
7
|
+
if (!isObjectRecord(attr.value) || attr.value.type !== "JSXExpressionContainer") return;
|
|
8
|
+
return readLiteralNodeValue(attr.value.expression);
|
|
9
|
+
}
|
|
10
|
+
function readLiteralNodeValue(node) {
|
|
11
|
+
if (!isObjectRecord(node)) return;
|
|
12
|
+
if (node.type === "StringLiteral" || node.type === "NumericLiteral" || node.type === "BooleanLiteral") return isStaticLiteral(node.value) ? node.value : void 0;
|
|
13
|
+
if (node.type === "Literal") return isStaticLiteral(node.value) ? node.value : void 0;
|
|
14
|
+
if (node.type === "UnaryExpression" && node.operator === "-") {
|
|
15
|
+
const value = readLiteralNodeValue(node.argument);
|
|
16
|
+
return typeof value === "number" ? -value : void 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function isObjectRecord(value) {
|
|
20
|
+
return typeof value === "object" && value !== null;
|
|
21
|
+
}
|
|
22
|
+
function isStaticLiteral(value) {
|
|
23
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/internal/utilities/prop-usage.ts
|
|
27
|
+
const KNOWN_NON_ELEMENT_PROPS = new Set([
|
|
28
|
+
"className",
|
|
29
|
+
"style",
|
|
30
|
+
"as",
|
|
31
|
+
"ref",
|
|
32
|
+
"forwardedAs",
|
|
33
|
+
"key",
|
|
34
|
+
"children"
|
|
35
|
+
]);
|
|
36
|
+
function createComponentPropUsageInfo(name) {
|
|
37
|
+
return {
|
|
38
|
+
componentName: name,
|
|
39
|
+
usageCount: 0,
|
|
40
|
+
hasUnknownUsage: false,
|
|
41
|
+
props: {}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function mergeComponentPropUsage(info, usage) {
|
|
45
|
+
info.usageCount += 1;
|
|
46
|
+
if (usage.hasSpread) info.hasUnknownUsage = true;
|
|
47
|
+
const presentProps = new Set(Object.keys(usage.props));
|
|
48
|
+
for (const [propName, propInfo] of Object.entries(info.props)) if (!presentProps.has(propName)) propInfo.omittedCount += 1;
|
|
49
|
+
for (const [propName, value] of Object.entries(usage.props)) {
|
|
50
|
+
const propInfo = info.props[propName] ?? (info.props[propName] = {
|
|
51
|
+
values: [],
|
|
52
|
+
hasUnknown: false,
|
|
53
|
+
usageCount: 0,
|
|
54
|
+
omittedCount: info.usageCount - 1
|
|
55
|
+
});
|
|
56
|
+
propInfo.usageCount += 1;
|
|
57
|
+
if (value.kind === "unknown") {
|
|
58
|
+
propInfo.hasUnknown = true;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (!propInfo.values.some((existing) => existing === value.value)) propInfo.values.push(value.value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { readStaticJsxLiteral as i, createComponentPropUsageInfo as n, mergeComponentPropUsage as r, KNOWN_NON_ELEMENT_PROPS as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveBarrelReExport, n as fileImportsFrom, o as resolveBarrelReExportBinding, r as findImportSource, s as Logger, t as fileExports } from "./extract-external-interface-
|
|
2
|
-
import { n as extractStyledDefBasesFromAstProgram, r as extractStyledDefBasesFromSource, t as computeGlobalLeafKeys } from "./compute-leaf-set-
|
|
1
|
+
import { a as resolveBarrelReExport, n as fileImportsFrom, o as resolveBarrelReExportBinding, r as findImportSource, s as Logger, t as fileExports } from "./extract-external-interface-CvkkJZb1.mjs";
|
|
2
|
+
import { n as extractStyledDefBasesFromAstProgram, r as extractStyledDefBasesFromSource, t as computeGlobalLeafKeys } from "./compute-leaf-set-90UrZ9WP.mjs";
|
|
3
3
|
import { r as escapeRegex } from "./string-utils-DD9wdRHW.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
4
|
+
import { n as isTemplatePlaceholderInSelectorContext, r as PLACEHOLDER_RE, t as isSelectorContext } from "./selector-context-heuristic-LVizWWOR.mjs";
|
|
5
|
+
import { i as readStaticJsxLiteral, n as createComponentPropUsageInfo, r as mergeComponentPropUsage, t as KNOWN_NON_ELEMENT_PROPS } from "./prop-usage-Bz3z0V2F.mjs";
|
|
6
6
|
import { relative, resolve } from "node:path";
|
|
7
7
|
import { readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { execSync } from "node:child_process";
|
|
@@ -327,7 +327,7 @@ function findComponentSelectorLocalsFromNodes(templateNodes, styledImportName, c
|
|
|
327
327
|
for (const match of rawCss.matchAll(PLACEHOLDER_RE_G)) {
|
|
328
328
|
const exprIndex = Number(match[1]);
|
|
329
329
|
const pos = match.index;
|
|
330
|
-
if (
|
|
330
|
+
if (isTemplatePlaceholderInSelectorContext(rawCss, pos, match[0].length)) {
|
|
331
331
|
const expr = expressions[exprIndex];
|
|
332
332
|
if (expr?.type === "Identifier" && typeof expr.name === "string") selectorLocals.add(expr.name);
|
|
333
333
|
}
|
|
@@ -357,11 +357,6 @@ function isCssTag(tag, cssImportNames) {
|
|
|
357
357
|
if (!tag || !cssImportNames || cssImportNames.size === 0) return false;
|
|
358
358
|
return tag.type === "Identifier" && typeof tag.name === "string" && cssImportNames.has(tag.name);
|
|
359
359
|
}
|
|
360
|
-
/** Check if a placeholder at the given position is in a CSS selector context. */
|
|
361
|
-
function isPlaceholderInSelectorContext(rawCss, pos, length) {
|
|
362
|
-
const after = rawCss.slice(pos + length).trimStart();
|
|
363
|
-
return isSelectorContext(rawCss.slice(0, pos).trimEnd().replace(PLACEHOLDER_RE_G, "hover"), after);
|
|
364
|
-
}
|
|
365
360
|
/** Safely extract the name string from an AST identifier-like node. */
|
|
366
361
|
function getNodeName(node) {
|
|
367
362
|
if (!node || typeof node !== "object") return;
|
|
@@ -755,7 +750,7 @@ function isTypeScriptParser(parserName) {
|
|
|
755
750
|
}
|
|
756
751
|
async function loadTypeScriptAnalysis() {
|
|
757
752
|
try {
|
|
758
|
-
return await import("./typescript-analysis-
|
|
753
|
+
return await import("./typescript-analysis-C_25uBrt.mjs");
|
|
759
754
|
} catch (err) {
|
|
760
755
|
const message = err instanceof Error ? err.message : String(err);
|
|
761
756
|
if (message.includes("typescript") && (message.includes("Cannot find") || message.includes("ERR_MODULE_NOT_FOUND"))) throw new Error(["TypeScript parser runs require the optional `typescript` package for compiler metadata.", "Install TypeScript in the project (supported range: >=5.0.0 <6), or use a non-TypeScript parser."].join("\n"));
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { compile } from "stylis";
|
|
2
|
+
//#region src/internal/styled-css.ts
|
|
3
|
+
/** Matches `__SC_EXPR_N__` and captures the slot index in group 1. */
|
|
4
|
+
const PLACEHOLDER_RE = /__SC_EXPR_(\d+)__/;
|
|
5
|
+
function parseStyledTemplateLiteral(template) {
|
|
6
|
+
const parts = [];
|
|
7
|
+
const slots = [];
|
|
8
|
+
for (let i = 0; i < template.quasis.length; i++) {
|
|
9
|
+
const quasi = template.quasis[i];
|
|
10
|
+
parts.push(quasi.value.raw);
|
|
11
|
+
const expr = template.expressions[i];
|
|
12
|
+
if (!expr) continue;
|
|
13
|
+
const placeholder = makeInterpolationPlaceholder(i);
|
|
14
|
+
const startOffset = parts.join("").length;
|
|
15
|
+
parts.push(placeholder);
|
|
16
|
+
const endOffset = parts.join("").length;
|
|
17
|
+
slots.push({
|
|
18
|
+
index: i,
|
|
19
|
+
placeholder,
|
|
20
|
+
expression: expr,
|
|
21
|
+
startOffset,
|
|
22
|
+
endOffset
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const rawCss = parts.join("");
|
|
26
|
+
return {
|
|
27
|
+
rawCss,
|
|
28
|
+
slots,
|
|
29
|
+
stylisAst: compile(terminateStandaloneInterpolationStatements(rawCss))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function terminateStandaloneInterpolationStatements(css) {
|
|
33
|
+
let parenDepth = 0;
|
|
34
|
+
const lines = css.split(/(?<=\n)/);
|
|
35
|
+
const depthsBeforeLine = [];
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
depthsBeforeLine.push(parenDepth);
|
|
38
|
+
parenDepth = updateParenDepth(parenDepth, line);
|
|
39
|
+
}
|
|
40
|
+
return lines.map((line, index) => {
|
|
41
|
+
return depthsBeforeLine[index] === 0 && /^\s*__SC_EXPR_\d+__\s*$/.test(line) && isBeforeAtRule(lines, index) ? line.replace(/(\s*)$/, ";$1") : line;
|
|
42
|
+
}).join("");
|
|
43
|
+
}
|
|
44
|
+
function makeInterpolationPlaceholder(index) {
|
|
45
|
+
return `__SC_EXPR_${index}__`;
|
|
46
|
+
}
|
|
47
|
+
function isBeforeAtRule(lines, startIndex) {
|
|
48
|
+
for (let i = startIndex + 1; i < lines.length; i++) {
|
|
49
|
+
const trimmed = lines[i].trim();
|
|
50
|
+
if (!trimmed || /^__SC_EXPR_\d+__\s*;?$/.test(trimmed)) continue;
|
|
51
|
+
return trimmed.startsWith("@");
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
function updateParenDepth(startDepth, line) {
|
|
56
|
+
let depth = startDepth;
|
|
57
|
+
let inString = false;
|
|
58
|
+
for (let i = 0; i < line.length; i++) {
|
|
59
|
+
const ch = line[i];
|
|
60
|
+
if ((ch === "\"" || ch === "'") && line[i - 1] !== "\\") {
|
|
61
|
+
if (!inString) inString = ch;
|
|
62
|
+
else if (inString === ch) inString = false;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (inString) continue;
|
|
66
|
+
if (ch === "(") depth++;
|
|
67
|
+
else if (ch === ")") depth = Math.max(0, depth - 1);
|
|
68
|
+
}
|
|
69
|
+
return depth;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/internal/utilities/selector-context-heuristic.ts
|
|
73
|
+
/**
|
|
74
|
+
* Shared heuristic for determining whether a placeholder/expression is in a
|
|
75
|
+
* CSS selector context rather than a property value context.
|
|
76
|
+
*
|
|
77
|
+
* Used by both the prepass scanner (on reconstructed CSS with placeholders)
|
|
78
|
+
* and the consumer patcher (on raw TypeScript source).
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Given the text before and after a template expression, determine if the
|
|
82
|
+
* expression is in a CSS selector context (e.g. `${Foo} { ... }`) rather
|
|
83
|
+
* than a property value context (e.g. `color: ${Foo};`).
|
|
84
|
+
*
|
|
85
|
+
* Selector clues:
|
|
86
|
+
* - Followed by `{` → definitely a selector
|
|
87
|
+
* - `{` appears before next `;` without a value-separator colon → likely selector
|
|
88
|
+
*
|
|
89
|
+
* Value clues:
|
|
90
|
+
* - Preceded by `:` with no intervening `{`, `}`, or `;` → value context
|
|
91
|
+
* (but `:hover`, `:focus` etc. are pseudo-selectors, not values)
|
|
92
|
+
*/
|
|
93
|
+
function isSelectorContext(before, after) {
|
|
94
|
+
const lastSemiOrBrace = Math.max(before.lastIndexOf(";"), before.lastIndexOf("{"), before.lastIndexOf("}"));
|
|
95
|
+
const lastColon = before.lastIndexOf(":");
|
|
96
|
+
if (lastColon > lastSemiOrBrace) {
|
|
97
|
+
const colonContext = before.slice(lastColon).trim();
|
|
98
|
+
if (!/^:[a-z-]+/i.test(colonContext)) return false;
|
|
99
|
+
}
|
|
100
|
+
if (after.startsWith("{")) return true;
|
|
101
|
+
const afterUpToBrace = after.split("{")[0] ?? "";
|
|
102
|
+
const afterUpToSemi = after.split(";")[0] ?? "";
|
|
103
|
+
if (afterUpToBrace.length < afterUpToSemi.length) {
|
|
104
|
+
if (!/:\s|:$/.test(afterUpToBrace)) return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const TEMPLATE_PLACEHOLDER_RE = new RegExp(PLACEHOLDER_RE.source, "g");
|
|
109
|
+
function isTemplatePlaceholderInSelectorContext(rawCss, pos, length) {
|
|
110
|
+
const after = rawCss.slice(pos + length).trimStart();
|
|
111
|
+
return isSelectorContext(rawCss.slice(0, pos).trimEnd().replace(TEMPLATE_PLACEHOLDER_RE, "hover"), after);
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { terminateStandaloneInterpolationStatements as a, parseStyledTemplateLiteral as i, isTemplatePlaceholderInSelectorContext as n, PLACEHOLDER_RE as r, isSelectorContext as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as toRealPath } from "./path-utils-BC4U8X_q.mjs";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
//#region src/internal/public-api-validation.ts
|
|
4
4
|
function describeValue(value) {
|
|
@@ -148,7 +148,7 @@ function assertAdapterShape(candidate, where, allowAutoExtIf) {
|
|
|
148
148
|
"",
|
|
149
149
|
"Expected signature:",
|
|
150
150
|
" wrappedComponentInterface(ctx: { localName: string; importSource: string; importedName: string; filePath: string })",
|
|
151
|
-
" => { acceptsSx: boolean } | undefined"
|
|
151
|
+
" => { acceptsSx: boolean; sxAllowedProperties?: string[]; sxExcludedProperties?: string[] } | undefined"
|
|
152
152
|
].join("\n"));
|
|
153
153
|
const themeHook = obj?.themeHook;
|
|
154
154
|
if (themeHook !== null && themeHook !== void 0) {
|
|
@@ -377,7 +377,7 @@ interface ResolveBaseComponentContext {
|
|
|
377
377
|
importSource: string;
|
|
378
378
|
/**
|
|
379
379
|
* Imported binding name for the wrapped base component.
|
|
380
|
-
* Example: `import { Flex as
|
|
380
|
+
* Example: `import { Flex as DesignSystemFlex } ...` -> importedName: "Flex"
|
|
381
381
|
*/
|
|
382
382
|
importedName: string;
|
|
383
383
|
/**
|
|
@@ -606,6 +606,37 @@ interface WrappedComponentInterfaceContext {
|
|
|
606
606
|
*/
|
|
607
607
|
interface WrappedComponentInterfaceResult {
|
|
608
608
|
acceptsSx: boolean;
|
|
609
|
+
/**
|
|
610
|
+
* Which element receives the wrapped component's `sx` prop.
|
|
611
|
+
*
|
|
612
|
+
* Most components apply `sx` to their root. Some controls expose `sx` for an
|
|
613
|
+
* inner element while `className`/`style` still target the outer root. Mark
|
|
614
|
+
* those as `"inner"` so the codemod can reject root-only wrapper styles
|
|
615
|
+
* instead of moving layout styles onto the wrong element.
|
|
616
|
+
*/
|
|
617
|
+
sxTarget?: "root" | "inner";
|
|
618
|
+
/**
|
|
619
|
+
* StyleX property names that must stay on the wrapped component root when
|
|
620
|
+
* `sxTarget` is `"inner"`.
|
|
621
|
+
*/
|
|
622
|
+
rootOnlyProperties?: string[];
|
|
623
|
+
/**
|
|
624
|
+
* StyleX property names that the wrapped component's `sx` prop explicitly rejects.
|
|
625
|
+
*
|
|
626
|
+
* Some components accept `sx`, but narrow it with `StyleXStylesWithout<...>` to
|
|
627
|
+
* reserve properties that the component owns internally. The transform can still
|
|
628
|
+
* use `sx` if it rewrites generated styles away from those excluded properties.
|
|
629
|
+
*/
|
|
630
|
+
sxExcludedProperties?: string[];
|
|
631
|
+
/**
|
|
632
|
+
* StyleX property names that the wrapped component's `sx` prop accepts.
|
|
633
|
+
*
|
|
634
|
+
* Use this for components whose `sx` prop is intentionally narrower than a full
|
|
635
|
+
* `StyleXStyles` surface. When present, generated wrapper styles must use only
|
|
636
|
+
* these properties, or the codemod bails instead of sending unsupported reset
|
|
637
|
+
* styles through a weak/incorrect channel.
|
|
638
|
+
*/
|
|
639
|
+
sxAllowedProperties?: string[];
|
|
609
640
|
}
|
|
610
641
|
/**
|
|
611
642
|
* Configuration for a custom style merger function that combines stylex.props()
|
|
@@ -786,6 +817,7 @@ interface Adapter {
|
|
|
786
817
|
*
|
|
787
818
|
* Return:
|
|
788
819
|
* - `{ acceptsSx: true }` to force the `sx={...}` path
|
|
820
|
+
* (optionally with `sxAllowedProperties` / `sxExcludedProperties`)
|
|
789
821
|
* - `{ acceptsSx: false }` to force the `{...stylex.props(...)}` path
|
|
790
822
|
* - `undefined` to fall through to auto-detection (default)
|
|
791
823
|
*
|
|
@@ -921,7 +953,7 @@ declare function defineAdapter<T extends AdapterInput>(adapter: T): T;
|
|
|
921
953
|
//#endregion
|
|
922
954
|
//#region src/internal/logger.d.ts
|
|
923
955
|
type Severity = "info" | "warning" | "error";
|
|
924
|
-
type WarningType = "`css` helper function switch must return css templates in all branches" | "`css` helper usage as a function call (css(...)) is not supported" | "`css` helper used outside of a styled component template cannot be statically transformed" | "Adapter helper call in border interpolation did not resolve to a single CSS value" | "Adapter resolveCall returned an unparseable styles expression" | "Adapter resolveCall returned an unparseable value expression" | "Adapter resolveCall returned StyleX styles for helper call where a CSS value was expected" | "Adapter resolved an imported helper call as StyleX styles without replacing the RuleSet helper" | "Adapter resolveCall returned undefined for helper call" | "Adapter resolveBaseComponent threw an error" | "Adapter resolved StyleX styles cannot be applied under nested selectors/at-rules" | "Adapter resolved StyleX styles inside pseudo selector but did not provide cssText for property expansion — add cssText to resolveCall result to enable pseudo-wrapping" | 'Adapter resolveCall cssText could not be parsed as CSS declarations — expected semicolon-separated property: value pairs (e.g. "white-space: nowrap; overflow: hidden;")' | "Adapter resolveValue returned an unparseable value expression" | "Adapter resolveValue returned undefined for imported value" | "Arrow function: body is not a recognized pattern (expected ternary, logical, call, or member expression)" | "Arrow function: conditional branches could not be resolved to static or theme values" | "Arrow function: helper call body is not supported" | "Arrow function: indexed theme lookup pattern not matched" | "Arrow function: logical expression pattern not supported" | "Arrow function: prop access cannot be converted to style function for this CSS property" | "Arrow function: theme access path could not be resolved" | "Component selectors like `${OtherComponent}:hover &` are not directly representable in StyleX. Manual refactor is required" | "Conditional `css` block: !important is not supported in StyleX" | "Conditional `css` block: @-rules (e.g., @media, @supports) are not supported" | "CSS block contains unsupported at-rule (only @media and @container are supported; @supports, etc. require manual handling)" | "Conditional `css` block: dynamic interpolation could not be resolved to a single component prop" | "Conditional `css` block: failed to parse expression" | "Conditional `css` block: missing CSS property name" | "Conditional `css` block: missing interpolation expression" | "Conditional `css` block: mixed static/dynamic values with non-theme expressions cannot be safely transformed" | "Conditional `css` block: multiple interpolation slots in a single property value" | "Conditional `css` block: ternary branch value could not be resolved (imported values require adapter support)" | "Conditional `css` block: ternary expressions inside pseudo selectors are not supported" | "Conditional `css` block: media query interpolation must be a simple imported reference (expressions like `value + 1` are not supported)" | "Conditional `css` block: unsupported selector" | "Directional border helper styles are not supported" | "Multi-slot border interpolation could not be resolved" | "Resolved border helper value could not be expanded to longhand properties" | "Resolved conditional border variant could not be expanded to longhand properties" | "createGlobalStyle is not supported in StyleX. Global styles should be handled separately (e.g., in a CSS file or using CSS reset libraries)" | "Failed to parse theme expressions" | "Heterogeneous background values (mix of gradients and colors) not currently supported" | "Higher-order styled factory wrappers (e.g. hoc(styled)) are not supported" | "Imported CSS helper mixins: cannot determine inherited properties for correct pseudo selector handling" | "Local helper function returns CSS that cannot be decomposed into individual properties" | "Local helper function computes CSS values that cannot be statically traced to the component prop" | "Unsupported background shorthand: multiple components cannot be mapped to a single StyleX longhand" | "Styled-components specificity hacks like `&&` / `&&&` are not representable in StyleX" | "Theme-dependent block-level conditional could not be fully resolved (branches may contain dynamic interpolations)" | "Theme-dependant call expression could not be resolved (e.g. theme helper calls like theme.highlight() are not supported)" | "Theme value with fallback (props.theme.X ?? / || default) cannot be resolved statically — use adapter.resolveValue to map theme paths to StyleX tokens" | "Theme-dependent nested prop access requires a project-specific theme source (e.g. useTheme())" | "Theme-dependent template literals require a project-specific theme source (e.g. useTheme())" | "Theme prop overrides on styled components are not supported" | "Universal selectors (`*`) are currently unsupported" | "Unsupported call expression (expected imported helper(...) or imported helper(...)(...))" | "Unsupported conditional test in shouldForwardProp" | "Unsupported .attrs() callback pattern" | "Unsupported shouldForwardProp pattern (only !prop.startsWith(), ![].includes(prop), and prop !== are supported)" | "Unsupported interpolation: arrow function" | "Unsupported interpolation: call expression" | "Unsupported interpolation: identifier" | "Unsupported interpolation: member expression" | "Unsupported interpolation: property" | "Unsupported interpolation: unknown" | "Unsupported nested conditional interpolation" | "Unsupported prop-based inline style expression cannot be safely inlined" | "Unsupported prop-based inline style props.theme access is not supported" | "Unsupported selector interpolation: imported value in selector position" | "Unsupported: media query interpolation must be a simple imported reference (expressions like `value + 1` are not supported)" | "Unsupported selector: class selector" | "Unsupported selector: comma-separated selectors must all be simple pseudos or pseudo-elements" | "Unsupported selector: descendant pseudo selector (space before pseudo)" | "Unsupported selector: adjacent sibling combinator" | "Unsupported selector: descendant/child/sibling selector" | "Unsupported selector: conditional css block inside pseudo-element selector" | "Unsupported selector: interpolated pseudo selector" | "Unsupported selector: pseudo-class on pseudo-element selector" | "Unsupported selector: unsupported pseudo-element" | "Unsupported selector: sibling combinator" | "Unsupported selector: unresolved interpolation in sibling selector" | "Unsupported selector: ambiguous element selector" | "Unsupported selector: attribute selector on unsupported element" | "Unsupported selector: element selector on exported component" | "Unsupported selector: element selector with combined ancestor and child pseudos" | "Unsupported selector: element selector with dynamic children" | "Unsupported selector: element selector with plain intrinsic children" | "Unsupported selector: element selector pseudo collision" | "Unsupported selector: cross-file component selector target has no JSX usage in this file" | "Unsupported selector: unresolved interpolation in cross-file component selector" | "Unsupported selector: unresolved interpolation in descendant component selector" | "Unsupported selector: unresolved interpolation in attribute selector" | "Unsupported selector: unresolved interpolation in element selector" | "Unsupported selector: unresolved interpolation in reverse component selector" | "Unsupported selector: unresolved interpolation in cross-component sibling selector" | "Unsupported selector: grouped reverse selector references different components" | "Unsupported selector: computed media query inside ancestor attribute selector" | "Unsupported selector: computed media query inside cross-component sibling selector" | "Unsupported selector: computed media query inside sibling selector" | "Unsupported selector: computed media query inside :has() component selector" | "Unsupported selector: cross-file :has() component selector not yet supported" | "Unsupported selector: unresolved interpolation in :has() component selector" | "Unsupported selector: unknown component selector" | "Unsupported selector: component selector with child pseudo" | "Unsupported selector: component selector target has no patchable JSX usage under selector parent" | "Unsupported selector: compound pseudo selector" | "Unsupported css`` mixin: after-base mixin style is not a plain object" | "Unsupported css`` mixin: nested contextual conditions in after-base mixin" | "Unsupported css`` mixin: cannot infer base default for after-base contextual override (base value is non-literal)" | "css`` helper function interpolation references closure variable that cannot be hoisted" | "Using styled-components components as mixins is not supported; use css`` mixins or strings instead" | "styled(ImportedComponent) wraps a component whose file uses styled-components — convert the base component's file first to avoid CSS cascade conflicts" | "Partial transform would have a StyleX leaf wrap a styled-components base — the extending component was transformed but its base was not, so the leaf's StyleX overrides cannot reliably beat the base's styled-components styles" | "Transient $-prefixed props renamed on exported component — update consumer call sites to use the new prop names" | "Shorthand property has an opaque value that StyleX will expand to longhands — use `directional` in resolveValue to return separate longhand tokens" | "animation shorthand contains a var() with no classifiable fallback — its longhand position cannot be determined statically; bind the variable to a specific longhand (e.g. animation-duration: var(--x)) instead";
|
|
956
|
+
type WarningType = "`css` helper function switch must return css templates in all branches" | "`css` helper usage as a function call (css(...)) is not supported" | "`css` helper used outside of a styled component template cannot be statically transformed" | "Adapter helper call in border interpolation did not resolve to a single CSS value" | "Adapter resolveCall returned an unparseable styles expression" | "Adapter resolveCall returned an unparseable value expression" | "Adapter resolveCall returned StyleX styles for helper call where a CSS value was expected" | "Adapter resolved an imported helper call as StyleX styles without replacing the RuleSet helper" | "Adapter resolveCall returned undefined for helper call" | "Adapter resolveBaseComponent threw an error" | "Adapter resolved StyleX styles cannot be applied under nested selectors/at-rules" | "Adapter resolved StyleX styles inside pseudo selector but did not provide cssText for property expansion — add cssText to resolveCall result to enable pseudo-wrapping" | 'Adapter resolveCall cssText could not be parsed as CSS declarations — expected semicolon-separated property: value pairs (e.g. "white-space: nowrap; overflow: hidden;")' | "Adapter resolveValue returned an unparseable value expression" | "Adapter resolveValue returned undefined for imported value" | "Arrow function: body is not a recognized pattern (expected ternary, logical, call, or member expression)" | "Arrow function: conditional branches could not be resolved to static or theme values" | "Arrow function: helper call body is not supported" | "Arrow function: indexed theme lookup pattern not matched" | "Arrow function: logical expression pattern not supported" | "Arrow function: prop access cannot be converted to style function for this CSS property" | "Arrow function: theme access path could not be resolved" | "Component selectors like `${OtherComponent}:hover &` are not directly representable in StyleX. Manual refactor is required" | "Conditional `css` block: !important is not supported in StyleX" | "Conditional `css` block: unsupported or mixed @-rules require manual handling" | "CSS block contains unsupported at-rule (only @media, @container, and @supports are supported; mixed nested at-rules require manual handling)" | "Conditional `css` block: dynamic interpolation could not be resolved to a single component prop" | "Conditional `css` block: failed to parse expression" | "Conditional `css` block: missing CSS property name" | "Conditional `css` block: missing interpolation expression" | "Conditional `css` block: mixed static/dynamic values with non-theme expressions cannot be safely transformed" | "Conditional `css` block: multiple interpolation slots in a single property value" | "Conditional `css` block: ternary branch value could not be resolved (imported values require adapter support)" | "Conditional `css` block: ternary expressions inside pseudo selectors are not supported" | "Conditional `css` block: media query interpolation must be a simple imported reference (expressions like `value + 1` are not supported)" | "Conditional `css` block: unsupported selector" | "Directional border helper styles are not supported" | "Multi-slot border interpolation could not be resolved" | "Resolved border helper value could not be expanded to longhand properties" | "Resolved conditional border variant could not be expanded to longhand properties" | "createGlobalStyle is not supported in StyleX. Global styles should be handled separately (e.g., in a CSS file or using CSS reset libraries)" | "Failed to parse theme expressions" | "Heterogeneous background values (mix of gradients and colors) not currently supported" | "Higher-order styled factory wrappers (e.g. hoc(styled)) are not supported" | "Imported CSS helper mixins: cannot determine inherited properties for correct pseudo selector handling" | "Local helper function returns CSS that cannot be decomposed into individual properties" | "Local helper function computes CSS values that cannot be statically traced to the component prop" | "Unsupported background shorthand: multiple components cannot be mapped to a single StyleX longhand" | "Styled-components specificity hacks like `&&` / `&&&` are not representable in StyleX" | "Theme-dependent block-level conditional could not be fully resolved (branches may contain dynamic interpolations)" | "Theme-dependant call expression could not be resolved (e.g. theme helper calls like theme.highlight() are not supported)" | "Theme value with fallback (props.theme.X ?? / || default) cannot be resolved statically — use adapter.resolveValue to map theme paths to StyleX tokens" | "Theme-dependent nested prop access requires a project-specific theme source (e.g. useTheme())" | "Theme-dependent template literals require a project-specific theme source (e.g. useTheme())" | "Theme prop overrides on styled components are not supported" | "Universal selectors (`*`) are currently unsupported" | "Unsupported call expression (expected imported helper(...) or imported helper(...)(...))" | "Unsupported conditional test in shouldForwardProp" | "Unsupported .attrs() callback pattern" | "Unsupported shouldForwardProp pattern (only !prop.startsWith(), ![].includes(prop), and prop !== are supported)" | "Unsupported interpolation: arrow function" | "Unsupported interpolation: call expression" | "Unsupported interpolation: identifier" | "Unsupported interpolation: member expression" | "Unsupported interpolation: property" | "Unsupported interpolation: unknown" | `Unsupported CSS property "${string}" cannot be emitted in StyleX` | "Unsupported nested conditional interpolation" | "Unsupported prop-based inline style expression cannot be safely inlined" | "Unsupported prop-based inline style props.theme access is not supported" | "Unsupported selector interpolation: imported value in selector position" | "Unsupported: media query interpolation must be a simple imported reference (expressions like `value + 1` are not supported)" | "Unsupported selector: class selector" | "Unsupported selector: comma-separated selectors must all be simple pseudos or pseudo-elements" | "Unsupported selector: descendant pseudo selector (space before pseudo)" | "Unsupported selector: adjacent sibling combinator" | "Unsupported selector: descendant/child/sibling selector" | "Unsupported selector: conditional css block inside pseudo-element selector" | "Unsupported selector: interpolated pseudo selector" | "Unsupported selector: pseudo-class on pseudo-element selector" | "Unsupported selector: unsupported pseudo-element" | "Unsupported selector: sibling combinator" | "Unsupported selector: unresolved interpolation in sibling selector" | "Unsupported selector: ambiguous element selector" | "Unsupported selector: attribute selector on unsupported element" | "Unsupported selector: element selector on exported component" | "Unsupported selector: element selector with combined ancestor and child pseudos" | "Unsupported selector: element selector with dynamic children" | "Unsupported selector: element selector with plain intrinsic children" | "Unsupported selector: element selector pseudo collision" | "Unsupported selector: cross-file component selector target has no JSX usage in this file" | "Unsupported selector: unresolved interpolation in cross-file component selector" | "Unsupported selector: unresolved interpolation in descendant component selector" | "Unsupported selector: unresolved interpolation in attribute selector" | "Unsupported selector: unresolved interpolation in element selector" | "Unsupported selector: unresolved interpolation in reverse component selector" | "Unsupported selector: unresolved interpolation in cross-component sibling selector" | "Unsupported selector: grouped reverse selector references different components" | "Unsupported selector: computed media query inside ancestor attribute selector" | "Unsupported selector: computed media query inside cross-component sibling selector" | "Unsupported selector: computed media query inside sibling selector" | "Unsupported selector: computed media query inside :has() component selector" | "Unsupported selector: cross-file :has() component selector not yet supported" | "Unsupported selector: unresolved interpolation in :has() component selector" | "Unsupported selector: unknown component selector" | "Unsupported selector: component selector with child pseudo" | "Unsupported selector: component selector target has no patchable JSX usage under selector parent" | "Unsupported selector: compound pseudo selector" | "Unsupported css`` mixin: after-base mixin style is not a plain object" | "Unsupported css`` mixin: nested contextual conditions in after-base mixin" | "Unsupported css`` mixin: cannot infer base default for after-base contextual override (base value is non-literal)" | "css`` helper function interpolation references closure variable that cannot be hoisted" | "Using styled-components components as mixins is not supported; use css`` mixins or strings instead" | "styled(ImportedComponent) wraps a component whose file uses styled-components — convert the base component's file first to avoid CSS cascade conflicts" | "Partial transform would have a StyleX leaf wrap a styled-components base — the extending component was transformed but its base was not, so the leaf's StyleX overrides cannot reliably beat the base's styled-components styles" | "Conditional StyleX default would override an unproven earlier style for the same property" | "Forwarded sx conditional default would override an unproven wrapped component base style" | "Wrapped component does not accept className or sx for generated StyleX styles" | "Wrapped component sx prop targets an inner element for a root style property" | "Wrapped component sx prop rejects logical CSS properties that cannot be preserved losslessly" | "Wrapped component sx prop does not accept generated StyleX property" | "Transient $-prefixed props renamed on exported component — update consumer call sites to use the new prop names" | "Shorthand property has an opaque value that StyleX will expand to longhands — use `directional` in resolveValue to return separate longhand tokens" | "animation shorthand contains a var() with no classifiable fallback — its longhand position cannot be determined statically; bind the variable to a specific longhand (e.g. animation-duration: var(--x)) instead";
|
|
925
957
|
interface WarningLog {
|
|
926
958
|
severity: Severity;
|
|
927
959
|
type: WarningType;
|
|
@@ -958,6 +990,8 @@ interface TypeScriptComponentMetadata {
|
|
|
958
990
|
restProps: TypeScriptRestPropMetadata[];
|
|
959
991
|
hasIndexSignature: boolean;
|
|
960
992
|
supportsSxProp: boolean;
|
|
993
|
+
sxExcludedProperties: string[];
|
|
994
|
+
sxAllowedProperties?: string[];
|
|
961
995
|
}
|
|
962
996
|
interface TypeScriptFunctionMetadata {
|
|
963
997
|
name: string;
|
package/dist/transform.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as TransformResult, r as TransformOptions, t as BridgeComponentResult } from "./transform-types-
|
|
1
|
+
import { i as TransformResult, r as TransformOptions, t as BridgeComponentResult } from "./transform-types-Bshr_dBf.mjs";
|
|
2
2
|
import { API, FileInfo, Options } from "jscodeshift";
|
|
3
3
|
|
|
4
4
|
//#region src/transform.d.ts
|