@hanzogui/static

v8.3.5 · types/index.d.ts · 48 values · 23 types

Exports

attrStr

value

export declare const attrStr: (attr?: ExtractedAttr) => string | t.JSXIdentifier;

@hanzogui/static/types/extractor/extractHelpers.d.ts

cacheDir

value

export declare const cacheDir: string | undefined;

@hanzogui/static/types/constants.d.ts

CacheObject

type

export interface CacheObject { [key: string]: any; }

@hanzogui/static/types/types.d.ts

checkDeps

value

export declare function checkDeps(root: string): Promise<void>;

@hanzogui/static/types/checkDeps.d.ts

ClassNameObject

type

export type ClassNameObject = t.StringLiteral | t.Expression;

@hanzogui/static/types/types.d.ts

ClassNameToStyleObj

type

export type ClassNameToStyleObj = { [key: string]: StyleObject; };

@hanzogui/static/types/types.d.ts

clearFormatCache

value

export declare function clearFormatCache(): void;

@hanzogui/static/types/extractor/detectModuleFormat.d.ts

concatClassName

value

next - take objects: { _shorthand: 'postfix' }

export declare function concatClassName(...args: any[]): any;

@hanzogui/static/types/extractor/concatClassName.d.ts

createExtractor

value

export declare function createExtractor({ logger, platform }?: ExtractorOptions): { options: { logger: import("../types.ts").Logger; }; cleanupBeforeExit: typeof cleanupBeforeExit; loadGui: (props: GuiOptions) => Promise<GuiProjectInfo | null>; loadGuiSync: (props: GuiOptions) => GuiProjectInfo | null; getGui(): import("@hanzogui/web").GuiInternalConfig | null | undefined; parseSync: (f: FileOrPath, props: ExtractorParseProps) => { styled: number; flattened: number; optimized: number; modified: number; found: number; } | null; parse: (f: FileOrPath, props: ExtractorParseProps) => Promise<{ styled: number; flattened: number; optimized: number; modified: number; found: number; } | null>; };

@hanzogui/static/types/extractor/createExtractor.d.ts

createLogger

value

export declare function createLogger(sourcePath: string, options: GuiOptions): (res: any) => void;

@hanzogui/static/types/extractor/createLogger.d.ts

CSS_FILE_NAME

value

export declare const CSS_FILE_NAME = "__snack.css";

@hanzogui/static/types/constants.d.ts

DEFAULT_EXTRACT_PACKAGES

value

The design-system allowlist an app can opt into. Not the default.

export declare const DEFAULT_EXTRACT_PACKAGES: string[];

@hanzogui/static/types/extractor/extractablePath.d.ts

DEPENDENCY_TYPE

value

export declare enum DEPENDENCY_TYPE { dependencies = "dependencies", devDependencies = "devDependencies", optionalDependencies = "optionalDependencies", peerDependencies = "peerDependencies", resolutions = "resolutions" }

@hanzogui/static/types/checkDeps.d.ts

detectModuleFormat

value

export declare function detectModuleFormat(filePath: string): ModuleFormat;

@hanzogui/static/types/extractor/detectModuleFormat.d.ts

esbuildWatchFiles

value

export declare function esbuildWatchFiles(entry: string, onChanged: () => void): Promise<() => void>;

@hanzogui/static/types/extractor/loadGui.d.ts

esbundleGuiConfig

value

export declare function esbundleGuiConfig(props: Props, platform: GuiPlatform, aliases?: Record<string, string>): Promise<esbuild.BuildResult<{ sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'; legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'; sourceRoot?: string; sourcesContent?: boolean; format?: esbuild.Format; globalName?: string; target?: string | string[]; supported?: Record<string, boolean>; platform?: esbuild.Platform; mangleProps?: RegExp; reserveProps?: RegExp; mangleQuoted?: boolean; mangleCache?: Record<string, string | false>; drop?: esbuild.Drop[]; dropLabels?: string[]; minify?: boolean; minifyWhitespace?: boolean; minifyIdentifiers?: boolean; minifySyntax?: boolean; lineLimit?: number; charset?: esbuild.Charset; treeShaking?: boolean; ignoreAnnotations?: boolean; jsx?: 'transform' | 'preserve' | 'automatic'; jsxFactory?: string; jsxFragment?: string; jsxImportSource?: string; jsxDev?: boolean; jsxSideEffects?: boolean; define?: { [key: string]: string; }; pure?: string[]; keepNames?: boolean; …

@hanzogui/static/types/extractor/bundle.d.ts

ExtractedAttr

type

export type ExtractedAttr = ExtractedAttrAttr | ExtractedTernaryAttr | ExtractedAttrStyle;

@hanzogui/static/types/types.d.ts

ExtractedAttrAttr

type

export type ExtractedAttrAttr = { type: 'attr'; value: t.JSXAttribute | t.JSXSpreadAttribute; extraClassNames?: string; };

@hanzogui/static/types/types.d.ts

ExtractedAttrStyle

type

export type ExtractedAttrStyle = { type: 'style'; value: ViewStyle & PseudoStyles; attr?: t.JSXAttribute | t.JSXSpreadAttribute; name?: string; extraClassNames?: string; };

@hanzogui/static/types/types.d.ts

ExtractedResponse

type

export type ExtractedResponse = { js: string | Buffer; styles: string; stylesPath?: string; ast: t.File; map: any; stats: { styled: number; flattened: number; optimized: number; found: number; }; };

@hanzogui/static/types/extractor/extractToClassNames.d.ts

ExtractedTernaryAttr

type

export type ExtractedTernaryAttr = { type: 'ternary'; value: Ternary; };

@hanzogui/static/types/types.d.ts

ExtractorOptions

type

export type ExtractorOptions = { logger?: Logger; platform?: GuiPlatform; };

@hanzogui/static/types/types.d.ts

ExtractorParseProps

type

export type ExtractorParseProps = Omit<GuiOptionsWithFileInfo, 'allLoadedComponents'> & { platform: GuiPlatform; shouldPrintDebug?: boolean | 'verbose'; onExtractTag: (props: ExtractTagProps) => void; getFlattenedNode?: (props: { isTextView: boolean; tag: string; }) => string; extractStyledDefinitions?: boolean; onStyledDefinitionRule?: (identifier: string, rules: string[]) => void; };

@hanzogui/static/types/types.d.ts

ExtractTagProps

type

export type ExtractTagProps = { parserProps: GuiOptionsWithFileInfo; attrs: ExtractedAttr[]; node: t.JSXOpeningElement; attemptEval: (exprNode: t.Node, evalFn?: ((node: t.Node) => any) | undefined) => any; flatNodeName?: string; jsxPath: NodePath<t.JSXElement>; programPath: NodePath<t.Program>; originalNodeName: string; lineNumbers: string; filePath: string; completeProps: Record<string, any>; staticConfig: StaticConfig; config: GuiConfig; };

@hanzogui/static/types/types.d.ts

extractToClassNames

value

export declare function extractToClassNames({ extractor, source, sourcePath, options, shouldPrintDebug, }: ExtractToClassNamesProps): Promise<ExtractedResponse | null>;

@hanzogui/static/types/extractor/extractToClassNames.d.ts

ExtractToClassNamesProps

type

export type ExtractToClassNamesProps = { extractor: Extractor; source: string | Buffer; sourcePath?: string; options: GuiOptions; shouldPrintDebug: boolean | 'verbose'; };

@hanzogui/static/types/extractor/extractToClassNames.d.ts

extractToNative

value

export declare function extractToNative(sourceFileName: string, sourceCode: string, options: GuiOptions): FileResult;

@hanzogui/static/types/extractor/extractToNative.d.ts

FAILED_EVAL

value

export declare const FAILED_EVAL: unique symbol;

@hanzogui/static/types/constants.d.ts

findComponentName

value

export declare function findComponentName(scope: any): string | undefined;

@hanzogui/static/types/extractor/extractHelpers.d.ts

generateThemesAndLog

value

export declare const generateThemesAndLog: (options: GuiOptions, force?: boolean) => Promise<void>;

@hanzogui/static/types/extractor/loadGui.d.ts

getBabelParseDefinition

value

export declare function getBabelParseDefinition(options: GuiOptions): { name: string; visitor: { Program: { enter(this: any, root: any): void; }; }; };

@hanzogui/static/types/extractor/extractToNative.d.ts

getBabelPlugin

value

export declare function getBabelPlugin(): (api: import("@babel/core").PluginAPI, options: GuiOptions, dirname: string) => import("@babel/core").PluginObject<any>;

@hanzogui/static/types/extractor/extractToNative.d.ts

getNameToPaths

value

export declare const getNameToPaths: () => {};

@hanzogui/static/types/registerRequire.d.ts

getOptions

value

export declare function getOptions({ root, tsconfigPath, hanzoguiOptions, host, debug, }?: Partial<CLIUserOptions>): Promise<CLIResolvedOptions>;

@hanzogui/static/types/extractor/loadGui.d.ts

getPragmaOptions

value

export declare function getPragmaOptions({ source, path }: { source: string; path: string; }): { shouldPrintDebug: "verbose" | boolean; shouldDisable: boolean; };

@hanzogui/static/types/getPragmaOptions.d.ts

getValidComponent

value

export declare function getValidComponent(props: GuiOptionsWithFileInfo, moduleName: string, componentName: string): false | { staticConfig: import("@hanzogui/web").StaticConfig; } | null;

@hanzogui/static/types/extractor/extractHelpers.d.ts

getValidComponentsPaths

value

export declare const getValidComponentsPaths: { (...args: any[]): any; cache: Map<any, any>; };

@hanzogui/static/types/extractor/extractHelpers.d.ts

getValidImport

value

export declare const getValidImport: (props: GuiOptionsWithFileInfo, moduleName: string, componentName?: string) => { staticConfig: import("@hanzogui/web").StaticConfig; } | null;

@hanzogui/static/types/extractor/extractHelpers.d.ts

GuiBuildOptions

type

export interface GuiBuildOptions { /** * module paths you want to compile with hanzogui (for example ['hanzogui']) * */ components?: string[]; /** * relative path to your hanzogui.config.ts */ config?: string; /** * Use the new ThemeBuilder in `@hanzogui/create-theme` to create beautiful theme sets, * see docs at https://hanzogui.dev/docs/guides/theme-builder * This helps you automate generating the build themes typescript file which loads fastere * and has smaller bundle size. */ themeBuilder?: { input: string; output: string; }; /** * Emit design system related CSS during build step for usage with frameworks */ outputCSS?: string | null | false; /** * (Experimental) outputs themes using CSS Nesting https://caniuse.com/css-nesting * Which can cut them in half due to no media query duplication. */ useCSSNesting?: boolean; /** * Gui can follow imports and evaluate them when parsing styles, leading to * higher percent of flattened / optimized views. We normalize this to be the * full path of the file, always ending in ".js". * …

@hanzogui/types/types/index.d.ts

GuiOptions

type

export interface GuiOptions extends GuiBuildOptions { platform?: 'native' | 'web'; }

@hanzogui/types/types/index.d.ts

GuiOptionsWithFileInfo

type

export type GuiOptionsWithFileInfo = GuiOptions & { sourcePath?: string; allLoadedComponents: LoadedComponents[]; };

@hanzogui/static/types/types.d.ts

GuiPlatform

type

export type GuiPlatform = 'native' | 'web';

@hanzogui/static/types/types.d.ts

GuiProjectInfo

type

export type { GuiProjectInfo };

@hanzogui/static/types/extractor/loadGui.d.ts

installedPackageOf

value

The installed package a file belongs to, or '' when the file is app or workspace source. Reads the LAST `node_modules/` segment, so a nested install and pnpm's `.pnpm/<pkg>@<ver>/node_modules/<pkg>` both name the package that actually owns the file.

export declare function installedPackageOf(sourcePath: string): string;

@hanzogui/static/types/extractor/extractablePath.d.ts

isComponentPackage

value

export declare const isComponentPackage: (props: GuiOptionsWithFileInfo, srcName: string) => any;

@hanzogui/static/types/extractor/extractHelpers.d.ts

isExtractable

value

May the compiler read styles out of this file?

export declare function isExtractable(sourcePath: string, extractPackages?: string[]): boolean;

@hanzogui/static/types/extractor/extractablePath.d.ts

isInsideComponentPackage

value

export declare const isInsideComponentPackage: (props: GuiOptionsWithFileInfo, moduleName: string) => any;

@hanzogui/static/types/extractor/extractHelpers.d.ts

isPresent

value

export declare function isPresent<T extends object>(input: null | void | undefined | T): input is T;

@hanzogui/static/types/extractor/extractHelpers.d.ts

isSimpleSpread

value

export declare function isSimpleSpread(node: t.JSXSpreadAttribute): boolean;

@hanzogui/static/types/extractor/extractHelpers.d.ts

isValidImport

value

export declare const isValidImport: (props: GuiOptionsWithFileInfo, moduleName: string, componentName?: string) => any;

@hanzogui/static/types/extractor/extractHelpers.d.ts

isValidModule

value

export declare const isValidModule: (props: GuiOptionsWithFileInfo, moduleName: string) => { isLocal: boolean; isValid: any; };

@hanzogui/static/types/extractor/extractHelpers.d.ts

isValidThemeHook

value

export declare function isValidThemeHook(props: GuiOptionsWithFileInfo, jsxPath: NodePath<t.JSXElement>, n: t.MemberExpression, sourcePath?: string): boolean;

@hanzogui/static/types/extractor/extractHelpers.d.ts

literalToAst

value

export declare function literalToAst(literal: any): t.Expression;

@hanzogui/static/types/extractor/literalToAst.d.ts

loadGui

value

export declare function loadGui(propsIn: Partial<GuiOptions>): Promise<GuiProjectInfo | null>;

@hanzogui/static/types/extractor/loadGui.d.ts

loadGuiBuildConfigAsync

value

Load hanzogui.build.ts config using esbuild-wasm transform Uses WASM to avoid native esbuild service lifecycle issues (EPIPE errors)

export declare function loadGuiBuildConfigAsync(hanzoguiOptions: Partial<GuiOptions> | undefined): Promise<GuiOptions>;

@hanzogui/static/types/extractor/loadGui.d.ts

loadGuiBuildConfigSync

value

@deprecated Use loadGuiBuildConfigAsync instead to avoid EPIPE errors

export declare function loadGuiBuildConfigSync(hanzoguiOptions: Partial<GuiOptions> | undefined): GuiOptions;

@hanzogui/static/types/extractor/loadGui.d.ts

loadGuiSync

value

export declare function loadGuiSync({ forceExports, cacheKey, ...propsIn }: Partial<GuiOptions> & { forceExports?: boolean; cacheKey?: string; }): GuiProjectInfo;

@hanzogui/static/types/extractor/loadGui.d.ts

Logger

type

export interface Logger { info(msg: string, options?: LogOptions): void; warn(msg: string, options?: LogOptions): void; error(msg: string, options?: LogOptions): void; }

@hanzogui/static/types/types.d.ts

LogOptions

type

export interface LogOptions { clear?: boolean; timestamp?: boolean; error?: Error | null; }

@hanzogui/static/types/types.d.ts

MEDIA_SEP

value

export declare const MEDIA_SEP = "_";

@hanzogui/static/types/constants.d.ts

objToStr

value

export declare const objToStr: (obj: any, spacer?: string) => any;

@hanzogui/static/types/extractor/extractHelpers.d.ts

Options

type

export type Options = { depType?: readonly `${DEPENDENCY_TYPE}`[]; fix?: boolean; ignoreDep?: readonly string[]; ignoreDepPattern?: readonly string[]; ignorePackage?: readonly string[]; ignorePackagePattern?: readonly string[]; ignorePath?: readonly string[]; ignorePathPattern?: readonly string[]; };

@hanzogui/static/types/checkDeps.d.ts

PluginContext

type

export interface PluginContext { write: (path: string, rules: { [key: string]: string; }) => any; }

@hanzogui/static/types/types.d.ts

registerRequire

value

export declare function registerRequire(platform: GuiPlatform, { proxyWormImports }?: { proxyWormImports: boolean; }): { hanzoguiRequire: (this: any, path: string) => any; unregister: () => void; };

@hanzogui/static/types/registerRequire.d.ts

resolveWebOrNativeSpecificEntry

value

export declare function resolveWebOrNativeSpecificEntry(entry: string, platform?: string): string;

@hanzogui/static/types/extractor/loadGui.d.ts

setRequireResult

value

export declare function setRequireResult(name: string, result: any): void;

@hanzogui/static/types/registerRequire.d.ts

SHOULD_DEBUG

value

export declare const SHOULD_DEBUG: boolean | undefined;

@hanzogui/static/types/constants.d.ts

StyleObject

type

export type StyleObject = [ property: string, value: any, identifier: string, pseudo: 'hover' | 'focus' | 'focus-visible' | 'focus-within' | 'active' | undefined, rules: string[] ];

@hanzogui/helpers/types/types.d.ts

Ternary

type

export interface Ternary { test: t.Expression; remove: Function; consequent: object | null; alternate: object | null; fontFamily?: string; inlineMediaQuery?: string; }

@hanzogui/static/types/types.d.ts

ternaryStr

value

export declare const ternaryStr: (x: Ternary) => string;

@hanzogui/static/types/extractor/extractHelpers.d.ts

watchGuiConfig

value

export declare function watchGuiConfig(hanzoguiOptions: GuiOptions): Promise<{ dispose(): void; } | undefined>;

@hanzogui/static/types/extractor/watchGuiConfig.d.ts