@qds.dev/tools 0.6.2 → 0.7.5

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.
Files changed (67) hide show
  1. package/lib/{vite → rolldown}/as-child.qwik.mjs +21 -18
  2. package/lib/{vite → rolldown}/icons.qwik.mjs +55 -44
  3. package/lib/rolldown/index.qwik.mjs +3 -2
  4. package/lib/rolldown/inline-css.qwik.mjs +25 -17
  5. package/lib/vite/index.qwik.mjs +5 -3
  6. package/lib/vite/minify-content.qwik.mjs +57 -0
  7. package/lib-types/tools/rolldown/as-child.d.ts +24 -0
  8. package/lib-types/tools/rolldown/icons.d.ts +47 -0
  9. package/lib-types/tools/rolldown/index.d.ts +4 -1
  10. package/lib-types/tools/rolldown/inline-css.d.ts +15 -5
  11. package/lib-types/tools/utils/icons/import-resolver.d.ts +1 -1
  12. package/lib-types/tools/utils/icons/transform/mdx.d.ts +1 -1
  13. package/lib-types/tools/utils/icons/transform/shared.d.ts +1 -1
  14. package/lib-types/tools/utils/icons/transform/tsx.d.ts +1 -1
  15. package/lib-types/tools/vite/index.d.ts +3 -3
  16. package/lib-types/tools/vite/minify-content.d.ts +9 -0
  17. package/package.json +9 -6
  18. package/lib/docs/component-props.qwik.mjs +0 -481
  19. package/lib/docs/index.qwik.mjs +0 -3
  20. package/lib/rolldown/qds-transform.qwik.mjs +0 -111
  21. package/lib/vite/component-props.qwik.mjs +0 -315
  22. package/lib-types/docs/component-props.d.ts +0 -25
  23. package/lib-types/docs/index.d.ts +0 -2
  24. package/lib-types/linter/qds-internal.d.ts +0 -7
  25. package/lib-types/linter/qds-internal.unit.d.ts +0 -1
  26. package/lib-types/linter/rule-tester.d.ts +0 -100
  27. package/lib-types/rolldown/index.d.ts +0 -3
  28. package/lib-types/rolldown/inline-css.d.ts +0 -16
  29. package/lib-types/rolldown/qds-transform.d.ts +0 -11
  30. package/lib-types/rolldown/qds-transform.unit.d.ts +0 -1
  31. package/lib-types/rolldown/qwik-rolldown.d.ts +0 -9
  32. package/lib-types/src/generate/icon-types.d.ts +0 -25
  33. package/lib-types/src/index.d.ts +0 -1
  34. package/lib-types/src/vite.d.ts +0 -1
  35. package/lib-types/tools/rolldown/qds-transform.d.ts +0 -11
  36. package/lib-types/tools/rolldown/qds-transform.unit.d.ts +0 -1
  37. package/lib-types/tools/vite/as-child.d.ts +0 -13
  38. package/lib-types/tools/vite/icons.d.ts +0 -19
  39. package/lib-types/utils/ast/core.d.ts +0 -4
  40. package/lib-types/utils/ast/imports.d.ts +0 -19
  41. package/lib-types/utils/ast/jsx-helpers.d.ts +0 -3
  42. package/lib-types/utils/ast/qwik.d.ts +0 -13
  43. package/lib-types/utils/fs.d.ts +0 -4
  44. package/lib-types/utils/icons/ast/expressions.d.ts +0 -50
  45. package/lib-types/utils/icons/ast/expressions.unit.d.ts +0 -1
  46. package/lib-types/utils/icons/ast/jsx.d.ts +0 -81
  47. package/lib-types/utils/icons/ast/jsx.unit.d.ts +0 -1
  48. package/lib-types/utils/icons/collections/loader.d.ts +0 -38
  49. package/lib-types/utils/icons/import-resolver.d.ts +0 -37
  50. package/lib-types/utils/icons/naming.d.ts +0 -46
  51. package/lib-types/utils/icons/transform/mdx.d.ts +0 -28
  52. package/lib-types/utils/icons/transform/shared.d.ts +0 -31
  53. package/lib-types/utils/icons/transform/tsx.d.ts +0 -51
  54. package/lib-types/utils/icons/types/mdx-ast.d.ts +0 -74
  55. package/lib-types/utils/index.d.ts +0 -13
  56. package/lib-types/utils/package-json.d.ts +0 -13
  57. package/lib-types/utils/transform-dts.d.ts +0 -15
  58. package/lib-types/utils/transform-dts.unit.d.ts +0 -1
  59. package/lib-types/vite/as-child.d.ts +0 -13
  60. package/lib-types/vite/as-child.unit.d.ts +0 -1
  61. package/lib-types/vite/component-props.d.ts +0 -24
  62. package/lib-types/vite/icons.d.ts +0 -19
  63. package/lib-types/vite/icons.unit.d.ts +0 -1
  64. package/lib-types/vite/index.d.ts +0 -3
  65. /package/lib-types/tools/{vite → rolldown}/as-child.unit.d.ts +0 -0
  66. /package/lib-types/tools/{vite → rolldown}/icons.unit.d.ts +0 -0
  67. /package/lib-types/{docs/component-props.unit.d.ts → tools/vite/minify-content.unit.d.ts} +0 -0
@@ -1,50 +0,0 @@
1
- import type { Node } from "@oxc-project/types";
2
- import { type Extracted } from "./jsx";
3
- /**
4
- * Handles various expression types in asChild elements
5
- * @param expression - The expression to handle
6
- * @param source - Original source code
7
- * @returns Extracted type and props, or null if unsupported
8
- */
9
- export declare function handleExpression(expression: Node, source: string): Extracted | null;
10
- /**
11
- * Handles conditional expressions (ternary operator)
12
- * @param expr - Conditional expression
13
- * @param source - Original source code
14
- * @returns Extracted type and props
15
- */
16
- export declare function handleConditionalExpression(expr: Node, source: string): Extracted;
17
- /**
18
- * Handles logical expressions (&&, ||)
19
- * @param expr - Logical expression
20
- * @param source - Original source code
21
- * @returns Extracted type and props, or null if unsupported
22
- */
23
- export declare function handleLogicalExpression(expr: Node, source: string): Extracted | null;
24
- /**
25
- * Handles identifier expressions (variables)
26
- * @param expr - Identifier expression
27
- * @param source - Original source code
28
- * @returns Extracted type and props
29
- */
30
- export declare function handleIdentifierExpression(expr: Node, source: string): Extracted;
31
- /**
32
- * Handles call expressions (function calls)
33
- * @param expr - Call expression
34
- * @param source - Original source code
35
- * @returns Extracted type and props
36
- */
37
- export declare function handleCallExpression(expr: Node, source: string): Extracted;
38
- /**
39
- * Handles member expressions (object.property, object.method())
40
- * @param expr - Member expression
41
- * @param source - Original source code
42
- * @returns Extracted type and props
43
- */
44
- export declare function handleMemberExpression(expr: Node, source: string): Extracted;
45
- /**
46
- * Checks if an expression type is supported
47
- * @param expressionType - The expression type to check
48
- * @returns True if the expression type is supported
49
- */
50
- export declare function isSupportedExpressionType(expressionType: string): boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1,81 +0,0 @@
1
- import type { Expression, JSXAttribute, JSXAttributeItem, JSXElement, JSXExpressionContainer, JSXMemberExpression, JSXText, Node } from "@oxc-project/types";
2
- export interface Extracted {
3
- type: string;
4
- props: string;
5
- }
6
- /**
7
- * Type guard to check if a node is a JSX element
8
- * @param node - AST node to check
9
- * @returns True if node is a JSX element
10
- */
11
- export declare function isJSXElement(node: Node): node is JSXElement;
12
- /**
13
- * Type guard to check if a node is a JSX expression container
14
- * @param node - AST node to check
15
- * @returns True if node is a JSX expression container
16
- */
17
- export declare function isJSXExpressionContainer(node: Node): node is JSXExpressionContainer;
18
- /**
19
- * Type guard to check if a node is JSX text
20
- * @param node - AST node to check
21
- * @returns True if node is JSX text
22
- */
23
- export declare function isJSXText(node: Node): node is JSXText;
24
- /**
25
- * Extracts type and props from various node types in conditional expressions
26
- * @param node - AST node to extract from
27
- * @param source - Original source code
28
- * @returns Object containing extracted type and props
29
- */
30
- export declare function extractFromNode(node: Node, source: string): Extracted;
31
- /**
32
- * Extracts type and props from a JSX element
33
- * @param elem - JSX element to extract from
34
- * @param source - Original source code
35
- * @returns Object containing extracted type and props
36
- */
37
- export declare function extractFromElement(elem: JSXElement, source: string): Extracted;
38
- /**
39
- * Extracts the full name from a JSX member expression (e.g., Menu.Item)
40
- * @param memberExpr - JSX member expression node
41
- * @param source - Original source code
42
- * @returns The full member expression as a string
43
- */
44
- export declare function extractJSXMemberExpressionName(memberExpr: JSXMemberExpression, source: string): string;
45
- /**
46
- * Extracts props from JSX attributes into object literal string
47
- * @param attributes - Array of JSX attributes
48
- * @param source - Original source code
49
- * @returns Object literal string representation of props
50
- */
51
- export declare function extractProps(attributes: JSXAttributeItem[], source: string): string;
52
- /**
53
- * Extracts the value from a JSX attribute
54
- * @param attr - JSX attribute to extract value from
55
- * @param source - Original source code
56
- * @returns String representation of the attribute value
57
- */
58
- export declare function getAttributeValue(attr: JSXAttribute, source: string): string;
59
- /**
60
- * Gets line number from source position for better error messages
61
- * @param source - Original source code
62
- * @param position - Character position in source
63
- * @returns Line number (1-based)
64
- */
65
- export declare function getLineNumber(source: string, position: number): number;
66
- /**
67
- * Convert extractProps result (object string) to attribute array
68
- * @param propsObj - Props object string from extractProps (e.g., '{ "class": "text-red" }')
69
- * @returns Array of attribute strings (e.g., ['class="text-red"'])
70
- */
71
- export declare function propsObjectToAttributes(propsObj: string): string[];
72
- /**
73
- * Extract children from JSX element, converting title and description props to SVG elements
74
- * @param elem - JSX element
75
- * @param source - Original source code
76
- * @param titleProp - Title prop value if present
77
- * @param descriptionProp - Description prop value if present
78
- * @param handleExpression - Expression handler function
79
- * @returns Children JSX code or null
80
- */
81
- export declare function extractChildren(elem: JSXElement, source: string, titleProp: string | undefined, descriptionProp: string | undefined, handleExpression: (expr: Expression, source: string) => unknown): string | null;
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- import type { IconifyJSON } from "@iconify/types";
2
- export type LazyCollections = Map<string, Promise<IconifyJSON>>;
3
- export type IconData = {
4
- body: string;
5
- viewBox: string;
6
- };
7
- export type LazyIconCache = Map<string, Promise<IconData | null>>;
8
- /**
9
- * Collection loader with lazy loading and caching
10
- */
11
- export declare class CollectionLoader {
12
- private debug;
13
- private lazyCollections;
14
- private lazyIconCache;
15
- private availableCollections;
16
- private require;
17
- constructor(debug: (message: string, ...data: unknown[]) => void);
18
- /**
19
- * Discover all available collections
20
- */
21
- discoverCollections(): void;
22
- /**
23
- * Get available collections
24
- */
25
- getAvailableCollections(): Set<string>;
26
- /**
27
- * Check if a collection is available
28
- */
29
- hasCollection(name: string): boolean;
30
- /**
31
- * Lazy load a collection
32
- */
33
- loadCollectionLazy(prefix: string): Promise<IconifyJSON>;
34
- /**
35
- * Lazy load icon data
36
- */
37
- loadIconDataLazy(prefix: string, name: string): Promise<IconData | null>;
38
- }
@@ -1,37 +0,0 @@
1
- import type { Program } from "@oxc-project/types";
2
- import type { PacksMap } from "../../vite/icons";
3
- /**
4
- * Map an imported name to a pack and collection name
5
- * @param importedName - The imported name from the import specifier
6
- * @param localAlias - The local alias for the import
7
- * @param aliasToPack - Map to store the alias to pack mapping
8
- * @param availableCollections - Set of available collection names
9
- * @param collectionNames - Map of alias to collection name
10
- * @param packs - Custom packs configuration
11
- * @param debug - Debug logging function
12
- * @param prefix - Debug prefix (e.g., "[MDX]")
13
- */
14
- export declare function mapImportToPack(importedName: string, localAlias: string, aliasToPack: Map<string, string>, availableCollections: Set<string>, collectionNames: Map<string, string>, packs: PacksMap | undefined, debug: (message: string, ...data: unknown[]) => void, prefix?: string): void;
15
- /**
16
- * Resolve import aliases from AST (for TSX/JSX files)
17
- * @param ast - AST program
18
- * @param importSources - Sources to scan for imports
19
- * @param availableCollections - Set of available collection names
20
- * @param collectionNames - Map of alias to collection name
21
- * @param packs - Custom packs configuration
22
- * @param debug - Debug logging function
23
- * @returns Map of local alias to pack name
24
- */
25
- export declare function resolveImportAliases(ast: Program, importSources: string[], availableCollections: Set<string>, collectionNames: Map<string, string>, packs: PacksMap | undefined, debug: (message: string, ...data: unknown[]) => void): Map<string, string>;
26
- /**
27
- * Extract import aliases from MDX MDAST using its built-in ESTree data
28
- * Uses oxc-walker for fast traversal
29
- * @param mdast - The MDAST from remark-mdx
30
- * @param importSources - Sources to scan for imports
31
- * @param availableCollections - Set of available collection names
32
- * @param collectionNames - Map of alias to collection name
33
- * @param packs - Custom packs configuration
34
- * @param debug - Debug logging function
35
- * @returns Map of local alias to pack name
36
- */
37
- export declare function extractMDXImportAliases(mdast: unknown, importSources: string[], availableCollections: Set<string>, collectionNames: Map<string, string>, packs: PacksMap | undefined, debug: (message: string, ...data: unknown[]) => void): Map<string, string>;
@@ -1,46 +0,0 @@
1
- /**
2
- * Convert PascalCase to kebab-case
3
- * @param str - Input string
4
- * @returns kebab-case string
5
- */
6
- export declare function toKebabCase(str: string): string;
7
- /**
8
- * Convert kebab-case or snake_case to PascalCase
9
- * @param str - Input string
10
- * @returns PascalCase string
11
- */
12
- export declare function toPascalCase(str: string): string;
13
- /**
14
- * Sanitize icon name to ensure valid identifier
15
- * @param name - Icon name
16
- * @param packName - Pack name (for custom sanitization)
17
- * @param customSanitizer - Optional custom sanitization function
18
- * @returns Sanitized icon name
19
- */
20
- export declare function sanitizeIconName(name: string, packName: string, customSanitizer?: (pascal: string) => string): string;
21
- /**
22
- * Resolve icon names to possible variants (kebab-case and lowercase)
23
- * @param pascalName - Icon name in PascalCase
24
- * @returns Array of possible icon name variants
25
- */
26
- export declare function resolveIconNames(pascalName: string): string[];
27
- /**
28
- * Generate stable import variable name for an icon
29
- * @param prefix - Iconify prefix
30
- * @param name - Icon name (kebab-case)
31
- * @param existingVars - Set of existing variable names in the file
32
- * @returns Unique variable name
33
- */
34
- export declare function generateImportVar(prefix: string, name: string, existingVars: Set<string>): string;
35
- /**
36
- * Get available Iconify collections from @iconify/json
37
- * @returns Array of collection prefixes
38
- */
39
- export declare function getAvailableCollections(): string[];
40
- /**
41
- * Discover all available iconify collections from node_modules
42
- * @returns Record of collection names to their configurations
43
- */
44
- export declare function discoverAllIconifyCollections(): Record<string, {
45
- iconifyPrefix: string;
46
- }>;
@@ -1,28 +0,0 @@
1
- import MagicString from "magic-string";
2
- import type { PacksMap } from "../../../vite/icons";
3
- import type { MDXJSXElement } from "../types/mdx-ast";
4
- /**
5
- * Extract attributes from MDX JSX node, handling title and description specially
6
- * @param jsxNode - MDX JSX node
7
- * @returns Object with attributes array and special props
8
- */
9
- export declare function extractMDXAttributes(jsxNode: MDXJSXElement): {
10
- attrs: string[];
11
- titleProp?: string;
12
- descriptionProp?: string;
13
- };
14
- /**
15
- * Transform MDX file using remark-mdx for semantic analysis
16
- * @param code - Original MDX source code
17
- * @param id - File ID
18
- * @param importSources - Sources to scan for imports
19
- * @param availableCollections - Set of available collection names
20
- * @param collectionNames - Map of alias to collection name
21
- * @param packs - Custom packs configuration
22
- * @param debug - Debug logging function
23
- * @returns Transformation result or null
24
- */
25
- export declare function transformMDXFile(code: string, id: string, importSources: string[], availableCollections: Set<string>, collectionNames: Map<string, string>, packs: PacksMap | undefined, debug: (message: string, ...data: unknown[]) => void): {
26
- code: string;
27
- map: ReturnType<MagicString["generateMap"]>;
28
- } | null;
@@ -1,31 +0,0 @@
1
- import type { PacksMap } from "../../../vite/icons";
2
- /**
3
- * Shared transformation context for both TSX/JSX and MDX files
4
- */
5
- export interface TransformContext {
6
- usedImports: Set<string>;
7
- importVars: Set<string>;
8
- virtualToVar: Map<string, string>;
9
- }
10
- /**
11
- * Generate virtual module ID and import variable for an icon
12
- * @param alias - The import alias used in the code
13
- * @param iconName - The icon name (PascalCase)
14
- * @param packName - The pack name
15
- * @param packs - Custom packs configuration
16
- * @param collectionNames - Map of alias to collection name
17
- * @param ctx - Transformation context
18
- * @returns Object with virtualId and varName
19
- */
20
- export declare function generateIconImport(alias: string, iconName: string, packName: string, packs: PacksMap | undefined, collectionNames: Map<string, string>, ctx: TransformContext): {
21
- virtualId: string;
22
- varName: string;
23
- };
24
- /**
25
- * Build SVG element string from attributes and import variable
26
- * @param attrs - Array of attribute strings
27
- * @param varName - Import variable name for dangerouslySetInnerHTML
28
- * @param children - Optional children JSX code
29
- * @returns Complete SVG element string
30
- */
31
- export declare function buildSVGElement(attrs: string[], varName: string, children?: string): string;
@@ -1,51 +0,0 @@
1
- import type { JSXElement, Program } from "@oxc-project/types";
2
- import MagicString from "magic-string";
3
- import type { PacksMap } from "../../../vite/icons";
4
- import { type TransformContext } from "./shared";
5
- /**
6
- * Check if a JSX element is an icon element based on its structure
7
- * @param elem - JSX element to check
8
- * @param aliasToPack - Map of aliases to pack names
9
- * @param collectionNames - Map of alias to collection name
10
- * @param availableCollections - Set of available collection names
11
- * @returns True if the element is an icon element
12
- */
13
- export declare function isIconElement(elem: JSXElement, aliasToPack: Map<string, string>, collectionNames: Map<string, string>, availableCollections: Set<string>): boolean;
14
- /**
15
- * Find all icon elements in an AST
16
- * @param ast - AST to search
17
- * @param aliasToPack - Map of aliases to pack names
18
- * @param collectionNames - Map of alias to collection name
19
- * @param availableCollections - Set of available collection names
20
- * @returns Array of JSX elements that are icon elements
21
- */
22
- export declare function findIconElements(ast: Program, aliasToPack: Map<string, string>, collectionNames: Map<string, string>, availableCollections: Set<string>): JSXElement[];
23
- /**
24
- * Transform a JSX icon element to SVG JSX
25
- * @param elem - JSX element to transform
26
- * @param s - MagicString instance
27
- * @param source - Original source code
28
- * @param aliasToPack - Map of aliases to pack names
29
- * @param collectionNames - Map of alias to collection name
30
- * @param packs - Custom packs configuration
31
- * @param ctx - Transformation context
32
- * @param debug - Debug logging function
33
- * @returns True if transformation was applied
34
- */
35
- export declare function transformIconElement(elem: JSXElement, s: MagicString, source: string, aliasToPack: Map<string, string>, collectionNames: Map<string, string>, packs: PacksMap | undefined, ctx: TransformContext, debug: (message: string, ...data: unknown[]) => void): boolean;
36
- /**
37
- * Transform TSX/JSX file
38
- * @param code - Original source code
39
- * @param id - File ID
40
- * @param ast - Parsed AST
41
- * @param aliasToPack - Map of aliases to pack names
42
- * @param collectionNames - Map of alias to collection name
43
- * @param availableCollections - Set of available collection names
44
- * @param packs - Custom packs configuration
45
- * @param debug - Debug logging function
46
- * @returns Transformation result or null
47
- */
48
- export declare function transformTSXFile(code: string, id: string, ast: Program, aliasToPack: Map<string, string>, collectionNames: Map<string, string>, availableCollections: Set<string>, packs: PacksMap | undefined, debug: (message: string, ...data: unknown[]) => void): {
49
- code: string;
50
- map: ReturnType<MagicString["generateMap"]>;
51
- } | null;
@@ -1,74 +0,0 @@
1
- /**
2
- * Type definitions for MDX AST nodes
3
- * These types are based on the MDAST and ESTree structures used by remark-mdx
4
- */
5
- export interface Position {
6
- start: {
7
- offset: number;
8
- line: number;
9
- column: number;
10
- };
11
- end: {
12
- offset: number;
13
- line: number;
14
- column: number;
15
- };
16
- }
17
- export interface MDXJSXAttribute {
18
- type: "mdxJsxAttribute";
19
- name: string;
20
- value?: string | {
21
- type: "mdxJsxAttributeValueExpression";
22
- value: string;
23
- data?: {
24
- estree?: unknown;
25
- };
26
- };
27
- }
28
- export interface MDXJSXElement {
29
- type: "mdxJsxFlowElement" | "mdxJsxTextElement";
30
- name: string | null;
31
- attributes?: MDXJSXAttribute[];
32
- position?: Position;
33
- children?: unknown[];
34
- }
35
- export interface ESTreeProgram {
36
- type: "Program";
37
- body: ESTreeStatement[];
38
- sourceType?: string;
39
- }
40
- export interface ESTreeImportDeclaration {
41
- type: "ImportDeclaration";
42
- source: {
43
- value: string;
44
- type: string;
45
- };
46
- specifiers: ESTreeImportSpecifier[];
47
- }
48
- export interface ESTreeImportSpecifier {
49
- type: "ImportSpecifier" | "ImportNamespaceSpecifier" | "ImportDefaultSpecifier";
50
- local: {
51
- name: string;
52
- type: string;
53
- };
54
- imported?: {
55
- name?: string;
56
- value?: string;
57
- type: string;
58
- };
59
- }
60
- export type ESTreeStatement = ESTreeImportDeclaration | {
61
- type: string;
62
- [key: string]: unknown;
63
- };
64
- export interface MDXjsEsmNode {
65
- type: "mdxjsEsm";
66
- data?: {
67
- estree?: ESTreeProgram;
68
- };
69
- position?: Position;
70
- }
71
- export type MDXNode = MDXJSXElement | MDXjsEsmNode | {
72
- type: string;
73
- [key: string]: unknown;
74
- };
@@ -1,13 +0,0 @@
1
- export * from "./ast/core";
2
- export * from "./ast/imports";
3
- export * from "./ast/jsx-helpers";
4
- export * from "./icons/ast/expressions";
5
- export * from "./icons/ast/jsx";
6
- export * from "./icons/collections/loader";
7
- export * from "./icons/import-resolver";
8
- export * from "./icons/naming";
9
- export * from "./icons/transform/mdx";
10
- export * from "./icons/transform/shared";
11
- export * from "./icons/transform/tsx";
12
- export * from "./package-json";
13
- export * from "./transform-dts";
@@ -1,13 +0,0 @@
1
- export type PackageJson = {
2
- dependencies?: Record<string, string>;
3
- peerDependencies?: Record<string, string>;
4
- devDependencies?: Record<string, string>;
5
- [key: string]: unknown;
6
- };
7
- /**
8
- * Safely reads and parses a package.json file
9
- * @param relativePath - Relative path to the package.json file from the current working directory
10
- * @returns Parsed package.json object
11
- * @throws Error if the file doesn't exist or has invalid structure
12
- */
13
- export declare function readPackageJson(relativePath?: string): PackageJson;
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- import type { Node } from "@oxc-project/types";
3
- import MagicString from "magic-string";
4
- import { parseSync } from "oxc-parser";
5
- declare function injectAsChildTypesIntoComponent(node: Node, content: string, s: MagicString): boolean;
6
- /**
7
- * Injects AsChildTypes import into the declaration file
8
- */
9
- declare function injectAsChildTypesImport(options: {
10
- ast: ReturnType<typeof parseSync>;
11
- magicString: MagicString;
12
- toolsImportNode: Node | null;
13
- }): void;
14
- declare function transformTypeFile(dtsPath: string, sourcePath: string): Promise<boolean>;
15
- export { injectAsChildTypesImport, injectAsChildTypesIntoComponent, transformTypeFile };
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import type { Plugin as VitePlugin } from "vite";
2
- export type AsChildTypes = {
3
- asChild?: true;
4
- };
5
- export type AsChildPluginOptions = {
6
- debug?: boolean;
7
- };
8
- /**
9
- * Vite plugin that transforms JSX elements with asChild prop by moving child element props to the parent
10
- * @param options - Plugin configuration options
11
- * @returns Vite plugin object
12
- */
13
- export declare const asChild: (options?: AsChildPluginOptions) => VitePlugin;
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import type { Plugin as VitePlugin } from "vite";
2
- export type PropType = {
3
- name: string;
4
- type: "boolean" | "string" | "number" | "union" | "function" | "unknown";
5
- unionValues?: string[];
6
- isBindable: boolean;
7
- defaultValue?: unknown;
8
- comment?: string;
9
- };
10
- export type ComponentPiece = {
11
- name: string;
12
- props: PropType[];
13
- };
14
- export type ComponentMetadata = {
15
- componentName: string;
16
- pieces: ComponentPiece[];
17
- };
18
- /**
19
- * Vite plugin that extracts component prop types and generates metadata JSON files
20
- */
21
- export declare const componentProps: (options: {
22
- componentsDir: string;
23
- outputDir: string;
24
- }) => VitePlugin;
@@ -1,19 +0,0 @@
1
- import type { Plugin as VitePlugin } from "vite";
2
- export type PacksMap = Record<string, {
3
- iconifyPrefix: string;
4
- sanitizeIcon?: (pascal: string) => string;
5
- }>;
6
- export type IconsPluginOptions = {
7
- debug?: boolean;
8
- /**
9
- * The sources to scan for imports. By default this includes QDS, you can also add your own when creating library wrappers.
10
- */
11
- importSources?: string[];
12
- packs?: PacksMap;
13
- };
14
- /**
15
- * Vite plugin that transforms icon JSX elements to direct <svg /> calls
16
- * @param options - Plugin configuration options
17
- * @returns Vite plugin object
18
- */
19
- export declare const icons: (options?: IconsPluginOptions) => VitePlugin;
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export * from "./as-child";
2
- export * from "./icons";
3
- export type { AsChildTypes } from "./as-child";