@stylexjs/babel-plugin 0.15.4 → 0.16.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.
@@ -632,10 +632,10 @@ declare export class NodePath<+T: Node = Node> {
632
632
  getCompletionRecords(): Array<NodePath<>>;
633
633
 
634
634
  getSibling(key: string | number): NodePath<>;
635
- getPrevSibling(): NodePath<>;
636
- getNextSibling(): NodePath<>;
637
- getAllPrevSiblings(): Array<NodePath<>>;
638
- getAllNextSiblings(): Array<NodePath<>>;
635
+ getSiblingBefore(): NodePath<>;
636
+ getSiblingAfter(): NodePath<>;
637
+ getAllSiblingBefore(): Array<NodePath<>>;
638
+ getAllSiblingAfter(): Array<NodePath<>>;
639
639
 
640
640
  get<K: $Keys<T>>(
641
641
  key: K,
package/lib/index.d.ts CHANGED
@@ -36,7 +36,14 @@ declare function stylexPluginWithOptions(
36
36
  export type Rule = [string, { ltr: string; rtl?: null | string }, number];
37
37
  declare function processStylexRules(
38
38
  rules: Array<Rule>,
39
- useLayers: boolean,
39
+ config?:
40
+ | boolean
41
+ | {
42
+ useLayers?: boolean,
43
+ enableLTRRTLComments?: boolean,
44
+ legacyDisableLayers?: boolean,
45
+ ...
46
+ },
40
47
  ): string;
41
48
  export type StyleXTransformObj = Readonly<{
42
49
  (): PluginObj;
package/lib/index.js CHANGED
@@ -807,6 +807,8 @@ class StateManager {
807
807
  stylexCreateThemeImport = new Set();
808
808
  stylexTypesImport = new Set();
809
809
  stylexViewTransitionClassImport = new Set();
810
+ stylexDefaultMarkerImport = new Set();
811
+ stylexWhenImport = new Set();
810
812
  injectImportInserted = null;
811
813
  styleMap = new Map();
812
814
  styleVars = new Map();
@@ -1176,6 +1178,12 @@ function readImportDeclarations(path, state) {
1176
1178
  if (importedName === 'types') {
1177
1179
  state.stylexTypesImport.add(localName);
1178
1180
  }
1181
+ if (importedName === 'when') {
1182
+ state.stylexWhenImport.add(localName);
1183
+ }
1184
+ if (importedName === 'defaultMarker') {
1185
+ state.stylexDefaultMarkerImport.add(localName);
1186
+ }
1179
1187
  }
1180
1188
  }
1181
1189
  }
@@ -1233,6 +1241,12 @@ function readRequires(path, state) {
1233
1241
  if (prop.key.name === 'types') {
1234
1242
  state.stylexTypesImport.add(value.name);
1235
1243
  }
1244
+ if (prop.key.name === 'when') {
1245
+ state.stylexWhenImport.add(value.name);
1246
+ }
1247
+ if (prop.key.name === 'defaultMarker') {
1248
+ state.stylexDefaultMarkerImport.add(value.name);
1249
+ }
1236
1250
  }
1237
1251
  }
1238
1252
  }
@@ -6231,9 +6245,11 @@ function styleXKeyframes(frames, options = defaultOptions) {
6231
6245
  const expandedObject = objMap(frames, frame => Pipe.create(frame).pipe(frame => expandFrameShorthands(frame, options)).pipe(x => objMapKeys(x, dashify)).pipe(x => objMap(x, (value, key) => transformValue(key, value, options))).done());
6232
6246
  const ltrStyles = objMap(expandedObject, frame => objMapEntry(frame, entry => generateLTR(entry, options)));
6233
6247
  const rtlStyles = objMap(expandedObject, frame => objMapEntry(frame, entry => generateRTL(entry, options) ?? entry));
6248
+ const stableStyles = objMap(expandedObject, frame => objMapEntry(frame, generateLTR));
6234
6249
  const ltrString = constructKeyframesObj(ltrStyles);
6235
6250
  const rtlString = constructKeyframesObj(rtlStyles);
6236
- const animationName = classNamePrefix + hash('<>' + ltrString) + '-B';
6251
+ const stableString = constructKeyframesObj(stableStyles);
6252
+ const animationName = classNamePrefix + hash('<>' + stableString) + '-B';
6237
6253
  const ltr = `@keyframes ${animationName}{${ltrString}}`;
6238
6254
  const rtl = ltrString === rtlString ? null : `@keyframes ${animationName}{${rtlString}}`;
6239
6255
  return [animationName, {
@@ -6313,6 +6329,53 @@ function genFileBasedIdentifier({
6313
6329
  return `${fileName}//${exportName}${key != null ? `.${key}` : ''}`;
6314
6330
  }
6315
6331
 
6332
+ function getDefaultMarkerClassName(options = defaultOptions) {
6333
+ const prefix = options.classNamePrefix != null ? `${options.classNamePrefix}-` : '';
6334
+ return `${prefix}default-marker`;
6335
+ }
6336
+ function validatePseudoSelector(pseudo) {
6337
+ if (!pseudo.startsWith(':')) {
6338
+ throw new Error('Pseudo selector must start with ":"');
6339
+ }
6340
+ if (pseudo.startsWith('::')) {
6341
+ throw new Error('Pseudo selector cannot start with "::" (pseudo-elements are not supported)');
6342
+ }
6343
+ }
6344
+ function ancestor(pseudo, options = defaultOptions) {
6345
+ validatePseudoSelector(pseudo);
6346
+ const defaultMarker = typeof options === 'string' ? options : getDefaultMarkerClassName(options);
6347
+ return `:where(.${defaultMarker}${pseudo} *)`;
6348
+ }
6349
+ function descendant(pseudo, options = defaultOptions) {
6350
+ validatePseudoSelector(pseudo);
6351
+ const defaultMarker = typeof options === 'string' ? options : getDefaultMarkerClassName(options);
6352
+ return `:has(.${defaultMarker}${pseudo})`;
6353
+ }
6354
+ function siblingBefore(pseudo, options = defaultOptions) {
6355
+ validatePseudoSelector(pseudo);
6356
+ const defaultMarker = typeof options === 'string' ? options : getDefaultMarkerClassName(options);
6357
+ return `:where(.${defaultMarker}${pseudo} ~ *)`;
6358
+ }
6359
+ function siblingAfter(pseudo, options = defaultOptions) {
6360
+ validatePseudoSelector(pseudo);
6361
+ const defaultMarker = typeof options === 'string' ? options : getDefaultMarkerClassName(options);
6362
+ return `:has(~ .${defaultMarker}${pseudo})`;
6363
+ }
6364
+ function anySibling(pseudo, options = defaultOptions) {
6365
+ validatePseudoSelector(pseudo);
6366
+ const defaultMarker = typeof options === 'string' ? options : getDefaultMarkerClassName(options);
6367
+ return `:where(.${defaultMarker}${pseudo} ~ *, :has(~ .${defaultMarker}${pseudo}))`;
6368
+ }
6369
+
6370
+ var _stylexWhen = /*#__PURE__*/Object.freeze({
6371
+ __proto__: null,
6372
+ ancestor: ancestor,
6373
+ anySibling: anySibling,
6374
+ descendant: descendant,
6375
+ siblingAfter: siblingAfter,
6376
+ siblingBefore: siblingBefore
6377
+ });
6378
+
6316
6379
  const create = styleXCreateSet;
6317
6380
  const defineVars = styleXDefineVars;
6318
6381
  const defineConsts = styleXDefineConsts;
@@ -6326,6 +6389,14 @@ const utils = {
6326
6389
  const messages = m;
6327
6390
  const firstThatWorks = stylexFirstThatWorks;
6328
6391
 
6392
+ function stylexDefaultMarker(options = defaultOptions) {
6393
+ const prefix = options.classNamePrefix != null ? `${options.classNamePrefix}-` : '';
6394
+ return {
6395
+ [`${prefix}default-marker`]: `${prefix}default-marker`,
6396
+ $$css: true
6397
+ };
6398
+ }
6399
+
6329
6400
  function getPackagePrefix(absolutePath) {
6330
6401
  const nodeModulesIndex = absolutePath.indexOf('node_modules');
6331
6402
  if (nodeModulesIndex !== -1) {
@@ -7268,6 +7339,7 @@ function transformStyleXCreate(path, state) {
7268
7339
  }
7269
7340
  const identifiers = {};
7270
7341
  const memberExpressions = {};
7342
+ const stylexWhen = Object.fromEntries(Object.entries(_stylexWhen).map(([key, value]) => [key, (pseudo, marker) => value(pseudo, marker ?? state.options)]));
7271
7343
  state.stylexFirstThatWorksImport.forEach(name => {
7272
7344
  identifiers[name] = {
7273
7345
  fn: firstThatWorks
@@ -7283,6 +7355,12 @@ function transformStyleXCreate(path, state) {
7283
7355
  fn: positionTry$1
7284
7356
  };
7285
7357
  });
7358
+ state.stylexDefaultMarkerImport.forEach(name => {
7359
+ identifiers[name] = () => stylexDefaultMarker(state.options);
7360
+ });
7361
+ state.stylexWhenImport.forEach(name => {
7362
+ identifiers[name] = stylexWhen;
7363
+ });
7286
7364
  state.stylexImport.forEach(name => {
7287
7365
  if (memberExpressions[name] == null) {
7288
7366
  memberExpressions[name] = {};
@@ -7296,6 +7374,13 @@ function transformStyleXCreate(path, state) {
7296
7374
  memberExpressions[name].positionTry = {
7297
7375
  fn: positionTry$1
7298
7376
  };
7377
+ memberExpressions[name].defaultMarker = {
7378
+ fn: () => stylexDefaultMarker(state.options)
7379
+ };
7380
+ identifiers[name] = {
7381
+ ...(identifiers[name] ?? {}),
7382
+ when: stylexWhen
7383
+ };
7299
7384
  });
7300
7385
  const {
7301
7386
  confident,
@@ -8175,6 +8260,22 @@ function transformStylexProps(path, state) {
8175
8260
  const args = node.arguments.flatMap(arg => arg.type === 'ArrayExpression' ? arg.elements : [arg]);
8176
8261
  let currentIndex = -1;
8177
8262
  let bailOutIndex = null;
8263
+ const identifiers = {};
8264
+ const memberExpressions = {};
8265
+ state.stylexDefaultMarkerImport.forEach(name => {
8266
+ identifiers[name] = () => stylexDefaultMarker(state.options);
8267
+ });
8268
+ state.stylexImport.forEach(name => {
8269
+ memberExpressions[name] = {
8270
+ defaultMarker: {
8271
+ fn: () => stylexDefaultMarker(state.options)
8272
+ }
8273
+ };
8274
+ });
8275
+ const evaluatePathFnConfig = {
8276
+ identifiers,
8277
+ memberExpressions
8278
+ };
8178
8279
  const resolvedArgs = [];
8179
8280
  for (const arg of args) {
8180
8281
  currentIndex++;
@@ -8277,7 +8378,7 @@ function transformStylexProps(path, state) {
8277
8378
  const {
8278
8379
  confident,
8279
8380
  value: styleValue
8280
- } = evaluate(path, state);
8381
+ } = evaluate(path, state, evaluatePathFnConfig);
8281
8382
  if (!confident || styleValue == null) {
8282
8383
  nonNullProps = true;
8283
8384
  styleNonNullProps = true;
@@ -8542,6 +8643,22 @@ function assertValidProperties(path, obj) {
8542
8643
  }
8543
8644
  }
8544
8645
 
8646
+ function transformStyleXDefaultMarker(path, state) {
8647
+ const {
8648
+ node
8649
+ } = path;
8650
+ if (node.type !== 'CallExpression') {
8651
+ return;
8652
+ }
8653
+ if (node.callee.type === 'Identifier' && state.stylexDefaultMarkerImport.has(node.callee.name) || node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'defaultMarker' && state.stylexImport.has(node.callee.object.name)) {
8654
+ if (node.arguments.length !== 0) {
8655
+ throw path.buildCodeFrameError(illegalArgumentLength('defaultMarker', 0), SyntaxError);
8656
+ }
8657
+ const value = stylexDefaultMarker(state.options);
8658
+ path.replaceWith(convertObjectToAST(value));
8659
+ }
8660
+ }
8661
+
8545
8662
  const NAME = 'stylex';
8546
8663
  function styleXTransform() {
8547
8664
  let state;
@@ -8692,14 +8809,13 @@ function styleXTransform() {
8692
8809
  }
8693
8810
  },
8694
8811
  CallExpression(path) {
8695
- if (path.parentPath.isVariableDeclarator()) {
8696
- const parentPath = path.parentPath;
8697
- if (parentPath.isVariableDeclarator()) {
8698
- transformStyleXKeyframes(parentPath, state);
8699
- transformStyleXViewTransitionClass(parentPath, state);
8700
- transformStyleXPositionTry(parentPath, state);
8701
- }
8812
+ const parentPath = path.parentPath;
8813
+ if (parentPath.isVariableDeclarator()) {
8814
+ transformStyleXKeyframes(parentPath, state);
8815
+ transformStyleXViewTransitionClass(parentPath, state);
8816
+ transformStyleXPositionTry(parentPath, state);
8702
8817
  }
8818
+ transformStyleXDefaultMarker(path, state);
8703
8819
  transformStyleXDefineVars(path, state);
8704
8820
  transformStyleXDefineConsts(path, state);
8705
8821
  transformStyleXCreateTheme(path, state);
@@ -8724,7 +8840,8 @@ function isExported(path) {
8724
8840
  function processStylexRules(rules, config) {
8725
8841
  const {
8726
8842
  useLayers = false,
8727
- enableLTRRTLComments = false
8843
+ enableLTRRTLComments = false,
8844
+ legacyDisableLayers = false
8728
8845
  } = typeof config === 'boolean' ? {
8729
8846
  useLayers: config
8730
8847
  } : config ?? {};
@@ -8784,24 +8901,32 @@ function processStylexRules(rules, config) {
8784
8901
  });
8785
8902
  let lastKPri = -1;
8786
8903
  const grouped = sortedRules.reduce((acc, rule) => {
8787
- const [_key, styleObj, priority] = rule;
8904
+ const [key, {
8905
+ ...styleObj
8906
+ }, priority] = rule;
8788
8907
  const priorityLevel = Math.floor(priority / 1000);
8789
8908
  Object.keys(styleObj).forEach(dir => {
8790
8909
  let original = styleObj[dir];
8791
8910
  for (const [varRef, constValue] of constsMap.entries()) {
8792
- if (typeof original === 'string') {
8793
- const replacement = String(constValue);
8794
- original = original.replaceAll(varRef, replacement);
8795
- styleObj[dir] = original;
8911
+ if (typeof original !== 'string') continue;
8912
+ const replacement = String(constValue);
8913
+ original = original.replaceAll(varRef, replacement);
8914
+ if (replacement.startsWith('var(') && replacement.endsWith(')')) {
8915
+ const inside = replacement.slice(4, -1).trim();
8916
+ const commaIdx = inside.indexOf(',');
8917
+ const targetName = (commaIdx >= 0 ? inside.slice(0, commaIdx) : inside).trim();
8918
+ const constName = varRef.slice(4, -1);
8919
+ original = original.replaceAll(`${constName}:`, `${targetName}:`);
8796
8920
  }
8921
+ styleObj[dir] = original;
8797
8922
  }
8798
8923
  });
8799
8924
  if (priorityLevel === lastKPri) {
8800
- acc[acc.length - 1].push(rule);
8925
+ acc[acc.length - 1].push([key, styleObj, priority]);
8801
8926
  return acc;
8802
8927
  }
8803
8928
  lastKPri = priorityLevel;
8804
- acc.push([rule]);
8929
+ acc.push([[key, styleObj, priority]]);
8805
8930
  return acc;
8806
8931
  }, []);
8807
8932
  const header = useLayers ? '\n@layer ' + grouped.map((_, index) => `priority${index + 1}`).join(', ') + ';\n' : '';
@@ -8814,7 +8939,7 @@ function processStylexRules(rules, config) {
8814
8939
  } = rule;
8815
8940
  let ltrRule = ltr,
8816
8941
  rtlRule = rtl;
8817
- if (!useLayers) {
8942
+ if (!useLayers && !legacyDisableLayers) {
8818
8943
  ltrRule = addSpecificityLevel(ltrRule, index);
8819
8944
  rtlRule = rtlRule && addSpecificityLevel(rtlRule, index);
8820
8945
  }
package/lib/index.js.flow CHANGED
@@ -52,6 +52,7 @@ declare function processStylexRules(
52
52
  | {
53
53
  useLayers?: boolean,
54
54
  enableLTRRTLComments?: boolean,
55
+ legacyDisableLayers?: boolean,
55
56
  ...
56
57
  },
57
58
  ): string;
@@ -30,12 +30,13 @@ import stylexFirstThatWorks from './stylex-first-that-works';
30
30
  import hash from './hash';
31
31
  import genFileBasedIdentifier from './utils/file-based-identifier';
32
32
  import * as m from './messages';
33
- export * as types from './types';
34
33
  import {
35
34
  PSEUDO_CLASS_PRIORITIES as _PSEUDO_CLASS_PRIORITIES,
36
35
  AT_RULE_PRIORITIES as _AT_RULE_PRIORITIES,
37
36
  PSEUDO_ELEMENT_PRIORITY as _PSEUDO_ELEMENT_PRIORITY,
38
37
  } from './utils/property-priorities';
38
+ export * as types from './types';
39
+ export * as when from './when/when';
39
40
  export declare const create: typeof styleXCreateSet;
40
41
  export declare const defineVars: typeof styleXDefineVars;
41
42
  export declare const defineConsts: typeof styleXDefineConsts;
@@ -37,13 +37,15 @@ import stylexFirstThatWorks from './stylex-first-that-works';
37
37
  import hash from './hash';
38
38
  import genFileBasedIdentifier from './utils/file-based-identifier';
39
39
  import * as m from './messages';
40
- export * as types from './types';
41
40
  import {
42
41
  PSEUDO_CLASS_PRIORITIES as _PSEUDO_CLASS_PRIORITIES,
43
42
  AT_RULE_PRIORITIES as _AT_RULE_PRIORITIES,
44
43
  PSEUDO_ELEMENT_PRIORITY as _PSEUDO_ELEMENT_PRIORITY,
45
44
  } from './utils/property-priorities';
46
45
 
46
+ export * as types from './types';
47
+ export * as when from './when/when';
48
+
47
49
  declare export const create: typeof styleXCreateSet;
48
50
  declare export const defineVars: typeof styleXDefineVars;
49
51
  declare export const defineConsts: typeof styleXDefineConsts;
@@ -0,0 +1,14 @@
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 { StyleXOptions } from './common-types';
11
+ declare function stylexDefaultMarker(options?: StyleXOptions): {
12
+ [$$Key$$: string]: string | true;
13
+ };
14
+ export default stylexDefaultMarker;
@@ -0,0 +1,13 @@
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 { StyleXOptions } from './common-types';
11
+ declare export default function stylexDefaultMarker(options?: StyleXOptions): {
12
+ [string]: string | true,
13
+ };
@@ -0,0 +1,66 @@
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 { StyleXOptions } from '../common-types';
11
+ /**
12
+ * Creates selector that observes if the given pseudo-class is
13
+ * active on an ancestor with the "defaultMarker"
14
+ *
15
+ *
16
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
17
+ * @returns A :where() clause for the ancestor observer
18
+ */
19
+ export declare function ancestor(
20
+ pseudo: string,
21
+ options: string | StyleXOptions,
22
+ ): string;
23
+ /**
24
+ * Creates selector that observes if the given pseudo-class is
25
+ * active on a descendant with the "defaultMarker"
26
+ *
27
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
28
+ * @returns A :has() clause for the descendant observer
29
+ */
30
+ export declare function descendant(
31
+ pseudo: string,
32
+ options: string | StyleXOptions,
33
+ ): string;
34
+ /**
35
+ * Creates selector that observes if the given pseudo-class is
36
+ * active on a previous sibling with the "defaultMarker"
37
+ *
38
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
39
+ * @returns A :where() clause for the previous sibling observer
40
+ */
41
+ export declare function siblingBefore(
42
+ pseudo: string,
43
+ options: string | StyleXOptions,
44
+ ): string;
45
+ /**
46
+ * Creates selector that observes if the given pseudo-class is
47
+ * active on a next sibling with the "defaultMarker"
48
+ *
49
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
50
+ * @returns A :has() clause for the next sibling observer
51
+ */
52
+ export declare function siblingAfter(
53
+ pseudo: string,
54
+ options: string | StyleXOptions,
55
+ ): string;
56
+ /**
57
+ * Creates selector that observes if the given pseudo-class is
58
+ * active on any sibling with the "defaultMarker"
59
+ *
60
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
61
+ * @returns A :where() clause for the any sibling observer
62
+ */
63
+ export declare function anySibling(
64
+ pseudo: string,
65
+ options: string | StyleXOptions,
66
+ ): string;
@@ -0,0 +1,71 @@
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 { StyleXOptions } from '../common-types';
11
+
12
+ /**
13
+ * Creates selector that observes if the given pseudo-class is
14
+ * active on an ancestor with the "defaultMarker"
15
+ *
16
+ *
17
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
18
+ * @returns A :where() clause for the ancestor observer
19
+ */
20
+ declare export function ancestor(
21
+ pseudo: string,
22
+ options: string | StyleXOptions,
23
+ ): string;
24
+
25
+ /**
26
+ * Creates selector that observes if the given pseudo-class is
27
+ * active on a descendant with the "defaultMarker"
28
+ *
29
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
30
+ * @returns A :has() clause for the descendant observer
31
+ */
32
+ declare export function descendant(
33
+ pseudo: string,
34
+ options: string | StyleXOptions,
35
+ ): string;
36
+
37
+ /**
38
+ * Creates selector that observes if the given pseudo-class is
39
+ * active on a previous sibling with the "defaultMarker"
40
+ *
41
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
42
+ * @returns A :where() clause for the previous sibling observer
43
+ */
44
+ declare export function siblingBefore(
45
+ pseudo: string,
46
+ options: string | StyleXOptions,
47
+ ): string;
48
+
49
+ /**
50
+ * Creates selector that observes if the given pseudo-class is
51
+ * active on a next sibling with the "defaultMarker"
52
+ *
53
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
54
+ * @returns A :has() clause for the next sibling observer
55
+ */
56
+ declare export function siblingAfter(
57
+ pseudo: string,
58
+ options: string | StyleXOptions,
59
+ ): string;
60
+
61
+ /**
62
+ * Creates selector that observes if the given pseudo-class is
63
+ * active on any sibling with the "defaultMarker"
64
+ *
65
+ * @param pseudo - The pseudo selector (e.g., ':hover', ':focus')
66
+ * @returns A :where() clause for the any sibling observer
67
+ */
68
+ declare export function anySibling(
69
+ pseudo: string,
70
+ options: string | StyleXOptions,
71
+ ): string;
@@ -123,6 +123,8 @@ declare class StateManager {
123
123
  readonly stylexCreateThemeImport: Set<string>;
124
124
  readonly stylexTypesImport: Set<string>;
125
125
  readonly stylexViewTransitionClassImport: Set<string>;
126
+ readonly stylexDefaultMarkerImport: Set<string>;
127
+ readonly stylexWhenImport: Set<string>;
126
128
  injectImportInserted: null | undefined | t.Identifier;
127
129
  readonly styleMap: Map<string, CompiledNamespaces>;
128
130
  readonly styleVars: Map<string, NodePath>;
@@ -80,6 +80,8 @@ declare export default class StateManager {
80
80
  +stylexCreateThemeImport: Set<string>;
81
81
  +stylexTypesImport: Set<string>;
82
82
  +stylexViewTransitionClassImport: Set<string>;
83
+ +stylexDefaultMarkerImport: Set<string>;
84
+ +stylexWhenImport: Set<string>;
83
85
  injectImportInserted: ?t.Identifier;
84
86
  +styleMap: Map<string, CompiledNamespaces>;
85
87
  +styleVars: Map<string, NodePath<>>;
@@ -0,0 +1,21 @@
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.defaultMarker()` (or imported `defaultMarker()`)
15
+ * into a string literal: "stylex-marker".
16
+ */
17
+ declare function transformStyleXDefaultMarker(
18
+ path: NodePath<t.CallExpression>,
19
+ state: StateManager,
20
+ ): void;
21
+ export default transformStyleXDefaultMarker;
@@ -0,0 +1,21 @@
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 '../../flow_modules/@babel/traverse';
11
+
12
+ import * as t from '../../flow_modules/@babel/types';
13
+ import StateManager from '../utils/state-manager';
14
+ /**
15
+ * Transforms calls to `stylex.defaultMarker()` (or imported `defaultMarker()`)
16
+ * into a string literal: "stylex-marker".
17
+ */
18
+ declare export default function transformStyleXDefaultMarker(
19
+ path: NodePath<t.CallExpression>,
20
+ state: StateManager,
21
+ ): void;
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  import type { NodePath } from '../../flow_modules/@babel/traverse';
11
-
12
11
  import * as t from '../../flow_modules/@babel/types';
13
12
  import StateManager from '../utils/state-manager';
14
13
  declare export function skipStylexPropsChildren(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.15.4",
3
+ "version": "0.16.0",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -21,7 +21,7 @@
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.15.4",
24
+ "@stylexjs/stylex": "0.16.0",
25
25
  "postcss-value-parser": "^4.1.0"
26
26
  },
27
27
  "devDependencies": {
@@ -33,7 +33,7 @@
33
33
  "@rollup/plugin-replace": "^6.0.1",
34
34
  "babel-plugin-syntax-hermes-parser": "^0.26.0",
35
35
  "rollup": "^4.24.0",
36
- "scripts": "0.15.4"
36
+ "scripts": "0.16.0"
37
37
  },
38
38
  "files": [
39
39
  "flow_modules/*",