@stylexswc/rs-compiler 0.15.4 → 0.15.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.
- package/dist/index.d.ts +43 -111
- package/dist/index.js +161 -614
- package/dist/transform.d.ts +83 -0
- package/dist/transform.js +581 -0
- package/package.json +40 -25
package/dist/index.d.ts
CHANGED
|
@@ -1,112 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface StyleXMetadata {
|
|
26
|
-
stylex: ([string, { ltr: string; rtl?: null | string }, number])[]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface StyleXModuleResolution {
|
|
30
|
-
type: string
|
|
31
|
-
rootDir?: string
|
|
32
|
-
themeFileExtension?: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface StyleXOptions {
|
|
36
|
-
styleResolution?: 'application-order' | 'property-specificity' | 'legacy-expand-shorthands'
|
|
37
|
-
enableFontSizePxToRem?: boolean
|
|
38
|
-
runtimeInjection?: boolean | string
|
|
39
|
-
classNamePrefix?: string
|
|
40
|
-
definedStylexCssVariables?: Record<string, string>
|
|
41
|
-
importSources?: (string | { as: string, from: string })[]
|
|
42
|
-
treeshakeCompensation?: boolean
|
|
43
|
-
enableInlinedConditionalMerge?: boolean
|
|
44
|
-
enableMediaQueryOrder?: boolean
|
|
45
|
-
enableLogicalStylesPolyfill?: boolean
|
|
46
|
-
enableLegacyValueFlipping?: boolean
|
|
47
|
-
enableLTRRTLComments?: boolean
|
|
48
|
-
legacyDisableLayers?: boolean
|
|
49
|
-
dev?: boolean
|
|
50
|
-
test?: boolean
|
|
51
|
-
debug?: boolean
|
|
52
|
-
enableDebugClassNames?: boolean
|
|
53
|
-
enableDebugDataProp?: boolean
|
|
54
|
-
enableDevClassNames?: boolean
|
|
55
|
-
enableMinifiedKeys?: boolean
|
|
56
|
-
injectStylexSideEffects?: boolean
|
|
57
|
-
useRealFileForSource?: boolean
|
|
58
|
-
aliases?: Record<string, string[]>
|
|
59
|
-
unstable_moduleResolution?: StyleXModuleResolution
|
|
60
|
-
sourceMap?: SourceMaps
|
|
61
|
-
include?: Array<string | RegExp>
|
|
62
|
-
exclude?: Array<string | RegExp>
|
|
63
|
-
swcPlugins?: Array<[string, Record<string, any>]>
|
|
64
|
-
propertyValidationMode?: 'throw' | 'warn' | 'silent'
|
|
65
|
-
/** Compile-time constants and functions accessible via `stylex.env`. */
|
|
66
|
-
env?: Record<string, any>
|
|
67
|
-
/**
|
|
68
|
-
* Optional function or string to transform file paths used in debug class
|
|
69
|
-
* names / source maps.
|
|
70
|
-
*/
|
|
71
|
-
debugFilePath?: ((filePath: string) => string) | string | undefined
|
|
72
|
-
/**
|
|
73
|
-
* The prop name to use as the `sx` shorthand (default: `"sx"`). Set to
|
|
74
|
-
* `false` to disable.
|
|
75
|
-
*/
|
|
76
|
-
sxPropName?: string | false
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface StyleXTransformResult {
|
|
80
|
-
code: string
|
|
81
|
-
metadata: StyleXMetadata
|
|
82
|
-
map?: string
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export declare function transform(filename: string, code: string, options: StyleXOptions): StyleXTransformResult
|
|
86
|
-
export interface TransformOutput {
|
|
87
|
-
code: string
|
|
88
|
-
map?: string
|
|
89
|
-
output?: string
|
|
90
|
-
diagnostics: Array<string>
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// === Types (injected by scripts/inject-types.mjs) ===
|
|
96
|
-
|
|
97
|
-
export type UseLayersType =
|
|
98
|
-
| boolean
|
|
99
|
-
| {
|
|
100
|
-
before?: ReadonlyArray<string>;
|
|
101
|
-
after?: ReadonlyArray<string>;
|
|
102
|
-
prefix?: string;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export type TransformedOptions = Partial<
|
|
106
|
-
Pick<StyleXOptions, 'legacyDisableLayers' | 'enableLTRRTLComments'> & {
|
|
1
|
+
export type { ImportSourceInput, StyleXMetadata, StyleXModuleResolution, StyleXTransformResult, } from '../dist/transform';
|
|
2
|
+
import type { StyleXOptions as NativeStyleXOptions, StyleXTransformResult } from '../dist/transform';
|
|
3
|
+
export declare const SourceMaps: Readonly<{
|
|
4
|
+
readonly True: "True";
|
|
5
|
+
readonly False: "False";
|
|
6
|
+
readonly Inline: "Inline";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const PropertyValidationMode: Readonly<{
|
|
9
|
+
readonly Throw: "throw";
|
|
10
|
+
readonly Warn: "warn";
|
|
11
|
+
readonly Silent: "silent";
|
|
12
|
+
}>;
|
|
13
|
+
/** StyleX compiler options (native options + TS-only fields). */
|
|
14
|
+
export interface StyleXOptions extends NativeStyleXOptions {
|
|
15
|
+
include?: Array<string | RegExp>;
|
|
16
|
+
exclude?: Array<string | RegExp>;
|
|
17
|
+
swcPlugins?: Array<[string, Record<string, unknown>]>;
|
|
18
|
+
}
|
|
19
|
+
export type UseLayersType = boolean | {
|
|
20
|
+
before?: ReadonlyArray<string>;
|
|
21
|
+
after?: ReadonlyArray<string>;
|
|
22
|
+
prefix?: string;
|
|
23
|
+
};
|
|
24
|
+
export type TransformedOptions = Partial<Pick<StyleXOptions, 'legacyDisableLayers' | 'enableLTRRTLComments'> & {
|
|
107
25
|
useLayers: UseLayersType;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Normalize StyleX compiler options by applying defaults and merging
|
|
29
|
+
* user-provided values. Uses a spread/defaults pattern: defaults are
|
|
30
|
+
* applied first, then user-provided values overlay them
|
|
31
|
+
* (undefined keys skipped).
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeRsOptions(options?: StyleXOptions | null): StyleXOptions;
|
|
34
|
+
/**
|
|
35
|
+
* Determine whether a file should be transformed based on include/exclude
|
|
36
|
+
* patterns (glob strings or RegExp).
|
|
37
|
+
*/
|
|
38
|
+
export declare function shouldTransformFile(filePath: string, include?: Array<string | RegExp> | null, exclude?: Array<string | RegExp> | null): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Transform source code with StyleX. When `options.swcPlugins` is set,
|
|
41
|
+
* SWC plugins are applied first, then the native StyleX transform runs.
|
|
42
|
+
*/
|
|
43
|
+
export declare function transform(filename: string, code: string, options: StyleXOptions): StyleXTransformResult;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|