@idealyst/tooling 1.2.25 → 1.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/index.cjs +730 -0
- package/dist/analyzer/index.cjs.map +1 -0
- package/dist/analyzer/index.d.cts +66 -0
- package/dist/analyzer/index.d.ts +1 -0
- package/dist/analyzer/index.js +5 -2
- package/dist/analyzer/index.js.map +1 -1
- package/dist/analyzers/index.cjs +1201 -0
- package/dist/analyzers/index.cjs.map +1 -0
- package/dist/analyzers/index.d.cts +205 -0
- package/dist/index.cjs +2146 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +55 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/rules/index.cjs +522 -0
- package/dist/rules/index.cjs.map +1 -0
- package/dist/rules/index.d.cts +69 -0
- package/dist/types-CrlxbLFJ.d.cts +121 -0
- package/dist/types-CvIlSIOV.d.cts +149 -0
- package/dist/utils/index.cjs +709 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +94 -0
- package/dist/vite-plugin.cjs +802 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.cts +40 -0
- package/dist/vite-plugin.js +3 -1
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +13 -7
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Registry Types
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of the auto-generated component registry
|
|
5
|
+
* that documents all components with their props, types, and valid values.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Definition of a single component prop
|
|
9
|
+
*/
|
|
10
|
+
interface PropDefinition {
|
|
11
|
+
/** The prop name */
|
|
12
|
+
name: string;
|
|
13
|
+
/** The TypeScript type as a string (e.g., 'Intent', 'Size', 'boolean', 'string') */
|
|
14
|
+
type: string;
|
|
15
|
+
/** Valid values for this prop (for unions, enums, theme-derived types) */
|
|
16
|
+
values?: string[];
|
|
17
|
+
/** Default value if specified in the component */
|
|
18
|
+
default?: string | number | boolean;
|
|
19
|
+
/** Description from JSDoc */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** Whether the prop is required */
|
|
22
|
+
required: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for a controlled state binding
|
|
26
|
+
*/
|
|
27
|
+
interface ControlledState {
|
|
28
|
+
/** Initial value for the state */
|
|
29
|
+
initial: any;
|
|
30
|
+
/** The prop name that receives the onChange callback */
|
|
31
|
+
onChangeProp: string;
|
|
32
|
+
/** If true, the callback toggles a boolean value instead of receiving a new value */
|
|
33
|
+
toggle?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sample props for rendering the component in documentation
|
|
37
|
+
*/
|
|
38
|
+
interface SampleProps {
|
|
39
|
+
/** Props needed to render the component (required props, sample data) */
|
|
40
|
+
props?: Record<string, any>;
|
|
41
|
+
/** Default children for the component */
|
|
42
|
+
children?: any;
|
|
43
|
+
/** Controlled state bindings - key is the prop name, value is the state config */
|
|
44
|
+
state?: Record<string, ControlledState>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Definition of a component in the registry
|
|
48
|
+
*/
|
|
49
|
+
interface ComponentDefinition {
|
|
50
|
+
/** Component name (e.g., 'Button', 'Card') */
|
|
51
|
+
name: string;
|
|
52
|
+
/** Component description from static property or JSDoc */
|
|
53
|
+
description?: string;
|
|
54
|
+
/** All props for this component */
|
|
55
|
+
props: Record<string, PropDefinition>;
|
|
56
|
+
/** Component category for grouping (e.g., 'form', 'display', 'layout') */
|
|
57
|
+
category?: ComponentCategory;
|
|
58
|
+
/** Path to the component file (relative) */
|
|
59
|
+
filePath?: string;
|
|
60
|
+
/** Sample props for rendering in documentation (from docs.ts) */
|
|
61
|
+
sampleProps?: SampleProps;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Component categories for organizing documentation
|
|
65
|
+
*/
|
|
66
|
+
type ComponentCategory = 'layout' | 'form' | 'display' | 'navigation' | 'overlay' | 'data' | 'feedback';
|
|
67
|
+
/**
|
|
68
|
+
* The complete component registry
|
|
69
|
+
*/
|
|
70
|
+
type ComponentRegistry = Record<string, ComponentDefinition>;
|
|
71
|
+
/**
|
|
72
|
+
* Theme values extracted from the theme configuration
|
|
73
|
+
*/
|
|
74
|
+
interface ThemeValues {
|
|
75
|
+
/** Intent names (e.g., ['primary', 'success', 'error', ...]) */
|
|
76
|
+
intents: string[];
|
|
77
|
+
/** Size keys per component (e.g., { button: ['xs', 'sm', 'md', ...], ... }) */
|
|
78
|
+
sizes: Record<string, string[]>;
|
|
79
|
+
/** Radius keys (e.g., ['none', 'xs', 'sm', 'md', ...]) */
|
|
80
|
+
radii: string[];
|
|
81
|
+
/** Shadow keys (e.g., ['none', 'sm', 'md', 'lg', 'xl']) */
|
|
82
|
+
shadows: string[];
|
|
83
|
+
/** Breakpoint keys (e.g., ['xs', 'sm', 'md', 'lg', 'xl']) */
|
|
84
|
+
breakpoints: string[];
|
|
85
|
+
/** Typography keys (e.g., ['h1', 'h2', 'body1', 'body2', ...]) */
|
|
86
|
+
typography: string[];
|
|
87
|
+
/** Surface color keys */
|
|
88
|
+
surfaceColors: string[];
|
|
89
|
+
/** Text color keys */
|
|
90
|
+
textColors: string[];
|
|
91
|
+
/** Border color keys */
|
|
92
|
+
borderColors: string[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Options for the component analyzer
|
|
96
|
+
*/
|
|
97
|
+
interface ComponentAnalyzerOptions {
|
|
98
|
+
/** Paths to scan for components (e.g., ['packages/components/src']) */
|
|
99
|
+
componentPaths: string[];
|
|
100
|
+
/** Path to the theme file (e.g., 'packages/theme/src/lightTheme.ts') */
|
|
101
|
+
themePath: string;
|
|
102
|
+
/** Component names to include (default: all) */
|
|
103
|
+
include?: string[];
|
|
104
|
+
/** Component names to exclude */
|
|
105
|
+
exclude?: string[];
|
|
106
|
+
/** Whether to include internal/private components */
|
|
107
|
+
includeInternal?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Options for the Vite plugin
|
|
111
|
+
*/
|
|
112
|
+
interface IdealystDocsPluginOptions extends ComponentAnalyzerOptions {
|
|
113
|
+
/** Output mode: 'virtual' for virtual module, 'file' for physical file */
|
|
114
|
+
output?: 'virtual' | 'file';
|
|
115
|
+
/** Path to write the registry file (if output is 'file') */
|
|
116
|
+
outputPath?: string;
|
|
117
|
+
/** Enable debug logging */
|
|
118
|
+
debug?: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type { ComponentRegistry as C, IdealystDocsPluginOptions as I, PropDefinition as P, SampleProps as S, ThemeValues as T, ComponentDefinition as a, ComponentAnalyzerOptions as b, ControlledState as c, ComponentCategory as d };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File type classification based on file extension patterns
|
|
3
|
+
*/
|
|
4
|
+
type FileType = 'shared' | 'web' | 'native' | 'styles' | 'types' | 'other';
|
|
5
|
+
/**
|
|
6
|
+
* Platform classification for imports
|
|
7
|
+
*/
|
|
8
|
+
type Platform = 'react-native' | 'react-dom' | 'neutral';
|
|
9
|
+
/**
|
|
10
|
+
* Violation type describing what kind of platform mismatch occurred
|
|
11
|
+
*/
|
|
12
|
+
type ViolationType = 'native-in-shared' | 'dom-in-shared' | 'native-in-web' | 'dom-in-native';
|
|
13
|
+
/**
|
|
14
|
+
* Severity level for violations
|
|
15
|
+
*/
|
|
16
|
+
type Severity = 'error' | 'warning' | 'info';
|
|
17
|
+
/**
|
|
18
|
+
* Information about a single import
|
|
19
|
+
*/
|
|
20
|
+
interface ImportInfo {
|
|
21
|
+
/** The imported identifier name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Original name if aliased (e.g., `Image as RNImage`) */
|
|
24
|
+
originalName?: string;
|
|
25
|
+
/** The module source (e.g., 'react-native', 'react-dom') */
|
|
26
|
+
source: string;
|
|
27
|
+
/** The platform this import belongs to */
|
|
28
|
+
platform: Platform;
|
|
29
|
+
/** Line number in source file */
|
|
30
|
+
line: number;
|
|
31
|
+
/** Column number in source file */
|
|
32
|
+
column: number;
|
|
33
|
+
/** Whether this is a default import */
|
|
34
|
+
isDefault: boolean;
|
|
35
|
+
/** Whether this is a namespace import (import * as X) */
|
|
36
|
+
isNamespace: boolean;
|
|
37
|
+
/** Whether this is a type-only import */
|
|
38
|
+
isTypeOnly: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A single violation found during analysis
|
|
42
|
+
*/
|
|
43
|
+
interface Violation {
|
|
44
|
+
/** Type of violation */
|
|
45
|
+
type: ViolationType;
|
|
46
|
+
/** The primitive/component that caused the violation */
|
|
47
|
+
primitive: string;
|
|
48
|
+
/** The module source (e.g., 'react-native', 'react-dom') */
|
|
49
|
+
source: string;
|
|
50
|
+
/** Path to the file with the violation */
|
|
51
|
+
filePath: string;
|
|
52
|
+
/** Line number where violation occurred */
|
|
53
|
+
line: number;
|
|
54
|
+
/** Column number where violation occurred */
|
|
55
|
+
column: number;
|
|
56
|
+
/** Human-readable message describing the violation */
|
|
57
|
+
message: string;
|
|
58
|
+
/** Severity level of this violation */
|
|
59
|
+
severity: Severity;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Result of analyzing a single file
|
|
63
|
+
*/
|
|
64
|
+
interface AnalysisResult {
|
|
65
|
+
/** Path to the analyzed file */
|
|
66
|
+
filePath: string;
|
|
67
|
+
/** Classified type of the file */
|
|
68
|
+
fileType: FileType;
|
|
69
|
+
/** List of violations found */
|
|
70
|
+
violations: Violation[];
|
|
71
|
+
/** All imports found in the file */
|
|
72
|
+
imports: ImportInfo[];
|
|
73
|
+
/** Whether the file passed validation (no violations) */
|
|
74
|
+
passed: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Options for configuring the platform import analyzer
|
|
78
|
+
*/
|
|
79
|
+
interface AnalyzerOptions {
|
|
80
|
+
/**
|
|
81
|
+
* Default severity level for violations
|
|
82
|
+
* @default 'error'
|
|
83
|
+
*/
|
|
84
|
+
severity?: Severity;
|
|
85
|
+
/**
|
|
86
|
+
* Additional React Native primitives to flag beyond the built-in list
|
|
87
|
+
* Useful for flagging custom native-only components
|
|
88
|
+
*/
|
|
89
|
+
additionalNativePrimitives?: string[];
|
|
90
|
+
/**
|
|
91
|
+
* Additional React DOM primitives to flag beyond the built-in list
|
|
92
|
+
* Useful for flagging custom web-only components
|
|
93
|
+
*/
|
|
94
|
+
additionalDomPrimitives?: string[];
|
|
95
|
+
/**
|
|
96
|
+
* Primitives to ignore/allow even if they would normally be flagged
|
|
97
|
+
*/
|
|
98
|
+
ignoredPrimitives?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Glob patterns for files to skip analysis on
|
|
101
|
+
* @example ['**\/*.test.tsx', '**\/*.stories.tsx']
|
|
102
|
+
*/
|
|
103
|
+
ignoredPatterns?: string[];
|
|
104
|
+
/**
|
|
105
|
+
* Additional module sources to treat as React Native
|
|
106
|
+
* @example ['react-native-gesture-handler', 'react-native-reanimated']
|
|
107
|
+
*/
|
|
108
|
+
additionalNativeSources?: string[];
|
|
109
|
+
/**
|
|
110
|
+
* Additional module sources to treat as React DOM
|
|
111
|
+
* @example ['react-dom/client']
|
|
112
|
+
*/
|
|
113
|
+
additionalDomSources?: string[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Input for batch file analysis
|
|
117
|
+
*/
|
|
118
|
+
interface FileInput {
|
|
119
|
+
/** File path */
|
|
120
|
+
path: string;
|
|
121
|
+
/** File content (source code) */
|
|
122
|
+
content: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Primitive rule definition
|
|
126
|
+
*/
|
|
127
|
+
interface PrimitiveRule {
|
|
128
|
+
/** Name of the primitive/component */
|
|
129
|
+
name: string;
|
|
130
|
+
/** Module source it comes from */
|
|
131
|
+
source: string;
|
|
132
|
+
/** Platform it belongs to */
|
|
133
|
+
platform: Platform;
|
|
134
|
+
/** Optional description of why it's platform-specific */
|
|
135
|
+
description?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Rule set containing primitives for a specific platform
|
|
139
|
+
*/
|
|
140
|
+
interface PrimitiveRuleSet {
|
|
141
|
+
/** Platform these rules apply to */
|
|
142
|
+
platform: Platform;
|
|
143
|
+
/** List of primitive rules */
|
|
144
|
+
primitives: PrimitiveRule[];
|
|
145
|
+
/** Module sources that indicate this platform */
|
|
146
|
+
sources: string[];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type { AnalysisResult as A, FileType as F, ImportInfo as I, Platform as P, Severity as S, ViolationType as V, Violation as a, AnalyzerOptions as b, FileInput as c, PrimitiveRule as d, PrimitiveRuleSet as e };
|