@sanity/ui-codemod 1.0.0-alpha.1
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/bin/run.js +5 -0
- package/dist/_chunks-es/addAttribute.js +11 -0
- package/dist/_chunks-es/addAttribute.js.map +1 -0
- package/dist/_chunks-es/box.mods.js +186 -0
- package/dist/_chunks-es/box.mods.js.map +1 -0
- package/dist/_chunks-es/flex.mods.js +74 -0
- package/dist/_chunks-es/flex.mods.js.map +1 -0
- package/dist/_chunks-es/getTransformPath.js +75 -0
- package/dist/_chunks-es/getTransformPath.js.map +1 -0
- package/dist/_chunks-es/grid.mods.js +110 -0
- package/dist/_chunks-es/grid.mods.js.map +1 -0
- package/dist/_chunks-es/layout-mods.js +424 -0
- package/dist/_chunks-es/layout-mods.js.map +1 -0
- package/dist/_chunks-es/transformComponent.js +359 -0
- package/dist/_chunks-es/transformComponent.js.map +1 -0
- package/dist/commands/latest/box.d.ts +47 -0
- package/dist/commands/latest/box.js +17 -0
- package/dist/commands/latest/box.js.map +1 -0
- package/dist/commands/latest/card.d.ts +47 -0
- package/dist/commands/latest/card.js +17 -0
- package/dist/commands/latest/card.js.map +1 -0
- package/dist/commands/latest/code.d.ts +47 -0
- package/dist/commands/latest/code.js +17 -0
- package/dist/commands/latest/code.js.map +1 -0
- package/dist/commands/latest/container.d.ts +47 -0
- package/dist/commands/latest/container.js +17 -0
- package/dist/commands/latest/container.js.map +1 -0
- package/dist/commands/latest/flex.d.ts +47 -0
- package/dist/commands/latest/flex.js +17 -0
- package/dist/commands/latest/flex.js.map +1 -0
- package/dist/commands/latest/grid.d.ts +47 -0
- package/dist/commands/latest/grid.js +17 -0
- package/dist/commands/latest/grid.js.map +1 -0
- package/dist/commands/latest/heading.d.ts +47 -0
- package/dist/commands/latest/heading.js +17 -0
- package/dist/commands/latest/heading.js.map +1 -0
- package/dist/commands/latest/text.d.ts +47 -0
- package/dist/commands/latest/text.js +17 -0
- package/dist/commands/latest/text.js.map +1 -0
- package/dist/transforms/latest/box/box.d.ts +18 -0
- package/dist/transforms/latest/box/box.js +101 -0
- package/dist/transforms/latest/box/box.js.map +1 -0
- package/dist/transforms/latest/card/card.d.ts +18 -0
- package/dist/transforms/latest/card/card.js +618 -0
- package/dist/transforms/latest/card/card.js.map +1 -0
- package/dist/transforms/latest/code/code.d.ts +18 -0
- package/dist/transforms/latest/code/code.js +73 -0
- package/dist/transforms/latest/code/code.js.map +1 -0
- package/dist/transforms/latest/container/container.d.ts +18 -0
- package/dist/transforms/latest/container/container.js +91 -0
- package/dist/transforms/latest/container/container.js.map +1 -0
- package/dist/transforms/latest/flex/flex.d.ts +18 -0
- package/dist/transforms/latest/flex/flex.js +19 -0
- package/dist/transforms/latest/flex/flex.js.map +1 -0
- package/dist/transforms/latest/grid/grid.d.ts +18 -0
- package/dist/transforms/latest/grid/grid.js +19 -0
- package/dist/transforms/latest/grid/grid.js.map +1 -0
- package/dist/transforms/latest/heading/heading.d.ts +18 -0
- package/dist/transforms/latest/heading/heading.js +85 -0
- package/dist/transforms/latest/heading/heading.js.map +1 -0
- package/dist/transforms/latest/text/text.d.ts +18 -0
- package/dist/transforms/latest/text/text.js +88 -0
- package/dist/transforms/latest/text/text.js.map +1 -0
- package/package.json +68 -0
- package/src/baseCommand.ts +74 -0
- package/src/commands/latest/box.ts +21 -0
- package/src/commands/latest/card.ts +21 -0
- package/src/commands/latest/code.ts +21 -0
- package/src/commands/latest/container.ts +21 -0
- package/src/commands/latest/flex.ts +21 -0
- package/src/commands/latest/grid.ts +21 -0
- package/src/commands/latest/heading.ts +21 -0
- package/src/commands/latest/inline.ts +21 -0
- package/src/commands/latest/label.ts +21 -0
- package/src/commands/latest/stack.ts +21 -0
- package/src/commands/latest/text.ts +21 -0
- package/src/constants/latest/layout-mods.ts +422 -0
- package/src/transforms/latest/box/box.mods.ts +88 -0
- package/src/transforms/latest/box/box.test.ts +204 -0
- package/src/transforms/latest/box/box.ts +104 -0
- package/src/transforms/latest/card/card.mods.ts +592 -0
- package/src/transforms/latest/card/card.test.ts +207 -0
- package/src/transforms/latest/card/card.ts +71 -0
- package/src/transforms/latest/code/code.mods.ts +57 -0
- package/src/transforms/latest/code/code.test.ts +61 -0
- package/src/transforms/latest/code/code.ts +53 -0
- package/src/transforms/latest/container/container.mods.ts +77 -0
- package/src/transforms/latest/container/container.test.ts +105 -0
- package/src/transforms/latest/container/container.ts +42 -0
- package/src/transforms/latest/flex/flex.mods.ts +73 -0
- package/src/transforms/latest/flex/flex.test.ts +80 -0
- package/src/transforms/latest/flex/flex.ts +42 -0
- package/src/transforms/latest/grid/grid.mods.ts +109 -0
- package/src/transforms/latest/grid/grid.test.ts +97 -0
- package/src/transforms/latest/grid/grid.ts +42 -0
- package/src/transforms/latest/heading/heading.mods.ts +70 -0
- package/src/transforms/latest/heading/heading.test.ts +87 -0
- package/src/transforms/latest/heading/heading.ts +53 -0
- package/src/transforms/latest/inline/inline.mods.ts +65 -0
- package/src/transforms/latest/inline/inline.test.ts +57 -0
- package/src/transforms/latest/inline/inline.ts +42 -0
- package/src/transforms/latest/label/label.mods.ts +72 -0
- package/src/transforms/latest/label/label.test.ts +113 -0
- package/src/transforms/latest/label/label.ts +67 -0
- package/src/transforms/latest/stack/stack.mods.ts +12 -0
- package/src/transforms/latest/stack/stack.test.ts +160 -0
- package/src/transforms/latest/stack/stack.ts +102 -0
- package/src/transforms/latest/text/text.mods.ts +72 -0
- package/src/transforms/latest/text/text.test.ts +113 -0
- package/src/transforms/latest/text/text.ts +57 -0
- package/src/types/AnyExpression.ts +9 -0
- package/src/types/AttributeMods.ts +16 -0
- package/src/types/BaseOptions.ts +6 -0
- package/src/utils/addAttribute.test.ts +43 -0
- package/src/utils/addAttribute.ts +26 -0
- package/src/utils/addImportSpecifier.test.ts +36 -0
- package/src/utils/addImportSpecifier.ts +42 -0
- package/src/utils/getAttribute.ts +22 -0
- package/src/utils/getAttributeExpression.ts +22 -0
- package/src/utils/getAttributeValue.ts +20 -0
- package/src/utils/getClonedImportSpecifiers.ts +29 -0
- package/src/utils/getComponentJsxNames.ts +17 -0
- package/src/utils/getComponentLocalNames.ts +69 -0
- package/src/utils/getCompositeAttrValue.ts +39 -0
- package/src/utils/getMappingArray.ts +36 -0
- package/src/utils/getMappingExpression.ts +22 -0
- package/src/utils/getMappingValue.ts +52 -0
- package/src/utils/getShorthandAttributes.ts +54 -0
- package/src/utils/getSplitImportSpecifiers.ts +40 -0
- package/src/utils/getStaticAttributeExpression.ts +35 -0
- package/src/utils/getStyleExpression.ts +37 -0
- package/src/utils/getStyledComponentAliases.ts +28 -0
- package/src/utils/getStyledComponentName.ts +52 -0
- package/src/utils/getTransformPath.ts +17 -0
- package/src/utils/insertTodoWarning.ts +48 -0
- package/src/utils/isImportBindingUsed.ts +53 -0
- package/src/utils/isValidStyleType.ts +21 -0
- package/src/utils/mergeStyle.ts +64 -0
- package/src/utils/removeUnusedImport.test.ts +77 -0
- package/src/utils/removeUnusedImport.ts +57 -0
- package/src/utils/replaceElement.test.ts +181 -0
- package/src/utils/replaceElement.ts +106 -0
- package/src/utils/replaceStyledComponent.test.ts +57 -0
- package/src/utils/replaceStyledComponent.ts +60 -0
- package/src/utils/shouldTransformComponent.test.ts +61 -0
- package/src/utils/shouldTransformComponent.ts +40 -0
- package/src/utils/testUtils.ts +54 -0
- package/src/utils/transformAttributes.test.ts +544 -0
- package/src/utils/transformAttributes.ts +248 -0
- package/src/utils/transformComponent.test.ts +45 -0
- package/src/utils/transformComponent.ts +31 -0
- package/src/utils/transformImport.test.ts +175 -0
- package/src/utils/transformImport.ts +55 -0
- package/src/utils/transformImportAlias.test.ts +40 -0
- package/src/utils/transformImportAlias.ts +49 -0
- package/src/utils/transformStyledComponents.test.ts +172 -0
- package/src/utils/transformStyledComponents.ts +58 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { Interfaces } from "@oclif/core";
|
|
3
|
+
|
|
4
|
+
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
5
|
+
T["args"]
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
9
|
+
static baseFlags: {
|
|
10
|
+
paths: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
11
|
+
fromPackage: Interfaces.OptionFlag<
|
|
12
|
+
string | undefined,
|
|
13
|
+
Interfaces.CustomOptions
|
|
14
|
+
>;
|
|
15
|
+
toPackage: Interfaces.OptionFlag<
|
|
16
|
+
string | undefined,
|
|
17
|
+
Interfaces.CustomOptions
|
|
18
|
+
>;
|
|
19
|
+
extensions: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
20
|
+
dry: Interfaces.BooleanFlag<boolean>;
|
|
21
|
+
print: Interfaces.BooleanFlag<boolean>;
|
|
22
|
+
verbose: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected flags: Flags<T>;
|
|
25
|
+
protected args: Args<T>;
|
|
26
|
+
static examples: string[];
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
protected catch(
|
|
29
|
+
err: Error & {
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
},
|
|
32
|
+
): Promise<unknown>;
|
|
33
|
+
protected finally(_: Error | undefined): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @public */
|
|
37
|
+
declare class Container extends BaseCommand<typeof Container> {
|
|
38
|
+
static description: string;
|
|
39
|
+
run(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export default Container;
|
|
42
|
+
|
|
43
|
+
declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
44
|
+
(typeof BaseCommand)["baseFlags"] & T["flags"]
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { run } from "jscodeshift/src/Runner.js";
|
|
2
|
+
import { BaseCommand, getTransformPath } from "../../_chunks-es/getTransformPath.js";
|
|
3
|
+
class Container extends BaseCommand {
|
|
4
|
+
static description = "Transform Container component";
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(Container), { paths, ...restFlags } = flags, transformPath = getTransformPath(this.config.root, "latest", "container");
|
|
7
|
+
await run(transformPath, paths, {
|
|
8
|
+
babel: !0,
|
|
9
|
+
parser: "tsx",
|
|
10
|
+
...restFlags
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Container as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sources":["../../../src/commands/latest/container.ts"],"sourcesContent":["import {run} from 'jscodeshift/src/Runner.js'\n\nimport {BaseCommand} from '../../baseCommand'\nimport {getTransformPath} from '../../utils/getTransformPath'\n\n/** @public */\nexport default class Container extends BaseCommand<typeof Container> {\n static override description = 'Transform Container component'\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(Container)\n const {paths, ...restFlags} = flags\n const transformPath = getTransformPath(this.config.root, 'latest', 'container')\n\n await run(transformPath, paths, {\n babel: true,\n parser: 'tsx',\n ...restFlags,\n })\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAqB,kBAAkB,YAA8B;AAAA,EACnE,OAAgB,cAAc;AAAA,EAE9B,MAAa,MAAqB;AAChC,UAAM,EAAC,UAAS,MAAM,KAAK,MAAM,SAAS,GACpC,EAAC,OAAO,GAAG,UAAA,IAAa,OACxB,gBAAgB,iBAAiB,KAAK,OAAO,MAAM,UAAU,WAAW;AAE9E,UAAM,IAAI,eAAe,OAAO;AAAA,MAC9B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { Interfaces } from "@oclif/core";
|
|
3
|
+
|
|
4
|
+
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
5
|
+
T["args"]
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
9
|
+
static baseFlags: {
|
|
10
|
+
paths: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
11
|
+
fromPackage: Interfaces.OptionFlag<
|
|
12
|
+
string | undefined,
|
|
13
|
+
Interfaces.CustomOptions
|
|
14
|
+
>;
|
|
15
|
+
toPackage: Interfaces.OptionFlag<
|
|
16
|
+
string | undefined,
|
|
17
|
+
Interfaces.CustomOptions
|
|
18
|
+
>;
|
|
19
|
+
extensions: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
20
|
+
dry: Interfaces.BooleanFlag<boolean>;
|
|
21
|
+
print: Interfaces.BooleanFlag<boolean>;
|
|
22
|
+
verbose: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected flags: Flags<T>;
|
|
25
|
+
protected args: Args<T>;
|
|
26
|
+
static examples: string[];
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
protected catch(
|
|
29
|
+
err: Error & {
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
},
|
|
32
|
+
): Promise<unknown>;
|
|
33
|
+
protected finally(_: Error | undefined): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
37
|
+
(typeof BaseCommand)["baseFlags"] & T["flags"]
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
/** @public */
|
|
41
|
+
declare class Flex extends BaseCommand<typeof Flex> {
|
|
42
|
+
static description: string;
|
|
43
|
+
run(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export default Flex;
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { run } from "jscodeshift/src/Runner.js";
|
|
2
|
+
import { BaseCommand, getTransformPath } from "../../_chunks-es/getTransformPath.js";
|
|
3
|
+
class Flex extends BaseCommand {
|
|
4
|
+
static description = "Transform Flex component";
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(Flex), { paths, ...restFlags } = flags, transformPath = getTransformPath(this.config.root, "latest", "flex");
|
|
7
|
+
await run(transformPath, paths, {
|
|
8
|
+
babel: !0,
|
|
9
|
+
parser: "tsx",
|
|
10
|
+
...restFlags
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Flex as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.js","sources":["../../../src/commands/latest/flex.ts"],"sourcesContent":["import {run} from 'jscodeshift/src/Runner.js'\n\nimport {BaseCommand} from '../../baseCommand'\nimport {getTransformPath} from '../../utils/getTransformPath'\n\n/** @public */\nexport default class Flex extends BaseCommand<typeof Flex> {\n static override description = 'Transform Flex component'\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(Flex)\n const {paths, ...restFlags} = flags\n const transformPath = getTransformPath(this.config.root, 'latest', 'flex')\n\n await run(transformPath, paths, {\n babel: true,\n parser: 'tsx',\n ...restFlags,\n })\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAqB,aAAa,YAAyB;AAAA,EACzD,OAAgB,cAAc;AAAA,EAE9B,MAAa,MAAqB;AAChC,UAAM,EAAC,UAAS,MAAM,KAAK,MAAM,IAAI,GAC/B,EAAC,OAAO,GAAG,UAAA,IAAa,OACxB,gBAAgB,iBAAiB,KAAK,OAAO,MAAM,UAAU,MAAM;AAEzE,UAAM,IAAI,eAAe,OAAO;AAAA,MAC9B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { Interfaces } from "@oclif/core";
|
|
3
|
+
|
|
4
|
+
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
5
|
+
T["args"]
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
9
|
+
static baseFlags: {
|
|
10
|
+
paths: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
11
|
+
fromPackage: Interfaces.OptionFlag<
|
|
12
|
+
string | undefined,
|
|
13
|
+
Interfaces.CustomOptions
|
|
14
|
+
>;
|
|
15
|
+
toPackage: Interfaces.OptionFlag<
|
|
16
|
+
string | undefined,
|
|
17
|
+
Interfaces.CustomOptions
|
|
18
|
+
>;
|
|
19
|
+
extensions: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
20
|
+
dry: Interfaces.BooleanFlag<boolean>;
|
|
21
|
+
print: Interfaces.BooleanFlag<boolean>;
|
|
22
|
+
verbose: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected flags: Flags<T>;
|
|
25
|
+
protected args: Args<T>;
|
|
26
|
+
static examples: string[];
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
protected catch(
|
|
29
|
+
err: Error & {
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
},
|
|
32
|
+
): Promise<unknown>;
|
|
33
|
+
protected finally(_: Error | undefined): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
37
|
+
(typeof BaseCommand)["baseFlags"] & T["flags"]
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
/** @public */
|
|
41
|
+
declare class Grid extends BaseCommand<typeof Grid> {
|
|
42
|
+
static description: string;
|
|
43
|
+
run(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export default Grid;
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { run } from "jscodeshift/src/Runner.js";
|
|
2
|
+
import { BaseCommand, getTransformPath } from "../../_chunks-es/getTransformPath.js";
|
|
3
|
+
class Grid extends BaseCommand {
|
|
4
|
+
static description = "Transform Grid component";
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(Grid), { paths, ...restFlags } = flags, transformPath = getTransformPath(this.config.root, "latest", "grid");
|
|
7
|
+
await run(transformPath, paths, {
|
|
8
|
+
babel: !0,
|
|
9
|
+
parser: "tsx",
|
|
10
|
+
...restFlags
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Grid as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","sources":["../../../src/commands/latest/grid.ts"],"sourcesContent":["import {run} from 'jscodeshift/src/Runner.js'\n\nimport {BaseCommand} from '../../baseCommand'\nimport {getTransformPath} from '../../utils/getTransformPath'\n\n/** @public */\nexport default class Grid extends BaseCommand<typeof Grid> {\n static override description = 'Transform Grid component'\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(Grid)\n const {paths, ...restFlags} = flags\n const transformPath = getTransformPath(this.config.root, 'latest', 'grid')\n\n await run(transformPath, paths, {\n babel: true,\n parser: 'tsx',\n ...restFlags,\n })\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAqB,aAAa,YAAyB;AAAA,EACzD,OAAgB,cAAc;AAAA,EAE9B,MAAa,MAAqB;AAChC,UAAM,EAAC,UAAS,MAAM,KAAK,MAAM,IAAI,GAC/B,EAAC,OAAO,GAAG,UAAA,IAAa,OACxB,gBAAgB,iBAAiB,KAAK,OAAO,MAAM,UAAU,MAAM;AAEzE,UAAM,IAAI,eAAe,OAAO;AAAA,MAC9B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { Interfaces } from "@oclif/core";
|
|
3
|
+
|
|
4
|
+
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
5
|
+
T["args"]
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
9
|
+
static baseFlags: {
|
|
10
|
+
paths: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
11
|
+
fromPackage: Interfaces.OptionFlag<
|
|
12
|
+
string | undefined,
|
|
13
|
+
Interfaces.CustomOptions
|
|
14
|
+
>;
|
|
15
|
+
toPackage: Interfaces.OptionFlag<
|
|
16
|
+
string | undefined,
|
|
17
|
+
Interfaces.CustomOptions
|
|
18
|
+
>;
|
|
19
|
+
extensions: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
20
|
+
dry: Interfaces.BooleanFlag<boolean>;
|
|
21
|
+
print: Interfaces.BooleanFlag<boolean>;
|
|
22
|
+
verbose: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected flags: Flags<T>;
|
|
25
|
+
protected args: Args<T>;
|
|
26
|
+
static examples: string[];
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
protected catch(
|
|
29
|
+
err: Error & {
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
},
|
|
32
|
+
): Promise<unknown>;
|
|
33
|
+
protected finally(_: Error | undefined): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
37
|
+
(typeof BaseCommand)["baseFlags"] & T["flags"]
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
/** @public */
|
|
41
|
+
declare class Heading extends BaseCommand<typeof Heading> {
|
|
42
|
+
static description: string;
|
|
43
|
+
run(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export default Heading;
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { run } from "jscodeshift/src/Runner.js";
|
|
2
|
+
import { BaseCommand, getTransformPath } from "../../_chunks-es/getTransformPath.js";
|
|
3
|
+
class Heading extends BaseCommand {
|
|
4
|
+
static description = "Transform Heading component";
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(Heading), { paths, ...restFlags } = flags, transformPath = getTransformPath(this.config.root, "latest", "heading");
|
|
7
|
+
await run(transformPath, paths, {
|
|
8
|
+
babel: !0,
|
|
9
|
+
parser: "tsx",
|
|
10
|
+
...restFlags
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Heading as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.js","sources":["../../../src/commands/latest/heading.ts"],"sourcesContent":["import {run} from 'jscodeshift/src/Runner.js'\n\nimport {BaseCommand} from '../../baseCommand'\nimport {getTransformPath} from '../../utils/getTransformPath'\n\n/** @public */\nexport default class Heading extends BaseCommand<typeof Heading> {\n static override description = 'Transform Heading component'\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(Heading)\n const {paths, ...restFlags} = flags\n const transformPath = getTransformPath(this.config.root, 'latest', 'heading')\n\n await run(transformPath, paths, {\n babel: true,\n parser: 'tsx',\n ...restFlags,\n })\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAqB,gBAAgB,YAA4B;AAAA,EAC/D,OAAgB,cAAc;AAAA,EAE9B,MAAa,MAAqB;AAChC,UAAM,EAAC,UAAS,MAAM,KAAK,MAAM,OAAO,GAClC,EAAC,OAAO,GAAG,UAAA,IAAa,OACxB,gBAAgB,iBAAiB,KAAK,OAAO,MAAM,UAAU,SAAS;AAE5E,UAAM,IAAI,eAAe,OAAO;AAAA,MAC9B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { Interfaces } from "@oclif/core";
|
|
3
|
+
|
|
4
|
+
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
5
|
+
T["args"]
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
9
|
+
static baseFlags: {
|
|
10
|
+
paths: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
11
|
+
fromPackage: Interfaces.OptionFlag<
|
|
12
|
+
string | undefined,
|
|
13
|
+
Interfaces.CustomOptions
|
|
14
|
+
>;
|
|
15
|
+
toPackage: Interfaces.OptionFlag<
|
|
16
|
+
string | undefined,
|
|
17
|
+
Interfaces.CustomOptions
|
|
18
|
+
>;
|
|
19
|
+
extensions: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
20
|
+
dry: Interfaces.BooleanFlag<boolean>;
|
|
21
|
+
print: Interfaces.BooleanFlag<boolean>;
|
|
22
|
+
verbose: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
protected flags: Flags<T>;
|
|
25
|
+
protected args: Args<T>;
|
|
26
|
+
static examples: string[];
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
protected catch(
|
|
29
|
+
err: Error & {
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
},
|
|
32
|
+
): Promise<unknown>;
|
|
33
|
+
protected finally(_: Error | undefined): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
37
|
+
(typeof BaseCommand)["baseFlags"] & T["flags"]
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
/** @public */
|
|
41
|
+
declare class Text_2 extends BaseCommand<typeof Text_2> {
|
|
42
|
+
static description: string;
|
|
43
|
+
run(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export default Text_2;
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { run } from "jscodeshift/src/Runner.js";
|
|
2
|
+
import { BaseCommand, getTransformPath } from "../../_chunks-es/getTransformPath.js";
|
|
3
|
+
class Text extends BaseCommand {
|
|
4
|
+
static description = "Transform Text component";
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(Text), { paths, ...restFlags } = flags, transformPath = getTransformPath(this.config.root, "latest", "text");
|
|
7
|
+
await run(transformPath, paths, {
|
|
8
|
+
babel: !0,
|
|
9
|
+
parser: "tsx",
|
|
10
|
+
...restFlags
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Text as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sources":["../../../src/commands/latest/text.ts"],"sourcesContent":["import {run} from 'jscodeshift/src/Runner.js'\n\nimport {BaseCommand} from '../../baseCommand'\nimport {getTransformPath} from '../../utils/getTransformPath'\n\n/** @public */\nexport default class Text extends BaseCommand<typeof Text> {\n static override description = 'Transform Text component'\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(Text)\n const {paths, ...restFlags} = flags\n const transformPath = getTransformPath(this.config.root, 'latest', 'text')\n\n await run(transformPath, paths, {\n babel: true,\n parser: 'tsx',\n ...restFlags,\n })\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAqB,aAAa,YAAyB;AAAA,EACzD,OAAgB,cAAc;AAAA,EAE9B,MAAa,MAAqB;AAChC,UAAM,EAAC,UAAS,MAAM,KAAK,MAAM,IAAI,GAC/B,EAAC,OAAO,GAAG,UAAA,IAAa,OACxB,gBAAgB,iBAAiB,KAAK,OAAO,MAAM,UAAU,MAAM;AAEzE,UAAM,IAAI,eAAe,OAAO;AAAA,MAC9B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { API } from "jscodeshift";
|
|
2
|
+
import { FileInfo } from "jscodeshift";
|
|
3
|
+
import type { Options } from "jscodeshift";
|
|
4
|
+
|
|
5
|
+
declare interface BaseOptions extends Options {
|
|
6
|
+
fromPackage?: string;
|
|
7
|
+
toPackage?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** @internal */
|
|
11
|
+
declare function transform(
|
|
12
|
+
fileInfo: FileInfo,
|
|
13
|
+
api: API,
|
|
14
|
+
options?: BaseOptions,
|
|
15
|
+
): string | undefined;
|
|
16
|
+
export default transform;
|
|
17
|
+
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import "jscodeshift";
|
|
2
|
+
import { insertTodoWarning, transformComponent, getComponentLocalNames, shouldTransformComponent, transformImport, transformAttributes, getStaticAttributeExpression } from "../../../_chunks-es/transformComponent.js";
|
|
3
|
+
import { replaceElement, BOX_MODS } from "../../../_chunks-es/box.mods.js";
|
|
4
|
+
import { FLEX_MODS } from "../../../_chunks-es/flex.mods.js";
|
|
5
|
+
import { GRID_MODS } from "../../../_chunks-es/grid.mods.js";
|
|
6
|
+
function getStyledComponentName(node) {
|
|
7
|
+
if (!node || typeof node != "object" || !("type" in node))
|
|
8
|
+
return null;
|
|
9
|
+
const current = node;
|
|
10
|
+
if (current.type === "TaggedTemplateExpression")
|
|
11
|
+
return getStyledComponentName(current.tag);
|
|
12
|
+
if (current.type === "CallExpression") {
|
|
13
|
+
const callee = current.callee;
|
|
14
|
+
if (callee && typeof callee == "object" && "type" in callee && callee.type === "Identifier" && "name" in callee && callee.name === "styled") {
|
|
15
|
+
const arg = current.arguments?.[0];
|
|
16
|
+
return arg && typeof arg == "object" && "type" in arg && arg.type === "Identifier" && "name" in arg ? arg.name : null;
|
|
17
|
+
}
|
|
18
|
+
return getStyledComponentName(callee);
|
|
19
|
+
}
|
|
20
|
+
return current.type === "MemberExpression" && current.object ? getStyledComponentName(current.object) : null;
|
|
21
|
+
}
|
|
22
|
+
function getStyledComponentAliases(j, root, localNames) {
|
|
23
|
+
const aliases = /* @__PURE__ */ new Set(), names = new Set(localNames);
|
|
24
|
+
return root.find(j.VariableDeclarator).forEach((path) => {
|
|
25
|
+
const { id, init } = path.node;
|
|
26
|
+
if (!init || id.type !== "Identifier")
|
|
27
|
+
return;
|
|
28
|
+
const baseComponent = getStyledComponentName(init);
|
|
29
|
+
baseComponent && names.has(baseComponent) && aliases.add(id.name);
|
|
30
|
+
}), aliases;
|
|
31
|
+
}
|
|
32
|
+
const DEFAULT_WARNING = "Please double check styled-component migration(s) below";
|
|
33
|
+
function transformStyledComponents(j, root, aliases, filter, options = {}) {
|
|
34
|
+
const names = new Set(aliases), { callback, warning = DEFAULT_WARNING } = options, aliasesToWarn = /* @__PURE__ */ new Set();
|
|
35
|
+
let hasChanges = !1;
|
|
36
|
+
return root.find(j.JSXOpeningElement).forEach((path) => {
|
|
37
|
+
const name = path.node.name;
|
|
38
|
+
if (name.type !== "JSXIdentifier" || !names.has(name.name))
|
|
39
|
+
return;
|
|
40
|
+
const attrs = path.node.attributes ?? [];
|
|
41
|
+
filter(attrs) || aliasesToWarn.add(name.name), filter(attrs) && callback?.(path) && (hasChanges = !0);
|
|
42
|
+
}), root.find(j.VariableDeclarator).forEach((path) => {
|
|
43
|
+
const { id } = path.node;
|
|
44
|
+
id.type === "Identifier" && aliasesToWarn.has(id.name) && insertTodoWarning(j, path, warning) && (hasChanges = !0);
|
|
45
|
+
}), hasChanges;
|
|
46
|
+
}
|
|
47
|
+
const BOX_TODO_WARNING = "Please double check the Box migration below", FLEX_TODO_WARNING = "Please double check the Flex migration below", GRID_TODO_WARNING = "Please double check the Grid migration below", STYLED_TODO_WARNING = "Please double check styled(Box) migration(s) below";
|
|
48
|
+
function transform(fileInfo, api, options) {
|
|
49
|
+
const { fromPackage, toPackage } = options || {};
|
|
50
|
+
return transformComponent(fileInfo, api, ({ j, root, markChanged }) => {
|
|
51
|
+
const localNames = getComponentLocalNames(j, root, "Box", options), styledAliases = getStyledComponentAliases(j, root, localNames);
|
|
52
|
+
if (!shouldTransformComponent(j, root, "Box", localNames, options))
|
|
53
|
+
return;
|
|
54
|
+
const replaceWithFlex = (attrs) => {
|
|
55
|
+
const display = getStaticAttributeExpression(j, attrs, "display");
|
|
56
|
+
return display === "flex" || display == "inline-flex";
|
|
57
|
+
}, replaceWithGrid = (attrs) => {
|
|
58
|
+
const display = getStaticAttributeExpression(j, attrs, "display");
|
|
59
|
+
return display === "grid" || display == "inline-grid";
|
|
60
|
+
};
|
|
61
|
+
transformImport(j, root, "Box", fromPackage, toPackage) && markChanged(), replaceElement(
|
|
62
|
+
j,
|
|
63
|
+
root,
|
|
64
|
+
replaceWithFlex,
|
|
65
|
+
{
|
|
66
|
+
element: "Box",
|
|
67
|
+
localNames
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
element: "Flex",
|
|
71
|
+
callback: (path) => transformAttributes(j, path, FLEX_MODS, FLEX_TODO_WARNING)
|
|
72
|
+
}
|
|
73
|
+
) && markChanged(), replaceElement(
|
|
74
|
+
j,
|
|
75
|
+
root,
|
|
76
|
+
replaceWithGrid,
|
|
77
|
+
{
|
|
78
|
+
element: "Box",
|
|
79
|
+
localNames,
|
|
80
|
+
callback: (path) => transformAttributes(j, path, BOX_MODS, BOX_TODO_WARNING)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
element: "Grid",
|
|
84
|
+
callback: (path) => transformAttributes(j, path, GRID_MODS, GRID_TODO_WARNING)
|
|
85
|
+
}
|
|
86
|
+
) && markChanged(), transformStyledComponents(
|
|
87
|
+
j,
|
|
88
|
+
root,
|
|
89
|
+
styledAliases,
|
|
90
|
+
(attrs) => !replaceWithFlex(attrs) && !replaceWithGrid(attrs),
|
|
91
|
+
{
|
|
92
|
+
warning: STYLED_TODO_WARNING,
|
|
93
|
+
callback: (path) => transformAttributes(j, path, BOX_MODS, BOX_TODO_WARNING)
|
|
94
|
+
}
|
|
95
|
+
) && markChanged();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
transform as default
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.js","sources":["../../../../src/utils/getStyledComponentName.ts","../../../../src/utils/getStyledComponentAliases.ts","../../../../src/utils/transformStyledComponents.ts","../../../../src/transforms/latest/box/box.ts"],"sourcesContent":["export function getStyledComponentName(node: unknown): string | null {\n if (!node || typeof node !== 'object' || !('type' in node)) {\n return null\n }\n\n const current = node as {\n type: string\n callee?: unknown\n tag?: unknown\n object?: unknown\n arguments?: unknown[]\n }\n\n if (current.type === 'TaggedTemplateExpression') {\n return getStyledComponentName(current.tag)\n }\n\n if (current.type === 'CallExpression') {\n const callee = current.callee\n\n if (\n callee &&\n typeof callee === 'object' &&\n 'type' in callee &&\n callee.type === 'Identifier' &&\n 'name' in callee &&\n callee.name === 'styled'\n ) {\n const arg = current.arguments?.[0]\n\n if (\n arg &&\n typeof arg === 'object' &&\n 'type' in arg &&\n arg.type === 'Identifier' &&\n 'name' in arg\n ) {\n return arg.name as string\n }\n\n return null\n }\n\n return getStyledComponentName(callee)\n }\n\n if (current.type === 'MemberExpression' && current.object) {\n return getStyledComponentName(current.object)\n }\n\n return null\n}\n","import type {API, Collection} from 'jscodeshift'\n\nimport {getStyledComponentName} from './getStyledComponentName'\n\nexport function getStyledComponentAliases(\n j: API['jscodeshift'],\n root: Collection,\n localNames: Iterable<string>,\n): Set<string> {\n const aliases = new Set<string>()\n const names = new Set(localNames)\n\n root.find(j.VariableDeclarator).forEach((path) => {\n const {id, init} = path.node\n\n if (!init || id.type !== 'Identifier') {\n return\n }\n\n const baseComponent = getStyledComponentName(init)\n\n if (baseComponent && names.has(baseComponent)) {\n aliases.add(id.name)\n }\n })\n\n return aliases\n}\n","import type {API, ASTPath, JSXAttribute, JSXOpeningElement, JSXSpreadAttribute} from 'jscodeshift'\n\nimport {insertTodoWarning} from './insertTodoWarning'\n\nconst DEFAULT_WARNING = 'Please double check styled-component migration(s) below'\n\n/**\n * Runs callback on JSX styled-component if `filter` passes. Otherwise, adds\n * a TODO on the styled definition if manual review is needed.\n * Returns whether the AST was updated.\n */\nexport function transformStyledComponents(\n j: API['jscodeshift'],\n root: ReturnType<API['jscodeshift']>,\n aliases: Iterable<string>,\n filter: (attrs: (JSXAttribute | JSXSpreadAttribute)[]) => boolean,\n options: {\n callback?: (path: ASTPath<JSXOpeningElement>) => boolean | void\n warning?: string\n } = {},\n): boolean {\n const names = new Set(aliases)\n const {callback, warning = DEFAULT_WARNING} = options\n const aliasesToWarn = new Set<string>()\n let hasChanges = false\n\n root.find(j.JSXOpeningElement).forEach((path) => {\n const name = path.node.name\n\n if (name.type !== 'JSXIdentifier' || !names.has(name.name)) {\n return\n }\n\n const attrs = path.node.attributes ?? []\n\n if (!filter(attrs)) {\n aliasesToWarn.add(name.name)\n }\n\n if (filter(attrs)) {\n if (callback?.(path)) {\n hasChanges = true\n }\n }\n })\n\n root.find(j.VariableDeclarator).forEach((path) => {\n const {id} = path.node\n\n if (id.type === 'Identifier' && aliasesToWarn.has(id.name)) {\n if (insertTodoWarning(j, path, warning)) {\n hasChanges = true\n }\n }\n })\n\n return hasChanges\n}\n","import {type API, type FileInfo, type JSXSpreadAttribute, type JSXAttribute} from 'jscodeshift'\n\nimport type {BaseOptions} from '../../../types/BaseOptions'\nimport {getComponentLocalNames} from '../../../utils/getComponentLocalNames'\nimport {getStaticAttributeExpression} from '../../../utils/getStaticAttributeExpression'\nimport {getStyledComponentAliases} from '../../../utils/getStyledComponentAliases'\nimport {replaceElement} from '../../../utils/replaceElement'\nimport {shouldTransformComponent} from '../../../utils/shouldTransformComponent'\nimport {transformAttributes} from '../../../utils/transformAttributes'\nimport {transformComponent} from '../../../utils/transformComponent'\nimport {transformImport} from '../../../utils/transformImport'\nimport {transformStyledComponents} from '../../../utils/transformStyledComponents'\nimport {FLEX_MODS} from '../flex/flex.mods'\nimport {GRID_MODS} from '../grid/grid.mods'\nimport {BOX_MODS} from './box.mods'\n\nconst BOX_TODO_WARNING = 'Please double check the Box migration below'\nconst FLEX_TODO_WARNING = 'Please double check the Flex migration below'\nconst GRID_TODO_WARNING = 'Please double check the Grid migration below'\nconst STYLED_TODO_WARNING = 'Please double check styled(Box) migration(s) below'\n\n/** @internal */\nexport default function transform(\n fileInfo: FileInfo,\n api: API,\n options?: BaseOptions,\n): string | undefined {\n const {fromPackage, toPackage} = options || {}\n\n return transformComponent(fileInfo, api, ({j, root, markChanged}) => {\n const localNames = getComponentLocalNames(j, root, 'Box', options)\n const styledAliases = getStyledComponentAliases(j, root, localNames)\n\n if (!shouldTransformComponent(j, root, 'Box', localNames, options)) {\n return\n }\n\n const replaceWithFlex = (attrs: (JSXAttribute | JSXSpreadAttribute)[]) => {\n const display = getStaticAttributeExpression(j, attrs, 'display')\n return display === 'flex' || display == 'inline-flex'\n }\n\n const replaceWithGrid = (attrs: (JSXAttribute | JSXSpreadAttribute)[]) => {\n const display = getStaticAttributeExpression(j, attrs, 'display')\n return display === 'grid' || display == 'inline-grid'\n }\n\n if (transformImport(j, root, 'Box', fromPackage, toPackage)) {\n markChanged()\n }\n\n if (\n replaceElement(\n j,\n root,\n replaceWithFlex,\n {\n element: 'Box',\n localNames,\n },\n {\n element: 'Flex',\n callback: (path) => transformAttributes(j, path, FLEX_MODS, FLEX_TODO_WARNING),\n },\n )\n ) {\n markChanged()\n }\n\n if (\n replaceElement(\n j,\n root,\n replaceWithGrid,\n {\n element: 'Box',\n localNames,\n callback: (path) => transformAttributes(j, path, BOX_MODS, BOX_TODO_WARNING),\n },\n {\n element: 'Grid',\n callback: (path) => transformAttributes(j, path, GRID_MODS, GRID_TODO_WARNING),\n },\n )\n ) {\n markChanged()\n }\n\n if (\n transformStyledComponents(\n j,\n root,\n styledAliases,\n (attrs) => !replaceWithFlex(attrs) && !replaceWithGrid(attrs),\n {\n warning: STYLED_TODO_WARNING,\n callback: (path) => transformAttributes(j, path, BOX_MODS, BOX_TODO_WARNING),\n },\n )\n ) {\n markChanged()\n }\n })\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { API } from "jscodeshift";
|
|
2
|
+
import { FileInfo } from "jscodeshift";
|
|
3
|
+
import type { Options } from "jscodeshift";
|
|
4
|
+
|
|
5
|
+
declare interface BaseOptions extends Options {
|
|
6
|
+
fromPackage?: string;
|
|
7
|
+
toPackage?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** @internal */
|
|
11
|
+
declare function transform(
|
|
12
|
+
fileInfo: FileInfo,
|
|
13
|
+
api: API,
|
|
14
|
+
options?: BaseOptions,
|
|
15
|
+
): string | undefined;
|
|
16
|
+
export default transform;
|
|
17
|
+
|
|
18
|
+
export {};
|