@stylexjs/babel-plugin 0.16.2 → 0.17.0

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 (45) hide show
  1. package/lib/index.d.ts +5 -5
  2. package/lib/index.js +893 -1775
  3. package/lib/index.js.flow +2 -1
  4. package/lib/shared/common-types.d.ts +3 -4
  5. package/lib/shared/index.d.ts +1 -1
  6. package/lib/shared/index.js.flow +1 -1
  7. package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +4 -0
  8. package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +5 -0
  9. package/lib/shared/stylex-create-theme.d.ts +1 -1
  10. package/lib/shared/stylex-define-vars.d.ts +3 -3
  11. package/lib/shared/types/index.js.flow +12 -12
  12. package/lib/shared/utils/object-utils.js.flow +1 -1
  13. package/lib/shared/when/when.d.ts +5 -5
  14. package/lib/shared/when/when.js.flow +5 -5
  15. package/lib/utils/add-sourcemap-data.js.flow +2 -2
  16. package/lib/utils/ast-helpers.js.flow +3 -3
  17. package/lib/utils/evaluate-path.d.ts +1 -0
  18. package/lib/utils/evaluate-path.js.flow +3 -2
  19. package/lib/utils/js-to-ast.d.ts +0 -4
  20. package/lib/utils/js-to-ast.js.flow +1 -7
  21. package/lib/utils/state-manager.d.ts +37 -19
  22. package/lib/utils/state-manager.js.flow +37 -22
  23. package/lib/utils/validate.d.ts +1 -0
  24. package/lib/utils/validate.js.flow +2 -0
  25. package/lib/visitors/imports.js.flow +2 -2
  26. package/lib/visitors/parse-stylex-create-arg.js.flow +2 -2
  27. package/lib/visitors/stylex-create-theme.js.flow +2 -2
  28. package/lib/visitors/stylex-create.js.flow +2 -2
  29. package/lib/visitors/stylex-default-marker.js.flow +2 -2
  30. package/lib/visitors/stylex-define-consts.js.flow +2 -2
  31. package/lib/visitors/stylex-define-marker.d.ts +22 -0
  32. package/lib/visitors/stylex-define-marker.js.flow +22 -0
  33. package/lib/visitors/stylex-define-vars.js.flow +2 -2
  34. package/lib/visitors/stylex-keyframes.js.flow +2 -2
  35. package/lib/visitors/stylex-merge.js.flow +2 -2
  36. package/lib/visitors/stylex-position-try.js.flow +2 -2
  37. package/lib/visitors/stylex-props.js.flow +2 -2
  38. package/lib/visitors/stylex-view-transition-class.js.flow +2 -2
  39. package/package.json +4 -3
  40. package/flow_modules/@babel/core/index.js.flow +0 -854
  41. package/flow_modules/@babel/generator/index.js.flow +0 -216
  42. package/flow_modules/@babel/helper-module-imports/index.js.flow +0 -182
  43. package/flow_modules/@babel/parser/index.js.flow +0 -253
  44. package/flow_modules/@babel/traverse/index.js.flow +0 -1007
  45. package/flow_modules/@babel/types/index.js.flow +0 -5225
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  /// This function looks for `stylex.create` calls and transforms them.
14
14
  /// 1. It finds the first argument to `stylex.create` and validates it.
@@ -7,9 +7,9 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { NodePath } from '@babel/traverse';
11
11
 
12
- import * as t from '../../flow_modules/@babel/types';
12
+ import * as t from '@babel/types';
13
13
  import StateManager from '../utils/state-manager';
14
14
  /**
15
15
  * Transforms calls to `stylex.defaultMarker()` (or imported `defaultMarker()`)
@@ -7,9 +7,9 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { NodePath } from '@babel/traverse';
11
11
 
12
- import * as t from '../../flow_modules/@babel/types';
12
+ import * as t from '@babel/types';
13
13
  import StateManager from '../utils/state-manager';
14
14
 
15
15
  /// This function looks for `stylex.defineConsts` calls and transforms them.
@@ -0,0 +1,22 @@
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 { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
+ import StateManager from '../utils/state-manager';
13
+ /**
14
+ * Transforms calls to `stylex.defineMarker()` (or imported `defineMarker()`)
15
+ * into an object: { $$css: true, [hash]: hash } where `hash` is generated from
16
+ * the file path and the export name.
17
+ */
18
+ declare function transformStyleXDefineMarker(
19
+ path: NodePath<t.CallExpression>,
20
+ state: StateManager,
21
+ ): void;
22
+ export default transformStyleXDefineMarker;
@@ -0,0 +1,22 @@
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 { NodePath } from '@babel/traverse';
11
+
12
+ import * as t from '@babel/types';
13
+ import StateManager from '../utils/state-manager';
14
+ /**
15
+ * Transforms calls to `stylex.defineMarker()` (or imported `defineMarker()`)
16
+ * into an object: { $$css: true, [hash]: hash } where `hash` is generated from
17
+ * the file path and the export name.
18
+ */
19
+ declare export default function transformStyleXDefineMarker(
20
+ path: NodePath<t.CallExpression>,
21
+ state: StateManager,
22
+ ): void;
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  /// This function looks for `stylex.defineVars` calls and transforms them.
14
14
  /// 1. It finds the first argument to `stylex.defineVars` and validates it.
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  /// This function looks for `stylex.keyframes` calls and transforms them.
14
14
  /// 1. It finds the first argument to `stylex.keyframes` and validates it.
@@ -7,9 +7,9 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { NodePath } from '@babel/traverse';
11
11
 
12
- import * as t from '../../flow_modules/@babel/types';
12
+ import * as t from '@babel/types';
13
13
  import StateManager from '../utils/state-manager';
14
14
  declare export function skipStylexMergeChildren(
15
15
  path: NodePath<t.CallExpression>,
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  /// This function looks for `stylex.positionTry` calls within variable declarations and transforms them.
14
14
  /// 1. It finds the first argument to `stylex.positionTry` and validates it.
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  declare export function skipStylexPropsChildren(
14
14
  path: NodePath<t.CallExpression>,
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  /// This function looks for `stylex.viewTransitionClass` calls within variable declarations and transforms them.
14
14
  /// 1. It finds the first argument to `stylex.viewTransitionClass` and validates it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.16.2",
3
+ "version": "0.17.0",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -21,7 +21,8 @@
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.16.2",
24
+ "@stylexjs/shared": "0.17.0",
25
+ "@stylexjs/stylex": "0.17.0",
25
26
  "postcss-value-parser": "^4.1.0"
26
27
  },
27
28
  "devDependencies": {
@@ -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.16.2"
37
+ "scripts": "0.17.0"
37
38
  },
38
39
  "files": [
39
40
  "flow_modules/*",