styled-components-to-stylex-codemod 0.0.54 → 0.0.55
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/{ast-walk-CCXrDCKY.mjs → ast-walk-C226poBl.mjs} +17 -1
- package/dist/{compute-leaf-set-u51kTofH.mjs → compute-leaf-set-Cu4lMMQ9.mjs} +1 -4
- package/dist/index.mjs +4 -7
- package/dist/{prop-usage-DyWABApg.mjs → prop-usage-Bs2F3Wke.mjs} +1 -1
- package/dist/{run-prepass-DRjZWWHF.mjs → run-prepass-D3Ti1ryc.mjs} +4 -4
- package/dist/sx-surface-Cth8EesU.mjs +1280 -0
- package/dist/transform.mjs +36981 -37135
- package/dist/{typescript-analysis-CmIDxfLv.mjs → typescript-analysis-BLyx4wAJ.mjs} +475 -467
- package/package.json +1 -1
- package/dist/sx-surface-CEPFSTO1.mjs +0 -498
|
@@ -425,6 +425,22 @@ function getFileImportsFromRes(name) {
|
|
|
425
425
|
return cached;
|
|
426
426
|
}
|
|
427
427
|
//#endregion
|
|
428
|
+
//#region src/internal/utilities/default-export-name.ts
|
|
429
|
+
/**
|
|
430
|
+
* Regex helpers for inspecting a module's default export by source text.
|
|
431
|
+
*
|
|
432
|
+
* These operate on raw source strings (not the AST) so they can be shared by
|
|
433
|
+
* both prepass and transform-step layers without import-graph coupling.
|
|
434
|
+
*/
|
|
435
|
+
/**
|
|
436
|
+
* Returns the local name of a PascalCase default export, supporting both
|
|
437
|
+
* `export default Name` and `export { Name as default }` forms. Returns
|
|
438
|
+
* `undefined` when no PascalCase default export is found.
|
|
439
|
+
*/
|
|
440
|
+
function findDefaultExportedLocalName(source) {
|
|
441
|
+
return source.match(/\bexport\s+default\s+([A-Z][A-Za-z0-9]*)\b/)?.[1] ?? source.match(/\bexport\s*\{[^}]*\b([A-Z][A-Za-z0-9]*)\s+as\s+default\b[^}]*\}/)?.[1];
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
428
444
|
//#region src/internal/prepass/prepass-parser.ts
|
|
429
445
|
/**
|
|
430
446
|
* Shared babel parser for prepass modules.
|
|
@@ -547,4 +563,4 @@ function walkAst(root, visitor) {
|
|
|
547
563
|
visit(root);
|
|
548
564
|
}
|
|
549
565
|
//#endregion
|
|
550
|
-
export {
|
|
566
|
+
export { fileImportsFrom as a, resolveBarrelReExport as c, Logger as d, PARTIAL_MIGRATION_INCOMPLETE_WARNING as f, fileExports as i, resolveBarrelReExportBinding as l, createPrepassParser as n, findImportSource as o, UNSUPPORTED_SHOULD_FORWARD_PROP_WARNING as p, findDefaultExportedLocalName as r, getReExportedSourceName as s, walkAst as t, CASCADE_CONFLICT_WARNING as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as resolveBarrelReExportBinding, o as findImportSource, r as findDefaultExportedLocalName } from "./ast-walk-C226poBl.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:
|
|
@@ -235,8 +235,5 @@ function leafKeyExists(defFile, exportedName, allowDefaultFallback, cachedRead,
|
|
|
235
235
|
const defaultLocalName = findDefaultExportedLocalName(cachedRead(defFile));
|
|
236
236
|
return defaultLocalName ? globalLeaves.get(defFile)?.has(defaultLocalName) ?? false : false;
|
|
237
237
|
}
|
|
238
|
-
function findDefaultExportedLocalName(source) {
|
|
239
|
-
return source.match(/\bexport\s+default\s+([A-Z][A-Za-z0-9]*)\b/)?.[1] ?? source.match(/\bexport\s*\{[^}]*\b([A-Z][A-Za-z0-9]*)\s+as\s+default\b[^}]*\}/)?.[1];
|
|
240
|
-
}
|
|
241
238
|
//#endregion
|
|
242
239
|
export { extractStyledDefBasesFromAstProgram as n, extractStyledDefBasesFromSource as r, computeGlobalLeafKeys as t };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as extractStyledDefBasesFromSource } from "./compute-leaf-set-
|
|
1
|
+
import { $ as describeValue, Q as assertValidAdapterInput, Y as defineAdapter, q as mergeMarkerDeclarations, t as transformedComponentAcceptsSx, x as identifierName } from "./sx-surface-Cth8EesU.mjs";
|
|
2
|
+
import { c as resolveBarrelReExport, d as Logger, n as createPrepassParser, t as walkAst } from "./ast-walk-C226poBl.mjs";
|
|
3
|
+
import { r as extractStyledDefBasesFromSource } from "./compute-leaf-set-Cu4lMMQ9.mjs";
|
|
4
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";
|
|
@@ -156,9 +156,6 @@ function addMemberTarget(memberAssignments, object, property, target) {
|
|
|
156
156
|
}
|
|
157
157
|
targets.add(target);
|
|
158
158
|
}
|
|
159
|
-
function identifierName(node) {
|
|
160
|
-
return node?.type === "Identifier" && typeof node.name === "string" ? node.name : null;
|
|
161
|
-
}
|
|
162
159
|
function capitalizedIdentifierName(node) {
|
|
163
160
|
const name = identifierName(node);
|
|
164
161
|
return name && /^[A-Z]/.test(name) ? name : null;
|
|
@@ -325,7 +322,7 @@ async function runTransform(options) {
|
|
|
325
322
|
const { createModuleResolver } = await import("./resolve-imports-DgSAddIF.mjs").then((n) => n.n);
|
|
326
323
|
const sharedResolver = createModuleResolver();
|
|
327
324
|
filePaths = orderFilesByLocalImportDependencies(filePaths, sharedResolver, toRealPath);
|
|
328
|
-
const { runPrepass } = await import("./run-prepass-
|
|
325
|
+
const { runPrepass } = await import("./run-prepass-D3Ti1ryc.mjs");
|
|
329
326
|
const absoluteFiles = filePaths.map((f) => resolve(f));
|
|
330
327
|
const absoluteConsumers = consumerFilePaths.map((f) => resolve(f));
|
|
331
328
|
let prepassResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createPrepassParser } from "./ast-walk-
|
|
1
|
+
import { n as createPrepassParser } from "./ast-walk-C226poBl.mjs";
|
|
2
2
|
import { n as isTemplatePlaceholderInSelectorContext, r as PLACEHOLDER_RE } from "./selector-context-heuristic-LVizWWOR.mjs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import "node:fs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as extractStyledDefBasesFromAstProgram, r as extractStyledDefBasesFromSource, t as computeGlobalLeafKeys } from "./compute-leaf-set-
|
|
1
|
+
import { a as fileImportsFrom, c as resolveBarrelReExport, d as Logger, i as fileExports, l as resolveBarrelReExportBinding, n as createPrepassParser, o as findImportSource, t as walkAst } from "./ast-walk-C226poBl.mjs";
|
|
2
|
+
import { n as extractStyledDefBasesFromAstProgram, r as extractStyledDefBasesFromSource, t as computeGlobalLeafKeys } from "./compute-leaf-set-Cu4lMMQ9.mjs";
|
|
3
3
|
import { r as escapeRegex } from "./string-utils-Bo3cWgss.mjs";
|
|
4
4
|
import { t as isSelectorContext } from "./selector-context-heuristic-LVizWWOR.mjs";
|
|
5
|
-
import { _ as walkForImportsAndTemplates, a as mergeComponentPropUsage, c as BARE_TEMPLATE_IDENTIFIER_RE, d as categorizeSelectorUsages, f as collectStyledLocalBindingNames, g as findStyledImportNameFromNodes, h as findCssImportNamesFromNodes, l as applyBridgeFields, m as findComponentSelectorLocalsFromNodes, n as createComponentPropUsageInfo, o as readStaticJsxLiteral, p as deduplicateAndResolve, s as collectStylexExportNames, t as KNOWN_NON_ELEMENT_PROPS, u as buildImportMapFromNodes, v as addToSetMap } from "./prop-usage-
|
|
5
|
+
import { _ as walkForImportsAndTemplates, a as mergeComponentPropUsage, c as BARE_TEMPLATE_IDENTIFIER_RE, d as categorizeSelectorUsages, f as collectStyledLocalBindingNames, g as findStyledImportNameFromNodes, h as findCssImportNamesFromNodes, l as applyBridgeFields, m as findComponentSelectorLocalsFromNodes, n as createComponentPropUsageInfo, o as readStaticJsxLiteral, p as deduplicateAndResolve, s as collectStylexExportNames, t as KNOWN_NON_ELEMENT_PROPS, u as buildImportMapFromNodes, v as addToSetMap } from "./prop-usage-Bs2F3Wke.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";
|
|
@@ -381,7 +381,7 @@ function isTypeScriptParser(parserName) {
|
|
|
381
381
|
}
|
|
382
382
|
async function loadTypeScriptAnalysis() {
|
|
383
383
|
try {
|
|
384
|
-
return await import("./typescript-analysis-
|
|
384
|
+
return await import("./typescript-analysis-BLyx4wAJ.mjs");
|
|
385
385
|
} catch (err) {
|
|
386
386
|
const message = err instanceof Error ? err.message : String(err);
|
|
387
387
|
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"));
|