1 | import * as T from '@babel/types';
|
2 | import StyleImportInjector from './utils/ImportInjector';
|
3 | export interface ResolvedImport {
|
4 | identifier: string;
|
5 | request: string;
|
6 | type: string;
|
7 | }
|
8 | export interface UserDependency {
|
9 | source: string;
|
10 | imported?: string;
|
11 | type?: StyleType;
|
12 | }
|
13 | export declare type DependencyResolver = (interpolation: ResolvedImport, localStyle: Style, node: T.Expression) => UserDependency | null;
|
14 | export interface ResolvedOptions {
|
15 | configFile?: string | boolean;
|
16 | writeFiles: boolean;
|
17 | allowGlobal: boolean;
|
18 | cssTagName: string | false;
|
19 | styledTagName: string | false;
|
20 | stylesheetTagName: string | false;
|
21 | jsxPragma?: string | boolean;
|
22 | enableCssProp: boolean;
|
23 | enableDynamicInterpolations: 'cssProp' | boolean;
|
24 | noWarnings?: boolean;
|
25 | resolveDependency?: DependencyResolver;
|
26 | generateInterpolations?: boolean;
|
27 | extension: string;
|
28 | getFileName?: (hostFile: string, opts: ResolvedOptions, id?: string) => string;
|
29 | getRequirePath?: (from: string, to: string, identifier: string) => string;
|
30 | experiments: {
|
31 | modularCssExternals?: boolean;
|
32 | };
|
33 | }
|
34 | export declare type StyleType = 'stylesheet' | 'class' | 'styled';
|
35 | export interface BaseStyle {
|
36 | start: number;
|
37 | end: number;
|
38 | type: StyleType;
|
39 | hostFilePath?: string;
|
40 | absoluteFilePath: string;
|
41 | requirePath: string;
|
42 | identifier: string;
|
43 | value: string;
|
44 | code?: string;
|
45 | importIdentifier?: string;
|
46 | }
|
47 | export interface StaticStyle extends BaseStyle {
|
48 | type: 'stylesheet' | 'class';
|
49 | }
|
50 | export interface DynamicStyle extends BaseStyle {
|
51 | type: 'class' | 'styled';
|
52 | imports: string;
|
53 | interpolations: Array<{
|
54 | id: string;
|
55 | unit: string;
|
56 | }>;
|
57 | }
|
58 | export declare type Style = StaticStyle | DynamicStyle;
|
59 | export declare type NodeStyleMap = Map<T.Node, Style>;
|
60 | export interface Change {
|
61 | type: 'stylesheet' | 'class' | 'styled' | 'create-element' | 'style-imports' | 'pragma' | 'import-optimization';
|
62 | start: number;
|
63 | end: number;
|
64 | code?: string;
|
65 | }
|
66 | export interface StyleState {
|
67 | styles: Map<string, Style>;
|
68 | changeset: Change[];
|
69 | }
|
70 | export interface AstroturfMetadata {
|
71 | styles: Style[];
|
72 | changeset: Change[];
|
73 | }
|
74 | export declare type PluginState = Record<symbol, any> & {
|
75 | opts: Partial<ResolvedOptions>;
|
76 | styleImports: StyleImportInjector;
|
77 | defaultedOptions: ResolvedOptions;
|
78 | file: any;
|
79 | };
|