diff --git a/docs/src/content/docs/v3/other/babel-plugin.mdx b/docs/src/content/docs/v3/other/babel-plugin.mdx index 772ebdea..7603803a 100644 --- a/docs/src/content/docs/v3/other/babel-plugin.mdx +++ b/docs/src/content/docs/v3/other/babel-plugin.mdx @@ -144,7 +144,7 @@ const ref = useRef() ``` ```ts title="Babel transform" -import { View } from 'react-native-unistyles/components/native/View' +import { View } from 'react-native-unistyles/src/components/native/View' const ref = useRef() diff --git a/package.json b/package.json index 47bb0e63..e83ead8b 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "main": "lib/commonjs/index", "module": "lib/module/index", "types": "lib/typescript/src/index.d.ts", - "react-native": "src", - "source": "src", + "react-native": "src/index", + "source": "src/index", "files": [ "src", "lib", diff --git a/plugin/__tests__/dependencies.spec.js b/plugin/__tests__/dependencies.spec.js index d392ddf4..a9e5d4a8 100644 --- a/plugin/__tests__/dependencies.spec.js +++ b/plugin/__tests__/dependencies.spec.js @@ -44,8 +44,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -102,8 +102,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -154,8 +154,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -264,8 +264,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -386,8 +386,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -441,8 +441,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -488,8 +488,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -538,8 +538,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -608,8 +608,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -680,8 +680,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' diff --git a/plugin/__tests__/ref.spec.js b/plugin/__tests__/ref.spec.js index 46b0bbd5..3b7d41c3 100644 --- a/plugin/__tests__/ref.spec.js +++ b/plugin/__tests__/ref.spec.js @@ -70,8 +70,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' export const Example = () => { return ( @@ -112,7 +112,7 @@ pluginTester({ }) `, output: ` - import { View } from 'react-native-unistyles/components/native/View' + import { View } from 'react-native-unistyles/src/components/native/View' import { Text } from 'custom-lib' @@ -161,8 +161,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import React from 'react' import { StyleSheet } from 'react-native-unistyles' @@ -217,8 +217,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { useRef } from 'react' import { StyleSheet } from 'react-native-unistyles' @@ -283,8 +283,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import React from 'react' import { StyleSheet } from 'react-native-unistyles' @@ -354,8 +354,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import React from 'react' import { StyleSheet } from 'react-native-unistyles' @@ -423,8 +423,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import React from 'react' import { StyleSheet } from 'react-native-unistyles' @@ -486,7 +486,7 @@ pluginTester({ })) `, output: ` - import { View } from 'react-native-unistyles/components/native/View' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -538,7 +538,7 @@ pluginTester({ })) `, output: ` - import { View } from 'react-native-unistyles/components/native/View' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -582,7 +582,7 @@ pluginTester({ })) `, output: ` - import { View } from 'react-native-unistyles/components/native/View' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' diff --git a/plugin/__tests__/stylesheet.spec.js b/plugin/__tests__/stylesheet.spec.js index 55293444..57ae83e0 100644 --- a/plugin/__tests__/stylesheet.spec.js +++ b/plugin/__tests__/stylesheet.spec.js @@ -34,8 +34,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -78,8 +78,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -123,8 +123,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet as ST } from 'react-native-unistyles' @@ -169,8 +169,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -216,8 +216,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -264,8 +264,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -313,8 +313,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -364,8 +364,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -423,8 +423,8 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -488,9 +488,9 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -549,9 +549,9 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -611,9 +611,9 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -677,9 +677,9 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -746,9 +746,9 @@ pluginTester({ }) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -807,9 +807,9 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -875,9 +875,9 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -951,9 +951,9 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -1027,8 +1027,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -1091,8 +1091,8 @@ pluginTester({ })) `, output: ` - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -1151,8 +1151,8 @@ pluginTester({ }) `, output: ` - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -1194,8 +1194,8 @@ pluginTester({ }) `, output: ` - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View } from 'react-native-unistyles/components/native/View' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' @@ -1239,9 +1239,9 @@ pluginTester({ }) `, output: ` - import { Text as SuperText } from 'react-native-unistyles/components/native/Text' - import { Pressable } from 'react-native-unistyles/components/native/Pressable' - import { View as RNView } from 'react-native-unistyles/components/native/View' + import { Text as SuperText } from 'react-native-unistyles/src/components/native/Text' + import { Pressable } from 'react-native-unistyles/src/components/native/Pressable' + import { View as RNView } from 'react-native-unistyles/src/components/native/View' import { StyleSheet } from 'react-native-unistyles' diff --git a/plugin/__tests__/variants.spec.js b/plugin/__tests__/variants.spec.js index 65b9b538..1d0c7679 100644 --- a/plugin/__tests__/variants.spec.js +++ b/plugin/__tests__/variants.spec.js @@ -54,8 +54,8 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' - import { View } from 'react-native-unistyles/components/native/View' + import { Text } from 'react-native-unistyles/src/components/native/Text' + import { View } from 'react-native-unistyles/src/components/native/View' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -143,7 +143,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import React from 'react' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -229,7 +229,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -315,7 +315,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import React from 'react' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -402,7 +402,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import React from 'react' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -495,7 +495,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import React from 'react' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -594,7 +594,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import React from 'react' import { StyleSheet, Variants } from 'react-native-unistyles' @@ -703,7 +703,7 @@ pluginTester({ })) `, output: ` - import { Text } from 'react-native-unistyles/components/native/Text' + import { Text } from 'react-native-unistyles/src/components/native/Text' import React from 'react' import { StyleSheet, Variants } from 'react-native-unistyles' diff --git a/plugin/import.js b/plugin/import.js index 3df9bfb9..4cee2eb5 100644 --- a/plugin/import.js +++ b/plugin/import.js @@ -29,7 +29,7 @@ function addUnistylesImport(t, path, state) { pairs.forEach(([localName, name]) => { const newImport = t.importDeclaration( [t.importSpecifier(t.identifier(localName), t.identifier(name))], - t.stringLiteral(`react-native-unistyles/components/native/${name}`) + t.stringLiteral(`react-native-unistyles/src/components/native/${name}`) ) path.node.body.unshift(newImport)