@stylexjs/babel-plugin 0.14.3 → 0.15.1

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.
@@ -46,6 +46,7 @@ export type StyleXOptions = Readonly<{
46
46
  enableDebugDataProp?: null | undefined | boolean;
47
47
  enableDevClassNames?: null | undefined | boolean;
48
48
  enableFontSizePxToRem?: null | undefined | boolean;
49
+ enableMediaQueryOrder?: null | undefined | boolean;
49
50
  enableLegacyValueFlipping?: null | undefined | boolean;
50
51
  enableLogicalStylesPolyfill?: null | undefined | boolean;
51
52
  enableMinifiedKeys?: null | undefined | boolean;
@@ -52,6 +52,7 @@ export type StyleXOptions = $ReadOnly<{
52
52
  enableDebugDataProp?: ?boolean,
53
53
  enableDevClassNames?: ?boolean,
54
54
  enableFontSizePxToRem?: ?boolean,
55
+ enableMediaQueryOrder?: ?boolean,
55
56
  enableLegacyValueFlipping?: ?boolean,
56
57
  enableLogicalStylesPolyfill?: ?boolean,
57
58
  enableMinifiedKeys?: ?boolean,
@@ -25,6 +25,7 @@ export declare const ILLEGAL_NAMESPACE_VALUE: 'A StyleX namespace must be an obj
25
25
  export declare const INVALID_CONST_KEY: 'Keys in defineConsts() cannot start with "--".';
26
26
  export declare const INVALID_PSEUDO: 'Invalid pseudo selector, not on the whitelist.';
27
27
  export declare const INVALID_PSEUDO_OR_AT_RULE: 'Invalid pseudo or at-rule.';
28
+ export declare const INVALID_MEDIA_QUERY_SYNTAX: 'Invalid media query syntax.';
28
29
  export declare const LINT_UNCLOSED_FUNCTION: 'Rule contains an unclosed function';
29
30
  export declare const LOCAL_ONLY: 'The return value of create() should not be exported.';
30
31
  export declare const NON_OBJECT_KEYFRAME: 'Every frame within a keyframes() call must be an object.';
@@ -29,6 +29,7 @@ declare export const ILLEGAL_NAMESPACE_VALUE: 'A StyleX namespace must be an obj
29
29
  declare export const INVALID_CONST_KEY: 'Keys in defineConsts() cannot start with "--".';
30
30
  declare export const INVALID_PSEUDO: 'Invalid pseudo selector, not on the whitelist.';
31
31
  declare export const INVALID_PSEUDO_OR_AT_RULE: 'Invalid pseudo or at-rule.';
32
+ declare export const INVALID_MEDIA_QUERY_SYNTAX: 'Invalid media query syntax.';
32
33
  declare export const LINT_UNCLOSED_FUNCTION: 'Rule contains an unclosed function';
33
34
  declare export const LOCAL_ONLY: 'The return value of create() should not be exported.';
34
35
  declare export const NON_OBJECT_KEYFRAME: 'Every frame within a keyframes() call must be an object.';
@@ -65,7 +65,7 @@ export interface CSSType<+_T: string | number = string | number> {
65
65
 
66
66
  declare export const isCSSType: (
67
67
  value: mixed,
68
- ) => implies value is CSSType<string | number>;
68
+ ) => value is CSSType<string | number>;
69
69
 
70
70
  type AngleValue = string;
71
71
  declare export class Angle<+T: AngleValue>
@@ -14,7 +14,7 @@ import type { CompiledStyles } from '../common-types';
14
14
  // eslint-disable-next-line no-unused-vars
15
15
  type AnyObject = { +[string]: mixed };
16
16
 
17
- declare export function isPlainObject(obj: mixed): implies obj is AnyObject;
17
+ declare export function isPlainObject(obj: mixed): obj is AnyObject;
18
18
 
19
19
  declare export function flattenObject(obj: CompiledStyles): {
20
20
  +[string]: null | string,
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ import type { ImportOptions } from '@babel/helper-module-imports';
11
+ import type { NodePath } from '@babel/traverse';
12
+ type ImportAdditionOptions = Omit<
13
+ Partial<ImportOptions>,
14
+ 'ensureLiveReference' | 'ensureNoContext'
15
+ >;
16
+ import * as t from '@babel/types';
17
+ export declare function hoistExpression(
18
+ path: NodePath,
19
+ astExpression: t.Expression,
20
+ ): t.Expression;
21
+ export declare function pathReplaceHoisted(
22
+ path: NodePath,
23
+ astExpression: t.Expression,
24
+ ): void;
25
+ export declare function addNamedImport(
26
+ statementPath: NodePath,
27
+ as: string,
28
+ from: string,
29
+ options: ImportAdditionOptions,
30
+ ): t.Identifier;
31
+ export declare function addDefaultImport(
32
+ statementPath: NodePath,
33
+ from: string,
34
+ options: ImportAdditionOptions,
35
+ ): t.Identifier;
36
+ export declare function isProgramLevel(path: NodePath): boolean;
37
+ export declare function getProgramStatement(path: NodePath): NodePath;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type { ImportOptions } from '../../flow_modules/@babel/helper-module-imports';
11
+ import type { NodePath } from '../../flow_modules/@babel/traverse';
12
+ type ImportAdditionOptions = Omit<
13
+ Partial<ImportOptions>,
14
+ 'ensureLiveReference' | 'ensureNoContext',
15
+ >;
16
+
17
+ import * as t from '../../flow_modules/@babel/types';
18
+
19
+ declare export function hoistExpression(
20
+ path: NodePath<>,
21
+ astExpression: t.Expression,
22
+ ): t.Expression;
23
+
24
+ declare export function pathReplaceHoisted(
25
+ path: NodePath<>,
26
+ astExpression: t.Expression,
27
+ ): void;
28
+
29
+ declare export function addNamedImport(
30
+ statementPath: NodePath<>,
31
+ as: string,
32
+ from: string,
33
+ options: ImportAdditionOptions,
34
+ ): t.Identifier;
35
+
36
+ declare export function addDefaultImport(
37
+ statementPath: NodePath<>,
38
+ from: string,
39
+ options: ImportAdditionOptions,
40
+ ): t.Identifier;
41
+
42
+ declare export function isProgramLevel(path: NodePath<>): boolean;
43
+
44
+ declare export function getProgramStatement(path: NodePath<>): NodePath<>;
@@ -13,12 +13,7 @@ import type {
13
13
  CompiledNamespaces,
14
14
  StyleXOptions as RuntimeOptions,
15
15
  } from '../shared';
16
- import type { ImportOptions } from '@babel/helper-module-imports';
17
16
  import * as t from '@babel/types';
18
- type ImportAdditionOptions = Omit<
19
- Partial<ImportOptions>,
20
- 'ensureLiveReference' | 'ensureNoContext'
21
- >;
22
17
  export type ImportPathResolution =
23
18
  | false
24
19
  | ['themeNameRef' | 'filePath', string];
@@ -46,6 +41,7 @@ export type StyleXOptions = Readonly<
46
41
  enableDebugDataProp?: boolean;
47
42
  enableDevClassNames?: boolean;
48
43
  enableInlinedConditionalMerge?: boolean;
44
+ enableMediaQueryOrder?: boolean;
49
45
  enableLegacyValueFlipping?: boolean;
50
46
  enableLogicalStylesPolyfill?: boolean;
51
47
  enableMinifiedKeys?: boolean;
@@ -69,6 +65,7 @@ export type StyleXOptions = Readonly<
69
65
  enableDebugDataProp?: boolean;
70
66
  enableDevClassNames?: boolean;
71
67
  enableInlinedConditionalMerge?: boolean;
68
+ enableMediaQueryOrder?: boolean;
72
69
  enableLegacyValueFlipping?: boolean;
73
70
  enableLogicalStylesPolyfill?: boolean;
74
71
  enableMinifiedKeys?: boolean;
@@ -143,17 +140,6 @@ declare class StateManager {
143
140
  | null
144
141
  | undefined
145
142
  | Readonly<{ from: string; as?: null | undefined | string }>;
146
- addNamedImport(
147
- statementPath: NodePath,
148
- as: string,
149
- from: string,
150
- options: ImportAdditionOptions,
151
- ): t.Identifier;
152
- addDefaultImport(
153
- statementPath: NodePath,
154
- from: string,
155
- options: ImportAdditionOptions,
156
- ): t.Identifier;
157
143
  get opts(): StyleXStateOptions;
158
144
  get isDebug(): boolean;
159
145
  get isDev(): boolean;
@@ -13,14 +13,7 @@ import type {
13
13
  CompiledNamespaces,
14
14
  StyleXOptions as RuntimeOptions,
15
15
  } from '../shared';
16
- import type { ImportOptions } from '../../flow_modules/@babel/helper-module-imports';
17
-
18
16
  import * as t from '../../flow_modules/@babel/types';
19
- type ImportAdditionOptions = Omit<
20
- Partial<ImportOptions>,
21
- 'ensureLiveReference' | 'ensureNoContext',
22
- >;
23
-
24
17
  export type ImportPathResolution =
25
18
  | false
26
19
  | ['themeNameRef' | 'filePath', string];
@@ -48,6 +41,7 @@ export type StyleXOptions = $ReadOnly<{
48
41
  enableDebugDataProp?: boolean,
49
42
  enableDevClassNames?: boolean,
50
43
  enableInlinedConditionalMerge?: boolean,
44
+ enableMediaQueryOrder?: boolean,
51
45
  enableLegacyValueFlipping?: boolean,
52
46
  enableLogicalStylesPolyfill?: boolean,
53
47
  enableMinifiedKeys?: boolean,
@@ -99,17 +93,6 @@ declare export default class StateManager {
99
93
  get canReferenceTheme(): boolean;
100
94
  get metadata(): { [key: string]: any };
101
95
  get runtimeInjection(): ?$ReadOnly<{ from: string, as?: ?string }>;
102
- addNamedImport(
103
- statementPath: NodePath<>,
104
- as: string,
105
- from: string,
106
- options: ImportAdditionOptions,
107
- ): t.Identifier;
108
- addDefaultImport(
109
- statementPath: NodePath<>,
110
- from: string,
111
- options: ImportAdditionOptions,
112
- ): t.Identifier;
113
96
  get opts(): StyleXStateOptions;
114
97
  get isDebug(): boolean;
115
98
  get isDev(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.14.3",
3
+ "version": "0.15.1",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -21,8 +21,9 @@
21
21
  "@babel/traverse": "^7.26.8",
22
22
  "@babel/types": "^7.26.8",
23
23
  "@dual-bundle/import-meta-resolve": "^4.1.0",
24
- "@stylexjs/stylex": "0.14.3",
25
- "postcss-value-parser": "^4.1.0"
24
+ "@stylexjs/stylex": "0.15.1",
25
+ "postcss-value-parser": "^4.1.0",
26
+ "style-value-parser": "0.15.1"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@rollup/plugin-alias": "^5.1.1",
@@ -33,7 +34,7 @@
33
34
  "@rollup/plugin-replace": "^6.0.1",
34
35
  "babel-plugin-syntax-hermes-parser": "^0.26.0",
35
36
  "rollup": "^4.24.0",
36
- "scripts": "0.14.3"
37
+ "scripts": "0.15.1"
37
38
  },
38
39
  "files": [
39
40
  "flow_modules/*",