react-native-unistyles 3.0.0-nightly-20250505 → 3.0.0-nightly-20250508

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { UnistyleDependency } from '../specs/NativePlatform/NativePlatform.nitro';
4
4
  import { deepMergeObjects } from '../utils';
5
- import { extractSecrets, extractUnistyleDependencies } from './utils';
5
+ import { extractSecrets, extractUnistyleDependencies, isGeneratedUnistyle } from './utils';
6
6
  import { getVariants } from './variants';
7
7
  export class UnistylesShadowRegistry {
8
8
  // MOCKS
@@ -25,6 +25,12 @@ export class UnistylesShadowRegistry {
25
25
  this.services.registry.connect(ref, hash);
26
26
  };
27
27
  addStyles = (unistyles, forChild) => {
28
+ const [firstStyle] = unistyles;
29
+
30
+ // If it is already a generated style, return it
31
+ if (firstStyle && isGeneratedUnistyle(firstStyle)) {
32
+ return firstStyle;
33
+ }
28
34
  const getParsedStyles = () => {
29
35
  const allStyles = unistyles.map(unistyle => {
30
36
  const secrets = extractSecrets(unistyle);
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleDependency","deepMergeObjects","extractSecrets","extractUnistyleDependencies","getVariants","UnistylesShadowRegistry","name","__type","equals","toString","dispose","scopedTheme","undefined","disposeMap","Map","constructor","services","add","ref","hash","HTMLElement","registry","connect","addStyles","unistyles","forChild","getParsedStyles","allStyles","map","unistyle","secrets","Object","keys","length","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","variants","newComputedStylesheet","getComputedStylesheet","style","result","variantsResult","resultWithVariants","dependencies","addDependenciesToStylesheet","_web","parsedStyles","existingHash","injectedClassNames","_classNames","injectedClassName","Array","isArray","join","filteredDependencies","state","CSSVars","filter","dependency","Theme","set","listener","addListeners","applyStyles","hashClassname","replace","setScopedTheme","theme","getScopedTheme","remove","then","removed","get","delete"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ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I,CAAC;IAChC,CAAC,CAAC;EACV,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["UnistyleDependency","deepMergeObjects","extractSecrets","extractUnistyleDependencies","isGeneratedUnistyle","getVariants","UnistylesShadowRegistry","name","__type","equals","toString","dispose","scopedTheme","undefined","disposeMap","Map","constructor","services","add","ref","hash","HTMLElement","registry","connect","addStyles","unistyles","forChild","firstStyle","getParsedStyles","allStyles","map","unistyle","secrets","Object","keys","length","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","variants","newComputedStylesheet","getComputedStylesheet","style","result","variantsResult","resultWithVariants","dependencies","addDependenciesToStylesheet","_web","parsedStyles","existingHash","injectedClassNames","_classNames","injectedClassName","Array","isArray","join","filteredDependencies","state","CSSVars","filter","dependency","Theme","set","listener","addListeners","applyStyles","hashClassname","replace","setScopedTheme","theme","getScopedTheme","remove","then","removed","get","delete"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,8CAA8C;AAEjF,SAASC,gBAAgB,QAAQ,UAAU;AAE3C,SAASC,cAAc,EAAEC,2BAA2B,EAAEC,mBAAmB,QAAQ,SAAS;AAC1F,SAASC,WAAW,QAAQ,YAAY;AAExC,OAAO,MAAMC,uBAAuB,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1CC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;;EAEQC,WAAW,GAA+BC,SAAS;EACnDC,UAAU,GAAG,IAAIC,GAAG,CAAuB,CAAC;EAEpDC,WAAWA,CAASC,QAA2B,EAAE;IAAA,KAA7BA,QAA2B,GAA3BA,QAA2B;EAAG;EAElDC,GAAG,GAAGA,CAACC,GAAQ,EAAEC,IAAa,KAAK;IAC/B,IAAI,EAAED,GAAG,YAAYE,WAAW,C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CAAC,CAAC;MAC/D,CAAC,CAAC,CAAC;IACP;IAEA,MAAMwC,aAAa,GAAG1C,QAAQ,GACxBN,IAAI,CAACiD,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GACxBjD,IAAI;IAEV,OAAO;MAAEkC,iBAAiB;MAAElC,IAAI,EAAEgD;IAAc,CAAC;EACrD,CAAC;EAEDE,cAAc,GAAIC,KAAsB,IAAK;IACzC,IAAI,CAAC3D,WAAW,GAAG2D,KAAK;EAC5B,CAAC;EAEDC,cAAc,GAAGA,CAAA,KAAM,IAAI,CAAC5D,WAAW;EAEvC6D,MAAM,GAAGA,CAACtD,GAAQ,EAAEC,IAAa,KAAK;IAClC,IAAI,EAAED,GAAG,YAAYE,WAAW,CAAC,IAAI,CAACD,IAAI,EAAE;MACxC;IACJ;IAEA,IAAI,CAACH,QAAQ,CAACK,QAAQ,CAACmD,MAAM,CAACtD,GAAG,EAAEC,IAAI,CAAC,CACnCsD,IAAI,CAACC,OAAO,IAAI;MACb,IAAI,CAACA,OAAO,EAAE;QACV;MACJ;MAEA,IAAI,CAAC7D,UAAU,CAAC8D,GAAG,CAACxD,IAAI,CAAC,GAAG,CAAC;MAC7B,IAAI,CAACN,UAAU,CAAC+D,MAAM,CAACzD,IAAI,CAAC;IAChC,CAAC,CAAC;EACV,CAAC;AACL","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
 
3
- export {};
3
+ export const UNI_GENERATED_KEYS = ['$$css', 'hash', 'injectedClassName'];
4
4
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["web/types.ts"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":["UNI_GENERATED_KEYS"],"sourceRoot":"../../../src","sources":["web/types.ts"],"mappings":";;AAcA,OAAO,MAAMA,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,CAAU","ignoreList":[]}
@@ -4,6 +4,7 @@ import { Animated } from 'react-native';
4
4
  import { ColorScheme, Orientation } from '../../specs/types';
5
5
  import { isUnistylesMq, parseMq } from '../../utils';
6
6
  import * as unistyles from '../services';
7
+ import { UNI_GENERATED_KEYS } from '../types';
7
8
  import { keyInObject, reduceObject } from './common';
8
9
  export const schemeToTheme = scheme => {
9
10
  switch (scheme) {
@@ -94,4 +95,7 @@ export const checkForAnimated = value => {
94
95
  }
95
96
  return false;
96
97
  };
98
+ export const isGeneratedUnistyle = value => {
99
+ return Object.keys(value).every(key => UNI_GENERATED_KEYS.includes(key));
100
+ };
97
101
  //# sourceMappingURL=unistyle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Animated","ColorScheme","Orientation","isUnistylesMq","parseMq","unistyles","keyInObject","reduceObject","schemeToTheme","scheme","Dark","Light","assignSecrets","object","secrets","secretsId","Math","random","toString","slice","Object","defineProperties","secret","value","enumerable","configurable","extractSecrets","undefined","entries","find","key","startsWith","getOwnPropertyDescriptors","removeInlineStyles","values","returnValue","getMediaQuery","query","allBreakpoints","includes","minWidth","maxWidth","minHeight","maxHeight","queries","filter","Boolean","join","breakpointValue","services","runtime","breakpoints","nextBreakpoint","b","map","sort","a","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray","checkForProp","prop","some","nestedValue","_web","checkForAnimated","objectValues","Node","length","keys"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,mBAAmB;AAE5D,SAASC,aAAa,EAAEC,OAAO,QAAQ,aAAa;AACpD,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,SAASC,WAAW,EAAEC,YAAY,QAAQ,UAAU;AAEpD,OAAO,MAAMC,aAAa,GAAIC,MAAmB,IAAK;EAClD,QAAQA,MAAM;IACV,KAAKR,WAAW,CAACS,IAAI;MACjB,OAAO,MAAM;IACjB,KAAKT,WAAW,CAACU,KAAK;IACtB;MACI,O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AAO5C,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,EAAE;IAC7C,MAAM6C,YAAY,GAAGhD,MAAM,CAACc,MAAM,CAACX,KAAK,CAAC;IACzC,MAAMT,OAAO,GAAGY,cAAc,CAACH,KAAK,CAAC;;IAErC;IACA,OAAOA,KAAK,YAAYvB,QAAQ,CAACqE,IAAI,IACjCD,YAAY,CAACE,MAAM,GAAG,CAAC,IAAIF,YAAY,CAACJ,IAAI,CAACG,gBAAgB,CAAC,IAC9DrD,OAAO,IAAIM,MAAM,CAACmD,IAAI,CAACzD,OAAO,CAAC,CAACwD,MAAM,KAAK,CAAC;EACpD;EAEA,OAAO,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Animated","ColorScheme","Orientation","isUnistylesMq","parseMq","unistyles","UNI_GENERATED_KEYS","keyInObject","reduceObject","schemeToTheme","scheme","Dark","Light","assignSecrets","object","secrets","secretsId","Math","random","toString","slice","Object","defineProperties","secret","value","enumerable","configurable","extractSecrets","undefined","entries","find","key","startsWith","getOwnPropertyDescriptors","removeInlineStyles","values","returnValue","getMediaQuery","query","allBreakpoints","includes","minWidth","maxWidth","minHeight","maxHeight","queries","filter","Boolean","join","breakpointValue","services","runtime","breakpoints","nextBreakpoint","b","map","sort","a","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray","checkForProp","prop","some","nestedValue","_web","checkForAnimated","objectValues","Node","length","keys","isGeneratedUnistyle","every"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,mBAAmB;AAE5D,SAASC,aAAa,EAAEC,OAAO,QAAQ,aAAa;AACpD,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,SAASC,kBAAkB,QAAsD,UAAU;AAC3F,SAASC,WAAW,EAAEC,YAAY,QAAQ,UAAU;AAEpD,OAAO,MAAMC,aAAa,GAAIC,M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AIqC,KAAK,CAACC,OAAO,CAACtC,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACyC,IAAI,CAACG,gBAAgB,CAAC;EACvC;EAEA,IAAI,OAAO5C,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,EAAE;IAC7C,MAAM6C,YAAY,GAAGhD,MAAM,CAACc,MAAM,CAACX,KAAK,CAAC;IACzC,MAAMT,OAAO,GAAGY,cAAc,CAACH,KAAK,CAAC;;IAErC;IACA,OAAOA,KAAK,YAAYxB,QAAQ,CAACsE,IAAI,IACjCD,YAAY,CAACE,MAAM,GAAG,CAAC,IAAIF,YAAY,CAACJ,IAAI,CAACG,gBAAgB,CAAC,IAC9DrD,OAAO,IAAIM,MAAM,CAACmD,IAAI,CAACzD,OAAO,CAAC,CAACwD,MAAM,KAAK,CAAC;EACpD;EAEA,OAAO,KAAK;AAChB,CAAC;AAED,OAAO,MAAME,mBAAmB,GAAIjD,KAA0B,IAAiC;EAC3F,OAAOH,MAAM,CAACmD,IAAI,CAAChD,KAAK,CAAC,CAACkD,KAAK,CAAC3C,GAAG,IAAIzB,kBAAkB,CAACkC,QAAQ,CAACT,GAAsB,CAAC,CAAC;AAC/F,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { UnistylesTheme, UnistylesValues } from '../types';
2
- import type { UnistylesServices } from './types';
2
+ import type { UniGeneratedStyle, UnistylesServices } from './types';
3
3
  export declare class UnistylesShadowRegistry {
4
4
  private services;
5
5
  name: string;
@@ -11,7 +11,7 @@ export declare class UnistylesShadowRegistry {
11
11
  private disposeMap;
12
12
  constructor(services: UnistylesServices);
13
13
  add: (ref: any, hash?: string) => void;
14
- addStyles: (unistyles: Array<UnistylesValues>, forChild?: boolean) => {
14
+ addStyles: (unistyles: Array<UnistylesValues>, forChild?: boolean) => UniGeneratedStyle | {
15
15
  injectedClassName: string;
16
16
  hash: string;
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAIhD,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,QAAS,GAAG,SAAS,MAAM,UAM7B;IAED,SAAS,cAAe,KAAK,CAAC,eAAe,CAAC,aAAa,OAAO;;;MA6DjE;IAED,cAAc,WAAY,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,QAAS,GAAG,SAAS,MAAM,UAchC;CACJ"}
1
+ {"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAInE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,QAAS,GAAG,SAAS,MAAM,UAM7B;IAED,SAAS,cAAe,KAAK,CAAC,eAAe,CAAC,aAAa,OAAO;;;MAoEjE;IAED,cAAc,WAAY,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,QAAS,GAAG,SAAS,MAAM,UAchC;CACJ"}
@@ -10,4 +10,7 @@ export type UnistylesServices = {
10
10
  state: UnistylesState;
11
11
  listener: UnistylesListener;
12
12
  };
13
+ export declare const UNI_GENERATED_KEYS: readonly ["$$css", "hash", "injectedClassName"];
14
+ export type UniGeneratedKey = typeof UNI_GENERATED_KEYS[number];
15
+ export type UniGeneratedStyle = Record<UniGeneratedKey, string>;
13
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAI,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAI,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,KAAI,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,EAAE,uBAAuB,CAAC;IACxC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAA;CAC9B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,EAAE,uBAAuB,CAAC;IACxC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,kBAAkB,iDAAkD,CAAA;AACjF,MAAM,MAAM,eAAe,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;AAE/D,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { UnistyleDependency } from '../../specs/NativePlatform/NativePlatform.nitro';
2
2
  import { ColorScheme } from '../../specs/types';
3
3
  import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet';
4
+ import { type UniGeneratedStyle } from '../types';
4
5
  export declare const schemeToTheme: (scheme: ColorScheme) => "light" | "dark";
5
6
  export type UnistyleSecrets = {
6
7
  __uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>;
@@ -17,4 +18,5 @@ export declare const getMediaQuery: (query: string, allBreakpoints: Array<string
17
18
  export declare const extractUnistyleDependencies: (value: any) => UnistyleDependency[];
18
19
  export declare const checkForProp: (value: any, prop: string) => boolean;
19
20
  export declare const checkForAnimated: (value: any) => boolean;
21
+ export declare const isGeneratedUnistyle: (value: Record<string, any>) => value is UniGeneratedStyle;
20
22
  //# sourceMappingURL=unistyle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAA;AACzF,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,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,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;CAC/D,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAanE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG;;aAYzC,CAAA;AAED,eAAO,MAAM,kBAAkB,WAAY,eAAe,OAUzD,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,KAAK,CAAC,MAAM,CAAC,WA6BzE,CAAA;AAED,eAAO,MAAM,2BAA2B,UAAW,GAAG,yBAQrD,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,GAAG,QAAQ,MAAM,KAAG,OAcvD,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,GAAG,KAAG,OAgB7C,CAAA;AAED,eAAO,MAAM,mBAAmB,UAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,KAAK,IAAI,iBAEzE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-nightly-20250505",
3
+ "version": "3.0.0-nightly-20250508",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "NODE_ENV=babel-test jest ./plugin",
package/plugin/index.js CHANGED
@@ -85,20 +85,19 @@ var NATIVE_COMPONENTS_PATHS = {
85
85
  var t = __toESM(require("@babel/types"));
86
86
 
87
87
  // plugin/src/paths.ts
88
- var path = __toESM(require("node:path"));
89
88
  var isWindows = process.platform === "win32";
90
89
  var toWinPath = (pathString) => {
91
- return path.normalize(pathString).replace(/\//g, "\\");
90
+ return pathString;
92
91
  };
93
92
  var toPlatformPath = (pathString) => {
94
93
  return isWindows ? toWinPath(pathString) : pathString;
95
94
  };
96
95
 
97
96
  // plugin/src/exotic.ts
98
- function handleExoticImport(path2, state, exoticImport) {
99
- const specifiers = path2.node.specifiers;
100
- const source = path2.node.source;
101
- if (path2.node.importKind !== "value") {
97
+ function handleExoticImport(path, state, exoticImport) {
98
+ const specifiers = path.node.specifiers;
99
+ const source = path.node.source;
100
+ if (path.node.importKind !== "value") {
102
101
  return;
103
102
  }
104
103
  specifiers.forEach((specifier) => {
@@ -116,7 +115,7 @@ function handleExoticImport(path2, state, exoticImport) {
116
115
  state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)) ?? "" : toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)
117
116
  )
118
117
  );
119
- path2.replaceWith(newImport);
118
+ path.replaceWith(newImport);
120
119
  } else {
121
120
  const newImport = t.importDeclaration(
122
121
  [t.importSpecifier(t.identifier(rule.mapTo), t.identifier(rule.mapTo))],
@@ -124,11 +123,11 @@ function handleExoticImport(path2, state, exoticImport) {
124
123
  state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)) ?? "" : toPlatformPath(`react-native-unistyles/components/native/${rule.mapTo}`)
125
124
  )
126
125
  );
127
- path2.node.specifiers = specifiers.filter((s) => s !== specifier);
128
- if (path2.node.specifiers.length === 0) {
129
- path2.replaceWith(newImport);
126
+ path.node.specifiers = specifiers.filter((s) => s !== specifier);
127
+ if (path.node.specifiers.length === 0) {
128
+ path.replaceWith(newImport);
130
129
  } else {
131
- path2.insertBefore(newImport);
130
+ path.insertBefore(newImport);
132
131
  }
133
132
  }
134
133
  return;
@@ -138,12 +137,12 @@ function handleExoticImport(path2, state, exoticImport) {
138
137
 
139
138
  // plugin/src/import.ts
140
139
  var t2 = __toESM(require("@babel/types"));
141
- function addUnistylesImport(path2, state) {
140
+ function addUnistylesImport(path, state) {
142
141
  const localNames = Object.keys(state.reactNativeImports);
143
142
  const names = Object.values(state.reactNativeImports);
144
143
  const pairs = Object.entries(state.reactNativeImports);
145
144
  const nodesToRemove = [];
146
- path2.node.body.forEach((node) => {
145
+ path.node.body.forEach((node) => {
147
146
  if (t2.isImportDeclaration(node) && node.source.value === "react-native") {
148
147
  node.specifiers = node.specifiers.filter((specifier) => !localNames.some((name) => name === specifier.local.name));
149
148
  if (node.specifiers.length === 0) {
@@ -152,7 +151,7 @@ function addUnistylesImport(path2, state) {
152
151
  }
153
152
  });
154
153
  names.forEach((name) => {
155
- const rnWebImport = path2.node.body.find((node) => t2.isImportDeclaration(node) && node.source.value === toPlatformPath(`react-native-web/dist/exports/${name}`));
154
+ const rnWebImport = path.node.body.find((node) => t2.isImportDeclaration(node) && node.source.value === toPlatformPath(`react-native-web/dist/exports/${name}`));
156
155
  if (rnWebImport) {
157
156
  rnWebImport.specifiers = [];
158
157
  }
@@ -164,14 +163,14 @@ function addUnistylesImport(path2, state) {
164
163
  state.opts.isLocal ? state.file.opts.filename?.split("react-native-unistyles").at(0)?.concat(toPlatformPath(`react-native-unistyles/src/components/native/${name}`)) ?? "" : toPlatformPath(`react-native-unistyles/components/native/${name}`)
165
164
  )
166
165
  );
167
- path2.node.body.unshift(newImport);
166
+ path.node.body.unshift(newImport);
168
167
  });
169
- nodesToRemove.forEach((node) => path2.node.body.splice(path2.node.body.indexOf(node), 1));
168
+ nodesToRemove.forEach((node) => path.node.body.splice(path.node.body.indexOf(node), 1));
170
169
  }
171
170
  function isInsideNodeModules(state) {
172
171
  return state.file.opts.filename?.includes("node_modules") && !state.file.replaceWithUnistyles;
173
172
  }
174
- function addUnistylesRequire(path2, state) {
173
+ function addUnistylesRequire(path, state) {
175
174
  Object.entries(state.reactNativeImports).forEach(([componentName, uniqueName]) => {
176
175
  const newRequire = t2.variableDeclaration("const", [
177
176
  t2.variableDeclarator(
@@ -181,14 +180,14 @@ function addUnistylesRequire(path2, state) {
181
180
  ])
182
181
  )
183
182
  ]);
184
- path2.node.body.unshift(newRequire);
183
+ path.node.body.unshift(newRequire);
185
184
  });
186
185
  }
187
186
 
188
187
  // plugin/src/ref.ts
189
188
  var t3 = __toESM(require("@babel/types"));
190
- function hasStringRef(path2) {
191
- return path2.node.openingElement.attributes.find(
189
+ function hasStringRef(path) {
190
+ return path.node.openingElement.attributes.find(
192
191
  (attr) => t3.isJSXAttribute(attr) && t3.isJSXIdentifier(attr.name, { name: "ref" }) && t3.isStringLiteral(attr.value)
193
192
  );
194
193
  }
@@ -325,8 +324,8 @@ function stringToUniqueId(str) {
325
324
  const absHash = Math.abs(hash);
326
325
  return absHash % 1e9;
327
326
  }
328
- function isUnistylesStyleSheet(path2, state) {
329
- const { callee } = path2.node;
327
+ function isUnistylesStyleSheet(path, state) {
328
+ const { callee } = path.node;
330
329
  if (!t4.isMemberExpression(callee) || !t4.isIdentifier(callee.property)) {
331
330
  return false;
332
331
  }
@@ -334,38 +333,38 @@ function isUnistylesStyleSheet(path2, state) {
334
333
  const isRequire = state.file.hasUnistylesImport && callee.property.name === "create" && t4.isMemberExpression(callee.object) && t4.isIdentifier(callee.object.property) && t4.isIdentifier(callee.object.object) && callee.object.object.name === state.file.styleSheetLocalName && callee.object.property.name === "StyleSheet";
335
334
  return isImport || isRequire;
336
335
  }
337
- function isUnistylesCommonJSRequire(path2, state) {
338
- const isRequire = t4.isIdentifier(path2.node.callee) && path2.node.arguments.length > 0 && t4.isStringLiteral(path2.node.arguments[0]) && path2.node.arguments[0].value === "react-native-unistyles";
339
- if (isRequire && t4.isVariableDeclarator(path2.parent) && t4.isIdentifier(path2.parent.id)) {
336
+ function isUnistylesCommonJSRequire(path, state) {
337
+ const isRequire = t4.isIdentifier(path.node.callee) && path.node.arguments.length > 0 && t4.isStringLiteral(path.node.arguments[0]) && path.node.arguments[0].value === "react-native-unistyles";
338
+ if (isRequire && t4.isVariableDeclarator(path.parent) && t4.isIdentifier(path.parent.id)) {
340
339
  state.file.hasUnistylesImport = true;
341
- state.file.styleSheetLocalName = path2.parent.id.name;
340
+ state.file.styleSheetLocalName = path.parent.id.name;
342
341
  }
343
342
  return isRequire;
344
343
  }
345
- function isReactNativeCommonJSRequire(path2, state) {
346
- const isRequire = t4.isIdentifier(path2.node.callee) && path2.node.arguments.length > 0 && path2.node.callee.name === "require";
347
- const requireImportName = path2.node.arguments.find((node) => t4.isStringLiteral(node));
344
+ function isReactNativeCommonJSRequire(path, state) {
345
+ const isRequire = t4.isIdentifier(path.node.callee) && path.node.arguments.length > 0 && path.node.callee.name === "require";
346
+ const requireImportName = path.node.arguments.find((node) => t4.isStringLiteral(node));
348
347
  const isReactNativeRequire = isRequire && requireImportName && (requireImportName.value === "react-native" || requireImportName.value === "react-native-web/dist/index");
349
- if (isReactNativeRequire && t4.isVariableDeclarator(path2.parent) && t4.isIdentifier(path2.parent.id)) {
350
- state.file.reactNativeCommonJSName = path2.parent.id.name;
348
+ if (isReactNativeRequire && t4.isVariableDeclarator(path.parent) && t4.isIdentifier(path.parent.id)) {
349
+ state.file.reactNativeCommonJSName = path.parent.id.name;
351
350
  }
352
351
  return isRequire;
353
352
  }
354
- function isKindOfStyleSheet(path2, state) {
353
+ function isKindOfStyleSheet(path, state) {
355
354
  if (!state.file.forceProcessing && !state.file.hasUnistylesImport) {
356
355
  return false;
357
356
  }
358
- const { callee } = path2.node;
357
+ const { callee } = path.node;
359
358
  return t4.isMemberExpression(callee) && t4.isIdentifier(callee.property) && callee.property.name === "create" && t4.isIdentifier(callee.object);
360
359
  }
361
- function addStyleSheetTag(path2, state) {
360
+ function addStyleSheetTag(path, state) {
362
361
  const str = state.filename?.replace(state.cwd, "") ?? "";
363
362
  const uniqueId = stringToUniqueId(str) + ++state.file.tagNumber;
364
- path2.node.arguments.push(t4.numericLiteral(uniqueId));
363
+ path.node.arguments.push(t4.numericLiteral(uniqueId));
365
364
  }
366
- function getStylesDependenciesFromObject(path2) {
365
+ function getStylesDependenciesFromObject(path) {
367
366
  const detectedStylesWithVariants = /* @__PURE__ */ new Set();
368
- const stylesheet = path2.node.arguments[0];
367
+ const stylesheet = path.node.arguments[0];
369
368
  if (t4.isObjectExpression(stylesheet)) {
370
369
  stylesheet?.properties.forEach((property) => {
371
370
  if (!t4.isObjectProperty(property) || !t4.isIdentifier(property.key)) {
@@ -664,8 +663,8 @@ function addDependencies(state, styleName, unistyle, detectedDependencies) {
664
663
 
665
664
  // plugin/src/variants.ts
666
665
  var t5 = __toESM(require("@babel/types"));
667
- function extractVariants(path2, state) {
668
- const maybeVariants = path2.node.body.filter((node2) => t5.isExpressionStatement(node2) && t5.isCallExpression(node2.expression) && t5.isMemberExpression(node2.expression.callee));
666
+ function extractVariants(path, state) {
667
+ const maybeVariants = path.node.body.filter((node2) => t5.isExpressionStatement(node2) && t5.isCallExpression(node2.expression) && t5.isMemberExpression(node2.expression.callee));
669
668
  if (maybeVariants.length === 0) {
670
669
  return;
671
670
  }
@@ -688,7 +687,7 @@ function extractVariants(path2, state) {
688
687
  return;
689
688
  }
690
689
  const calleeName = callee.object.name;
691
- const newUniqueName = path2.scope.generateUidIdentifier(calleeName);
690
+ const newUniqueName = path.scope.generateUidIdentifier(calleeName);
692
691
  const shadowDeclaration = t5.variableDeclaration("const", [
693
692
  t5.variableDeclarator(newUniqueName, t5.identifier(calleeName))
694
693
  ]);
@@ -699,14 +698,14 @@ function extractVariants(path2, state) {
699
698
  const finalDeclaration = t5.variableDeclaration("const", [
700
699
  t5.variableDeclarator(t5.identifier(calleeName), newCallExpression)
701
700
  ]);
702
- const pathIndex = path2.node.body.findIndex((bodyPath) => bodyPath === targetVariant);
703
- const rest = path2.node.body.slice(pathIndex + 1);
701
+ const pathIndex = path.node.body.findIndex((bodyPath) => bodyPath === targetVariant);
702
+ const rest = path.node.body.slice(pathIndex + 1);
704
703
  const statement = t5.blockStatement([
705
704
  finalDeclaration,
706
705
  ...rest
707
706
  ]);
708
- path2.node.body = [
709
- ...path2.node.body.slice(0, pathIndex),
707
+ path.node.body = [
708
+ ...path.node.body.slice(0, pathIndex),
710
709
  shadowDeclaration,
711
710
  statement
712
711
  ];
@@ -725,8 +724,8 @@ function index_default() {
725
724
  name: "babel-react-native-unistyles",
726
725
  visitor: {
727
726
  Program: {
728
- enter(path2, state) {
729
- state.file.replaceWithUnistyles = REPLACE_WITH_UNISTYLES_PATHS.map(toPlatformPath).concat(state.opts.autoProcessPaths ?? []).some((path3) => state.filename?.includes(path3));
727
+ enter(path, state) {
728
+ state.file.replaceWithUnistyles = REPLACE_WITH_UNISTYLES_PATHS.map(toPlatformPath).concat(state.opts.autoProcessPaths ?? []).some((path2) => state.filename?.includes(path2));
730
729
  state.file.hasAnyUnistyle = false;
731
730
  state.file.hasUnistylesImport = false;
732
731
  state.file.addUnistylesRequire = false;
@@ -736,7 +735,7 @@ function index_default() {
736
735
  state.file.tagNumber = 0;
737
736
  state.reactNativeImports = {};
738
737
  state.file.forceProcessing = state.opts.autoProcessRoot && state.filename ? state.filename.includes(toPlatformPath(`${state.file.opts.root}/${state.opts.autoProcessRoot}/`)) : false;
739
- path2.traverse({
738
+ path.traverse({
740
739
  BlockStatement(blockPath) {
741
740
  if (isInsideNodeModules(state)) {
742
741
  return;
@@ -745,41 +744,41 @@ function index_default() {
745
744
  }
746
745
  });
747
746
  },
748
- exit(path2, state) {
747
+ exit(path, state) {
749
748
  if (isInsideNodeModules(state)) {
750
749
  return;
751
750
  }
752
751
  if (state.file.addUnistylesRequire) {
753
- return addUnistylesRequire(path2, state);
752
+ return addUnistylesRequire(path, state);
754
753
  }
755
754
  if (state.file.hasAnyUnistyle || state.file.hasVariants || state.file.replaceWithUnistyles || state.file.forceProcessing) {
756
- addUnistylesImport(path2, state);
755
+ addUnistylesImport(path, state);
757
756
  }
758
757
  }
759
758
  },
760
- FunctionDeclaration(path2, state) {
759
+ FunctionDeclaration(path, state) {
761
760
  if (isInsideNodeModules(state)) {
762
761
  return;
763
762
  }
764
- const componentName = path2.node.id ? path2.node.id.name : null;
763
+ const componentName = path.node.id ? path.node.id.name : null;
765
764
  if (componentName) {
766
765
  state.file.hasVariants = false;
767
766
  }
768
767
  },
769
- ClassDeclaration(path2, state) {
768
+ ClassDeclaration(path, state) {
770
769
  if (isInsideNodeModules(state)) {
771
770
  return;
772
771
  }
773
- const componentName = path2.node.id ? path2.node.id.name : null;
772
+ const componentName = path.node.id ? path.node.id.name : null;
774
773
  if (componentName) {
775
774
  state.file.hasVariants = false;
776
775
  }
777
776
  },
778
- VariableDeclaration(path2, state) {
777
+ VariableDeclaration(path, state) {
779
778
  if (isInsideNodeModules(state)) {
780
779
  return;
781
780
  }
782
- path2.node.declarations.forEach((declaration) => {
781
+ path.node.declarations.forEach((declaration) => {
783
782
  if (t6.isArrowFunctionExpression(declaration.init) || t6.isFunctionExpression(declaration.init)) {
784
783
  const componentName = declaration.id && t6.isIdentifier(declaration.id) ? declaration.id.name : null;
785
784
  if (componentName) {
@@ -788,83 +787,83 @@ function index_default() {
788
787
  }
789
788
  });
790
789
  },
791
- ImportDeclaration(path2, state) {
790
+ ImportDeclaration(path, state) {
792
791
  const exoticImport = REPLACE_WITH_UNISTYLES_EXOTIC_PATHS.concat(state.opts.autoRemapImports ?? []).find((exotic) => state.filename?.includes(exotic.path));
793
792
  if (exoticImport) {
794
- return handleExoticImport(path2, state, exoticImport);
793
+ return handleExoticImport(path, state, exoticImport);
795
794
  }
796
795
  if (isInsideNodeModules(state)) {
797
796
  return;
798
797
  }
799
- const importSource = path2.node.source.value;
798
+ const importSource = path.node.source.value;
800
799
  if (importSource.includes("react-native-unistyles")) {
801
800
  state.file.hasUnistylesImport = true;
802
- path2.node.specifiers.forEach((specifier) => {
801
+ path.node.specifiers.forEach((specifier) => {
803
802
  if (t6.isImportSpecifier(specifier) && t6.isIdentifier(specifier.imported) && specifier.imported.name === "StyleSheet") {
804
803
  state.file.styleSheetLocalName = specifier.local.name;
805
804
  }
806
805
  });
807
806
  }
808
807
  if (importSource === "react-native") {
809
- path2.node.specifiers.forEach((specifier) => {
808
+ path.node.specifiers.forEach((specifier) => {
810
809
  if (t6.isImportSpecifier(specifier) && t6.isIdentifier(specifier.imported) && REACT_NATIVE_COMPONENT_NAMES.includes(specifier.imported.name)) {
811
810
  state.reactNativeImports[specifier.local.name] = specifier.imported.name;
812
811
  }
813
812
  });
814
813
  }
815
814
  if (importSource.includes(toPlatformPath("react-native/Libraries"))) {
816
- handleExoticImport(path2, state, NATIVE_COMPONENTS_PATHS);
815
+ handleExoticImport(path, state, NATIVE_COMPONENTS_PATHS);
817
816
  }
818
817
  if (!state.file.forceProcessing && Array.isArray(state.opts.autoProcessImports)) {
819
818
  state.file.forceProcessing = state.opts.autoProcessImports.includes(importSource);
820
819
  }
821
820
  },
822
- JSXElement(path2, state) {
821
+ JSXElement(path, state) {
823
822
  if (isInsideNodeModules(state)) {
824
823
  return;
825
824
  }
826
- if (hasStringRef(path2)) {
825
+ if (hasStringRef(path)) {
827
826
  throw new Error("Detected string based ref which is not supported by Unistyles.");
828
827
  }
829
828
  },
830
- MemberExpression(path2, state) {
829
+ MemberExpression(path, state) {
831
830
  if (isInsideNodeModules(state)) {
832
831
  return;
833
832
  }
834
- if (!state.file.reactNativeCommonJSName || !t6.isIdentifier(path2.node.object)) {
833
+ if (!state.file.reactNativeCommonJSName || !t6.isIdentifier(path.node.object)) {
835
834
  return;
836
835
  }
837
- if (path2.node.object.name !== state.file.reactNativeCommonJSName || !t6.isIdentifier(path2.node.property)) {
836
+ if (path.node.object.name !== state.file.reactNativeCommonJSName || !t6.isIdentifier(path.node.property)) {
838
837
  return;
839
838
  }
840
- if (!REACT_NATIVE_COMPONENT_NAMES.includes(path2.node.property.name)) {
839
+ if (!REACT_NATIVE_COMPONENT_NAMES.includes(path.node.property.name)) {
841
840
  return;
842
841
  }
843
- if (!state.reactNativeImports[path2.node.property.name]) {
844
- const uniqueId = path2.scope.generateUidIdentifier(`reactNativeUnistyles_${path2.node.property.name}`);
845
- state.reactNativeImports[path2.node.property.name] = uniqueId.name;
842
+ if (!state.reactNativeImports[path.node.property.name]) {
843
+ const uniqueId = path.scope.generateUidIdentifier(`reactNativeUnistyles_${path.node.property.name}`);
844
+ state.reactNativeImports[path.node.property.name] = uniqueId.name;
846
845
  state.file.addUnistylesRequire = true;
847
846
  }
848
- path2.node.object.name = state.reactNativeImports[path2.node.property.name];
847
+ path.node.object.name = state.reactNativeImports[path.node.property.name];
849
848
  },
850
- CallExpression(path2, state) {
849
+ CallExpression(path, state) {
851
850
  if (isInsideNodeModules(state)) {
852
851
  return;
853
852
  }
854
- if (isUnistylesCommonJSRequire(path2, state)) {
853
+ if (isUnistylesCommonJSRequire(path, state)) {
855
854
  return;
856
855
  }
857
- if (isReactNativeCommonJSRequire(path2, state)) {
856
+ if (isReactNativeCommonJSRequire(path, state)) {
858
857
  return;
859
858
  }
860
- if (!isUnistylesStyleSheet(path2, state) && !isKindOfStyleSheet(path2, state)) {
859
+ if (!isUnistylesStyleSheet(path, state) && !isKindOfStyleSheet(path, state)) {
861
860
  return;
862
861
  }
863
862
  state.file.hasAnyUnistyle = true;
864
- addStyleSheetTag(path2, state);
865
- const arg = t6.isAssignmentExpression(path2.node.arguments[0]) ? path2.node.arguments[0].right : path2.node.arguments[0];
863
+ addStyleSheetTag(path, state);
864
+ const arg = t6.isAssignmentExpression(path.node.arguments[0]) ? path.node.arguments[0].right : path.node.arguments[0];
866
865
  if (t6.isObjectExpression(arg)) {
867
- const detectedDependencies = getStylesDependenciesFromObject(path2);
866
+ const detectedDependencies = getStylesDependenciesFromObject(path);
868
867
  if (detectedDependencies) {
869
868
  if (t6.isObjectExpression(arg)) {
870
869
  arg.properties.forEach((property) => {
@@ -876,7 +875,7 @@ function index_default() {
876
875
  }
877
876
  }
878
877
  if (t6.isArrowFunctionExpression(arg) || t6.isFunctionExpression(arg)) {
879
- const funcPath = t6.isAssignmentExpression(path2.node.arguments[0]) ? path2.get("arguments.0.right") : path2.get("arguments.0");
878
+ const funcPath = t6.isAssignmentExpression(path.node.arguments[0]) ? path.get("arguments.0.right") : path.get("arguments.0");
880
879
  const detectedDependencies = getStylesDependenciesFromFunction(funcPath);
881
880
  if (detectedDependencies) {
882
881
  const body = t6.isBlockStatement(arg.body) ? arg.body.body.find((statement) => t6.isReturnStatement(statement))?.argument : arg.body;