react-native-css 3.0.0-nightly.4723140 → 3.0.0-nightly.61014be
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/README.md +184 -1
- package/dist/commonjs/babel/allowedModules.js +23 -0
- package/dist/commonjs/babel/allowedModules.js.map +1 -0
- package/dist/commonjs/babel/helpers.js +18 -122
- package/dist/commonjs/babel/helpers.js.map +1 -1
- package/dist/commonjs/babel/import-plugin.js +62 -58
- package/dist/commonjs/babel/import-plugin.js.map +1 -1
- package/dist/commonjs/babel/react-native-web.js +118 -0
- package/dist/commonjs/babel/react-native-web.js.map +1 -0
- package/dist/commonjs/babel/react-native.js +118 -0
- package/dist/commonjs/babel/react-native.js.map +1 -0
- package/dist/commonjs/compiler/atRules.js +101 -0
- package/dist/commonjs/compiler/atRules.js.map +1 -0
- package/dist/commonjs/compiler/attributes.test.js +20 -0
- package/dist/commonjs/compiler/attributes.test.js.map +1 -0
- package/dist/commonjs/compiler/compiler.js +143 -344
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/compiler.types.js.map +1 -1
- package/dist/commonjs/compiler/container-query.js +10 -10
- package/dist/commonjs/compiler/container-query.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +1233 -988
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +78 -0
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -0
- package/dist/commonjs/compiler/keyframes.js +15 -24
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/media-query.js +22 -22
- package/dist/commonjs/compiler/media-query.js.map +1 -1
- package/dist/commonjs/compiler/selectors.js +264 -184
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/split-by-delimiter.js +21 -0
- package/dist/commonjs/compiler/split-by-delimiter.js.map +1 -0
- package/dist/commonjs/compiler/stylesheet.js +385 -0
- package/dist/commonjs/compiler/stylesheet.js.map +1 -0
- package/dist/commonjs/components/Text.js +2 -0
- package/dist/commonjs/components/Text.js.map +1 -1
- package/dist/commonjs/components/View.js +2 -0
- package/dist/commonjs/components/View.js.map +1 -1
- package/dist/commonjs/index.js +11 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/jest/index.js +2 -18
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +111 -50
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/injection-code.js +24 -4
- package/dist/commonjs/metro/injection-code.js.map +1 -1
- package/dist/commonjs/metro/resolver.js +62 -0
- package/dist/commonjs/metro/resolver.js.map +1 -0
- package/dist/commonjs/metro/typescript.js +1 -1
- package/dist/commonjs/poison.pill.js +36 -0
- package/dist/commonjs/poison.pill.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/guards.js +10 -4
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +2 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/index.js +11 -1
- package/dist/commonjs/runtime/native/index.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +18 -0
- package/dist/commonjs/runtime/native/injection.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +23 -27
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -5
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/animation.js +70 -72
- package/dist/commonjs/runtime/native/styles/animation.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/border.js +12 -0
- package/dist/commonjs/runtime/native/styles/border.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/box-shadow.js +40 -0
- package/dist/commonjs/runtime/native/styles/box-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calc.js +33 -61
- package/dist/commonjs/runtime/native/styles/calc.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/calculate-props.js +123 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/constants.js +2 -1
- package/dist/commonjs/runtime/native/styles/constants.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/filters.js +84 -0
- package/dist/commonjs/runtime/native/styles/filters.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +2 -110
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/platform-functions.js +46 -0
- package/dist/commonjs/runtime/native/styles/platform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/resolve.js +46 -13
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/shorthand.js +34 -17
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/transform.js +9 -3
- package/dist/commonjs/runtime/native/styles/transform.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/units.js +7 -4
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/variables.js +57 -36
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +18 -5
- package/dist/commonjs/runtime/utils/objects.js.map +1 -1
- package/dist/commonjs/runtime/utils/style-value.js +7 -0
- package/dist/commonjs/runtime/utils/style-value.js.map +1 -1
- package/dist/commonjs/runtime/web/index.js +1 -0
- package/dist/commonjs/runtime/web/index.js.map +1 -1
- package/dist/commonjs/runtime/web/metro.js +6 -0
- package/dist/commonjs/runtime/web/metro.js.map +1 -0
- package/dist/module/babel/allowedModules.js +19 -0
- package/dist/module/babel/allowedModules.js.map +1 -0
- package/dist/module/babel/helpers.js +17 -116
- package/dist/module/babel/helpers.js.map +1 -1
- package/dist/module/babel/import-plugin.js +63 -59
- package/dist/module/babel/import-plugin.js.map +1 -1
- package/dist/module/babel/react-native-web.js +112 -0
- package/dist/module/babel/react-native-web.js.map +1 -0
- package/dist/module/babel/react-native.js +112 -0
- package/dist/module/babel/react-native.js.map +1 -0
- package/dist/module/compiler/atRules.js +97 -0
- package/dist/module/compiler/atRules.js.map +1 -0
- package/dist/module/compiler/attributes.test.js +20 -0
- package/dist/module/compiler/attributes.test.js.map +1 -0
- package/dist/module/compiler/compiler.js +144 -345
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +0 -12
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/container-query.js +10 -10
- package/dist/module/compiler/container-query.js.map +1 -1
- package/dist/module/compiler/declarations.js +1172 -992
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +78 -0
- package/dist/module/compiler/inheritance.test.js.map +1 -0
- package/dist/module/compiler/keyframes.js +15 -24
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/media-query.js +22 -22
- package/dist/module/compiler/media-query.js.map +1 -1
- package/dist/module/compiler/selectors.js +264 -184
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/split-by-delimiter.js +17 -0
- package/dist/module/compiler/split-by-delimiter.js.map +1 -0
- package/dist/module/compiler/stylesheet.js +380 -0
- package/dist/module/compiler/stylesheet.js.map +1 -0
- package/dist/module/components/Text.js +1 -0
- package/dist/module/components/Text.js.map +1 -1
- package/dist/module/components/View.js +1 -0
- package/dist/module/components/View.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/jest/index.js +3 -3
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +111 -50
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/injection-code.js +22 -3
- package/dist/module/metro/injection-code.js.map +1 -1
- package/dist/module/metro/resolver.js +57 -0
- package/dist/module/metro/resolver.js.map +1 -0
- package/dist/module/metro/typescript.js +1 -1
- package/dist/module/poison.pill.js +34 -0
- package/dist/module/poison.pill.js.map +1 -0
- package/dist/module/runtime/native/conditions/guards.js +10 -4
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +2 -0
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/index.js +1 -2
- package/dist/module/runtime/native/index.js.map +1 -1
- package/dist/module/runtime/native/injection.js +18 -0
- package/dist/module/runtime/native/injection.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +22 -27
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +1 -5
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/animation.js +68 -71
- package/dist/module/runtime/native/styles/animation.js.map +1 -1
- package/dist/module/runtime/native/styles/border.js +8 -0
- package/dist/module/runtime/native/styles/border.js.map +1 -0
- package/dist/module/runtime/native/styles/box-shadow.js +35 -0
- package/dist/module/runtime/native/styles/box-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/calc.js +33 -62
- package/dist/module/runtime/native/styles/calc.js.map +1 -1
- package/dist/module/runtime/native/styles/calculate-props.js +118 -0
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -0
- package/dist/module/runtime/native/styles/constants.js +1 -0
- package/dist/module/runtime/native/styles/constants.js.map +1 -1
- package/dist/module/runtime/native/styles/filters.js +70 -0
- package/dist/module/runtime/native/styles/filters.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +2 -110
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/platform-functions.js +36 -0
- package/dist/module/runtime/native/styles/platform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/resolve.js +47 -14
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/shorthand.js +34 -17
- package/dist/module/runtime/native/styles/shorthand.js.map +1 -1
- package/dist/module/runtime/native/styles/transform.js +9 -3
- package/dist/module/runtime/native/styles/transform.js.map +1 -1
- package/dist/module/runtime/native/styles/units.js +7 -4
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/module/runtime/native/styles/variables.js +57 -36
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +16 -4
- package/dist/module/runtime/utils/objects.js.map +1 -1
- package/dist/module/runtime/utils/style-value.js +6 -0
- package/dist/module/runtime/utils/style-value.js.map +1 -1
- package/dist/module/runtime/web/index.js +2 -0
- package/dist/module/runtime/web/index.js.map +1 -1
- package/dist/module/runtime/web/metro.js +5 -0
- package/dist/module/runtime/web/metro.js.map +1 -0
- package/dist/typescript/commonjs/example/app.config.d.ts +4 -0
- package/dist/typescript/commonjs/example/app.config.d.ts.map +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/allowedModules.d.ts +2 -0
- package/dist/typescript/commonjs/src/babel/allowedModules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts +3 -8
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +8 -0
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/react-native.d.ts +8 -0
- package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts +34 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +27 -108
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +118 -25
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +5 -4
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +4 -4
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +10 -5
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +54 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +2 -3
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts +5 -4
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +15 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/resolver.d.ts +4 -0
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/poison.pill.d.ts +2 -0
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +3 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +10 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts +3 -4
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts +6 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts +3 -4
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts +0 -15
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts +3 -2
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/metro.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/web/metro.d.ts.map +1 -0
- package/dist/typescript/module/example/app.config.d.ts +4 -0
- package/dist/typescript/module/example/app.config.d.ts.map +1 -0
- package/dist/typescript/module/example/src/App.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/allowedModules.d.ts +2 -0
- package/dist/typescript/module/src/babel/allowedModules.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/helpers.d.ts +3 -8
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts +8 -0
- package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/react-native.d.ts +8 -0
- package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts +34 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/attributes.test.d.ts +2 -0
- package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +27 -108
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +118 -25
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts +2 -0
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts +5 -4
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/media-query.d.ts +4 -4
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selectors.d.ts +10 -5
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts +2 -0
- package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +54 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Text.d.ts +1 -1
- package/dist/typescript/module/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/module/src/components/View.d.ts +1 -1
- package/dist/typescript/module/src/components/View.d.ts.map +1 -1
- package/dist/typescript/module/src/index.d.ts +1 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +2 -3
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts +5 -4
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts +15 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/resolver.d.ts +4 -0
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -0
- package/dist/typescript/module/src/poison.pill.d.ts +2 -0
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/index.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +3 -2
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +10 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts +12 -0
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts +3 -4
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts +6 -2
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts +3 -4
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/runtime.types.d.ts +0 -15
- package/dist/typescript/module/src/runtime/runtime.types.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/components.d.ts +1 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts +2 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts +3 -2
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/index.d.ts +1 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/metro.d.ts +2 -0
- package/dist/typescript/module/src/runtime/web/metro.d.ts.map +1 -0
- package/package.json +67 -13
- package/src/babel/allowedModules.ts +24 -0
- package/src/babel/helpers.ts +16 -158
- package/src/babel/import-plugin.ts +125 -132
- package/src/babel/react-native-web.ts +226 -0
- package/src/babel/react-native.ts +226 -0
- package/src/compiler/atRules.ts +144 -0
- package/src/compiler/attributes.test.ts +28 -0
- package/src/compiler/compiler.ts +154 -482
- package/src/compiler/compiler.types.ts +30 -135
- package/src/compiler/container-query.ts +12 -12
- package/src/compiler/declarations.ts +1789 -1971
- package/src/compiler/inheritance.test.ts +121 -0
- package/src/compiler/keyframes.ts +28 -42
- package/src/compiler/media-query.ts +27 -26
- package/src/compiler/selectors.ts +289 -271
- package/src/compiler/split-by-delimiter.ts +19 -0
- package/src/compiler/stylesheet.ts +546 -0
- package/src/components/Text.tsx +2 -0
- package/src/components/View.tsx +2 -0
- package/src/index.ts +2 -0
- package/src/jest/index.ts +6 -5
- package/src/metro/index.ts +161 -64
- package/src/metro/injection-code.ts +33 -3
- package/src/metro/resolver.ts +89 -0
- package/src/metro/typescript.ts +1 -1
- package/src/poison.pill.ts +32 -0
- package/src/runtime/native/conditions/guards.ts +12 -4
- package/src/runtime/native/conditions/media-query.ts +2 -0
- package/src/runtime/native/index.ts +1 -2
- package/src/runtime/native/injection.ts +30 -0
- package/src/runtime/native/react/rules.ts +26 -33
- package/src/runtime/native/reactivity.ts +3 -7
- package/src/runtime/native/styles/animation.ts +143 -104
- package/src/runtime/native/styles/border.ts +10 -0
- package/src/runtime/native/styles/box-shadow.ts +54 -0
- package/src/runtime/native/styles/calc.ts +37 -60
- package/src/runtime/native/styles/calculate-props.ts +165 -0
- package/src/runtime/native/styles/constants.ts +1 -0
- package/src/runtime/native/styles/filters.ts +98 -0
- package/src/runtime/native/styles/index.ts +2 -138
- package/src/runtime/native/styles/platform-functions.ts +50 -0
- package/src/runtime/native/styles/resolve.ts +91 -17
- package/src/runtime/native/styles/shorthand.ts +61 -41
- package/src/runtime/native/styles/transform.ts +10 -4
- package/src/runtime/native/styles/units.ts +9 -4
- package/src/runtime/native/styles/variables.ts +51 -35
- package/src/runtime/runtime.types.ts +0 -25
- package/src/runtime/utils/objects.ts +20 -5
- package/src/runtime/utils/style-value.ts +14 -2
- package/src/runtime/web/index.ts +3 -0
- package/src/runtime/web/metro.ts +2 -0
- package/types.d.ts +70 -0
- package/dist/commonjs/compiler/add.js +0 -175
- package/dist/commonjs/compiler/add.js.map +0 -1
- package/dist/commonjs/components/ActivityIndicator.js +0 -20
- package/dist/commonjs/components/ActivityIndicator.js.map +0 -1
- package/dist/commonjs/components/SafeAreaProvider/index.js +0 -41
- package/dist/commonjs/components/SafeAreaProvider/index.js.map +0 -1
- package/dist/commonjs/components/SafeAreaProvider/index.web.js +0 -13
- package/dist/commonjs/components/SafeAreaProvider/index.web.js.map +0 -1
- package/dist/commonjs/components/TextInput.js +0 -20
- package/dist/commonjs/components/TextInput.js.map +0 -1
- package/dist/module/compiler/add.js +0 -168
- package/dist/module/compiler/add.js.map +0 -1
- package/dist/module/components/ActivityIndicator.js +0 -16
- package/dist/module/components/ActivityIndicator.js.map +0 -1
- package/dist/module/components/SafeAreaProvider/index.js +0 -36
- package/dist/module/components/SafeAreaProvider/index.js.map +0 -1
- package/dist/module/components/SafeAreaProvider/index.web.js +0 -4
- package/dist/module/components/SafeAreaProvider/index.web.js.map +0 -1
- package/dist/module/components/TextInput.js +0 -16
- package/dist/module/components/TextInput.js.map +0 -1
- package/dist/typescript/commonjs/src/compiler/add.d.ts +0 -10
- package/dist/typescript/commonjs/src/compiler/add.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +0 -3
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts +0 -4
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts +0 -2
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +0 -13
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/add.d.ts +0 -10
- package/dist/typescript/module/src/compiler/add.d.ts.map +0 -1
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +0 -3
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts +0 -4
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts.map +0 -1
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts +0 -2
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts.map +0 -1
- package/dist/typescript/module/src/components/TextInput.d.ts +0 -13
- package/dist/typescript/module/src/components/TextInput.d.ts.map +0 -1
- package/src/compiler/add.ts +0 -257
- package/src/components/ActivityIndicator.tsx +0 -19
- package/src/components/SafeAreaProvider/index.tsx +0 -50
- package/src/components/SafeAreaProvider/index.web.tsx +0 -1
- package/src/components/TextInput.tsx +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-css",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.61014be",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"./types": {
|
|
17
|
-
"types": "./
|
|
17
|
+
"types": "./types.d.ts"
|
|
18
18
|
},
|
|
19
19
|
"./metro": {
|
|
20
20
|
"source": "./src/metro/index.ts",
|
|
@@ -27,6 +27,28 @@
|
|
|
27
27
|
"default": "./dist/commonjs/metro/index.js"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
"./compiler": {
|
|
31
|
+
"source": "./src/compiler/index.ts",
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/typescript/module/src/compiler/index.d.ts",
|
|
34
|
+
"default": "./dist/module/compiler/index.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/typescript/commonjs/src/compiler/index.d.ts",
|
|
38
|
+
"default": "./dist/commonjs/compiler/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./jest": {
|
|
42
|
+
"source": "./src/jest/index.ts",
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/typescript/module/src/jest/index.d.ts",
|
|
45
|
+
"default": "./dist/module/jest/index.js"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/typescript/commonjs/src/jest/index.d.ts",
|
|
49
|
+
"default": "./dist/commonjs/jest/index.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
30
52
|
"./babel": {
|
|
31
53
|
"source": "./src/babel/index.ts",
|
|
32
54
|
"import": {
|
|
@@ -72,15 +94,21 @@
|
|
|
72
94
|
"configs"
|
|
73
95
|
],
|
|
74
96
|
"scripts": {
|
|
75
|
-
"test": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest",
|
|
76
|
-
"lint": "eslint",
|
|
77
|
-
"typecheck": "tsc --noEmit",
|
|
78
97
|
"build": "bob build",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
98
|
+
"clean": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +; yarn install --immutable --immutable-cache --check-cache; yarn build; yes | yarn example expo prebuild --clean",
|
|
99
|
+
"clean:android": "yarn clean && yarn example android",
|
|
100
|
+
"clean:ios": "yarn clean && yarn example ios",
|
|
81
101
|
"example": "yarn workspace react-native-css-example",
|
|
102
|
+
"lint": "eslint",
|
|
103
|
+
"prepare": "bob build",
|
|
104
|
+
"prepublishOnly": "bob build",
|
|
82
105
|
"release": "release-it",
|
|
83
|
-
"release:nightly": "release-it 3.0.0-nightly.\"$(git rev-parse --short HEAD)\" --npm.tag=beta"
|
|
106
|
+
"release:nightly": "release-it 3.0.0-nightly.\"$(git rev-parse --short HEAD)\" --npm.tag=beta",
|
|
107
|
+
"start": "yarn example start",
|
|
108
|
+
"start:build": "yarn build && yarn example build",
|
|
109
|
+
"start:debug": "yarn build && yarn example debug",
|
|
110
|
+
"test": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest",
|
|
111
|
+
"typecheck": "tsc --noEmit"
|
|
84
112
|
},
|
|
85
113
|
"keywords": [
|
|
86
114
|
"react-native",
|
|
@@ -106,11 +134,14 @@
|
|
|
106
134
|
"files": [
|
|
107
135
|
"src",
|
|
108
136
|
"dist",
|
|
137
|
+
"types.d.ts",
|
|
109
138
|
"!**/__tests__",
|
|
110
139
|
"!**/__fixtures__",
|
|
111
140
|
"!**/__mocks__"
|
|
112
141
|
],
|
|
113
142
|
"dependencies": {
|
|
143
|
+
"babel-plugin-react-compiler": "^19.1.0-rc.2",
|
|
144
|
+
"colorjs.io": "0.6.0-alpha.1",
|
|
114
145
|
"comment-json": "^4.2.5",
|
|
115
146
|
"debug": "^4.4.1"
|
|
116
147
|
},
|
|
@@ -121,18 +152,23 @@
|
|
|
121
152
|
"react-native": "0.80.1"
|
|
122
153
|
},
|
|
123
154
|
"devDependencies": {
|
|
155
|
+
"@babel/core": "^7.28.0",
|
|
124
156
|
"@commitlint/config-conventional": "^19.8.1",
|
|
125
157
|
"@eslint/js": "^9.30.1",
|
|
126
158
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.2",
|
|
127
159
|
"@testing-library/react-native": "^13.2.0",
|
|
128
160
|
"@tsconfig/react-native": "^3.0.6",
|
|
161
|
+
"@types/babel__core": "^7",
|
|
129
162
|
"@types/connect": "^3.4.38",
|
|
130
163
|
"@types/debug": "^4.1.12",
|
|
131
164
|
"@types/jest": "^30.0.0",
|
|
132
165
|
"@types/react": "^19.1.8",
|
|
166
|
+
"@types/react-refresh": "^0",
|
|
167
|
+
"@types/react-test-renderer": "^19",
|
|
133
168
|
"babel-plugin-tester": "^12.0.0",
|
|
134
169
|
"babel-preset-expo": "13.3.0-canary-20250713-8f814f8",
|
|
135
170
|
"commitlint": "^19.8.1",
|
|
171
|
+
"eas-build-cache-provider": "^16.4.2",
|
|
136
172
|
"eslint": "^9.30.1",
|
|
137
173
|
"eslint-config-prettier": "^10.1.5",
|
|
138
174
|
"eslint-plugin-prettier": "^5.5.1",
|
|
@@ -141,14 +177,18 @@
|
|
|
141
177
|
"jest-expo": "54.0.0-canary-20250713-8f814f8",
|
|
142
178
|
"lefthook": "^1.12.2",
|
|
143
179
|
"lightningcss": "^1.30.1",
|
|
180
|
+
"metro-runtime": "^0.83.0",
|
|
144
181
|
"prettier": "^3.6.2",
|
|
145
182
|
"react": "19.1.0",
|
|
146
183
|
"react-native": "0.80.1",
|
|
147
|
-
"react-native-builder-bob": "^0.40.
|
|
148
|
-
"react-native-reanimated": "
|
|
184
|
+
"react-native-builder-bob": "^0.40.13",
|
|
185
|
+
"react-native-reanimated": "4.0.1",
|
|
149
186
|
"react-native-safe-area-context": "5.4.0",
|
|
150
|
-
"react-native-worklets": "0.4.
|
|
187
|
+
"react-native-worklets": "0.4.1",
|
|
188
|
+
"react-refresh": "^0.17.0",
|
|
189
|
+
"react-test-renderer": "^19.1.0",
|
|
151
190
|
"release-it": "^19.0.4",
|
|
191
|
+
"tailwindcss": "^4.1.11",
|
|
152
192
|
"typescript": "^5.8.3",
|
|
153
193
|
"typescript-eslint": "^8.37.0"
|
|
154
194
|
},
|
|
@@ -184,8 +224,22 @@
|
|
|
184
224
|
},
|
|
185
225
|
"prettier": {
|
|
186
226
|
"plugins": [
|
|
187
|
-
"
|
|
188
|
-
]
|
|
227
|
+
"@ianvs/prettier-plugin-sort-imports"
|
|
228
|
+
],
|
|
229
|
+
"importOrderParserPlugins": [
|
|
230
|
+
"typescript",
|
|
231
|
+
"jsx"
|
|
232
|
+
],
|
|
233
|
+
"importOrder": [
|
|
234
|
+
"^react$|^react-native$",
|
|
235
|
+
"",
|
|
236
|
+
"<BUILTIN_MODULES>",
|
|
237
|
+
"",
|
|
238
|
+
"<THIRD_PARTY_MODULES>",
|
|
239
|
+
"",
|
|
240
|
+
"^[.]"
|
|
241
|
+
],
|
|
242
|
+
"quoteProps": "consistent"
|
|
189
243
|
},
|
|
190
244
|
"jest": {
|
|
191
245
|
"preset": "./.config/jest.config.cjs"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readdirSync } from "fs";
|
|
2
|
+
import { join, parse } from "path";
|
|
3
|
+
|
|
4
|
+
function getFilesWithoutExtension(dirPath: string) {
|
|
5
|
+
// Read all files and directories inside dirPath synchronously
|
|
6
|
+
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
7
|
+
|
|
8
|
+
// Filter only files (ignore directories)
|
|
9
|
+
const files = entries.filter(
|
|
10
|
+
(entry) =>
|
|
11
|
+
entry.isFile() &&
|
|
12
|
+
/\.[jt]sx?$/.exec(entry.name) &&
|
|
13
|
+
!/index\.[jt]sx?$/.exec(entry.name),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// For each file, get the filename without extension
|
|
17
|
+
const filesWithoutExt = files.map((file) => parse(file.name).name);
|
|
18
|
+
|
|
19
|
+
return filesWithoutExt;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const allowedModules = new Set(
|
|
23
|
+
getFilesWithoutExtension(join(__dirname, "../components")),
|
|
24
|
+
);
|
package/src/babel/helpers.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { readdirSync } from "fs";
|
|
3
|
-
import { dirname, join, normalize, parse, resolve, sep } from "path";
|
|
4
|
-
import { type NodePath } from "@babel/traverse";
|
|
1
|
+
import tBabelTypes, { type CallExpression } from "@babel/types";
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type BabelTypes = typeof t;
|
|
3
|
+
export type BabelTypes = typeof tBabelTypes;
|
|
9
4
|
|
|
10
5
|
export interface PluginOpts {
|
|
11
6
|
target?: string;
|
|
@@ -18,165 +13,28 @@ export interface PluginState {
|
|
|
18
13
|
filename: string;
|
|
19
14
|
}
|
|
20
15
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
28
|
-
|
|
29
|
-
// Filter only files (ignore directories)
|
|
30
|
-
const files = entries.filter(
|
|
31
|
-
(entry) =>
|
|
32
|
-
entry.isFile() &&
|
|
33
|
-
/\.[jt]sx$/.exec(entry.name) &&
|
|
34
|
-
!/index\.[jt]sx$/.exec(entry.name),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
// For each file, get the filename without extension
|
|
38
|
-
const filesWithoutExt = files.map((file) => parse(file.name).name);
|
|
39
|
-
|
|
40
|
-
return filesWithoutExt;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function isInsideModule(filename: string, module: string): boolean {
|
|
44
|
-
const normalized = normalize(filename);
|
|
45
|
-
|
|
46
|
-
// Match exact module name
|
|
47
|
-
if (normalized === module) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Absolute posix paths
|
|
52
|
-
if (normalized.startsWith(`${module}/`)) {
|
|
53
|
-
return true;
|
|
16
|
+
export function getInteropRequireDefaultSource(
|
|
17
|
+
init: CallExpression,
|
|
18
|
+
t: BabelTypes,
|
|
19
|
+
) {
|
|
20
|
+
if (!t.isIdentifier(init.callee, { name: "_interopRequireDefault" })) {
|
|
21
|
+
return;
|
|
54
22
|
}
|
|
55
23
|
|
|
56
|
-
|
|
57
|
-
if (normalized.includes(`${sep}${module}${sep}src${sep}`)) {
|
|
58
|
-
// Ignore the test files
|
|
59
|
-
return !normalized.includes("__tests__");
|
|
60
|
-
}
|
|
24
|
+
const interopArg = init.arguments.at(0);
|
|
61
25
|
|
|
62
|
-
// Match classic node_modules
|
|
63
|
-
if (normalized.includes(`${sep}node_modules${sep}${module}${sep}`)) {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Match Yarn PnP .zip-style paths (e.g., .zip/node_modules/${module}/)
|
|
68
26
|
if (
|
|
69
|
-
|
|
27
|
+
!t.isCallExpression(interopArg) ||
|
|
28
|
+
!t.isIdentifier(interopArg.callee, { name: "require" })
|
|
70
29
|
) {
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Match Yarn .yarn/cache/${module}/*
|
|
75
|
-
if (normalized.includes(`${sep}.yarn${sep}cache${sep}${module}${sep}`)) {
|
|
76
|
-
return true;
|
|
30
|
+
return;
|
|
77
31
|
}
|
|
78
32
|
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function isPackageImport(
|
|
83
|
-
path: NodePath<t.ImportDeclaration | t.ExportNamedDeclaration>,
|
|
84
|
-
) {
|
|
85
|
-
const source = path.node.source?.value;
|
|
86
|
-
if (!source) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return source === "react-native" || source === "react-native-web";
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function shouldTransformImport(
|
|
94
|
-
path: NodePath<t.ImportDeclaration | t.ExportNamedDeclaration>,
|
|
95
|
-
filename: string,
|
|
96
|
-
) {
|
|
97
|
-
let source = path.node.source?.value;
|
|
98
|
-
|
|
99
|
-
if (!source) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (source.startsWith(".")) {
|
|
104
|
-
source = resolve(dirname(filename), source);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
108
|
-
return isReactNativeSource(source) || isReactNativeWebSource(source);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function isReactNativeSource(source: string) {
|
|
112
|
-
if (source === "react-native") return true;
|
|
113
|
-
|
|
114
|
-
const components = source.split(
|
|
115
|
-
`react-native${sep}Libraries${sep}Components${sep}`,
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
if (components.length > 1) {
|
|
119
|
-
const component = components[1]?.split(sep)[0];
|
|
120
|
-
return component && allowedModules.has(component);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function isReactNativeWebSource(source: string) {
|
|
127
|
-
if (source === "react-native-web") return true;
|
|
128
|
-
|
|
129
|
-
let components = source.split(
|
|
130
|
-
`react-native-web${sep}dist${sep}commonjs${sep}exports${sep}`,
|
|
131
|
-
);
|
|
132
|
-
if (components.length > 1) {
|
|
133
|
-
const component = components[1]?.split(sep)[0];
|
|
134
|
-
return component && allowedModules.has(component);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
components = source.split(
|
|
138
|
-
`react-native-web${sep}dist${sep}module${sep}exports${sep}`,
|
|
139
|
-
);
|
|
140
|
-
if (components.length > 1) {
|
|
141
|
-
const component = components[1]?.split(sep)[0];
|
|
142
|
-
return component && allowedModules.has(component);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function shouldTransformRequire(
|
|
149
|
-
t: BabelTypes,
|
|
150
|
-
node: t.VariableDeclaration,
|
|
151
|
-
basePath: string,
|
|
152
|
-
) {
|
|
153
|
-
const { declarations } = node;
|
|
154
|
-
|
|
155
|
-
const declaration = declarations[0];
|
|
156
|
-
|
|
157
|
-
if (declarations.length > 1 || !declaration) {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
const { id, init } = declaration;
|
|
161
|
-
|
|
162
|
-
let source =
|
|
163
|
-
(t.isObjectPattern(id) || t.isIdentifier(id)) &&
|
|
164
|
-
t.isCallExpression(init) &&
|
|
165
|
-
t.isIdentifier(init.callee) &&
|
|
166
|
-
init.callee.name === "require" &&
|
|
167
|
-
init.arguments.length === 1 &&
|
|
168
|
-
"value" in init.arguments[0]! &&
|
|
169
|
-
typeof init.arguments[0].value === "string" &&
|
|
170
|
-
init.arguments[0].value;
|
|
171
|
-
|
|
172
|
-
if (!source) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
33
|
+
const requireArg = interopArg.arguments.at(0);
|
|
175
34
|
|
|
176
|
-
if (
|
|
177
|
-
|
|
35
|
+
if (!t.isStringLiteral(requireArg)) {
|
|
36
|
+
return;
|
|
178
37
|
}
|
|
179
38
|
|
|
180
|
-
|
|
181
|
-
return isReactNativeSource(source) || isReactNativeWebSource(source);
|
|
39
|
+
return requireArg.value;
|
|
182
40
|
}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
|
|
1
3
|
import { type PluginObj } from "@babel/core";
|
|
4
|
+
import type { Statement } from "@babel/types";
|
|
2
5
|
|
|
3
6
|
import {
|
|
7
|
+
getInteropRequireDefaultSource,
|
|
4
8
|
type BabelTypes,
|
|
5
9
|
type PluginState,
|
|
6
|
-
allowedModules,
|
|
7
|
-
shouldTransformImport,
|
|
8
|
-
isInsideModule,
|
|
9
|
-
isPackageImport,
|
|
10
|
-
shouldTransformRequire,
|
|
11
10
|
} from "./helpers";
|
|
11
|
+
import {
|
|
12
|
+
handleReactNativeIdentifierRequire,
|
|
13
|
+
handleReactNativeImport,
|
|
14
|
+
handleReactNativeObjectPatternRequire,
|
|
15
|
+
} from "./react-native";
|
|
16
|
+
import {
|
|
17
|
+
handleReactNativeWebIdentifierRequire,
|
|
18
|
+
handleReactNativeWebImport,
|
|
19
|
+
handleReactNativeWebObjectPatternRequire,
|
|
20
|
+
} from "./react-native-web";
|
|
12
21
|
|
|
13
22
|
export default function ({
|
|
14
23
|
types: t,
|
|
@@ -17,166 +26,150 @@ export default function ({
|
|
|
17
26
|
}): PluginObj<PluginState> {
|
|
18
27
|
const processed = new WeakSet();
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
processed.add(declaration);
|
|
23
|
-
return declaration;
|
|
24
|
-
}
|
|
29
|
+
const thisModuleDist = resolve(__dirname, "../../../dist");
|
|
30
|
+
const thisModuleSrc = resolve(__dirname, "../../../src");
|
|
25
31
|
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
processed.add(declaration);
|
|
31
|
-
return declaration;
|
|
32
|
+
function isFromThisModule(filename: string): boolean {
|
|
33
|
+
return (
|
|
34
|
+
filename.startsWith(thisModuleDist) || filename.startsWith(thisModuleSrc)
|
|
35
|
+
);
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
return {
|
|
35
39
|
name: "Rewrite react-native to react-native-css",
|
|
36
40
|
visitor: {
|
|
37
41
|
ImportDeclaration(path, state): void {
|
|
38
|
-
if (
|
|
42
|
+
if (
|
|
43
|
+
processed.has(path) ||
|
|
44
|
+
processed.has(path.node) ||
|
|
45
|
+
isFromThisModule(state.filename)
|
|
46
|
+
) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const statements =
|
|
51
|
+
handleReactNativeImport(path.node, t, state.filename) ??
|
|
52
|
+
handleReactNativeWebImport(path.node, t, state.filename);
|
|
53
|
+
|
|
54
|
+
if (!statements) {
|
|
39
55
|
return;
|
|
40
56
|
}
|
|
41
57
|
|
|
42
|
-
const
|
|
58
|
+
for (const statement of statements) {
|
|
59
|
+
processed.add(statement);
|
|
60
|
+
}
|
|
43
61
|
|
|
62
|
+
path.replaceWithMultiple(statements);
|
|
63
|
+
},
|
|
64
|
+
VariableDeclaration(path, state): void {
|
|
44
65
|
if (
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
processed.has(path) ||
|
|
67
|
+
processed.has(path.node) ||
|
|
68
|
+
isFromThisModule(state.filename)
|
|
47
69
|
) {
|
|
48
70
|
return;
|
|
49
71
|
}
|
|
50
72
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
t.stringLiteral("react-native-css/components"),
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
path.scope.registerDeclaration(path);
|
|
73
|
+
const firstDeclaration = path.node.declarations.at(0);
|
|
74
|
+
|
|
75
|
+
// We only handle single variable declarations for now.
|
|
76
|
+
if (path.node.declarations.length > 1) {
|
|
59
77
|
return;
|
|
60
78
|
}
|
|
61
79
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (isPackageImport(path)) {
|
|
67
|
-
return importDeclaration(
|
|
68
|
-
[t.importDefaultSpecifier(specifier.local)],
|
|
69
|
-
t.stringLiteral("react-native-css/components"),
|
|
70
|
-
);
|
|
71
|
-
} else if (allowedModules.has(name)) {
|
|
72
|
-
return importDeclaration(
|
|
73
|
-
[t.importSpecifier(specifier.local, specifier.local)],
|
|
74
|
-
t.stringLiteral(`react-native-css/components/${name}`),
|
|
75
|
-
);
|
|
76
|
-
} else {
|
|
77
|
-
return importDeclaration([specifier], source);
|
|
78
|
-
}
|
|
79
|
-
} else if (t.isImportNamespaceSpecifier(specifier)) {
|
|
80
|
-
return importDeclaration(
|
|
81
|
-
[specifier],
|
|
82
|
-
t.stringLiteral("react-native-css/components"),
|
|
83
|
-
);
|
|
84
|
-
} else {
|
|
85
|
-
const localName = t.isStringLiteral(specifier.imported)
|
|
86
|
-
? specifier.imported.value
|
|
87
|
-
: specifier.imported.name;
|
|
88
|
-
|
|
89
|
-
return allowedModules.has(localName)
|
|
90
|
-
? importDeclaration(
|
|
91
|
-
[t.importSpecifier(specifier.local, specifier.imported)],
|
|
92
|
-
t.stringLiteral(`react-native-css/components/${localName}`),
|
|
93
|
-
)
|
|
94
|
-
: importDeclaration([specifier], source);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
80
|
+
// Skip declarations that are not initialized. eg `let x;`
|
|
81
|
+
if (!firstDeclaration?.init) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
VariableDeclaration(path, state): void {
|
|
103
|
-
if (processed.has(path) || processed.has(path.node)) {
|
|
85
|
+
const { id, init } = firstDeclaration;
|
|
86
|
+
|
|
87
|
+
// We only handle `const <id> = <init>()`
|
|
88
|
+
if (!t.isCallExpression(init)) {
|
|
104
89
|
return;
|
|
105
90
|
}
|
|
106
91
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
!shouldTransformRequire(t, path.node, state.filename)
|
|
110
|
-
) {
|
|
92
|
+
// We only handle `const id = <init>() OR const { <id> } = <init>()`
|
|
93
|
+
if (!(t.isIdentifier(id) || t.isObjectPattern(id))) {
|
|
111
94
|
return;
|
|
112
95
|
}
|
|
113
96
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (!t.isObjectPattern(id) || !init) {
|
|
118
|
-
path.replaceWith(
|
|
119
|
-
requireDeclaration(path.node.kind, [
|
|
120
|
-
t.variableDeclarator(
|
|
121
|
-
id,
|
|
122
|
-
t.callExpression(t.identifier("require"), [
|
|
123
|
-
t.stringLiteral(`react-native-css/components`),
|
|
124
|
-
]),
|
|
125
|
-
),
|
|
126
|
-
]),
|
|
127
|
-
);
|
|
97
|
+
const initArg = init.arguments.at(0);
|
|
98
|
+
|
|
99
|
+
if (!initArg) {
|
|
128
100
|
return;
|
|
129
101
|
}
|
|
130
102
|
|
|
131
|
-
|
|
132
|
-
if (t.isRestElement(identifier)) {
|
|
133
|
-
return requireDeclaration(path.node.kind, [
|
|
134
|
-
t.variableDeclarator(identifier, init),
|
|
135
|
-
]);
|
|
136
|
-
}
|
|
103
|
+
let statements: Statement[] | undefined;
|
|
137
104
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
105
|
+
// `const <id> = require(<source>);`
|
|
106
|
+
if (
|
|
107
|
+
t.isIdentifier(id) &&
|
|
108
|
+
t.isIdentifier(init.callee, { name: "require" }) &&
|
|
109
|
+
t.isStringLiteral(initArg)
|
|
110
|
+
) {
|
|
111
|
+
statements =
|
|
112
|
+
handleReactNativeIdentifierRequire(
|
|
113
|
+
path,
|
|
114
|
+
t,
|
|
115
|
+
id.name,
|
|
116
|
+
initArg.value,
|
|
117
|
+
state.filename,
|
|
118
|
+
) ??
|
|
119
|
+
handleReactNativeWebIdentifierRequire(
|
|
120
|
+
path,
|
|
121
|
+
t,
|
|
122
|
+
id.name,
|
|
123
|
+
initArg.value,
|
|
124
|
+
state.filename,
|
|
125
|
+
);
|
|
126
|
+
} else if (
|
|
127
|
+
t.isObjectPattern(id) &&
|
|
128
|
+
t.isIdentifier(init.callee, { name: "require" }) &&
|
|
129
|
+
t.isStringLiteral(initArg)
|
|
130
|
+
) {
|
|
131
|
+
statements =
|
|
132
|
+
handleReactNativeObjectPatternRequire(
|
|
133
|
+
path,
|
|
134
|
+
t,
|
|
135
|
+
id,
|
|
136
|
+
initArg.value,
|
|
137
|
+
state.filename,
|
|
138
|
+
) ??
|
|
139
|
+
handleReactNativeWebObjectPatternRequire(
|
|
140
|
+
path,
|
|
141
|
+
t,
|
|
142
|
+
id,
|
|
143
|
+
initArg.value,
|
|
144
|
+
state.filename,
|
|
145
|
+
);
|
|
146
|
+
} else if (
|
|
147
|
+
t.isIdentifier(id) &&
|
|
148
|
+
t.isIdentifier(init.callee, { name: "_interopRequireDefault" })
|
|
149
|
+
) {
|
|
150
|
+
// `const <id> = _interopRequireDefault(require(<source>));`
|
|
151
|
+
const source = getInteropRequireDefaultSource(init, t);
|
|
152
|
+
if (!source) {
|
|
153
|
+
return;
|
|
142
154
|
}
|
|
155
|
+
statements = handleReactNativeWebIdentifierRequire(
|
|
156
|
+
path,
|
|
157
|
+
t,
|
|
158
|
+
id.name,
|
|
159
|
+
source,
|
|
160
|
+
state.filename,
|
|
161
|
+
);
|
|
162
|
+
}
|
|
143
163
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
t.identifier(name),
|
|
152
|
-
t.identifier(name),
|
|
153
|
-
false,
|
|
154
|
-
true,
|
|
155
|
-
),
|
|
156
|
-
]),
|
|
157
|
-
init,
|
|
158
|
-
),
|
|
159
|
-
]);
|
|
160
|
-
}
|
|
164
|
+
if (!statements) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
for (const statement of statements) {
|
|
169
|
+
processed.add(statement);
|
|
170
|
+
}
|
|
161
171
|
|
|
162
|
-
|
|
163
|
-
t.variableDeclarator(
|
|
164
|
-
t.objectPattern([
|
|
165
|
-
t.objectProperty(
|
|
166
|
-
t.identifier(name),
|
|
167
|
-
t.identifier(name),
|
|
168
|
-
false,
|
|
169
|
-
true,
|
|
170
|
-
),
|
|
171
|
-
]),
|
|
172
|
-
t.callExpression(t.identifier("require"), [
|
|
173
|
-
t.stringLiteral(`react-native-css/components/${name}`),
|
|
174
|
-
]),
|
|
175
|
-
),
|
|
176
|
-
]);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
path.replaceWithMultiple(imports);
|
|
172
|
+
path.replaceWithMultiple(statements);
|
|
180
173
|
},
|
|
181
174
|
},
|
|
182
175
|
};
|