code-auditor-mcp 3.1.0 → 3.4.0
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +665 -1
- package/README.md +85 -11
- package/dist/__test_tmp__/spec18_test.d.ts +2 -0
- package/dist/__test_tmp__/spec18_test.d.ts.map +1 -0
- package/dist/__test_tmp__/spec18_test.js +5 -0
- package/dist/__test_tmp__/spec18_test.js.map +1 -0
- package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts +6 -0
- package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-20/scripts/tool.js +12 -0
- package/dist/__tests__/fixtures/spec-20/scripts/tool.js.map +1 -0
- package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts +7 -0
- package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-20/src/demo-module.js +13 -0
- package/dist/__tests__/fixtures/spec-20/src/demo-module.js.map +1 -0
- package/dist/analyzers/analyzerUtils.js +2 -2
- package/dist/analyzers/analyzerUtils.js.map +1 -1
- package/dist/analyzers/cross-language/APIContractAnalyzer.d.ts +1 -1
- package/dist/analyzers/cross-language/APIContractAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/cross-language/APIContractAnalyzer.js +2 -4
- package/dist/analyzers/cross-language/APIContractAnalyzer.js.map +1 -1
- package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.d.ts +3 -0
- package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.js +3 -5
- package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.js.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js +0 -3
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.d.ts +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.js +2 -5
- package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts +83 -0
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +611 -0
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -0
- package/dist/analyzers/documentationAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/documentationAnalyzer.js +8 -4
- package/dist/analyzers/documentationAnalyzer.js.map +1 -1
- package/dist/analyzers/orm/adapterRegistry.d.ts +41 -0
- package/dist/analyzers/orm/adapterRegistry.d.ts.map +1 -0
- package/dist/analyzers/orm/adapterRegistry.js +73 -0
- package/dist/analyzers/orm/adapterRegistry.js.map +1 -0
- package/dist/analyzers/orm/drizzleAdapter.d.ts +42 -0
- package/dist/analyzers/orm/drizzleAdapter.d.ts.map +1 -0
- package/dist/analyzers/orm/drizzleAdapter.js +166 -0
- package/dist/analyzers/orm/drizzleAdapter.js.map +1 -0
- package/dist/analyzers/orm/index.d.ts +14 -0
- package/dist/analyzers/orm/index.d.ts.map +1 -0
- package/dist/analyzers/orm/index.js +24 -0
- package/dist/analyzers/orm/index.js.map +1 -0
- package/dist/analyzers/orm/prismaAdapter.d.ts +45 -0
- package/dist/analyzers/orm/prismaAdapter.d.ts.map +1 -0
- package/dist/analyzers/orm/prismaAdapter.js +170 -0
- package/dist/analyzers/orm/prismaAdapter.js.map +1 -0
- package/dist/analyzers/orm/types.d.ts +63 -0
- package/dist/analyzers/orm/types.d.ts.map +1 -0
- package/dist/analyzers/orm/types.js +10 -0
- package/dist/analyzers/orm/types.js.map +1 -0
- package/dist/analyzers/provenance.d.ts +133 -0
- package/dist/analyzers/provenance.d.ts.map +1 -0
- package/dist/analyzers/provenance.js +1041 -0
- package/dist/analyzers/provenance.js.map +1 -0
- package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/reactAnalyzer.js +117 -1
- package/dist/analyzers/reactAnalyzer.js.map +1 -1
- package/dist/analyzers/ruleRegistry.d.ts +38 -0
- package/dist/analyzers/ruleRegistry.d.ts.map +1 -0
- package/dist/analyzers/ruleRegistry.js +123 -0
- package/dist/analyzers/ruleRegistry.js.map +1 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts +58 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +445 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -0
- package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +52 -0
- package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js +108 -26
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +64 -0
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +259 -103
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +5 -15
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +10 -10
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +25 -0
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +250 -59
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +103 -0
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js +750 -0
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -0
- package/dist/auditRunner.d.ts.map +1 -1
- package/dist/auditRunner.js +483 -3
- package/dist/auditRunner.js.map +1 -1
- package/dist/baseline.d.ts +98 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +184 -0
- package/dist/baseline.js.map +1 -0
- package/dist/churn/churnExtractor.d.ts +32 -0
- package/dist/churn/churnExtractor.d.ts.map +1 -0
- package/dist/churn/churnExtractor.js +261 -0
- package/dist/churn/churnExtractor.js.map +1 -0
- package/dist/cli.js +1215 -11
- package/dist/cli.js.map +1 -1
- package/dist/codeIndexDB-enhanced.js +1 -1
- package/dist/codeIndexDB-enhanced.js.map +1 -1
- package/dist/codeIndexDB.d.ts +101 -0
- package/dist/codeIndexDB.d.ts.map +1 -1
- package/dist/codeIndexDB.js +661 -5
- package/dist/codeIndexDB.js.map +1 -1
- package/dist/config/configLoader.d.ts.map +1 -1
- package/dist/config/configLoader.js +95 -1
- package/dist/config/configLoader.js.map +1 -1
- package/dist/config/defaults.d.ts +72 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +146 -15
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/pathProfiles.d.ts +38 -0
- package/dist/config/pathProfiles.d.ts.map +1 -0
- package/dist/config/pathProfiles.js +47 -0
- package/dist/config/pathProfiles.js.map +1 -0
- package/dist/conventions/conventionMiner.d.ts +63 -0
- package/dist/conventions/conventionMiner.d.ts.map +1 -0
- package/dist/conventions/conventionMiner.js +696 -0
- package/dist/conventions/conventionMiner.js.map +1 -0
- package/dist/coverage/coverageService.d.ts +49 -0
- package/dist/coverage/coverageService.d.ts.map +1 -0
- package/dist/coverage/coverageService.js +117 -0
- package/dist/coverage/coverageService.js.map +1 -0
- package/dist/coverage/istanbulParser.d.ts +84 -0
- package/dist/coverage/istanbulParser.d.ts.map +1 -0
- package/dist/coverage/istanbulParser.js +120 -0
- package/dist/coverage/istanbulParser.js.map +1 -0
- package/dist/coverage/lcovParser.d.ts +40 -0
- package/dist/coverage/lcovParser.d.ts.map +1 -0
- package/dist/coverage/lcovParser.js +168 -0
- package/dist/coverage/lcovParser.js.map +1 -0
- package/dist/fingerprint.d.ts +17 -0
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +42 -0
- package/dist/fingerprint.js.map +1 -1
- package/dist/grammars/tree-sitter-css.wasm +0 -0
- package/dist/graph/blastRadius.d.ts +27 -0
- package/dist/graph/blastRadius.d.ts.map +1 -0
- package/dist/graph/blastRadius.js +150 -0
- package/dist/graph/blastRadius.js.map +1 -0
- package/dist/graph/callGraph.d.ts +78 -0
- package/dist/graph/callGraph.d.ts.map +1 -0
- package/dist/graph/callGraph.js +484 -0
- package/dist/graph/callGraph.js.map +1 -0
- package/dist/graph/importGraph.d.ts +91 -0
- package/dist/graph/importGraph.d.ts.map +1 -0
- package/dist/graph/importGraph.js +602 -0
- package/dist/graph/importGraph.js.map +1 -0
- package/dist/graph/outputFormatter.d.ts +55 -0
- package/dist/graph/outputFormatter.d.ts.map +1 -0
- package/dist/graph/outputFormatter.js +283 -0
- package/dist/graph/outputFormatter.js.map +1 -0
- package/dist/hooks/codex.d.ts +36 -1
- package/dist/hooks/codex.d.ts.map +1 -1
- package/dist/hooks/codex.js +88 -54
- package/dist/hooks/codex.js.map +1 -1
- package/dist/hotspots/hotspotScorer.d.ts +20 -0
- package/dist/hotspots/hotspotScorer.d.ts.map +1 -0
- package/dist/hotspots/hotspotScorer.js +202 -0
- package/dist/hotspots/hotspotScorer.js.map +1 -0
- package/dist/invariants/invariant-rules.schema.json +42 -1
- package/dist/invariants/ruleEngine.d.ts +4 -1
- package/dist/invariants/ruleEngine.d.ts.map +1 -1
- package/dist/invariants/ruleEngine.js +141 -5
- package/dist/invariants/ruleEngine.js.map +1 -1
- package/dist/invariants/ruleValidator.d.ts.map +1 -1
- package/dist/invariants/ruleValidator.js +62 -1
- package/dist/invariants/ruleValidator.js.map +1 -1
- package/dist/invariants/types.d.ts +23 -2
- package/dist/invariants/types.d.ts.map +1 -1
- package/dist/languages/UniversalAnalyzer.d.ts +1 -1
- package/dist/languages/UniversalAnalyzer.d.ts.map +1 -1
- package/dist/languages/UniversalAnalyzer.js +59 -24
- package/dist/languages/UniversalAnalyzer.js.map +1 -1
- package/dist/languages/index.d.ts +1 -0
- package/dist/languages/index.d.ts.map +1 -1
- package/dist/languages/index.js +3 -0
- package/dist/languages/index.js.map +1 -1
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.d.ts +59 -0
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.d.ts.map +1 -0
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.js +236 -0
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.js.map +1 -0
- package/dist/languages/tree-sitter/parser.d.ts.map +1 -1
- package/dist/languages/tree-sitter/parser.js +2 -0
- package/dist/languages/tree-sitter/parser.js.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +61 -10
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
- package/dist/ledger.d.ts +128 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.js +345 -0
- package/dist/ledger.js.map +1 -0
- package/dist/mcp-tools/projectTasks.d.ts.map +1 -1
- package/dist/mcp-tools/projectTasks.js +9 -14
- package/dist/mcp-tools/projectTasks.js.map +1 -1
- package/dist/mcp.js +0 -0
- package/dist/mcpAuditJobs.d.ts.map +1 -1
- package/dist/mcpAuditJobs.js +3 -0
- package/dist/mcpAuditJobs.js.map +1 -1
- package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
- package/dist/reporting/csvReportGenerator.js +7 -1
- package/dist/reporting/csvReportGenerator.js.map +1 -1
- package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
- package/dist/reporting/htmlReportGenerator.js +5 -1
- package/dist/reporting/htmlReportGenerator.js.map +1 -1
- package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
- package/dist/reporting/jsonReportGenerator.js +10 -2
- package/dist/reporting/jsonReportGenerator.js.map +1 -1
- package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
- package/dist/reporting/sarifReportGenerator.js +17 -17
- package/dist/reporting/sarifReportGenerator.js.map +1 -1
- package/dist/scripts/runBench.d.ts +94 -0
- package/dist/scripts/runBench.d.ts.map +1 -0
- package/dist/scripts/runBench.js +1559 -0
- package/dist/scripts/runBench.js.map +1 -0
- package/dist/search/QueryParser.d.ts.map +1 -1
- package/dist/search/QueryParser.js +51 -4
- package/dist/search/QueryParser.js.map +1 -1
- package/dist/services/CodeMapGenerator.d.ts +33 -0
- package/dist/services/CodeMapGenerator.d.ts.map +1 -1
- package/dist/services/CodeMapGenerator.js +404 -0
- package/dist/services/CodeMapGenerator.js.map +1 -1
- package/dist/styles/normalizer.d.ts +37 -0
- package/dist/styles/normalizer.d.ts.map +1 -0
- package/dist/styles/normalizer.js +301 -0
- package/dist/styles/normalizer.js.map +1 -0
- package/dist/styles/styleExtractor.d.ts +38 -0
- package/dist/styles/styleExtractor.d.ts.map +1 -0
- package/dist/styles/styleExtractor.js +630 -0
- package/dist/styles/styleExtractor.js.map +1 -0
- package/dist/styles/styleIndexer.d.ts +35 -0
- package/dist/styles/styleIndexer.d.ts.map +1 -0
- package/dist/styles/styleIndexer.js +266 -0
- package/dist/styles/styleIndexer.js.map +1 -0
- package/dist/styles/tailwindConfigLoader.d.ts +38 -0
- package/dist/styles/tailwindConfigLoader.d.ts.map +1 -0
- package/dist/styles/tailwindConfigLoader.js +374 -0
- package/dist/styles/tailwindConfigLoader.js.map +1 -0
- package/dist/styles/tailwindExpander.d.ts +38 -0
- package/dist/styles/tailwindExpander.d.ts.map +1 -0
- package/dist/styles/tailwindExpander.js +637 -0
- package/dist/styles/tailwindExpander.js.map +1 -0
- package/dist/styles/types.d.ts +92 -0
- package/dist/styles/types.d.ts.map +1 -0
- package/dist/styles/types.js +10 -0
- package/dist/styles/types.js.map +1 -0
- package/dist/symbols.d.ts +21 -0
- package/dist/symbols.d.ts.map +1 -0
- package/dist/symbols.js +31 -0
- package/dist/symbols.js.map +1 -0
- package/dist/types.d.ts +326 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -5
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/scripts/hook-audit.sh +5 -1
- package/plugin/skills/code-auditor/SKILL.md +51 -0
- package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.d.ts +0 -21
- package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.js +0 -21
- package/dist/analyzers/__tests__/fixtures/spec-17/anonymous-callback-map.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.d.ts +0 -13
- package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.js +0 -12
- package/dist/analyzers/__tests__/fixtures/spec-17/barrel-test-migration.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.d.ts +0 -11
- package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.js +0 -22
- package/dist/analyzers/__tests__/fixtures/spec-17/direct-access-allow-config.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.d.ts +0 -9
- package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.js +0 -13
- package/dist/analyzers/__tests__/fixtures/spec-17/exported-undocumented.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.d.ts +0 -13
- package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.js +0 -18
- package/dist/analyzers/__tests__/fixtures/spec-17/for-loop-query.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.d.ts +0 -10
- package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.js +0 -16
- package/dist/analyzers/__tests__/fixtures/spec-17/import-node-builtin.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.d.ts +0 -14
- package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.js +0 -18
- package/dist/analyzers/__tests__/fixtures/spec-17/jsx-event-handler.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.d.ts +0 -13
- package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.js +0 -22
- package/dist/analyzers/__tests__/fixtures/spec-17/nested-loops-query.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.d.ts +0 -10
- package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.js +0 -20
- package/dist/analyzers/__tests__/fixtures/spec-17/nine-line-repeated.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.d.ts +0 -18
- package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.js +0 -28
- package/dist/analyzers/__tests__/fixtures/spec-17/private-methods.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.d.ts +0 -11
- package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.js +0 -31
- package/dist/analyzers/__tests__/fixtures/spec-17/scope-all-config.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.d.ts +0 -11
- package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.js +0 -18
- package/dist/analyzers/__tests__/fixtures/spec-17/sql-tagged-template.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.d.ts +0 -13
- package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.js +0 -61
- package/dist/analyzers/__tests__/fixtures/spec-17/structural-similar-methods.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.d.ts +0 -10
- package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.js +0 -15
- package/dist/analyzers/__tests__/fixtures/spec-17/template-prefix-table.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.d.ts +0 -11
- package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.js +0 -49
- package/dist/analyzers/__tests__/fixtures/spec-17/token-identical-20-lines.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.d.ts +0 -10
- package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.js +0 -19
- package/dist/analyzers/__tests__/fixtures/spec-17/tsx-no-db-usage.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.d.ts +0 -37
- package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.js +0 -73
- package/dist/analyzers/__tests__/fixtures/spec-17/twenty-methods-vs-complex.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.d.ts +0 -12
- package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.js +0 -82
- package/dist/analyzers/__tests__/fixtures/spec-17/unique-method-74-lines.js.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.d.ts +0 -10
- package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.d.ts.map +0 -1
- package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.js +0 -15
- package/dist/analyzers/__tests__/fixtures/spec-17/word-the-in-comment.js.map +0 -1
- package/dist/analyzers/dataAccessAnalyzer.d.ts +0 -46
- package/dist/analyzers/dataAccessAnalyzer.d.ts.map +0 -1
- package/dist/analyzers/dataAccessAnalyzer.js +0 -474
- package/dist/analyzers/dataAccessAnalyzer.js.map +0 -1
- package/dist/analyzers/dryAnalyzer.d.ts +0 -31
- package/dist/analyzers/dryAnalyzer.d.ts.map +0 -1
- package/dist/analyzers/dryAnalyzer.js +0 -734
- package/dist/analyzers/dryAnalyzer.js.map +0 -1
- package/dist/analyzers/schemaAnalyzer.d.ts +0 -23
- package/dist/analyzers/schemaAnalyzer.d.ts.map +0 -1
- package/dist/analyzers/schemaAnalyzer.js +0 -564
- package/dist/analyzers/schemaAnalyzer.js.map +0 -1
- package/dist/analyzers/solidAnalyzer.d.ts +0 -33
- package/dist/analyzers/solidAnalyzer.d.ts.map +0 -1
- package/dist/analyzers/solidAnalyzer.js +0 -847
- package/dist/analyzers/solidAnalyzer.js.map +0 -1
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind utility class expander — Spec 10.
|
|
3
|
+
*
|
|
4
|
+
* Expands Tailwind utility classes into normalized CSS declarations.
|
|
5
|
+
* Uses design tokens from the config loader for value resolution.
|
|
6
|
+
*
|
|
7
|
+
* Three-tier resolution for values:
|
|
8
|
+
* 1. Arbitrary values: mt-[17px] → margin-top: 17px
|
|
9
|
+
* 2. Theme tokens: bg-blue-500 → background-color: #3b82f6
|
|
10
|
+
* 3. Fixed scale: rounded-lg → border-radius: 8px
|
|
11
|
+
*/
|
|
12
|
+
import { normalizeValue, expandShorthand } from './normalizer.js';
|
|
13
|
+
const UTILITY_MAP = {
|
|
14
|
+
// -- Spacing (margin / padding) -------------------------------------------
|
|
15
|
+
'm': {
|
|
16
|
+
property: 'margin',
|
|
17
|
+
directional: {
|
|
18
|
+
suffixes: { 't': ['margin-top'], 'r': ['margin-right'], 'b': ['margin-bottom'], 'l': ['margin-left'], 'x': ['margin-left', 'margin-right'], 'y': ['margin-top', 'margin-bottom'] },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
'p': {
|
|
22
|
+
property: 'padding',
|
|
23
|
+
directional: {
|
|
24
|
+
suffixes: { 't': ['padding-top'], 'r': ['padding-right'], 'b': ['padding-bottom'], 'l': ['padding-left'], 'x': ['padding-left', 'padding-right'], 'y': ['padding-top', 'padding-bottom'] },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
'mt': { property: 'margin-top' },
|
|
28
|
+
'mr': { property: 'margin-right' },
|
|
29
|
+
'mb': { property: 'margin-bottom' },
|
|
30
|
+
'ml': { property: 'margin-left' },
|
|
31
|
+
'mx': { property: 'margin-left', directional: { suffixes: {} } },
|
|
32
|
+
'my': { property: 'margin-top', directional: { suffixes: {} } },
|
|
33
|
+
'pt': { property: 'padding-top' },
|
|
34
|
+
'pr': { property: 'padding-right' },
|
|
35
|
+
'pb': { property: 'padding-bottom' },
|
|
36
|
+
'pl': { property: 'padding-left' },
|
|
37
|
+
'px': { property: 'padding-left', directional: { suffixes: {} } },
|
|
38
|
+
'py': { property: 'padding-top', directional: { suffixes: {} } },
|
|
39
|
+
// -- Gap ------------------------------------------------------------------
|
|
40
|
+
'gap': { property: 'gap' },
|
|
41
|
+
'gap-x': { property: 'column-gap' },
|
|
42
|
+
'gap-y': { property: 'row-gap' },
|
|
43
|
+
// -- Colors ---------------------------------------------------------------
|
|
44
|
+
'bg': { property: 'background-color', colorValue: true },
|
|
45
|
+
'text': { property: 'color', colorValue: true },
|
|
46
|
+
'border': { property: 'border-color', colorValue: true },
|
|
47
|
+
'border-t': { property: 'border-top-color', colorValue: true },
|
|
48
|
+
'border-r': { property: 'border-right-color', colorValue: true },
|
|
49
|
+
'border-b': { property: 'border-bottom-color', colorValue: true },
|
|
50
|
+
'border-l': { property: 'border-left-color', colorValue: true },
|
|
51
|
+
'ring': { property: '--tw-ring-color', colorValue: true },
|
|
52
|
+
'accent': { property: 'accent-color', colorValue: true },
|
|
53
|
+
'fill': { property: 'fill', colorValue: true },
|
|
54
|
+
'stroke': { property: 'stroke', colorValue: true },
|
|
55
|
+
'placeholder': { property: 'placeholder-color', colorValue: true },
|
|
56
|
+
'caret': { property: 'caret-color', colorValue: true },
|
|
57
|
+
'divide': { property: 'border-color', colorValue: true },
|
|
58
|
+
'shadow': { property: '--tw-shadow-color', colorValue: true },
|
|
59
|
+
'outline': { property: 'outline-color', colorValue: true },
|
|
60
|
+
// -- Typography -----------------------------------------------------------
|
|
61
|
+
'font': { property: 'font-family' },
|
|
62
|
+
'text-': { property: 'font-size', valuePrefix: 'text-' },
|
|
63
|
+
'leading': { property: 'line-height' },
|
|
64
|
+
'tracking': { property: 'letter-spacing' },
|
|
65
|
+
'font-bold': { property: 'font-weight' },
|
|
66
|
+
'font-semibold': { property: 'font-weight' },
|
|
67
|
+
'font-medium': { property: 'font-weight' },
|
|
68
|
+
'font-normal': { property: 'font-weight' },
|
|
69
|
+
'font-light': { property: 'font-weight' },
|
|
70
|
+
'font-extralight': { property: 'font-weight' },
|
|
71
|
+
'font-thin': { property: 'font-weight' },
|
|
72
|
+
'font-extrabold': { property: 'font-weight' },
|
|
73
|
+
'font-black': { property: 'font-weight' },
|
|
74
|
+
// -- Sizing ---------------------------------------------------------------
|
|
75
|
+
'w': { property: 'width' },
|
|
76
|
+
'min-w': { property: 'min-width' },
|
|
77
|
+
'max-w': { property: 'max-width' },
|
|
78
|
+
'h': { property: 'height' },
|
|
79
|
+
'min-h': { property: 'min-height' },
|
|
80
|
+
'max-h': { property: 'max-height' },
|
|
81
|
+
'size': { property: 'width', directional: { suffixes: {} } },
|
|
82
|
+
// -- Layout ---------------------------------------------------------------
|
|
83
|
+
'top': { property: 'top' },
|
|
84
|
+
'right': { property: 'right' },
|
|
85
|
+
'bottom': { property: 'bottom' },
|
|
86
|
+
'left': { property: 'left' },
|
|
87
|
+
'inset': { property: 'inset' },
|
|
88
|
+
'inset-x': { property: 'left', directional: { suffixes: {} } },
|
|
89
|
+
'inset-y': { property: 'top', directional: { suffixes: {} } },
|
|
90
|
+
'z': { property: 'z-index' },
|
|
91
|
+
// -- Borders --------------------------------------------------------------
|
|
92
|
+
'rounded': { property: 'border-radius' },
|
|
93
|
+
'rounded-t': { property: 'border-top-left-radius', directional: { suffixes: { '': [] } } },
|
|
94
|
+
'rounded-r': { property: 'border-top-right-radius', directional: { suffixes: { '': [] } } },
|
|
95
|
+
'rounded-b': { property: 'border-bottom-right-radius', directional: { suffixes: { '': [] } } },
|
|
96
|
+
'rounded-l': { property: 'border-bottom-left-radius', directional: { suffixes: { '': [] } } },
|
|
97
|
+
'rounded-tl': { property: 'border-top-left-radius' },
|
|
98
|
+
'rounded-tr': { property: 'border-top-right-radius' },
|
|
99
|
+
'rounded-br': { property: 'border-bottom-right-radius' },
|
|
100
|
+
'rounded-bl': { property: 'border-bottom-left-radius' },
|
|
101
|
+
'border-': { property: 'border-width', valuePrefix: 'border-' },
|
|
102
|
+
'border-t-': { property: 'border-top-width', valuePrefix: 'border-t-' },
|
|
103
|
+
'border-r-': { property: 'border-right-width', valuePrefix: 'border-r-' },
|
|
104
|
+
'border-b-': { property: 'border-bottom-width', valuePrefix: 'border-b-' },
|
|
105
|
+
'border-l-': { property: 'border-left-width', valuePrefix: 'border-l-' },
|
|
106
|
+
// -- Flexbox & Grid -------------------------------------------------------
|
|
107
|
+
'flex-': { property: 'flex', valuePrefix: 'flex-' },
|
|
108
|
+
'grow': { property: 'flex-grow' },
|
|
109
|
+
'shrink': { property: 'flex-shrink' },
|
|
110
|
+
'basis': { property: 'flex-basis' },
|
|
111
|
+
'order': { property: 'order' },
|
|
112
|
+
'col-span': { property: 'grid-column' },
|
|
113
|
+
// -- Effects --------------------------------------------------------------
|
|
114
|
+
'opacity': { property: 'opacity' },
|
|
115
|
+
'shadow-': { property: 'box-shadow', valuePrefix: 'shadow-' },
|
|
116
|
+
// -- Transforms -----------------------------------------------------------
|
|
117
|
+
'scale': { property: 'transform' },
|
|
118
|
+
'rotate': { property: 'transform' },
|
|
119
|
+
'translate-x': { property: 'transform' },
|
|
120
|
+
'translate-y': { property: 'transform' },
|
|
121
|
+
// -- Transition -----------------------------------------------------------
|
|
122
|
+
'duration': { property: 'transition-duration' },
|
|
123
|
+
'delay': { property: 'transition-delay' },
|
|
124
|
+
'ease': { property: 'transition-timing-function' },
|
|
125
|
+
};
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Typography Scale (for font-weight, font-size, etc.)
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
const FONT_WEIGHT_MAP = {
|
|
130
|
+
'thin': '100',
|
|
131
|
+
'extralight': '200',
|
|
132
|
+
'light': '300',
|
|
133
|
+
'normal': '400',
|
|
134
|
+
'medium': '500',
|
|
135
|
+
'semibold': '600',
|
|
136
|
+
'bold': '700',
|
|
137
|
+
'extrabold': '800',
|
|
138
|
+
'black': '900',
|
|
139
|
+
};
|
|
140
|
+
const ROUNDED_SCALE = {
|
|
141
|
+
'none': '0px',
|
|
142
|
+
'sm': '2px',
|
|
143
|
+
'': '4px',
|
|
144
|
+
'DEFAULT': '4px',
|
|
145
|
+
'md': '6px',
|
|
146
|
+
'lg': '8px',
|
|
147
|
+
'xl': '12px',
|
|
148
|
+
'2xl': '16px',
|
|
149
|
+
'3xl': '24px',
|
|
150
|
+
'full': '9999px',
|
|
151
|
+
};
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// Variant prefixes (state / responsive)
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
/**
|
|
156
|
+
* Known variant prefixes that signal a state or responsive breakpoint.
|
|
157
|
+
* Everything before the last colon in a compound variant like
|
|
158
|
+
* `sm:hover:bg-red-500` is treated as variantContext.
|
|
159
|
+
*/
|
|
160
|
+
const KNOWN_VARIANTS = new Set([
|
|
161
|
+
// Responsive
|
|
162
|
+
'sm', 'md', 'lg', 'xl', '2xl',
|
|
163
|
+
// State
|
|
164
|
+
'hover', 'focus', 'focus-visible', 'focus-within', 'active',
|
|
165
|
+
'visited', 'target', 'first', 'last', 'only', 'odd', 'even',
|
|
166
|
+
'first-of-type', 'last-of-type', 'only-of-type', 'empty',
|
|
167
|
+
'disabled', 'enabled', 'checked', 'indeterminate', 'default',
|
|
168
|
+
'required', 'valid', 'invalid', 'in-range', 'out-of-range',
|
|
169
|
+
'placeholder-shown', 'autofill', 'read-only',
|
|
170
|
+
// Pseudo-elements
|
|
171
|
+
'before', 'after', 'first-letter', 'first-line', 'marker', 'selection',
|
|
172
|
+
'file', 'backdrop',
|
|
173
|
+
// Media / preference
|
|
174
|
+
'dark', 'light', 'motion-safe', 'motion-reduce',
|
|
175
|
+
'contrast-more', 'contrast-less', 'portrait', 'landscape',
|
|
176
|
+
'print', 'supports',
|
|
177
|
+
// Group / peer
|
|
178
|
+
'group-hover', 'group-focus', 'peer-hover', 'peer-focus',
|
|
179
|
+
]);
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// Public API
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
/**
|
|
184
|
+
* Expand a single Tailwind utility class into normalized declarations.
|
|
185
|
+
*
|
|
186
|
+
* @param className - The utility class (e.g. "bg-blue-500", "mt-4", "hover:bg-red-500")
|
|
187
|
+
* @param tokens - Theme tokens from config loader (or defaults)
|
|
188
|
+
* @param filePath - Source file path (for the declaration)
|
|
189
|
+
* @param line - Line number (for the declaration)
|
|
190
|
+
* @returns Array of NormalizedDeclaration, or empty if the class can't be expanded.
|
|
191
|
+
*/
|
|
192
|
+
export function expandUtility(className, tokens, filePath, line) {
|
|
193
|
+
const trimmed = className.trim();
|
|
194
|
+
if (!trimmed)
|
|
195
|
+
return [];
|
|
196
|
+
// Strip variant prefix to get the base utility
|
|
197
|
+
const { baseUtility, variantContext } = splitVariants(trimmed);
|
|
198
|
+
const mechanism = 'tailwind';
|
|
199
|
+
// Try arbitrary value first: bg-[#ff0000], mt-[17px], w-[calc(100%-1rem)]
|
|
200
|
+
const arbitraryResult = expandArbitrary(baseUtility, tokens, filePath, line, mechanism, variantContext);
|
|
201
|
+
if (arbitraryResult)
|
|
202
|
+
return arbitraryResult;
|
|
203
|
+
// Try standard utility expansion
|
|
204
|
+
const standardResult = expandStandard(baseUtility, tokens, filePath, line, mechanism, variantContext);
|
|
205
|
+
if (standardResult.length > 0)
|
|
206
|
+
return standardResult;
|
|
207
|
+
// Special cases: predefined utilities without values
|
|
208
|
+
const staticResult = expandStatic(baseUtility, filePath, line, mechanism, variantContext);
|
|
209
|
+
if (staticResult)
|
|
210
|
+
return staticResult;
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Expand variant-prefixed declarations by applying variantContext.
|
|
215
|
+
* This is a convenience wrapper that first expands the utility, then
|
|
216
|
+
* applies the variant context.
|
|
217
|
+
*
|
|
218
|
+
* @param variantPrefix - e.g. "hover", "sm:dark"
|
|
219
|
+
* @param declarations - Declarations to apply the variant to
|
|
220
|
+
*/
|
|
221
|
+
export function expandVariant(variantPrefix, declarations) {
|
|
222
|
+
const prefix = variantPrefix.endsWith(':') ? variantPrefix.slice(0, -1) : variantPrefix;
|
|
223
|
+
return declarations.map((d) => ({
|
|
224
|
+
...d,
|
|
225
|
+
variantContext: d.variantContext
|
|
226
|
+
? `${prefix}:${d.variantContext}`
|
|
227
|
+
: prefix,
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// Internal: Variant splitting
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
function splitVariants(className) {
|
|
234
|
+
// Split on the LAST colon that separates known variants from the utility
|
|
235
|
+
// e.g. "hover:bg-red-500" → variant="hover", utility="bg-red-500"
|
|
236
|
+
// e.g. "sm:hover:bg-red-500" → variant="sm:hover", utility="bg-red-500"
|
|
237
|
+
// e.g. "bg-red-500" → no variant
|
|
238
|
+
const parts = className.split(':');
|
|
239
|
+
// If no colon, it's a plain utility
|
|
240
|
+
if (parts.length === 1) {
|
|
241
|
+
return { baseUtility: className, variantContext: null };
|
|
242
|
+
}
|
|
243
|
+
// Walk from the end: the last part is always the utility
|
|
244
|
+
// Everything before it is the variant chain
|
|
245
|
+
const variantParts = [];
|
|
246
|
+
let utilityIndex = parts.length - 1;
|
|
247
|
+
for (let i = parts.length - 2; i >= 0; i--) {
|
|
248
|
+
const part = parts[i];
|
|
249
|
+
// Check if this part (and the remaining prefix) are all variants
|
|
250
|
+
if (KNOWN_VARIANTS.has(part)) {
|
|
251
|
+
variantParts.unshift(part);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
// Not a known variant — it's part of the utility
|
|
255
|
+
utilityIndex = i;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const baseUtility = parts.slice(utilityIndex).join(':');
|
|
260
|
+
const variantContext = variantParts.length > 0 ? variantParts.join(':') : null;
|
|
261
|
+
return { baseUtility, variantContext };
|
|
262
|
+
}
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
// Internal: Arbitrary values
|
|
265
|
+
// ---------------------------------------------------------------------------
|
|
266
|
+
function expandArbitrary(utility, tokens, filePath, line, mechanism, variantContext) {
|
|
267
|
+
// Match utility-[value] or utility/modifier-[value]
|
|
268
|
+
const match = utility.match(/^([a-z-]+?)(?:\/[\d.]+)?-\[(.+)\]$/);
|
|
269
|
+
if (!match)
|
|
270
|
+
return null;
|
|
271
|
+
const prefix = match[1];
|
|
272
|
+
const rawValue = match[2];
|
|
273
|
+
// Find the mapping for this utility prefix
|
|
274
|
+
const mapping = findMapping(prefix);
|
|
275
|
+
if (!mapping)
|
|
276
|
+
return null;
|
|
277
|
+
const normalizedValue = normalizeValue(rawValue, mapping.property);
|
|
278
|
+
return [{
|
|
279
|
+
property: mapping.property,
|
|
280
|
+
rawValue,
|
|
281
|
+
normalizedValue,
|
|
282
|
+
mechanism,
|
|
283
|
+
filePath,
|
|
284
|
+
line,
|
|
285
|
+
context: null,
|
|
286
|
+
variantContext,
|
|
287
|
+
tokenRef: null,
|
|
288
|
+
}];
|
|
289
|
+
}
|
|
290
|
+
// ---------------------------------------------------------------------------
|
|
291
|
+
// Internal: Standard utilities
|
|
292
|
+
// ---------------------------------------------------------------------------
|
|
293
|
+
function expandStandard(utility, tokens, filePath, line, mechanism, variantContext) {
|
|
294
|
+
// Find the matching utility prefix
|
|
295
|
+
const mapping = findMapping(utility);
|
|
296
|
+
if (!mapping)
|
|
297
|
+
return [];
|
|
298
|
+
// Extract the value portion
|
|
299
|
+
let value;
|
|
300
|
+
if (mapping.valuePrefix) {
|
|
301
|
+
value = utility.slice(mapping.valuePrefix.length);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// The value is everything after the matched prefix
|
|
305
|
+
// but we need to handle prefix matching carefully
|
|
306
|
+
const matchKey = findMatchingKey(utility);
|
|
307
|
+
if (!matchKey)
|
|
308
|
+
return [];
|
|
309
|
+
value = utility.slice(matchKey.length);
|
|
310
|
+
}
|
|
311
|
+
// Check for opacity modifier: bg-red-500/50
|
|
312
|
+
let opacity = null;
|
|
313
|
+
const slashIdx = value.lastIndexOf('/');
|
|
314
|
+
if (slashIdx > 0 && /^\d+$/.test(value.slice(slashIdx + 1))) {
|
|
315
|
+
opacity = value.slice(slashIdx + 1);
|
|
316
|
+
value = value.slice(0, slashIdx);
|
|
317
|
+
}
|
|
318
|
+
// Resolve the value
|
|
319
|
+
const resolvedValue = mapping.colorValue
|
|
320
|
+
? resolveColorValue(value, tokens)
|
|
321
|
+
: resolveSpacingValue(value, tokens);
|
|
322
|
+
if (!resolvedValue) {
|
|
323
|
+
// Try ROUNDED_SCALE for border-radius utilities
|
|
324
|
+
if (mapping.property === 'border-radius') {
|
|
325
|
+
const roundedVal = ROUNDED_SCALE[value];
|
|
326
|
+
if (roundedVal !== undefined) {
|
|
327
|
+
return buildDeclarations(mapping.property, roundedVal, filePath, line, mechanism, variantContext);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// Try font-weight
|
|
331
|
+
if (mapping.property === 'font-weight') {
|
|
332
|
+
const weightVal = FONT_WEIGHT_MAP[value];
|
|
333
|
+
if (weightVal) {
|
|
334
|
+
return buildDeclarations(mapping.property, weightVal, filePath, line, mechanism, variantContext);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return [];
|
|
338
|
+
}
|
|
339
|
+
return buildDeclarations(mapping.property, resolvedValue, filePath, line, mechanism, variantContext, opacity);
|
|
340
|
+
}
|
|
341
|
+
function buildDeclarations(property, rawValue, filePath, line, mechanism, variantContext, opacity) {
|
|
342
|
+
let finalValue = rawValue;
|
|
343
|
+
if (opacity) {
|
|
344
|
+
// Apply opacity as a CSS color-mix or alpha modification
|
|
345
|
+
// For simplicity, record the opacity as part of the raw value
|
|
346
|
+
finalValue = `${rawValue}/${opacity}`;
|
|
347
|
+
}
|
|
348
|
+
const normalizedValue = normalizeValue(finalValue, property);
|
|
349
|
+
// Handle shorthand expansion for multi-side properties
|
|
350
|
+
// mx-4 → margin-left: 4 + margin-right: 4
|
|
351
|
+
if (property === 'margin-left' && rawValue) {
|
|
352
|
+
// mx prefix
|
|
353
|
+
return ['margin-left', 'margin-right'].map((prop) => ({
|
|
354
|
+
property: prop,
|
|
355
|
+
rawValue: finalValue,
|
|
356
|
+
normalizedValue: normalizeValue(finalValue, prop),
|
|
357
|
+
mechanism,
|
|
358
|
+
filePath,
|
|
359
|
+
line,
|
|
360
|
+
context: null,
|
|
361
|
+
variantContext,
|
|
362
|
+
tokenRef: null,
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
if (property === 'margin-top' && rawValue) {
|
|
366
|
+
// my prefix
|
|
367
|
+
return ['margin-top', 'margin-bottom'].map((prop) => ({
|
|
368
|
+
property: prop,
|
|
369
|
+
rawValue: finalValue,
|
|
370
|
+
normalizedValue: normalizeValue(finalValue, prop),
|
|
371
|
+
mechanism,
|
|
372
|
+
filePath,
|
|
373
|
+
line,
|
|
374
|
+
context: null,
|
|
375
|
+
variantContext,
|
|
376
|
+
tokenRef: null,
|
|
377
|
+
}));
|
|
378
|
+
}
|
|
379
|
+
if (property === 'padding-left' && rawValue) {
|
|
380
|
+
// px prefix
|
|
381
|
+
return ['padding-left', 'padding-right'].map((prop) => ({
|
|
382
|
+
property: prop,
|
|
383
|
+
rawValue: finalValue,
|
|
384
|
+
normalizedValue: normalizeValue(finalValue, prop),
|
|
385
|
+
mechanism,
|
|
386
|
+
filePath,
|
|
387
|
+
line,
|
|
388
|
+
context: null,
|
|
389
|
+
variantContext,
|
|
390
|
+
tokenRef: null,
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
if (property === 'padding-top' && rawValue) {
|
|
394
|
+
// py prefix
|
|
395
|
+
return ['padding-top', 'padding-bottom'].map((prop) => ({
|
|
396
|
+
property: prop,
|
|
397
|
+
rawValue: finalValue,
|
|
398
|
+
normalizedValue: normalizeValue(finalValue, prop),
|
|
399
|
+
mechanism,
|
|
400
|
+
filePath,
|
|
401
|
+
line,
|
|
402
|
+
context: null,
|
|
403
|
+
variantContext,
|
|
404
|
+
tokenRef: null,
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
407
|
+
if (property === 'width' && rawValue) {
|
|
408
|
+
// size utility → both width and height
|
|
409
|
+
// (only for the 'size' prefix which we mapped to width)
|
|
410
|
+
// Actually, we need a different marker. The 'size' utility maps to both width and height.
|
|
411
|
+
// For now, only expand 'size-' prefix manually.
|
|
412
|
+
}
|
|
413
|
+
// For size-N utility, expand to both width and height
|
|
414
|
+
// (This is handled by the prefix match — if the prefix was 'size', expand to both)
|
|
415
|
+
// Expand shorthand properties
|
|
416
|
+
const expanded = expandShorthand(property, finalValue, normalizedValue);
|
|
417
|
+
return expanded.map((e) => ({
|
|
418
|
+
property: e.property,
|
|
419
|
+
rawValue: e.rawValue,
|
|
420
|
+
normalizedValue: e.normalizedValue,
|
|
421
|
+
mechanism,
|
|
422
|
+
filePath,
|
|
423
|
+
line,
|
|
424
|
+
context: null,
|
|
425
|
+
variantContext,
|
|
426
|
+
tokenRef: null,
|
|
427
|
+
}));
|
|
428
|
+
}
|
|
429
|
+
const STATIC_UTILITIES = {
|
|
430
|
+
'block': { declarations: [{ property: 'display', value: 'block' }] },
|
|
431
|
+
'inline': { declarations: [{ property: 'display', value: 'inline' }] },
|
|
432
|
+
'inline-block': { declarations: [{ property: 'display', value: 'inline-block' }] },
|
|
433
|
+
'flex': { declarations: [{ property: 'display', value: 'flex' }] },
|
|
434
|
+
'inline-flex': { declarations: [{ property: 'display', value: 'inline-flex' }] },
|
|
435
|
+
'grid': { declarations: [{ property: 'display', value: 'grid' }] },
|
|
436
|
+
'inline-grid': { declarations: [{ property: 'display', value: 'inline-grid' }] },
|
|
437
|
+
'hidden': { declarations: [{ property: 'display', value: 'none' }] },
|
|
438
|
+
'table': { declarations: [{ property: 'display', value: 'table' }] },
|
|
439
|
+
'flow-root': { declarations: [{ property: 'display', value: 'flow-root' }] },
|
|
440
|
+
'contents': { declarations: [{ property: 'display', value: 'contents' }] },
|
|
441
|
+
'list-item': { declarations: [{ property: 'display', value: 'list-item' }] },
|
|
442
|
+
'static': { declarations: [{ property: 'position', value: 'static' }] },
|
|
443
|
+
'fixed': { declarations: [{ property: 'position', value: 'fixed' }] },
|
|
444
|
+
'absolute': { declarations: [{ property: 'position', value: 'absolute' }] },
|
|
445
|
+
'relative': { declarations: [{ property: 'position', value: 'relative' }] },
|
|
446
|
+
'sticky': { declarations: [{ property: 'position', value: 'sticky' }] },
|
|
447
|
+
'visible': { declarations: [{ property: 'visibility', value: 'visible' }] },
|
|
448
|
+
'invisible': { declarations: [{ property: 'visibility', value: 'hidden' }] },
|
|
449
|
+
'collapse': { declarations: [{ property: 'visibility', value: 'collapse' }] },
|
|
450
|
+
'flex-row': { declarations: [{ property: 'flex-direction', value: 'row' }] },
|
|
451
|
+
'flex-row-reverse': { declarations: [{ property: 'flex-direction', value: 'row-reverse' }] },
|
|
452
|
+
'flex-col': { declarations: [{ property: 'flex-direction', value: 'column' }] },
|
|
453
|
+
'flex-col-reverse': { declarations: [{ property: 'flex-direction', value: 'column-reverse' }] },
|
|
454
|
+
'flex-wrap': { declarations: [{ property: 'flex-wrap', value: 'wrap' }] },
|
|
455
|
+
'flex-nowrap': { declarations: [{ property: 'flex-wrap', value: 'nowrap' }] },
|
|
456
|
+
'flex-wrap-reverse': { declarations: [{ property: 'flex-wrap', value: 'wrap-reverse' }] },
|
|
457
|
+
'justify-start': { declarations: [{ property: 'justify-content', value: 'flex-start' }] },
|
|
458
|
+
'justify-end': { declarations: [{ property: 'justify-content', value: 'flex-end' }] },
|
|
459
|
+
'justify-center': { declarations: [{ property: 'justify-content', value: 'center' }] },
|
|
460
|
+
'justify-between': { declarations: [{ property: 'justify-content', value: 'space-between' }] },
|
|
461
|
+
'justify-around': { declarations: [{ property: 'justify-content', value: 'space-around' }] },
|
|
462
|
+
'justify-evenly': { declarations: [{ property: 'justify-content', value: 'space-evenly' }] },
|
|
463
|
+
'items-start': { declarations: [{ property: 'align-items', value: 'flex-start' }] },
|
|
464
|
+
'items-end': { declarations: [{ property: 'align-items', value: 'flex-end' }] },
|
|
465
|
+
'items-center': { declarations: [{ property: 'align-items', value: 'center' }] },
|
|
466
|
+
'items-baseline': { declarations: [{ property: 'align-items', value: 'baseline' }] },
|
|
467
|
+
'items-stretch': { declarations: [{ property: 'align-items', value: 'stretch' }] },
|
|
468
|
+
'self-auto': { declarations: [{ property: 'align-self', value: 'auto' }] },
|
|
469
|
+
'self-start': { declarations: [{ property: 'align-self', value: 'flex-start' }] },
|
|
470
|
+
'self-end': { declarations: [{ property: 'align-self', value: 'flex-end' }] },
|
|
471
|
+
'self-center': { declarations: [{ property: 'align-self', value: 'center' }] },
|
|
472
|
+
'self-stretch': { declarations: [{ property: 'align-self', value: 'stretch' }] },
|
|
473
|
+
'text-left': { declarations: [{ property: 'text-align', value: 'left' }] },
|
|
474
|
+
'text-center': { declarations: [{ property: 'text-align', value: 'center' }] },
|
|
475
|
+
'text-right': { declarations: [{ property: 'text-align', value: 'right' }] },
|
|
476
|
+
'text-justify': { declarations: [{ property: 'text-align', value: 'justify' }] },
|
|
477
|
+
'uppercase': { declarations: [{ property: 'text-transform', value: 'uppercase' }] },
|
|
478
|
+
'lowercase': { declarations: [{ property: 'text-transform', value: 'lowercase' }] },
|
|
479
|
+
'capitalize': { declarations: [{ property: 'text-transform', value: 'capitalize' }] },
|
|
480
|
+
'normal-case': { declarations: [{ property: 'text-transform', value: 'none' }] },
|
|
481
|
+
'underline': { declarations: [{ property: 'text-decoration-line', value: 'underline' }] },
|
|
482
|
+
'overline': { declarations: [{ property: 'text-decoration-line', value: 'overline' }] },
|
|
483
|
+
'line-through': { declarations: [{ property: 'text-decoration-line', value: 'line-through' }] },
|
|
484
|
+
'no-underline': { declarations: [{ property: 'text-decoration-line', value: 'none' }] },
|
|
485
|
+
'truncate': {
|
|
486
|
+
declarations: [
|
|
487
|
+
{ property: 'overflow', value: 'hidden' },
|
|
488
|
+
{ property: 'text-overflow', value: 'ellipsis' },
|
|
489
|
+
{ property: 'white-space', value: 'nowrap' },
|
|
490
|
+
],
|
|
491
|
+
},
|
|
492
|
+
'overflow-auto': { declarations: [{ property: 'overflow', value: 'auto' }] },
|
|
493
|
+
'overflow-hidden': { declarations: [{ property: 'overflow', value: 'hidden' }] },
|
|
494
|
+
'overflow-visible': { declarations: [{ property: 'overflow', value: 'visible' }] },
|
|
495
|
+
'overflow-scroll': { declarations: [{ property: 'overflow', value: 'scroll' }] },
|
|
496
|
+
'box-border': { declarations: [{ property: 'box-sizing', value: 'border-box' }] },
|
|
497
|
+
'box-content': { declarations: [{ property: 'box-sizing', value: 'content-box' }] },
|
|
498
|
+
'cursor-pointer': { declarations: [{ property: 'cursor', value: 'pointer' }] },
|
|
499
|
+
'cursor-default': { declarations: [{ property: 'cursor', value: 'default' }] },
|
|
500
|
+
'cursor-not-allowed': { declarations: [{ property: 'cursor', value: 'not-allowed' }] },
|
|
501
|
+
'resize': { declarations: [{ property: 'resize', value: 'both' }] },
|
|
502
|
+
'resize-none': { declarations: [{ property: 'resize', value: 'none' }] },
|
|
503
|
+
'resize-y': { declarations: [{ property: 'resize', value: 'vertical' }] },
|
|
504
|
+
'resize-x': { declarations: [{ property: 'resize', value: 'horizontal' }] },
|
|
505
|
+
'select-none': { declarations: [{ property: 'user-select', value: 'none' }] },
|
|
506
|
+
'select-text': { declarations: [{ property: 'user-select', value: 'text' }] },
|
|
507
|
+
'select-all': { declarations: [{ property: 'user-select', value: 'all' }] },
|
|
508
|
+
'select-auto': { declarations: [{ property: 'user-select', value: 'auto' }] },
|
|
509
|
+
'sr-only': {
|
|
510
|
+
declarations: [
|
|
511
|
+
{ property: 'position', value: 'absolute' },
|
|
512
|
+
{ property: 'width', value: '1px' },
|
|
513
|
+
{ property: 'height', value: '1px' },
|
|
514
|
+
{ property: 'padding', value: '0' },
|
|
515
|
+
{ property: 'margin', value: '-1px' },
|
|
516
|
+
{ property: 'overflow', value: 'hidden' },
|
|
517
|
+
{ property: 'clip', value: 'rect(0,0,0,0)' },
|
|
518
|
+
{ property: 'white-space', value: 'nowrap' },
|
|
519
|
+
{ property: 'border-width', value: '0' },
|
|
520
|
+
],
|
|
521
|
+
},
|
|
522
|
+
'whitespace-normal': { declarations: [{ property: 'white-space', value: 'normal' }] },
|
|
523
|
+
'whitespace-nowrap': { declarations: [{ property: 'white-space', value: 'nowrap' }] },
|
|
524
|
+
'whitespace-pre': { declarations: [{ property: 'white-space', value: 'pre' }] },
|
|
525
|
+
'whitespace-pre-line': { declarations: [{ property: 'white-space', value: 'pre-line' }] },
|
|
526
|
+
'whitespace-pre-wrap': { declarations: [{ property: 'white-space', value: 'pre-wrap' }] },
|
|
527
|
+
'whitespace-break-spaces': { declarations: [{ property: 'white-space', value: 'break-spaces' }] },
|
|
528
|
+
'break-normal': { declarations: [{ property: 'overflow-wrap', value: 'normal' }, { property: 'word-break', value: 'normal' }] },
|
|
529
|
+
'break-words': { declarations: [{ property: 'overflow-wrap', value: 'break-word' }] },
|
|
530
|
+
'break-all': { declarations: [{ property: 'word-break', value: 'break-all' }] },
|
|
531
|
+
'break-keep': { declarations: [{ property: 'word-break', value: 'keep-all' }] },
|
|
532
|
+
};
|
|
533
|
+
function expandStatic(utility, filePath, line, mechanism, variantContext) {
|
|
534
|
+
const staticDef = STATIC_UTILITIES[utility];
|
|
535
|
+
if (!staticDef)
|
|
536
|
+
return null;
|
|
537
|
+
return staticDef.declarations.map((d) => ({
|
|
538
|
+
property: d.property,
|
|
539
|
+
rawValue: d.value,
|
|
540
|
+
normalizedValue: normalizeValue(d.value, d.property),
|
|
541
|
+
mechanism,
|
|
542
|
+
filePath,
|
|
543
|
+
line,
|
|
544
|
+
context: null,
|
|
545
|
+
variantContext,
|
|
546
|
+
tokenRef: null,
|
|
547
|
+
}));
|
|
548
|
+
}
|
|
549
|
+
// ---------------------------------------------------------------------------
|
|
550
|
+
// Internal: Value resolution
|
|
551
|
+
// ---------------------------------------------------------------------------
|
|
552
|
+
function resolveColorValue(value, tokens) {
|
|
553
|
+
// Direct match in color tokens
|
|
554
|
+
if (tokens.colors[value])
|
|
555
|
+
return tokens.colors[value];
|
|
556
|
+
// Try with 'transparent', 'current', 'inherit'
|
|
557
|
+
if (value === 'transparent' || value === 'current' || value === 'inherit') {
|
|
558
|
+
return value;
|
|
559
|
+
}
|
|
560
|
+
// Check if it's a hex/rgb value already in the class name
|
|
561
|
+
// (this shouldn't happen with standard tailwind, but handle gracefully)
|
|
562
|
+
if (value.startsWith('#') || value.startsWith('rgb')) {
|
|
563
|
+
return value;
|
|
564
|
+
}
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
function resolveSpacingValue(value, tokens) {
|
|
568
|
+
// Direct match in spacing tokens
|
|
569
|
+
if (tokens.spacing[value])
|
|
570
|
+
return tokens.spacing[value];
|
|
571
|
+
// Try as a raw px value (used by arbitrary spacing in non-arbitrary classes)
|
|
572
|
+
if (/^\d+$/.test(value)) {
|
|
573
|
+
const num = parseFloat(value);
|
|
574
|
+
return `${num * 4}px`; // Default Tailwind: 1 unit = 4px
|
|
575
|
+
}
|
|
576
|
+
// Try font-size
|
|
577
|
+
if (tokens.fontSize[value])
|
|
578
|
+
return tokens.fontSize[value];
|
|
579
|
+
// Try border-radius
|
|
580
|
+
if (tokens.borderRadius[value])
|
|
581
|
+
return tokens.borderRadius[value];
|
|
582
|
+
// Auto, full, screen, min, max, fit keywords
|
|
583
|
+
if (['auto', 'full', 'screen', 'min', 'max', 'fit', 'none'].includes(value)) {
|
|
584
|
+
return value;
|
|
585
|
+
}
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
// ---------------------------------------------------------------------------
|
|
589
|
+
// Internal: Utility prefix matching
|
|
590
|
+
// ---------------------------------------------------------------------------
|
|
591
|
+
function findMapping(utility) {
|
|
592
|
+
// Try exact match first
|
|
593
|
+
if (UTILITY_MAP[utility])
|
|
594
|
+
return UTILITY_MAP[utility];
|
|
595
|
+
// Try prefix matching (longest prefix first to avoid "text" matching before "text-")
|
|
596
|
+
const prefixes = Object.keys(UTILITY_MAP).sort((a, b) => b.length - a.length);
|
|
597
|
+
for (const prefix of prefixes) {
|
|
598
|
+
if (utility.startsWith(prefix) && utility !== prefix) {
|
|
599
|
+
return UTILITY_MAP[prefix];
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
function findMatchingKey(utility) {
|
|
605
|
+
const prefixes = Object.keys(UTILITY_MAP).sort((a, b) => b.length - a.length);
|
|
606
|
+
for (const prefix of prefixes) {
|
|
607
|
+
if (utility.startsWith(prefix) && utility !== prefix) {
|
|
608
|
+
return prefix;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
// ---------------------------------------------------------------------------
|
|
614
|
+
// Utility: Check if a class might be a Tailwind utility
|
|
615
|
+
// ---------------------------------------------------------------------------
|
|
616
|
+
/**
|
|
617
|
+
* Heuristic check: does this class name look like a Tailwind utility?
|
|
618
|
+
* Used to skip non-utility class names without attempting expansion.
|
|
619
|
+
*/
|
|
620
|
+
export function looksLikeTailwind(className) {
|
|
621
|
+
const trimmed = className.trim();
|
|
622
|
+
if (!trimmed || trimmed.length < 2)
|
|
623
|
+
return false;
|
|
624
|
+
// Must start with a letter or group/peer
|
|
625
|
+
if (!/^[a-z]/.test(trimmed))
|
|
626
|
+
return false;
|
|
627
|
+
// Common Tailwind patterns:
|
|
628
|
+
// - Contains a dash (most utilities)
|
|
629
|
+
// - Starts with known utility prefixes
|
|
630
|
+
// - Known static utility
|
|
631
|
+
if (STATIC_UTILITIES[trimmed])
|
|
632
|
+
return true;
|
|
633
|
+
if (findMapping(trimmed))
|
|
634
|
+
return true;
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
//# sourceMappingURL=tailwindExpander.js.map
|