@niibase/uniwind 1.6.4 → 1.8.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.
- package/CHANGELOG.md +71 -0
- package/dist/cli/index.cjs +91 -0
- package/dist/cli/index.mjs +84 -0
- package/dist/common/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/common/{css → bundler/artifacts/css}/themes.js +4 -1
- package/dist/common/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +1 -2
- package/dist/common/bundler/cli/index.js +76 -0
- package/dist/common/bundler/config.js +75 -0
- package/dist/common/bundler/css-compiler/compileCSS.js +18 -0
- package/dist/common/bundler/css-compiler/compileNativeCSS.js +19 -0
- package/dist/common/bundler/css-compiler/compileTailwind.js +27 -0
- package/dist/common/bundler/css-compiler/compileWebCSS.js +15 -0
- package/dist/common/{vite → bundler/css-compiler}/index.js +4 -4
- package/dist/common/bundler/css-processor/addMetaToStylesTemplate.js +130 -0
- package/dist/common/bundler/css-processor/animation.js +112 -0
- package/dist/common/bundler/css-processor/color.js +66 -0
- package/dist/common/bundler/css-processor/css.js +510 -0
- package/dist/common/bundler/css-processor/functions.js +145 -0
- package/dist/common/bundler/css-processor/index.js +38 -0
- package/dist/common/bundler/css-processor/mq.js +87 -0
- package/dist/common/bundler/css-processor/processor.js +353 -0
- package/dist/common/bundler/css-processor/rn.js +356 -0
- package/dist/common/bundler/css-processor/serialize.js +86 -0
- package/dist/common/bundler/css-processor/types.js +1 -0
- package/dist/common/bundler/css-processor/units.js +55 -0
- package/dist/common/bundler/css-processor/utils.js +61 -0
- package/dist/common/bundler/css-processor/var.js +20 -0
- package/dist/common/{css-visitor → bundler/css-visitor}/rule-visitor.js +7 -7
- package/dist/common/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/common/bundler/logger.js +44 -0
- package/dist/common/bundler/types.js +1 -0
- package/dist/common/common/consts.js +26 -2
- package/dist/common/components/web/rnw.js +2 -2
- package/dist/common/core/config/config.common.js +9 -9
- package/dist/common/core/config/config.js +2 -2
- package/dist/common/core/config/config.native.js +4 -8
- package/dist/common/core/listener.js +10 -10
- package/dist/common/core/native/native-utils.js +1 -8
- package/dist/common/core/native/parsers/textShadow.js +6 -18
- package/dist/common/core/native/parsers/transforms.js +1 -5
- package/dist/common/core/native/runtime.js +7 -3
- package/dist/common/core/native/store.js +22 -69
- package/dist/common/core/web/cssListener.js +2 -2
- package/dist/common/hoc/withUniwind.js +5 -5
- package/dist/common/hoc/withUniwind.native.js +5 -5
- package/dist/common/hooks/useCSSVariable/getVariableValue.native.js +4 -1
- package/dist/common/hooks/useCSSVariable/useCSSVariable.js +6 -2
- package/dist/common/hooks/useUniwind.js +2 -2
- package/dist/metro/index.cjs +40 -34
- package/dist/metro/index.d.ts +2 -0
- package/dist/metro/index.mjs +28 -22
- package/dist/metro/{metro-transformer.cjs → transformer.cjs} +316 -200
- package/dist/metro/{metro-transformer.mjs → transformer.mjs} +254 -138
- package/dist/module/{css → bundler/artifacts/css}/index.d.ts +1 -1
- package/dist/module/{css → bundler/artifacts/css}/index.js +1 -4
- package/dist/module/{css → bundler/artifacts/css}/themes.js +4 -1
- package/dist/module/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +3 -4
- package/dist/module/bundler/cli/index.d.ts +2 -0
- package/dist/module/bundler/cli/index.js +81 -0
- package/dist/module/bundler/config.d.ts +17 -0
- package/dist/module/bundler/config.js +77 -0
- package/dist/module/bundler/css-compiler/compileCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileCSS.js +11 -0
- package/dist/module/bundler/css-compiler/compileNativeCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileNativeCSS.js +33 -0
- package/dist/module/bundler/css-compiler/compileTailwind.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileTailwind.js +22 -0
- package/dist/module/bundler/css-compiler/compileWebCSS.d.ts +2 -0
- package/dist/module/bundler/css-compiler/compileWebCSS.js +8 -0
- package/dist/module/bundler/css-compiler/index.d.ts +1 -0
- package/dist/module/bundler/css-compiler/index.js +1 -0
- package/dist/module/bundler/css-processor/addMetaToStylesTemplate.d.ts +3 -0
- package/dist/module/bundler/css-processor/addMetaToStylesTemplate.js +136 -0
- package/dist/module/bundler/css-processor/animation.d.ts +6 -0
- package/dist/module/bundler/css-processor/animation.js +112 -0
- package/dist/module/bundler/css-processor/color.d.ts +12 -0
- package/dist/module/bundler/css-processor/color.js +63 -0
- package/dist/module/bundler/css-processor/css.d.ts +23 -0
- package/dist/module/bundler/css-processor/css.js +566 -0
- package/dist/module/bundler/css-processor/functions.d.ts +12 -0
- package/dist/module/bundler/css-processor/functions.js +190 -0
- package/dist/module/bundler/css-processor/index.d.ts +3 -0
- package/dist/module/bundler/css-processor/index.js +3 -0
- package/dist/module/bundler/css-processor/mq.d.ts +12 -0
- package/dist/module/bundler/css-processor/mq.js +78 -0
- package/dist/module/bundler/css-processor/processor.d.ts +36 -0
- package/dist/module/bundler/css-processor/processor.js +336 -0
- package/dist/module/bundler/css-processor/rn.d.ts +10 -0
- package/dist/module/bundler/css-processor/rn.js +400 -0
- package/dist/module/bundler/css-processor/serialize.d.ts +2 -0
- package/dist/module/bundler/css-processor/serialize.js +101 -0
- package/dist/module/bundler/css-processor/types.d.ts +28 -0
- package/dist/module/bundler/css-processor/types.js +0 -0
- package/dist/module/bundler/css-processor/units.d.ts +10 -0
- package/dist/module/bundler/css-processor/units.js +48 -0
- package/dist/module/bundler/css-processor/utils.d.ts +23 -0
- package/dist/{shared/uniwind.PtWWxxnh.mjs → module/bundler/css-processor/utils.js} +12 -18
- package/dist/module/bundler/css-processor/var.d.ts +7 -0
- package/dist/module/bundler/css-processor/var.js +13 -0
- package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.d.ts +1 -1
- package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.d.ts +4 -3
- package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.js +7 -7
- package/dist/module/{css-visitor → bundler/css-visitor}/visitor.d.ts +3 -3
- package/dist/module/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
- package/dist/module/bundler/logger.d.ts +12 -0
- package/dist/module/bundler/logger.js +37 -0
- package/dist/module/bundler/types.d.ts +15 -0
- package/dist/module/bundler/types.js +0 -0
- package/dist/module/common/consts.d.ts +21 -0
- package/dist/module/common/consts.js +24 -0
- package/dist/module/components/ScopedTheme/ScopedTheme.native.d.ts +1 -1
- package/dist/module/components/native/Pressable.d.ts +1 -1
- package/dist/module/components/native/TouchableHighlight.d.ts +1 -1
- package/dist/module/components/native/TouchableOpacity.d.ts +1 -1
- package/dist/module/components/native/useAccentColor.d.ts +1 -1
- package/dist/module/components/native/useStyle.d.ts +3 -3
- package/dist/module/components/react-native-gesture-handler/native/BaseButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/FlatList.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Pressable.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RawButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RectButton.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/RefreshControl.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/ScrollView.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Switch.d.ts +1 -1
- package/dist/module/components/react-native-gesture-handler/native/Text.d.ts +4 -1
- package/dist/module/components/react-native-gesture-handler/native/TextInput.d.ts +1 -1
- package/dist/module/components/web/Pressable.d.ts +1 -1
- package/dist/module/components/web/TouchableHighlight.d.ts +1 -1
- package/dist/module/components/web/TouchableOpacity.d.ts +1 -1
- package/dist/module/components/web/rnw.js +1 -1
- package/dist/module/core/config/config.common.d.ts +6 -7
- package/dist/module/core/config/config.common.js +2 -2
- package/dist/module/core/config/config.d.ts +1 -1
- package/dist/module/core/config/config.js +1 -1
- package/dist/module/core/config/config.native.d.ts +2 -2
- package/dist/module/core/config/config.native.js +2 -6
- package/dist/module/core/listener.d.ts +1 -1
- package/dist/module/core/listener.js +1 -1
- package/dist/module/core/native/native-utils.d.ts +0 -1
- package/dist/module/core/native/native-utils.js +0 -6
- package/dist/module/core/native/parsers/textShadow.js +6 -18
- package/dist/module/core/native/parsers/transforms.js +1 -5
- package/dist/module/core/native/runtime.js +5 -1
- package/dist/module/core/native/store.d.ts +3 -3
- package/dist/module/core/native/store.js +22 -65
- package/dist/module/core/types.d.ts +12 -7
- package/dist/module/core/web/cssListener.js +1 -1
- package/dist/module/core/web/getWebStyles.d.ts +1 -1
- package/dist/module/hoc/types.d.ts +2 -2
- package/dist/module/hoc/withUniwind.d.ts +1 -1
- package/dist/module/hoc/withUniwind.js +5 -5
- package/dist/module/hoc/withUniwind.native.d.ts +1 -1
- package/dist/module/hoc/withUniwind.native.js +5 -5
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/getVariableValue.native.js +4 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +1 -1
- package/dist/module/hooks/useCSSVariable/useCSSVariable.js +5 -1
- package/dist/module/hooks/useResolveClassNames.d.ts +1 -1
- package/dist/module/hooks/useUniwind.d.ts +1 -1
- package/dist/module/hooks/useUniwind.js +1 -1
- package/dist/module/index.d.ts +1 -2
- package/dist/shared/{uniwind.r2i22V6d.cjs → uniwind.BEqYiPBB.cjs} +319 -217
- package/dist/shared/uniwind.CFAAUZ2t.mjs +3 -0
- package/dist/shared/uniwind.DJ5M1Q4q.cjs +5 -0
- package/dist/shared/{uniwind.BGiqYvxb.mjs → uniwind.DgC4MT51.mjs} +312 -214
- package/dist/vite/index.cjs +82 -59
- package/dist/vite/index.mjs +80 -58
- package/package.json +37 -21
- package/src/{metro → bundler/adapters/metro}/index.d.ts +2 -0
- package/src/bundler/adapters/metro/index.ts +1 -0
- package/src/bundler/adapters/metro/metro.ts +67 -0
- package/src/{metro/metro-css-patches.ts → bundler/adapters/metro/patches.ts} +3 -2
- package/src/{metro → bundler/adapters/metro}/resolvers.ts +8 -8
- package/src/bundler/adapters/metro/transformer.ts +85 -0
- package/src/bundler/adapters/vite/vite.ts +148 -0
- package/src/{css → bundler/artifacts/css}/extraUtilities.ts +1 -1
- package/src/{css → bundler/artifacts/css}/index.ts +1 -5
- package/src/{css → bundler/artifacts/css}/themes.ts +7 -2
- package/src/{utils/buildDtsFile.ts → bundler/artifacts/dts.ts} +3 -4
- package/src/bundler/cli/index.ts +105 -0
- package/src/bundler/config.ts +94 -0
- package/src/bundler/css-compiler/compileCSS.ts +15 -0
- package/src/bundler/css-compiler/compileNativeCSS.ts +41 -0
- package/src/bundler/css-compiler/compileTailwind.ts +25 -0
- package/src/bundler/css-compiler/compileWebCSS.ts +10 -0
- package/src/bundler/css-compiler/index.ts +1 -0
- package/src/{metro → bundler/css-processor}/addMetaToStylesTemplate.ts +36 -17
- package/src/{metro/processor → bundler/css-processor}/animation.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/color.ts +5 -4
- package/src/{metro/processor → bundler/css-processor}/css.ts +19 -11
- package/src/{metro/processor → bundler/css-processor}/functions.ts +2 -2
- package/src/bundler/css-processor/index.ts +3 -0
- package/src/{metro/processor → bundler/css-processor}/mq.ts +4 -4
- package/src/{metro/processor → bundler/css-processor}/processor.ts +20 -18
- package/src/{metro/processor → bundler/css-processor}/rn.ts +96 -3
- package/src/{metro/utils → bundler/css-processor}/serialize.ts +2 -2
- package/src/{metro → bundler/css-processor}/types.ts +3 -17
- package/src/{metro/processor → bundler/css-processor}/units.ts +2 -2
- package/src/{metro/utils/common.ts → bundler/css-processor/utils.ts} +2 -5
- package/src/{metro/processor → bundler/css-processor}/var.ts +2 -2
- package/src/{css-visitor → bundler/css-visitor}/function-visitor.ts +1 -1
- package/src/{css-visitor → bundler/css-visitor}/rule-visitor.ts +8 -7
- package/src/{css-visitor → bundler/css-visitor}/visitor.ts +4 -3
- package/src/{metro → bundler}/logger.ts +4 -0
- package/src/bundler/types.ts +17 -0
- package/src/common/consts.ts +25 -0
- package/src/components/ScopedTheme/ScopedTheme.native.tsx +1 -1
- package/src/components/native/ActivityIndicator.tsx +2 -1
- package/src/components/native/Button.tsx +2 -1
- package/src/components/native/FlatList.tsx +2 -1
- package/src/components/native/Image.tsx +2 -1
- package/src/components/native/ImageBackground.tsx +2 -1
- package/src/components/native/InputAccessoryView.tsx +3 -2
- package/src/components/native/KeyboardAvoidingView.tsx +2 -1
- package/src/components/native/Modal.tsx +2 -1
- package/src/components/native/Pressable.tsx +1 -1
- package/src/components/native/RefreshControl.tsx +2 -1
- package/src/components/native/SafeAreaView.tsx +2 -1
- package/src/components/native/ScrollView.tsx +2 -1
- package/src/components/native/SectionList.tsx +2 -1
- package/src/components/native/Switch.tsx +3 -2
- package/src/components/native/Text.tsx +3 -2
- package/src/components/native/TextInput.tsx +3 -2
- package/src/components/native/TouchableHighlight.tsx +3 -2
- package/src/components/native/TouchableNativeFeedback.tsx +3 -2
- package/src/components/native/TouchableOpacity.tsx +3 -2
- package/src/components/native/TouchableWithoutFeedback.tsx +3 -2
- package/src/components/native/View.tsx +2 -1
- package/src/components/native/VirtualizedList.tsx +2 -1
- package/src/components/native/useAccentColor.ts +1 -1
- package/src/components/native/useStyle.ts +2 -2
- package/src/components/react-native-gesture-handler/native/BaseButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/BorderlessButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/DrawerLayoutAndroid.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/FlatList.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/GestureHandlerRootView.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/Pressable.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/PureNativeButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RawButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RectButton.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/ScrollView.tsx +1 -1
- package/src/components/react-native-gesture-handler/native/Switch.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/Text.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TextInput.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableNativeFeedback.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableOpacity.tsx +2 -2
- package/src/components/react-native-gesture-handler/native/TouchableWithoutFeedback.tsx +2 -2
- package/src/components/web/ActivityIndicator.tsx +2 -1
- package/src/components/web/Button.tsx +2 -1
- package/src/components/web/FlatList.tsx +2 -1
- package/src/components/web/Image.tsx +2 -1
- package/src/components/web/ImageBackground.tsx +2 -1
- package/src/components/web/KeyboardAvoidingView.tsx +2 -1
- package/src/components/web/Modal.tsx +2 -1
- package/src/components/web/Pressable.tsx +2 -1
- package/src/components/web/RefreshControl.tsx +2 -1
- package/src/components/web/SafeAreaView.tsx +2 -1
- package/src/components/web/ScrollView.tsx +2 -1
- package/src/components/web/SectionList.tsx +2 -1
- package/src/components/web/Switch.tsx +2 -1
- package/src/components/web/Text.tsx +2 -1
- package/src/components/web/TextInput.tsx +2 -1
- package/src/components/web/TouchableHighlight.tsx +2 -1
- package/src/components/web/TouchableOpacity.tsx +2 -1
- package/src/components/web/TouchableWithoutFeedback.tsx +2 -1
- package/src/components/web/View.tsx +2 -1
- package/src/components/web/VirtualizedList.tsx +2 -1
- package/src/components/web/rnw.ts +1 -1
- package/src/core/config/config.common.ts +11 -9
- package/src/core/config/config.native.ts +4 -8
- package/src/core/config/config.ts +2 -2
- package/src/core/listener.ts +1 -1
- package/src/core/native/native-utils.ts +0 -9
- package/src/core/native/parsers/textShadow.ts +6 -18
- package/src/core/native/parsers/transforms.ts +1 -5
- package/src/core/native/runtime.ts +6 -1
- package/src/core/native/store.ts +26 -69
- package/src/core/types.ts +13 -7
- package/src/core/web/cssListener.ts +1 -1
- package/src/core/web/getWebStyles.ts +1 -1
- package/src/hoc/types.ts +2 -2
- package/src/hoc/withUniwind.native.tsx +4 -3
- package/src/hoc/withUniwind.tsx +3 -2
- package/src/hooks/useCSSVariable/getVariableValue.native.ts +6 -3
- package/src/hooks/useCSSVariable/useCSSVariable.ts +8 -2
- package/src/hooks/useResolveClassNames.ts +1 -1
- package/src/hooks/useUniwind.ts +2 -2
- package/src/index.ts +1 -2
- package/dist/common/types.js +0 -28
- package/dist/common/utils/stringifyThemes.js +0 -8
- package/dist/common/vite/vite.js +0 -95
- package/dist/module/types.d.ts +0 -21
- package/dist/module/types.js +0 -22
- package/dist/module/utils/stringifyThemes.d.ts +0 -1
- package/dist/module/utils/stringifyThemes.js +0 -1
- package/dist/module/vite/index.d.ts +0 -9
- package/dist/module/vite/index.js +0 -1
- package/dist/module/vite/vite.d.ts +0 -8
- package/dist/module/vite/vite.js +0 -98
- package/dist/shared/uniwind.B5q8hBGv.cjs +0 -18
- package/dist/shared/uniwind.Cv73KtI-.cjs +0 -86
- package/dist/shared/uniwind.JSWK3vHl.mjs +0 -14
- package/src/metro/compileVirtual.ts +0 -85
- package/src/metro/index.ts +0 -1
- package/src/metro/injectThemes.ts +0 -23
- package/src/metro/metro-transformer.ts +0 -116
- package/src/metro/processor/index.ts +0 -1
- package/src/metro/utils/index.ts +0 -2
- package/src/metro/withUniwindConfig.ts +0 -61
- package/src/types.ts +0 -23
- package/src/utils/stringifyThemes.ts +0 -1
- package/src/vite/index.d.ts +0 -9
- package/src/vite/vite.ts +0 -113
- /package/dist/common/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/insets.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/overwrite.js +0 -0
- /package/dist/common/{css → bundler/artifacts/css}/variants.js +0 -0
- /package/dist/common/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
- /package/dist/common/{css-visitor → bundler/css-visitor}/index.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/insets.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/insets.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/overwrite.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/overwrite.js +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/themes.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/variants.d.ts +0 -0
- /package/dist/module/{css → bundler/artifacts/css}/variants.js +0 -0
- /package/dist/module/{utils/buildDtsFile.d.ts → bundler/artifacts/dts.d.ts} +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/index.d.ts +0 -0
- /package/dist/module/{css-visitor → bundler/css-visitor}/index.js +0 -0
- /package/{dist/common → src/bundler/adapters}/vite/index.d.ts +0 -0
- /package/src/{vite → bundler/adapters/vite}/index.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/insets.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/overwrite.ts +0 -0
- /package/src/{css → bundler/artifacts/css}/variants.ts +0 -0
- /package/src/{css-visitor → bundler/css-visitor}/index.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
+
## What's Changed in 1.8.0
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### 🚀 Features
|
|
6
|
+
|
|
7
|
+
* vite 8 support (#560) by @Brentlok
|
|
8
|
+
* public generate-artifacts script (#550) by @Brentlok
|
|
9
|
+
|
|
10
|
+
### 🐛 Bug Fixes
|
|
11
|
+
|
|
12
|
+
* bundler infinite loop when multiple uniwind instances are installed (#570) by @Brentlok
|
|
13
|
+
* combined variants overriding each other (#567) by @Brentlok
|
|
14
|
+
* phantom dependencies (#561) by @Brentlok
|
|
15
|
+
|
|
16
|
+
### 🔨 Refactoring
|
|
17
|
+
|
|
18
|
+
* replace computed with functions in styles (#547) by @Brentlok
|
|
19
|
+
|
|
20
|
+
### 🧪 Testing
|
|
21
|
+
|
|
22
|
+
* generate artifacts before test by @Brentlok
|
|
23
|
+
|
|
24
|
+
### 🏠 Chores
|
|
25
|
+
|
|
26
|
+
* update dependencies (#549) by @Brentlok
|
|
27
|
+
|
|
28
|
+
### 📦 Other
|
|
29
|
+
|
|
30
|
+
* Merge branch 'updates' by @divineniiquaye
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
**Full Changelog**: https://github.com/divineniiquaye/uniwind/compare/v1.7.0...v1.8.0
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## What's Changed in 1.7.0
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### 🚀 Features
|
|
41
|
+
|
|
42
|
+
* introduce responsive scaling support by @divineniiquaye
|
|
43
|
+
|
|
44
|
+
### 🐛 Bug Fixes
|
|
45
|
+
|
|
46
|
+
* reemove redundant constructor assignment from css processor by @divineniiquaye
|
|
47
|
+
* dont parse flex: 1 (#543) by @Brentlok
|
|
48
|
+
* deeply find themed variables (#535) by @Brentlok
|
|
49
|
+
|
|
50
|
+
### 🔨 Refactoring
|
|
51
|
+
|
|
52
|
+
* major bundler refactor (#523) by @Brentlok
|
|
53
|
+
|
|
54
|
+
### 🏠 Chores
|
|
55
|
+
|
|
56
|
+
* pass bundler config directly by @Brentlok
|
|
57
|
+
* generate artifacts before compiling virtual code by @Brentlok
|
|
58
|
+
* update version by @Brentlok
|
|
59
|
+
* silent css variable warning for SSR (#539) by @Brentlok
|
|
60
|
+
|
|
61
|
+
### 📦 Other
|
|
62
|
+
|
|
63
|
+
* Merge branch 'updates' by @divineniiquaye
|
|
64
|
+
* Fix !important modifier having no effect on native (#534) by @jezsung
|
|
65
|
+
|
|
66
|
+
### New Contributors
|
|
67
|
+
* @jezsung made their first contribution
|
|
68
|
+
|
|
69
|
+
**Full Changelog**: https://github.com/divineniiquaye/uniwind/compare/v1.6.4...v1.7.0
|
|
70
|
+
|
|
71
|
+
|
|
1
72
|
## What's Changed in 1.6.4
|
|
2
73
|
|
|
3
74
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const config = require('../shared/uniwind.BEqYiPBB.cjs');
|
|
5
|
+
const node_url = require('node:url');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
require('fs');
|
|
8
|
+
require('@tailwindcss/node');
|
|
9
|
+
require('lightningcss');
|
|
10
|
+
|
|
11
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
13
|
+
|
|
14
|
+
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
15
|
+
|
|
16
|
+
const dirname = path__default.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli/index.cjs', document.baseURI).href))));
|
|
17
|
+
const cssArtifactPath = path__default.resolve(dirname, "../../uniwind.css");
|
|
18
|
+
const printHelp = () => {
|
|
19
|
+
console.log([
|
|
20
|
+
"Usage: uniwind generate-artifacts --css <file> [--theme <name>...] [--dts <file>]",
|
|
21
|
+
"",
|
|
22
|
+
"Options:",
|
|
23
|
+
" --css <file> CSS entry file path, e.g. ./global.css",
|
|
24
|
+
" --theme <name> Extra theme name. Can be passed multiple times",
|
|
25
|
+
" --dts <file> Generated TypeScript declarations path",
|
|
26
|
+
" --help Show help"
|
|
27
|
+
].join("\n"));
|
|
28
|
+
};
|
|
29
|
+
const readValue = (args, index, flag) => {
|
|
30
|
+
const value = args[index + 1];
|
|
31
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
32
|
+
throw new Error(`Uniwind: ${flag} requires a value`);
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
36
|
+
const parseGenerateArtifactsArgs = (args) => {
|
|
37
|
+
const parsed = {
|
|
38
|
+
extraThemes: []
|
|
39
|
+
};
|
|
40
|
+
for (let index = 0; index < args.length; index++) {
|
|
41
|
+
const arg = args[index];
|
|
42
|
+
switch (arg) {
|
|
43
|
+
case "--css":
|
|
44
|
+
parsed.cssEntryFile = readValue(args, index, arg);
|
|
45
|
+
index++;
|
|
46
|
+
break;
|
|
47
|
+
case "--theme":
|
|
48
|
+
parsed.extraThemes.push(readValue(args, index, arg));
|
|
49
|
+
index++;
|
|
50
|
+
break;
|
|
51
|
+
case "--dts":
|
|
52
|
+
parsed.dtsFile = readValue(args, index, arg);
|
|
53
|
+
index++;
|
|
54
|
+
break;
|
|
55
|
+
case "--help":
|
|
56
|
+
printHelp();
|
|
57
|
+
process.exit(0);
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Uniwind: Unknown option ${arg}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return parsed;
|
|
63
|
+
};
|
|
64
|
+
const generateArtifacts = async (args) => {
|
|
65
|
+
const parsed = parseGenerateArtifactsArgs(args);
|
|
66
|
+
const bundlerConfig = config.UniwindBundlerConfig.fromCliConfig({
|
|
67
|
+
cssEntryFile: parsed.cssEntryFile,
|
|
68
|
+
dtsFile: parsed.dtsFile,
|
|
69
|
+
extraThemes: parsed.extraThemes
|
|
70
|
+
});
|
|
71
|
+
await bundlerConfig.generateArtifacts(cssArtifactPath);
|
|
72
|
+
config.Logger.info("Artifacts generated");
|
|
73
|
+
};
|
|
74
|
+
const main = async () => {
|
|
75
|
+
const [command, ...args] = process.argv.slice(2);
|
|
76
|
+
if (command === "--help" || command === void 0) {
|
|
77
|
+
printHelp();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
switch (command) {
|
|
81
|
+
case "generate-artifacts":
|
|
82
|
+
await generateArtifacts(args);
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
throw new Error(`Uniwind: Unknown command ${command}`);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
main().catch((error) => {
|
|
89
|
+
console.error(error instanceof Error ? error.message : error);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { U as UniwindBundlerConfig, L as Logger } from '../shared/uniwind.DgC4MT51.mjs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import '@tailwindcss/node';
|
|
7
|
+
import 'lightningcss';
|
|
8
|
+
|
|
9
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const cssArtifactPath = path.resolve(dirname, "../../uniwind.css");
|
|
11
|
+
const printHelp = () => {
|
|
12
|
+
console.log([
|
|
13
|
+
"Usage: uniwind generate-artifacts --css <file> [--theme <name>...] [--dts <file>]",
|
|
14
|
+
"",
|
|
15
|
+
"Options:",
|
|
16
|
+
" --css <file> CSS entry file path, e.g. ./global.css",
|
|
17
|
+
" --theme <name> Extra theme name. Can be passed multiple times",
|
|
18
|
+
" --dts <file> Generated TypeScript declarations path",
|
|
19
|
+
" --help Show help"
|
|
20
|
+
].join("\n"));
|
|
21
|
+
};
|
|
22
|
+
const readValue = (args, index, flag) => {
|
|
23
|
+
const value = args[index + 1];
|
|
24
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
25
|
+
throw new Error(`Uniwind: ${flag} requires a value`);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
const parseGenerateArtifactsArgs = (args) => {
|
|
30
|
+
const parsed = {
|
|
31
|
+
extraThemes: []
|
|
32
|
+
};
|
|
33
|
+
for (let index = 0; index < args.length; index++) {
|
|
34
|
+
const arg = args[index];
|
|
35
|
+
switch (arg) {
|
|
36
|
+
case "--css":
|
|
37
|
+
parsed.cssEntryFile = readValue(args, index, arg);
|
|
38
|
+
index++;
|
|
39
|
+
break;
|
|
40
|
+
case "--theme":
|
|
41
|
+
parsed.extraThemes.push(readValue(args, index, arg));
|
|
42
|
+
index++;
|
|
43
|
+
break;
|
|
44
|
+
case "--dts":
|
|
45
|
+
parsed.dtsFile = readValue(args, index, arg);
|
|
46
|
+
index++;
|
|
47
|
+
break;
|
|
48
|
+
case "--help":
|
|
49
|
+
printHelp();
|
|
50
|
+
process.exit(0);
|
|
51
|
+
default:
|
|
52
|
+
throw new Error(`Uniwind: Unknown option ${arg}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return parsed;
|
|
56
|
+
};
|
|
57
|
+
const generateArtifacts = async (args) => {
|
|
58
|
+
const parsed = parseGenerateArtifactsArgs(args);
|
|
59
|
+
const bundlerConfig = UniwindBundlerConfig.fromCliConfig({
|
|
60
|
+
cssEntryFile: parsed.cssEntryFile,
|
|
61
|
+
dtsFile: parsed.dtsFile,
|
|
62
|
+
extraThemes: parsed.extraThemes
|
|
63
|
+
});
|
|
64
|
+
await bundlerConfig.generateArtifacts(cssArtifactPath);
|
|
65
|
+
Logger.info("Artifacts generated");
|
|
66
|
+
};
|
|
67
|
+
const main = async () => {
|
|
68
|
+
const [command, ...args] = process.argv.slice(2);
|
|
69
|
+
if (command === "--help" || command === void 0) {
|
|
70
|
+
printHelp();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
switch (command) {
|
|
74
|
+
case "generate-artifacts":
|
|
75
|
+
await generateArtifacts(args);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
throw new Error(`Uniwind: Unknown command ${command}`);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
main().catch((error) => {
|
|
82
|
+
console.error(error instanceof Error ? error.message : error);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
});
|
|
@@ -5,17 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.buildCSS = void 0;
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
8
|
var _extraUtilities = require("./extraUtilities");
|
|
10
9
|
var _insets = require("./insets");
|
|
11
10
|
var _overwrite = require("./overwrite");
|
|
12
11
|
var _themes = require("./themes");
|
|
13
12
|
var _variants = require("./variants");
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const
|
|
16
|
-
const buildCSS = async (themes, input) => {
|
|
14
|
+
const buildCSS = async (themes, input, cssFilePath) => {
|
|
17
15
|
const themesCSS = await (0, _themes.generateCSSForThemes)(themes, input);
|
|
18
|
-
const cssFilePath = _path.default.join(dirname, "../../uniwind.css");
|
|
19
16
|
const oldCSSFile = _fs.default.existsSync(cssFilePath) ? _fs.default.readFileSync(cssFilePath, "utf-8") : "";
|
|
20
17
|
const newCssFile = [_variants.VARIANTS_CSS, _insets.INSETS_CSS, _overwrite.OVERWRITE_CSS, _extraUtilities.EXTRA_UTILITIES_CSS, themesCSS].join("\n");
|
|
21
18
|
if (oldCSSFile === newCssFile) {
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.generateCSSForThemes = void 0;
|
|
7
|
+
var _logger = require("@/bundler/logger");
|
|
7
8
|
var _node = require("@tailwindcss/node");
|
|
8
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
10
|
var _lightningcss = require("lightningcss");
|
|
10
11
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
var _logger = require("../metro/logger");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
const readFileSafe = filePath => {
|
|
14
14
|
try {
|
|
@@ -53,6 +53,9 @@ const generateCSSForThemes = async (themes, input) => {
|
|
|
53
53
|
}
|
|
54
54
|
const importUrls = /* @__PURE__ */new Set();
|
|
55
55
|
const importsCSS = dependencies.filter(dependency => {
|
|
56
|
+
if (dependency.type !== "import") {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
56
59
|
if (dependency.url.startsWith(".")) {
|
|
57
60
|
importUrls.add(_path.default.resolve(_path.default.dirname(cssPath), dependency.url));
|
|
58
61
|
return false;
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.buildDtsFile = void 0;
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
-
var _package = require("../../package.json");
|
|
9
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
const buildDtsFile = (dtsPath, stringifiedThemes) => {
|
|
11
10
|
const oldDtsContent = _fs.default.existsSync(dtsPath) ? _fs.default.readFileSync(dtsPath, "utf-8") : "";
|
|
12
|
-
const dtsContent = [`// NOTE: This file is generated by
|
|
11
|
+
const dtsContent = [`// NOTE: This file is generated by uniwind and it should not be edited manually.`, `/// <reference types="uniwind/types" />`, "", `declare module 'uniwind' {`, ` export interface UniwindConfig {`, ` themes: readonly ${stringifiedThemes}`, ` }`, `}`, "", `export {}`, ""].join("\n");
|
|
13
12
|
if (oldDtsContent === dtsContent) {
|
|
14
13
|
return;
|
|
15
14
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// #!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _config = require("@/bundler/config");
|
|
5
|
+
var _logger = require("@/bundler/logger");
|
|
6
|
+
var _nodeUrl = require("node:url");
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const dirname = _path.default.dirname((0, _nodeUrl.fileURLToPath)(require('url').pathToFileURL(__filename).toString()));
|
|
10
|
+
const cssArtifactPath = _path.default.resolve(dirname, "../../uniwind.css");
|
|
11
|
+
const printHelp = () => {
|
|
12
|
+
console.log(["Usage: uniwind generate-artifacts --css <file> [--theme <name>...] [--dts <file>]", "", "Options:", " --css <file> CSS entry file path, e.g. ./global.css", " --theme <name> Extra theme name. Can be passed multiple times", " --dts <file> Generated TypeScript declarations path", " --help Show help"].join("\n"));
|
|
13
|
+
};
|
|
14
|
+
const readValue = (args, index, flag) => {
|
|
15
|
+
const value = args[index + 1];
|
|
16
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
17
|
+
throw new Error(`Uniwind: ${flag} requires a value`);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
const parseGenerateArtifactsArgs = args => {
|
|
22
|
+
const parsed = {
|
|
23
|
+
extraThemes: []
|
|
24
|
+
};
|
|
25
|
+
for (let index = 0; index < args.length; index++) {
|
|
26
|
+
const arg = args[index];
|
|
27
|
+
switch (arg) {
|
|
28
|
+
case "--css":
|
|
29
|
+
parsed.cssEntryFile = readValue(args, index, arg);
|
|
30
|
+
index++;
|
|
31
|
+
break;
|
|
32
|
+
case "--theme":
|
|
33
|
+
parsed.extraThemes.push(readValue(args, index, arg));
|
|
34
|
+
index++;
|
|
35
|
+
break;
|
|
36
|
+
case "--dts":
|
|
37
|
+
parsed.dtsFile = readValue(args, index, arg);
|
|
38
|
+
index++;
|
|
39
|
+
break;
|
|
40
|
+
case "--help":
|
|
41
|
+
printHelp();
|
|
42
|
+
process.exit(0);
|
|
43
|
+
default:
|
|
44
|
+
throw new Error(`Uniwind: Unknown option ${arg}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return parsed;
|
|
48
|
+
};
|
|
49
|
+
const generateArtifacts = async args => {
|
|
50
|
+
const parsed = parseGenerateArtifactsArgs(args);
|
|
51
|
+
const bundlerConfig = _config.UniwindBundlerConfig.fromCliConfig({
|
|
52
|
+
cssEntryFile: parsed.cssEntryFile,
|
|
53
|
+
dtsFile: parsed.dtsFile,
|
|
54
|
+
extraThemes: parsed.extraThemes
|
|
55
|
+
});
|
|
56
|
+
await bundlerConfig.generateArtifacts(cssArtifactPath);
|
|
57
|
+
_logger.Logger.info("Artifacts generated");
|
|
58
|
+
};
|
|
59
|
+
const main = async () => {
|
|
60
|
+
const [command, ...args] = process.argv.slice(2);
|
|
61
|
+
if (command === "--help" || command === void 0) {
|
|
62
|
+
printHelp();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
switch (command) {
|
|
66
|
+
case "generate-artifacts":
|
|
67
|
+
await generateArtifacts(args);
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
throw new Error(`Uniwind: Unknown command ${command}`);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
main().catch(error => {
|
|
74
|
+
console.error(error instanceof Error ? error.message : error);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UniwindBundlerConfig = void 0;
|
|
7
|
+
var _css = require("@/bundler/artifacts/css");
|
|
8
|
+
var _dts = require("@/bundler/artifacts/dts");
|
|
9
|
+
var _cssVisitor = require("@/bundler/css-visitor");
|
|
10
|
+
var _consts = require("@/common/consts");
|
|
11
|
+
var _utils = require("@/common/utils");
|
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
class UniwindBundlerConfig {
|
|
15
|
+
constructor(config, platform) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.platform = platform;
|
|
18
|
+
}
|
|
19
|
+
static fromMetroConfig(config, platform) {
|
|
20
|
+
const getPlatform = () => {
|
|
21
|
+
if (!(0, _utils.isDefined)(platform)) {
|
|
22
|
+
return _consts.Platform.Native;
|
|
23
|
+
}
|
|
24
|
+
if (!config.isTV) {
|
|
25
|
+
return platform;
|
|
26
|
+
}
|
|
27
|
+
if (platform === _consts.Platform.Android) {
|
|
28
|
+
return _consts.Platform.AndroidTV;
|
|
29
|
+
}
|
|
30
|
+
if (platform === _consts.Platform.iOS) {
|
|
31
|
+
return _consts.Platform.AppleTV;
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`Platform ${platform} not supported`);
|
|
34
|
+
};
|
|
35
|
+
if (typeof config === "undefined") {
|
|
36
|
+
throw new Error("Uniwind: You need to pass second parameter to withUniwindConfig");
|
|
37
|
+
}
|
|
38
|
+
if (typeof config.cssEntryFile === "undefined") {
|
|
39
|
+
throw new Error('Uniwind: You need to pass css css entry file to withUniwindConfig, e.g. withUniwindConfig(config, { cssEntryFile: "./global.css" })');
|
|
40
|
+
}
|
|
41
|
+
return new UniwindBundlerConfig(config, getPlatform());
|
|
42
|
+
}
|
|
43
|
+
static fromViteConfig(config) {
|
|
44
|
+
return new UniwindBundlerConfig(config, _consts.Platform.Web);
|
|
45
|
+
}
|
|
46
|
+
static fromCliConfig(config) {
|
|
47
|
+
if (typeof config.cssEntryFile === "undefined") {
|
|
48
|
+
throw new Error("Uniwind: You need to pass css entry file, e.g. uniwind generate-artifacts --css ./global.css. Run uniwind generate-artifacts --help for usage.");
|
|
49
|
+
}
|
|
50
|
+
return new UniwindBundlerConfig(config, _consts.Platform.Web);
|
|
51
|
+
}
|
|
52
|
+
get cssPath() {
|
|
53
|
+
return _path.default.join(process.cwd(), this.config.cssEntryFile);
|
|
54
|
+
}
|
|
55
|
+
get themes() {
|
|
56
|
+
return Array.from(/* @__PURE__ */new Set(["light", "dark", ...(this.config.extraThemes ?? [])]));
|
|
57
|
+
}
|
|
58
|
+
get cssVisitor() {
|
|
59
|
+
return new _cssVisitor.UniwindCSSVisitor(this);
|
|
60
|
+
}
|
|
61
|
+
get polyfills() {
|
|
62
|
+
return this.config.polyfills;
|
|
63
|
+
}
|
|
64
|
+
get stringifiedThemes() {
|
|
65
|
+
return `[${this.themes.map(theme => `'${theme}'`).join(", ")}]`;
|
|
66
|
+
}
|
|
67
|
+
toMetroConfig() {
|
|
68
|
+
return this.config;
|
|
69
|
+
}
|
|
70
|
+
async generateArtifacts(cssArtifactPath) {
|
|
71
|
+
await (0, _css.buildCSS)(this.themes, this.config.cssEntryFile, cssArtifactPath);
|
|
72
|
+
(0, _dts.buildDtsFile)(this.config.dtsFile ?? "uniwind-types.d.ts", this.stringifiedThemes);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.UniwindBundlerConfig = UniwindBundlerConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compileCSS = void 0;
|
|
7
|
+
var _consts = require("@/common/consts");
|
|
8
|
+
var _compileNativeCSS = require("./compileNativeCSS");
|
|
9
|
+
var _compileTailwind = require("./compileTailwind");
|
|
10
|
+
var _compileWebCSS = require("./compileWebCSS");
|
|
11
|
+
const compileCSS = async bundlerConfig => {
|
|
12
|
+
const tailwindCSS = await (0, _compileTailwind.compileTailwind)(bundlerConfig);
|
|
13
|
+
if (bundlerConfig.platform === _consts.Platform.Web) {
|
|
14
|
+
return (0, _compileWebCSS.compileWebCSS)(bundlerConfig, tailwindCSS);
|
|
15
|
+
}
|
|
16
|
+
return (0, _compileNativeCSS.compileNativeCSS)(bundlerConfig, tailwindCSS);
|
|
17
|
+
};
|
|
18
|
+
exports.compileCSS = compileCSS;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compileNativeCSS = void 0;
|
|
7
|
+
var _cssProcessor = require("../css-processor");
|
|
8
|
+
const compileNativeCSS = (bundlerConfig, tailwindCSS) => {
|
|
9
|
+
const Processor = new _cssProcessor.ProcessorBuilder(bundlerConfig);
|
|
10
|
+
Processor.transform(tailwindCSS);
|
|
11
|
+
const stylesheet = (0, _cssProcessor.serializeJSObject)((0, _cssProcessor.addMetaToStylesTemplate)(Processor, bundlerConfig.platform), (key, value) => `"${key}": ${value}`);
|
|
12
|
+
const vars = (0, _cssProcessor.serializeJSObject)(Processor.vars, (key, value) => `"${key}": vars => ${value}`);
|
|
13
|
+
const keyframes = (0, _cssProcessor.serializeJSObject)(Processor.keyframes, (key, value) => `get "${key}"() { return ${value} }`);
|
|
14
|
+
const scopedVars = Object.fromEntries(Object.entries(Processor.scopedVars).map(([scopedVarsName, scopedVars2]) => [scopedVarsName, (0, _cssProcessor.serializeJSObject)(scopedVars2, (key, value) => `"${key}": vars => ${value}`)]));
|
|
15
|
+
const serializedScopedVars = Object.entries(scopedVars).map(([scopedVarsName, scopedVars2]) => `"${scopedVarsName}": ({ ${scopedVars2} }),`).join("");
|
|
16
|
+
const currentColorVar = `currentColor: () => rt.colorScheme === 'dark' ? '#ffffff' : '#000000',`;
|
|
17
|
+
return ["({", `scopedVars: ({ ${serializedScopedVars} }),`, `vars: ({ ${currentColorVar} ${vars} }),`, `stylesheet: ({ ${stylesheet} }),`, `keyframes: ({ ${keyframes} }),`, "})"].join("");
|
|
18
|
+
};
|
|
19
|
+
exports.compileNativeCSS = compileNativeCSS;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compileTailwind = void 0;
|
|
7
|
+
var _node = require("@tailwindcss/node");
|
|
8
|
+
var _oxide = require("@tailwindcss/oxide");
|
|
9
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const compileTailwind = async bundlerConfig => {
|
|
13
|
+
const css = await _fs.default.promises.readFile(bundlerConfig.cssPath, "utf-8");
|
|
14
|
+
const compiler = await (0, _node.compile)(css, {
|
|
15
|
+
base: _path.default.dirname(bundlerConfig.cssPath),
|
|
16
|
+
onDependency: () => void 0
|
|
17
|
+
});
|
|
18
|
+
const scanner = new _oxide.Scanner({
|
|
19
|
+
sources: [...compiler.sources, {
|
|
20
|
+
negated: false,
|
|
21
|
+
pattern: "**/*",
|
|
22
|
+
base: _path.default.dirname(bundlerConfig.cssPath)
|
|
23
|
+
}]
|
|
24
|
+
});
|
|
25
|
+
return compiler.build(scanner.scan());
|
|
26
|
+
};
|
|
27
|
+
exports.compileTailwind = compileTailwind;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compileWebCSS = void 0;
|
|
7
|
+
var _lightningcss = require("lightningcss");
|
|
8
|
+
const compileWebCSS = (bundlerConfig, tailwindCSS) => {
|
|
9
|
+
return (0, _lightningcss.transform)({
|
|
10
|
+
code: Buffer.from(tailwindCSS),
|
|
11
|
+
filename: "uniwind.css",
|
|
12
|
+
visitor: bundlerConfig.cssVisitor
|
|
13
|
+
}).code.toString();
|
|
14
|
+
};
|
|
15
|
+
exports.compileWebCSS = compileWebCSS;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var
|
|
7
|
-
Object.keys(
|
|
6
|
+
var _compileCSS = require("./compileCSS");
|
|
7
|
+
Object.keys(_compileCSS).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] ===
|
|
9
|
+
if (key in exports && exports[key] === _compileCSS[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
12
|
get: function () {
|
|
13
|
-
return
|
|
13
|
+
return _compileCSS[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|