@ikas/component-cli 1.4.0-beta.137 → 1.4.0-beta.138

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/component-cli",
3
- "version": "1.4.0-beta.137",
3
+ "version": "1.4.0-beta.138",
4
4
  "description": "CLI for developing ikas code components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,4 +0,0 @@
1
- import { Command } from "commander";
2
- export declare function createCreateCommand(): Command;
3
- export declare function run(): Promise<void>;
4
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4IpC,wBAAgB,mBAAmB,IAAI,OAAO,CA4B7C;AAGD,wBAAsB,GAAG,kBAiCxB"}
@@ -1,176 +0,0 @@
1
- import chalk from "chalk";
2
- import { Command } from "commander";
3
- import * as fs from "fs";
4
- import inquirer from "inquirer";
5
- import ora from "ora";
6
- import * as path from "path";
7
- import { generateComponentId, generateProjectId } from "../utils/component-helpers.js";
8
- import { readTemplate } from "../utils/template.js";
9
- const PROP_TYPES = [
10
- "TEXT",
11
- "NUMBER",
12
- "BOOLEAN",
13
- "IMAGE",
14
- "LINK",
15
- "LIST_OF_LINK",
16
- "COLOR",
17
- "PRODUCT",
18
- "PRODUCT_LIST",
19
- "CATEGORY",
20
- "CATEGORY_LIST",
21
- "BRAND",
22
- "BRAND_LIST",
23
- "BLOG",
24
- "BLOG_LIST",
25
- "BLOG_CATEGORY",
26
- "BLOG_CATEGORY_LIST",
27
- "TYPE",
28
- "ENUM",
29
- "COMPONENT",
30
- "COMPONENT_LIST",
31
- ];
32
- async function createProject(projectName) {
33
- const spinner = ora("Creating project...").start();
34
- try {
35
- const projectPath = path.resolve(process.cwd(), projectName);
36
- // Check if directory exists
37
- if (fs.existsSync(projectPath)) {
38
- spinner.fail(`Directory "${projectName}" already exists`);
39
- process.exit(1);
40
- }
41
- // Create directory structure
42
- fs.mkdirSync(projectPath, { recursive: true });
43
- fs.mkdirSync(path.join(projectPath, "src/components/ExampleComponent"), { recursive: true });
44
- fs.mkdirSync(path.join(projectPath, "src/components/ExampleSection"), { recursive: true });
45
- // Generate IDs for the example config
46
- const projectId = generateProjectId();
47
- const exampleComponentId = generateComponentId(projectId, "example-component");
48
- const exampleSectionId = generateComponentId(projectId, "example-section");
49
- const vars = {
50
- PROJECT_NAME: projectName,
51
- PROJECT_ID: projectId,
52
- EXAMPLE_COMPONENT_ID: exampleComponentId,
53
- EXAMPLE_SECTION_ID: exampleSectionId,
54
- };
55
- // Write all template files
56
- const files = [
57
- { template: "create/package.json", dest: "package.json", vars },
58
- { template: "create/tsconfig.json", dest: "tsconfig.json" },
59
- { template: "create/vite.config.ts", dest: "vite.config.ts" },
60
- { template: "create/ikas.config.json", dest: "ikas.config.json", vars },
61
- { template: "create/gitignore", dest: ".gitignore" },
62
- { template: "create/mcp.json", dest: ".mcp.json" },
63
- { template: "create/README.md", dest: "README.md", vars },
64
- { template: "create/claude-md", dest: "CLAUDE.md" },
65
- { template: "create/cursorrules", dest: ".cursorrules" },
66
- { template: "create/src/global.css", dest: "src/global.css" },
67
- { template: "create/src/global-types.ts", dest: "src/global-types.ts" },
68
- { template: "create/src/ikas-component-utils.d.ts", dest: "src/ikas-component-utils.d.ts" },
69
- { template: "create/src/components/index.ts", dest: "src/components/index.ts" },
70
- { template: "create/src/components/ExampleComponent/index.tsx", dest: "src/components/ExampleComponent/index.tsx" },
71
- { template: "create/src/components/ExampleComponent/types.ts", dest: "src/components/ExampleComponent/types.ts" },
72
- { template: "create/src/components/ExampleComponent/styles.css", dest: "src/components/ExampleComponent/styles.css" },
73
- { template: "create/src/components/ExampleSection/index.tsx", dest: "src/components/ExampleSection/index.tsx" },
74
- { template: "create/src/components/ExampleSection/types.ts", dest: "src/components/ExampleSection/types.ts" },
75
- { template: "create/src/components/ExampleSection/styles.css", dest: "src/components/ExampleSection/styles.css" },
76
- ];
77
- for (const file of files) {
78
- fs.writeFileSync(path.join(projectPath, file.dest), readTemplate(file.template, file.vars));
79
- }
80
- // Create or merge .cursor/mcp.json for Cursor editor
81
- // Uses node + ${workspaceFolder} instead of npx because Cursor
82
- // doesn't reliably inherit the shell PATH.
83
- const cursorDir = path.join(projectPath, ".cursor");
84
- const cursorMcpPath = path.join(cursorDir, "mcp.json");
85
- fs.mkdirSync(cursorDir, { recursive: true });
86
- let cursorMcpConfig = { mcpServers: {} };
87
- if (fs.existsSync(cursorMcpPath)) {
88
- try {
89
- cursorMcpConfig = JSON.parse(fs.readFileSync(cursorMcpPath, "utf-8"));
90
- if (!cursorMcpConfig.mcpServers) {
91
- cursorMcpConfig.mcpServers = {};
92
- }
93
- }
94
- catch {
95
- cursorMcpConfig = { mcpServers: {} };
96
- }
97
- }
98
- cursorMcpConfig.mcpServers["ikas-code-components"] = {
99
- command: "node",
100
- args: ["${workspaceFolder}/node_modules/@ikas/code-components-mcp/dist/index.js"]
101
- };
102
- fs.writeFileSync(cursorMcpPath, JSON.stringify(cursorMcpConfig, null, 2));
103
- spinner.succeed(chalk.green(`Project "${projectName}" created successfully!`));
104
- console.log("\n" + chalk.cyan("Next steps:"));
105
- console.log(chalk.white(` cd ${projectName}`));
106
- console.log(chalk.white(" npm install"));
107
- console.log(chalk.white(" npm run dev"));
108
- console.log("\n" + chalk.gray("Happy coding! 🚀"));
109
- }
110
- catch (error) {
111
- spinner.fail("Failed to create project");
112
- console.error(error);
113
- process.exit(1);
114
- }
115
- }
116
- export function createCreateCommand() {
117
- return new Command("create")
118
- .description("Create a new ikas component project")
119
- .argument("[name]", "Project name")
120
- .action(async (name) => {
121
- let projectName = name;
122
- if (!projectName) {
123
- const answers = await inquirer.prompt([
124
- {
125
- type: "input",
126
- name: "projectName",
127
- message: "What is your project name?",
128
- default: "my-ikas-components",
129
- validate: (input) => {
130
- if (!input.trim())
131
- return "Project name is required";
132
- if (!/^[a-z0-9-_]+$/i.test(input)) {
133
- return "Project name can only contain letters, numbers, hyphens, and underscores";
134
- }
135
- return true;
136
- }
137
- }
138
- ]);
139
- projectName = answers.projectName;
140
- }
141
- await createProject(projectName);
142
- });
143
- }
144
- // Standalone runner for create-ikas-component command
145
- export async function run() {
146
- const program = new Command();
147
- program
148
- .name("create-ikas-component")
149
- .description("Create a new ikas component project")
150
- .argument("[name]", "Project name")
151
- .action(async (name) => {
152
- let projectName = name;
153
- if (!projectName) {
154
- const answers = await inquirer.prompt([
155
- {
156
- type: "input",
157
- name: "projectName",
158
- message: "What is your project name?",
159
- default: "my-ikas-components",
160
- validate: (input) => {
161
- if (!input.trim())
162
- return "Project name is required";
163
- if (!/^[a-z0-9-_]+$/i.test(input)) {
164
- return "Project name can only contain letters, numbers, hyphens, and underscores";
165
- }
166
- return true;
167
- }
168
- }
169
- ]);
170
- projectName = answers.projectName;
171
- }
172
- await createProject(projectName);
173
- });
174
- program.parse(process.argv);
175
- }
176
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMpD,MAAM,UAAU,GAAG;IACjB,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,MAAM;IAC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C;4BAClC,OAAO,0EAA0E,CAAC;wBACpF,CAAC;wBACD,OAAO,IAAI,CAAC;oBACd,CAAC;iBACF;aACF,CAAC,CAAC;YACH,WAAW,GAAG,OAAO,CAAC,WAAqB,CAAC;QAC9C,CAAC;QAED,MAAM,aAAa,CAAC,WAAY,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=detect-theme-global-name-lookup.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-theme-global-name-lookup.test.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/detect-theme-global-name-lookup.test.ts"],"names":[],"mappings":""}
@@ -1,83 +0,0 @@
1
- import { detectThemeGlobalNameLookup } from "../detect-theme-global-name-lookup.js";
2
- const scan = (src) => detectThemeGlobalNameLookup(src, "src/test.tsx");
3
- describe("detectThemeGlobalNameLookup", () => {
4
- // ---- Positives: by-name lookups that must be flagged ----
5
- it("flags a chained .find by name", () => {
6
- const findings = scan(`
7
- import { getThemeColors } from "@ikas/bp-storefront";
8
- const primary = getThemeColors().find(c => c.name === "Primary");
9
- `);
10
- expect(findings).toHaveLength(1);
11
- expect(findings[0].accessor).toBe("getThemeColors");
12
- expect(findings[0].line).toBe(3);
13
- });
14
- it("flags a var-stored result filtered by name", () => {
15
- const findings = scan(`
16
- import { getThemeKeyframes } from "@ikas/bp-storefront";
17
- const kfs = getThemeKeyframes();
18
- const hover = kfs.find(k => k.name === "hoverLift");
19
- `);
20
- expect(findings).toHaveLength(1);
21
- expect(findings[0].accessor).toBe("getThemeKeyframes");
22
- });
23
- it("flags a .filter by displayName", () => {
24
- const findings = scan(`
25
- import { getThemeSettings } from "@ikas/bp-storefront";
26
- const matches = getThemeSettings().filter(s => s.displayName === "Brand Color");
27
- `);
28
- expect(findings).toHaveLength(1);
29
- expect(findings[0].accessor).toBe("getThemeSettings");
30
- });
31
- it("flags a destructured callback param compared by name", () => {
32
- const findings = scan(`
33
- import { getThemeTypography } from "@ikas/bp-storefront";
34
- const heading = getThemeTypography().find(({ name }) => name === "Heading");
35
- `);
36
- expect(findings).toHaveLength(1);
37
- expect(findings[0].accessor).toBe("getThemeTypography");
38
- });
39
- it("flags name lookup on getThemeColorSchemes().values", () => {
40
- const findings = scan(`
41
- import { getThemeColorSchemes } from "@ikas/bp-storefront";
42
- const dark = getThemeColorSchemes().values.find(v => v.name === "Dark");
43
- `);
44
- expect(findings).toHaveLength(1);
45
- expect(findings[0].accessor).toBe("getThemeColorSchemes");
46
- });
47
- // ---- Negatives: id-based / unrelated usage that must NOT be flagged ----
48
- it("does not flag id/ref-based lookup", () => {
49
- const findings = scan(`
50
- import { getThemeKeyframes } from "@ikas/bp-storefront";
51
- const hover = getThemeKeyframes().find(k => k.ref === "_i3x5JPYbPI");
52
- `);
53
- expect(findings).toHaveLength(0);
54
- });
55
- it("does not flag mapping to a stable field", () => {
56
- const findings = scan(`
57
- import { getThemeColors } from "@ikas/bp-storefront";
58
- const vars = getThemeColors().map(c => c.cssVar);
59
- `);
60
- expect(findings).toHaveLength(0);
61
- });
62
- it("does not flag a .name compare on a non-accessor array", () => {
63
- const findings = scan(`
64
- const products = getProducts();
65
- const found = products.find(p => p.name === "Shirt");
66
- `);
67
- expect(findings).toHaveLength(0);
68
- });
69
- it("does not flag getThemeSetting by stable key", () => {
70
- const findings = scan(`
71
- import { getThemeSetting } from "@ikas/bp-storefront";
72
- const v = getThemeSetting("_6Q0KV7VGGM");
73
- `);
74
- expect(findings).toHaveLength(0);
75
- });
76
- it("returns empty for source without any theme accessor", () => {
77
- expect(scan(`const x = [1, 2, 3].find(n => n === 2);`)).toHaveLength(0);
78
- });
79
- it("is resilient to unparsable source", () => {
80
- expect(scan(`getThemeColors().find(c => c.name === `)).toEqual(expect.any(Array));
81
- });
82
- });
83
- //# sourceMappingURL=detect-theme-global-name-lookup.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-theme-global-name-lookup.test.js","sourceRoot":"","sources":["../../../src/utils/__tests__/detect-theme-global-name-lookup.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,2BAA2B,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AAE/E,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,4DAA4D;IAE5D,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC;;;KAGrB,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC;;;;KAIrB,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC;;;KAGrB,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,QAAQ,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,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC;;;KAGrB,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Detect when a code component (or a shared module it imports) resolves a theme
3
- * global by its human NAME instead of its stable id — e.g.
4
- *
5
- * getThemeColors().find(c => c.name === "Primary")
6
- * const cols = getThemeColors(); cols.find(c => c.name === "Primary")
7
- *
8
- * Why this matters: a customer can install TWO partner design assets into ONE
9
- * theme. Each asset brings its own globals, so two colors named "Primary" (with
10
- * DIFFERENT stable ids) can coexist. Every SDK accessor resolves by stable id
11
- * (`getThemeSetting("_id")`, `var(--id)`, `_id` class/ref), so id-based code is
12
- * collision-safe. The ONLY way to pick the wrong "Primary" is to filter an
13
- * accessor RESULT by `.name` / `.displayName` — names are not unique, and
14
- * `.find` returns whichever happens to come first. This detector flags exactly
15
- * that anti-pattern so publish can warn the author to reference by id.
16
- *
17
- * AST (not a regex on minified output): the CLI already depends on `typescript`,
18
- * and at build time the partner SOURCE is available, where the accessor call and
19
- * the callback param are intact. A minified-bundle scan would be both noisy
20
- * (every `product.name ===`) and leaky (a result stored in a var breaks the
21
- * chain). This runs on source, so it sees both the chained and var-stored forms.
22
- */
23
- export type ThemeGlobalNameLookupFinding = {
24
- /** Source path relative to the project root. */
25
- file: string;
26
- /** 1-based line of the offending array-method call. */
27
- line: number;
28
- /** The theme accessor whose result is filtered by name (e.g. "getThemeColors"). */
29
- accessor: string;
30
- /** Short single-line excerpt of the offending expression. */
31
- snippet: string;
32
- };
33
- /**
34
- * Scan one source file's text and return findings for any by-name theme-global
35
- * lookup. Resilient: a parse failure yields no findings (the lint never blocks a build).
36
- */
37
- export declare function detectThemeGlobalNameLookup(sourceText: string, fileName: string): ThemeGlobalNameLookupFinding[];
38
- //# sourceMappingURL=detect-theme-global-name-lookup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-theme-global-name-lookup.d.ts","sourceRoot":"","sources":["../../src/utils/detect-theme-global-name-lookup.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,4BAA4B,GAAG;IACzC,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAwIF;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,4BAA4B,EAAE,CA2ChC"}
@@ -1,173 +0,0 @@
1
- import * as ts from "typescript";
2
- // SDK accessors that return a LIST of tokens, each carrying a non-unique `name`.
3
- // `getThemeSetting`/`getThemeSettingValue` are intentionally excluded: they take a
4
- // stable key argument, not a name, so they cannot be name-filtered. Duplicated here
5
- // (not imported from editor-core) because the CLI ships standalone to npm — same
6
- // convention as the duplicated CSS scoper in compile.ts.
7
- const LIST_ACCESSORS = new Set([
8
- "getThemeColors",
9
- "getThemeKeyframes",
10
- "getThemeTypography",
11
- "getThemeBreakpoints",
12
- "getThemeSettings",
13
- "getThemeColorSchemes",
14
- ]);
15
- // Array methods that take a per-element predicate/callback where a `.name` compare
16
- // would live. `map`/`forEach`/`reduce` are included because a name compare can hide
17
- // in any of them (e.g. `getThemeColors().map(c => c.name === target ? ... : ...)`).
18
- const ARRAY_CALLBACK_METHODS = new Set([
19
- "find",
20
- "filter",
21
- "some",
22
- "every",
23
- "findIndex",
24
- "findLast",
25
- "findLastIndex",
26
- "forEach",
27
- "map",
28
- "flatMap",
29
- "reduce",
30
- ]);
31
- // Token properties whose comparison signals a by-name lookup. `name` and the
32
- // settings token's `displayName` are the human labels; everything stable
33
- // (`id`/`ref`/`cssVar`/`className`) is fine and intentionally NOT listed.
34
- const NAME_PROPS = new Set(["name", "displayName"]);
35
- /** The accessor name if `node` is (or unwraps to) a call to a LIST_ACCESSOR, else undefined. */
36
- function listAccessorOf(node) {
37
- // Unwrap `getThemeColorSchemes().values` / `.schemes` and parenthesized forms so the
38
- // underlying accessor call is still recognized.
39
- let expr = node;
40
- if (ts.isParenthesizedExpression(expr))
41
- expr = expr.expression;
42
- if (ts.isPropertyAccessExpression(expr))
43
- expr = expr.expression;
44
- if (ts.isParenthesizedExpression(expr))
45
- expr = expr.expression;
46
- if (!ts.isCallExpression(expr))
47
- return undefined;
48
- const callee = expr.expression;
49
- const name = ts.isIdentifier(callee)
50
- ? callee.text
51
- : ts.isPropertyAccessExpression(callee)
52
- ? callee.name.text
53
- : undefined;
54
- return name && LIST_ACCESSORS.has(name) ? name : undefined;
55
- }
56
- /** Collect local `const x = getTheme*()` bindings so var-stored results are also tracked. */
57
- function collectAccessorBoundVars(sourceFile) {
58
- const bound = new Map();
59
- const visit = (node) => {
60
- if (ts.isVariableDeclaration(node) &&
61
- node.initializer &&
62
- ts.isIdentifier(node.name)) {
63
- const accessor = listAccessorOf(node.initializer);
64
- if (accessor)
65
- bound.set(node.name.text, accessor);
66
- }
67
- ts.forEachChild(node, visit);
68
- };
69
- visit(sourceFile);
70
- return bound;
71
- }
72
- /** True if the callback compares its iterated element's `.name`/`.displayName`. */
73
- function callbackComparesName(callback, sourceFile) {
74
- if (!ts.isArrowFunction(callback) && !ts.isFunctionExpression(callback))
75
- return false;
76
- const firstParam = callback.parameters[0];
77
- if (!firstParam)
78
- return false;
79
- // Element accessed as `param.name` — the common `c => c.name === ...` form.
80
- const paramName = ts.isIdentifier(firstParam.name) ? firstParam.name.text : undefined;
81
- // Element destructured as `({ name }) => name === ...`.
82
- const destructuredNames = new Set();
83
- if (ts.isObjectBindingPattern(firstParam.name)) {
84
- for (const el of firstParam.name.elements) {
85
- const prop = el.propertyName ?? el.name;
86
- if (ts.isIdentifier(prop) && NAME_PROPS.has(prop.text)) {
87
- if (ts.isIdentifier(el.name))
88
- destructuredNames.add(el.name.text);
89
- }
90
- }
91
- }
92
- if (!paramName && destructuredNames.size === 0)
93
- return false;
94
- let found = false;
95
- const visit = (node) => {
96
- if (found)
97
- return;
98
- // `param.name` / `param.displayName` referenced anywhere in the body.
99
- if (paramName &&
100
- ts.isPropertyAccessExpression(node) &&
101
- ts.isIdentifier(node.expression) &&
102
- node.expression.text === paramName &&
103
- NAME_PROPS.has(node.name.text)) {
104
- found = true;
105
- return;
106
- }
107
- // A destructured `name`/`displayName` identifier used in an equality compare.
108
- if (destructuredNames.size > 0 && ts.isBinaryExpression(node)) {
109
- const op = node.operatorToken.kind;
110
- const isEq = op === ts.SyntaxKind.EqualsEqualsEqualsToken ||
111
- op === ts.SyntaxKind.EqualsEqualsToken ||
112
- op === ts.SyntaxKind.ExclamationEqualsEqualsToken ||
113
- op === ts.SyntaxKind.ExclamationEqualsToken;
114
- if (isEq) {
115
- for (const side of [node.left, node.right]) {
116
- if (ts.isIdentifier(side) && destructuredNames.has(side.text)) {
117
- found = true;
118
- return;
119
- }
120
- }
121
- }
122
- }
123
- ts.forEachChild(node, visit);
124
- };
125
- visit(callback);
126
- return found;
127
- }
128
- function oneLineSnippet(node, sourceFile) {
129
- const text = node.getText(sourceFile).replace(/\s+/g, " ").trim();
130
- return text.length > 120 ? `${text.slice(0, 117)}...` : text;
131
- }
132
- /**
133
- * Scan one source file's text and return findings for any by-name theme-global
134
- * lookup. Resilient: a parse failure yields no findings (the lint never blocks a build).
135
- */
136
- export function detectThemeGlobalNameLookup(sourceText, fileName) {
137
- if (!sourceText.includes("getTheme"))
138
- return [];
139
- const findings = [];
140
- try {
141
- const sourceFile = ts.createSourceFile(fileName, sourceText, ts.ScriptTarget.Latest,
142
- /* setParentNodes */ true, fileName.endsWith(".tsx") || fileName.endsWith(".jsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
143
- const boundVars = collectAccessorBoundVars(sourceFile);
144
- const visit = (node) => {
145
- // Looking for `<arraySource>.<method>(<callback>)`.
146
- if (ts.isCallExpression(node) &&
147
- ts.isPropertyAccessExpression(node.expression) &&
148
- ARRAY_CALLBACK_METHODS.has(node.expression.name.text) &&
149
- node.arguments.length > 0) {
150
- const arraySource = node.expression.expression;
151
- // (a) direct chain on an accessor call, or (b) a var bound to an accessor result.
152
- const accessor = listAccessorOf(arraySource) ??
153
- (ts.isIdentifier(arraySource) ? boundVars.get(arraySource.text) : undefined);
154
- if (accessor && callbackComparesName(node.arguments[0], sourceFile)) {
155
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
156
- findings.push({
157
- file: fileName,
158
- line: line + 1,
159
- accessor,
160
- snippet: oneLineSnippet(node, sourceFile),
161
- });
162
- }
163
- }
164
- ts.forEachChild(node, visit);
165
- };
166
- visit(sourceFile);
167
- }
168
- catch {
169
- return [];
170
- }
171
- return findings;
172
- }
173
- //# sourceMappingURL=detect-theme-global-name-lookup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect-theme-global-name-lookup.js","sourceRoot":"","sources":["../../src/utils/detect-theme-global-name-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAoCjC,iF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