babel-plugin-react-native-direct-imports 1.1.2 → 1.2.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.
Files changed (147) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +9 -3
  3. package/index.js +55 -15
  4. package/maps.json +1 -0
  5. package/package.json +6 -4
  6. package/maps/0.70.0.json +0 -330
  7. package/maps/0.70.1.json +0 -330
  8. package/maps/0.70.10.json +0 -330
  9. package/maps/0.70.11.json +0 -330
  10. package/maps/0.70.12.json +0 -330
  11. package/maps/0.70.13.json +0 -330
  12. package/maps/0.70.14.json +0 -330
  13. package/maps/0.70.15.json +0 -330
  14. package/maps/0.70.2.json +0 -330
  15. package/maps/0.70.3.json +0 -330
  16. package/maps/0.70.4.json +0 -330
  17. package/maps/0.70.5.json +0 -330
  18. package/maps/0.70.6.json +0 -330
  19. package/maps/0.70.7.json +0 -330
  20. package/maps/0.70.8.json +0 -330
  21. package/maps/0.70.9.json +0 -330
  22. package/maps/0.71.0.json +0 -338
  23. package/maps/0.71.1.json +0 -338
  24. package/maps/0.71.10.json +0 -338
  25. package/maps/0.71.11.json +0 -338
  26. package/maps/0.71.12.json +0 -338
  27. package/maps/0.71.13.json +0 -338
  28. package/maps/0.71.14.json +0 -338
  29. package/maps/0.71.15.json +0 -338
  30. package/maps/0.71.16.json +0 -338
  31. package/maps/0.71.17.json +0 -338
  32. package/maps/0.71.18.json +0 -338
  33. package/maps/0.71.19.json +0 -338
  34. package/maps/0.71.2.json +0 -338
  35. package/maps/0.71.3.json +0 -338
  36. package/maps/0.71.4.json +0 -338
  37. package/maps/0.71.5.json +0 -338
  38. package/maps/0.71.6.json +0 -338
  39. package/maps/0.71.7.json +0 -338
  40. package/maps/0.71.8.json +0 -338
  41. package/maps/0.71.9.json +0 -338
  42. package/maps/0.72.0.json +0 -326
  43. package/maps/0.72.1.json +0 -326
  44. package/maps/0.72.10.json +0 -326
  45. package/maps/0.72.11.json +0 -326
  46. package/maps/0.72.12.json +0 -326
  47. package/maps/0.72.13.json +0 -326
  48. package/maps/0.72.14.json +0 -326
  49. package/maps/0.72.15.json +0 -326
  50. package/maps/0.72.17.json +0 -326
  51. package/maps/0.72.2.json +0 -326
  52. package/maps/0.72.3.json +0 -326
  53. package/maps/0.72.4.json +0 -326
  54. package/maps/0.72.5.json +0 -326
  55. package/maps/0.72.6.json +0 -326
  56. package/maps/0.72.7.json +0 -326
  57. package/maps/0.72.8.json +0 -326
  58. package/maps/0.72.9.json +0 -326
  59. package/maps/0.73.0.json +0 -326
  60. package/maps/0.73.1.json +0 -326
  61. package/maps/0.73.10.json +0 -326
  62. package/maps/0.73.11.json +0 -326
  63. package/maps/0.73.2.json +0 -326
  64. package/maps/0.73.3.json +0 -326
  65. package/maps/0.73.4.json +0 -326
  66. package/maps/0.73.5.json +0 -326
  67. package/maps/0.73.6.json +0 -326
  68. package/maps/0.73.7.json +0 -326
  69. package/maps/0.73.8.json +0 -326
  70. package/maps/0.73.9.json +0 -326
  71. package/maps/0.74.0.json +0 -314
  72. package/maps/0.74.1.json +0 -314
  73. package/maps/0.74.2.json +0 -314
  74. package/maps/0.74.3.json +0 -314
  75. package/maps/0.74.4.json +0 -314
  76. package/maps/0.74.5.json +0 -314
  77. package/maps/0.74.6.json +0 -314
  78. package/maps/0.74.7.json +0 -314
  79. package/maps/0.75.0.json +0 -314
  80. package/maps/0.75.1.json +0 -314
  81. package/maps/0.75.2.json +0 -314
  82. package/maps/0.75.3.json +0 -314
  83. package/maps/0.75.4.json +0 -314
  84. package/maps/0.75.5.json +0 -314
  85. package/maps/0.76.0.json +0 -314
  86. package/maps/0.76.1.json +0 -314
  87. package/maps/0.76.2.json +0 -314
  88. package/maps/0.76.3.json +0 -314
  89. package/maps/0.76.4.json +0 -314
  90. package/maps/0.76.5.json +0 -314
  91. package/maps/0.76.6.json +0 -314
  92. package/maps/0.76.7.json +0 -314
  93. package/maps/0.76.8.json +0 -314
  94. package/maps/0.76.9.json +0 -314
  95. package/maps/0.77.0.json +0 -318
  96. package/maps/0.77.1.json +0 -318
  97. package/maps/0.77.2.json +0 -318
  98. package/maps/0.77.3.json +0 -318
  99. package/maps/0.78.0.json +0 -322
  100. package/maps/0.78.1.json +0 -322
  101. package/maps/0.78.2.json +0 -322
  102. package/maps/0.78.3.json +0 -322
  103. package/maps/0.79.0.json +0 -318
  104. package/maps/0.79.1.json +0 -318
  105. package/maps/0.79.2.json +0 -318
  106. package/maps/0.79.3.json +0 -318
  107. package/maps/0.79.4.json +0 -318
  108. package/maps/0.79.5.json +0 -318
  109. package/maps/0.79.6.json +0 -318
  110. package/maps/0.79.7.json +0 -318
  111. package/maps/0.80.0.json +0 -326
  112. package/maps/0.80.1.json +0 -326
  113. package/maps/0.80.2.json +0 -326
  114. package/maps/0.80.3.json +0 -326
  115. package/maps/0.81.0.json +0 -338
  116. package/maps/0.81.1.json +0 -338
  117. package/maps/0.81.2.json +0 -338
  118. package/maps/0.81.3.json +0 -338
  119. package/maps/0.81.4.json +0 -338
  120. package/maps/0.81.5.json +0 -338
  121. package/maps/0.81.6.json +0 -338
  122. package/maps/0.82.0.json +0 -346
  123. package/maps/0.82.1.json +0 -346
  124. package/maps/0.83.0.json +0 -354
  125. package/maps/0.83.1.json +0 -354
  126. package/maps/0.83.10.json +0 -354
  127. package/maps/0.83.2.json +0 -354
  128. package/maps/0.83.3.json +0 -354
  129. package/maps/0.83.4.json +0 -354
  130. package/maps/0.83.5.json +0 -354
  131. package/maps/0.83.6.json +0 -354
  132. package/maps/0.83.7.json +0 -354
  133. package/maps/0.83.8.json +0 -354
  134. package/maps/0.83.9.json +0 -354
  135. package/maps/0.84.0.json +0 -358
  136. package/maps/0.84.1.json +0 -358
  137. package/maps/0.85.0.json +0 -370
  138. package/maps/0.85.1.json +0 -370
  139. package/maps/0.85.2.json +0 -370
  140. package/maps/0.85.3.json +0 -370
  141. package/maps/0.86.0.json +0 -394
  142. package/maps/0.86.2.json +0 -394
  143. package/maps/0.86.3.json +0 -394
  144. package/maps/0.87.0.json +0 -390
  145. package/maps/0.87.1.json +0 -390
  146. package/maps/0.88.0.json +0 -390
  147. package/maps/0.88.1.json +0 -390
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # babel-plugin-react-native-direct-imports
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#8](https://github.com/retyui/babel-plugin-react-native-direct-imports/pull/8) [`a4c6d6e`](https://github.com/retyui/babel-plugin-react-native-direct-imports/commit/a4c6d6e76448742134745b8c11e9a2ac0aff06f4) Thanks [@retyui](https://github.com/retyui)! - Ship all version maps as a single `maps.json` with version ranges instead of 142 per-version files, cutting the installed package size by ~98% (≈980 KB of maps -> ≈15 KB) and the npm tarball from ≈19 KB to ≈10 KB.
8
+
9
+ An unknown `reactNativeVersion` now falls back to the closest older map instead of failing the build, so upgrading React Native before updating the plugin no longer breaks it. Only a version older than every known map (< 0.70.0) throws.
10
+
3
11
  ## 1.1.2
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -61,7 +61,7 @@ module.exports = {
61
61
 
62
62
  Then reset the Metro cache once (`npx react-native start --reset-cache` or `npx expo start --clear`).
63
63
 
64
- `reactNativeVersion` picks the map from [`maps/`](maps) (default: the latest). Every stable release from `0.70.0` has one. The version must match exactly, otherwise the build fails, so update the plugin after upgrading React Native.
64
+ `reactNativeVersion` picks the React Native version to generate imports for (default: the latest known). An unknown version falls back to the closest older map — a `0.88.2` or `0.89.0` app keeps building with the `0.88.1` map — so upgrading React Native no longer breaks the build, though updating the plugin still gets you the exact map. Only a version older than everything the plugin knows (`< 0.70.0`) fails.
65
65
 
66
66
  `silenceBatchedUpdatesWarning` (default: `false`) hides the warning logged once when `unstable_batchedUpdates` is imported on React Native 0.86+, where it [does nothing](https://github.com/react/react-native/commit/1a623a826654db4238cddc22fb958ccb76207a74) and just calls the callback.
67
67
 
@@ -71,7 +71,7 @@ Then reset the Metro cache once (`npx react-native start --reset-cache` or `npx
71
71
  - Re-exports (`export { X } from 'react-native'`) and `require('react-native')` in compiled CommonJS code (e.g. in `node_modules`) are rewritten too.
72
72
  - `Platform` stays a local `Platform` variable, so Metro's `Platform.OS` / `Platform.select` inlining keeps working (not for aliases like `Platform as P`).
73
73
  - `import * as RN from 'react-native'` and `module.exports = require('react-native')` throw a build error.
74
- - Generated paths point to React Native internals, which is why every version has its own map.
74
+ - Generated paths point to React Native internals, which is why the map is per version.
75
75
 
76
76
  ## Compatibility
77
77
 
@@ -80,9 +80,15 @@ Then reset the Metro cache once (`npx react-native start --reset-cache` or `npx
80
80
 
81
81
  ## Generating maps (development)
82
82
 
83
+ The map lives in two shapes:
84
+
85
+ - [`maps/<version>.json`](maps) — one pretty-printed file per React Native version. This is the committed source of truth, so adding a version stays a small reviewable diff.
86
+ - `maps.json` — all versions folded into one file with version ranges and interned values (≈15 KB vs ≈980 KB, and a ≈9 KB npm tarball instead of ≈19 KB). Generated automatically before tests and before packing, gitignored, and the only map that ships.
87
+
83
88
  ```bash
84
- yarn generate-maps # all versions
89
+ yarn generate-maps # fetch react-native/index.js for all versions -> maps/*.json
85
90
  yarn generate-maps 0.88.1 # specific versions
91
+ yarn build-maps # fold maps/*.json -> maps.json (also runs on test/prepack)
86
92
  ```
87
93
 
88
94
  ## License
package/index.js CHANGED
@@ -38,18 +38,17 @@
38
38
  * Unknown names and type-only imports/exports are left untouched.
39
39
  *
40
40
  * Options:
41
- * reactNativeVersion - picks `maps/<version>.json` (defaults to the latest map)
41
+ * reactNativeVersion - which react-native version to generate imports for
42
+ * (defaults to the latest known one). An unknown version falls back to the
43
+ * closest older map, so `0.88.2` and `0.89.0` both use the `0.88.1` map.
42
44
  * silenceBatchedUpdatesWarning - hides the `unstable_batchedUpdates` no-op
43
45
  * warning on 0.86+
44
46
  */
45
47
 
46
- const fs = require('fs');
47
48
  const nodePath = require('path');
48
49
 
49
50
  const RN = 'react-native';
50
51
 
51
- const MAPS_DIR = nodePath.join(__dirname, 'maps');
52
-
53
52
  let warnedBatchedUpdates = false;
54
53
 
55
54
  const compareVersions = (a, b) => {
@@ -62,24 +61,65 @@ const compareVersions = (a, b) => {
62
61
  return 0;
63
62
  };
64
63
 
65
- const availableVersions = () =>
66
- fs
67
- .readdirSync(MAPS_DIR)
68
- .filter((file) => file.endsWith('.json'))
69
- .map((file) => file.slice(0, -'.json'.length))
70
- .sort(compareVersions);
64
+ // `maps.json` is generated by `scripts/build-maps.js` from `maps/*.json`
65
+ // (Format B: one entry per export name, with version ranges and interned
66
+ // values). See that script for the exact format.
67
+ const loadData = () => require(nodePath.join(__dirname, 'maps.json'));
68
+
69
+ // 'Libraries/Image/Image|default' -> ['Libraries/Image/Image', 'default']
70
+ const splitValue = (value) => {
71
+ const separator = value.indexOf('|');
72
+ return [value.slice(0, separator), value.slice(separator + 1)];
73
+ };
74
+
75
+ // Windows are sorted by version, so the first one containing `version` wins.
76
+ const pickWindow = (windows, version) => {
77
+ for (const [from, to, valueIndex] of windows) {
78
+ if (compareVersions(version, from) < 0) break;
79
+ if (compareVersions(version, to) <= 0) return valueIndex;
80
+ }
81
+ return null;
82
+ };
83
+
84
+ const resolvedMaps = new Map();
85
+
86
+ // `versions` is ascending, so the last one that doesn't post-date `requested`
87
+ // is the closest match: `0.88.2` and `0.89.0` both pick the `0.88.1` map.
88
+ // Returns `null` when the request predates every known map.
89
+ const findMapVersion = (versions, requested) => {
90
+ let found = null;
91
+ for (const version of versions) {
92
+ if (compareVersions(version, requested) > 0) break;
93
+ found = version;
94
+ }
95
+ return found;
96
+ };
71
97
 
72
98
  const loadMap = (version) => {
73
- const versions = availableVersions();
74
- const selected = version ?? versions[versions.length - 1];
99
+ const data = loadData();
100
+ const selected =
101
+ version == null ? data.latest : findMapVersion(data.versions, version);
75
102
 
76
- if (!versions.includes(selected)) {
103
+ if (selected === null) {
77
104
  throw new Error(
78
- `[react-native-direct-imports] No map for react-native ${selected}. Available versions: ${versions.join(', ')}`,
105
+ `[react-native-direct-imports] No map for react-native ${version}. Available versions: ${data.versions.join(', ')}`,
79
106
  );
80
107
  }
81
108
 
82
- return require(nodePath.join(MAPS_DIR, `${selected}.json`));
109
+ const cached = resolvedMaps.get(selected);
110
+ if (cached) return cached;
111
+
112
+ const map = {};
113
+ for (const [name, entry] of Object.entries(data.exports)) {
114
+ const valueIndex =
115
+ typeof entry === 'number' ? entry : pickWindow(entry, selected);
116
+ // `null` means the name doesn't exist on this version.
117
+ if (valueIndex === null) continue;
118
+ map[name] = splitValue(data.values[valueIndex]);
119
+ }
120
+
121
+ resolvedMaps.set(selected, map);
122
+ return map;
83
123
  };
84
124
 
85
125
  module.exports = function reactNativeDirectImports(
package/maps.json ADDED
@@ -0,0 +1 @@
1
+ {"format":1,"latest":"0.88.1","versions":["0.70.0","0.70.1","0.70.2","0.70.3","0.70.4","0.70.5","0.70.6","0.70.7","0.70.8","0.70.9","0.70.10","0.70.11","0.70.12","0.70.13","0.70.14","0.70.15","0.71.0","0.71.1","0.71.2","0.71.3","0.71.4","0.71.5","0.71.6","0.71.7","0.71.8","0.71.9","0.71.10","0.71.11","0.71.12","0.71.13","0.71.14","0.71.15","0.71.16","0.71.17","0.71.18","0.71.19","0.72.0","0.72.1","0.72.2","0.72.3","0.72.4","0.72.5","0.72.6","0.72.7","0.72.8","0.72.9","0.72.10","0.72.11","0.72.12","0.72.13","0.72.14","0.72.15","0.72.17","0.73.0","0.73.1","0.73.2","0.73.3","0.73.4","0.73.5","0.73.6","0.73.7","0.73.8","0.73.9","0.73.10","0.73.11","0.74.0","0.74.1","0.74.2","0.74.3","0.74.4","0.74.5","0.74.6","0.74.7","0.75.0","0.75.1","0.75.2","0.75.3","0.75.4","0.75.5","0.76.0","0.76.1","0.76.2","0.76.3","0.76.4","0.76.5","0.76.6","0.76.7","0.76.8","0.76.9","0.77.0","0.77.1","0.77.2","0.77.3","0.78.0","0.78.1","0.78.2","0.78.3","0.79.0","0.79.1","0.79.2","0.79.3","0.79.4","0.79.5","0.79.6","0.79.7","0.80.0","0.80.1","0.80.2","0.80.3","0.81.0","0.81.1","0.81.2","0.81.3","0.81.4","0.81.5","0.81.6","0.82.0","0.82.1","0.83.0","0.83.1","0.83.2","0.83.3","0.83.4","0.83.5","0.83.6","0.83.7","0.83.8","0.83.9","0.83.10","0.84.0","0.84.1","0.85.0","0.85.1","0.85.2","0.85.3","0.86.0","0.86.2","0.86.3","0.87.0","0.87.1","0.88.0","0.88.1"],"values":["Libraries/Components/AccessibilityInfo/AccessibilityInfo|default","Libraries/ActionSheetIOS/ActionSheetIOS|*","Libraries/ActionSheetIOS/ActionSheetIOS|default","Libraries/Components/ActivityIndicator/ActivityIndicator|*","Libraries/Components/ActivityIndicator/ActivityIndicator|default","Libraries/Alert/Alert|*","Libraries/Alert/Alert|default","Libraries/Animated/Animated|*","Libraries/Animated/Animated|default","Libraries/ReactNative/AppRegistry|*","Libraries/ReactNative/AppRegistry|default","Libraries/ReactNative/AppRegistry|AppRegistry","Libraries/AppState/AppState|*","Libraries/AppState/AppState|default","Libraries/Utilities/Appearance|*","src/private/assets/AssetRegistry|AssetRegistry","Libraries/Storage/AsyncStorage|*","Libraries/Utilities/BackHandler|*","Libraries/Utilities/BackHandler|default","Libraries/Components/Button|*","Libraries/Components/Button|default","Libraries/Components/Clipboard/Clipboard|*","Libraries/Components/Clipboard/Clipboard|default","deprecated-react-native-prop-types|ColorPropType","Libraries/Components/DatePicker/DatePickerIOS|*","src/private/devmenu/DevMenu|*","src/private/devmenu/DevMenu|default","src/private/devsupport/devmenu/DevMenu|default","Libraries/Utilities/DevSettings|*","Libraries/Utilities/DevSettings|default","Libraries/EventEmitter/RCTDeviceEventEmitter|default","Libraries/Utilities/DeviceInfo|*","Libraries/Utilities/DeviceInfo|default","Libraries/Utilities/Dimensions|*","Libraries/Utilities/Dimensions|default","Libraries/Components/DrawerAndroid/DrawerLayoutAndroid|*","Libraries/Components/DrawerAndroid/DrawerLayoutAndroid|default","Libraries/StyleSheet/PlatformColorValueTypesIOS|DynamicColorIOS","Libraries/Animated/Easing|*","Libraries/Animated/Easing|default","deprecated-react-native-prop-types|EdgeInsetsPropType","Libraries/vendor/emitter/EventEmitter|default","Libraries/Lists/FlatList|*","Libraries/Lists/FlatList|default","Libraries/ReactNative/I18nManager|*","Libraries/ReactNative/I18nManager|default","Libraries/Image/Image|*","Libraries/Image/Image|default","Libraries/Image/ImageBackground|*","Libraries/Image/ImageBackground|default","Libraries/Image/ImagePickerIOS|*","Libraries/Components/TextInput/InputAccessoryView|*","Libraries/Components/TextInput/InputAccessoryView|default","Libraries/Interaction/InteractionManager|*","Libraries/Interaction/InteractionManager|default","Libraries/Components/Keyboard/Keyboard|*","Libraries/Components/Keyboard/Keyboard|default","Libraries/Components/Keyboard/KeyboardAvoidingView|default","Libraries/LayoutAnimation/LayoutAnimation|*","Libraries/LayoutAnimation/LayoutAnimation|default","Libraries/Linking/Linking|*","Libraries/Linking/Linking|default","Libraries/LogBox/LogBox|*","Libraries/LogBox/LogBox|default","Libraries/Components/MaskedView/MaskedViewIOS|*","Libraries/Modal/Modal|*","Libraries/Modal/Modal|default","Libraries/EventEmitter/RCTNativeAppEventEmitter|*","Libraries/EventEmitter/RCTNativeAppEventEmitter|default","Libraries/NativeComponent/NativeComponentRegistry|*","Libraries/NativeModules/specs/NativeDialogManagerAndroid|default","Libraries/EventEmitter/NativeEventEmitter|default","Libraries/BatchedBridge/NativeModules|*","Libraries/BatchedBridge/NativeModules|default","Libraries/Network/RCTNetworking|*","Libraries/Network/RCTNetworking|default","Libraries/Interaction/PanResponder|*","Libraries/Interaction/PanResponder|default","Libraries/PermissionsAndroid/PermissionsAndroid|*","Libraries/PermissionsAndroid/PermissionsAndroid|default","Libraries/Utilities/PixelRatio|*","Libraries/Utilities/PixelRatio|default","Libraries/Utilities/Platform|*","Libraries/Utilities/Platform|default","Libraries/StyleSheet/PlatformColorValueTypes|PlatformColor","deprecated-react-native-prop-types|PointPropType","Libraries/Components/Pressable/Pressable|default","Libraries/Components/ProgressBarAndroid/ProgressBarAndroid|*","Libraries/Components/ProgressBarAndroid/ProgressBarAndroid|default","Libraries/Components/ProgressViewIOS/ProgressViewIOS|*","Libraries/PushNotificationIOS/PushNotificationIOS|*","Libraries/PushNotificationIOS/PushNotificationIOS|default","Libraries/Core/ReactNativeVersion|default","Libraries/Components/RefreshControl/RefreshControl|*","Libraries/Components/RefreshControl/RefreshControl|default","Libraries/ReactNative/RootTag|RootTagContext","Libraries/Components/SafeAreaView/SafeAreaView|default","Libraries/Components/ScrollView/ScrollView|*","Libraries/Components/ScrollView/ScrollView|default","Libraries/Lists/SectionList|default","Libraries/Settings/Settings|*","Libraries/Settings/Settings|default","Libraries/Share/Share|*","Libraries/Share/Share|default","Libraries/Components/Slider/Slider|*","Libraries/Components/StatusBar/StatusBar|*","Libraries/Components/StatusBar/StatusBar|default","Libraries/StyleSheet/StyleSheet|*","Libraries/StyleSheet/StyleSheet|default","Libraries/Components/Switch/Switch|default","Libraries/Performance/Systrace|*","Libraries/Text/Text|*","Libraries/Text/Text|default","Libraries/Components/TextInput/TextInput|*","Libraries/Components/TextInput/TextInput|default","Libraries/Components/ToastAndroid/ToastAndroid|*","Libraries/Components/ToastAndroid/ToastAndroid|default","Libraries/Components/Touchable/Touchable|*","Libraries/Components/Touchable/Touchable|default","Libraries/Components/Touchable/TouchableHighlight|*","Libraries/Components/Touchable/TouchableHighlight|default","Libraries/Components/Touchable/TouchableNativeFeedback|*","Libraries/Components/Touchable/TouchableNativeFeedback|default","Libraries/Components/Touchable/TouchableOpacity|*","Libraries/Components/Touchable/TouchableOpacity|default","Libraries/Components/Touchable/TouchableWithoutFeedback|*","Libraries/Components/Touchable/TouchableWithoutFeedback|default","Libraries/TurboModule/TurboModuleRegistry|*","Libraries/ReactNative/UIManager|*","Libraries/ReactNative/UIManager|default","Libraries/UTFSequence|*","Libraries/UTFSequence|default","Libraries/Vibration/Vibration|*","Libraries/Vibration/Vibration|default","Libraries/Components/View/View|*","Libraries/Components/View/View|default","deprecated-react-native-prop-types|ViewPropTypes","src/private/components/virtualview/VirtualView|VirtualViewMode","Libraries/Lists/VirtualizedList|*","Libraries/Lists/VirtualizedList|default","Libraries/Lists/VirtualizedSectionList|*","Libraries/Lists/VirtualizedSectionList|default","Libraries/YellowBox/YellowBoxDeprecated|*","Libraries/Utilities/codegenNativeCommands|default","Libraries/Utilities/codegenNativeComponent|default","Libraries/Components/LayoutConformance/LayoutConformance|default","Libraries/Renderer/shims/ReactNative|findNodeHandle","Libraries/ReactNative/RendererProxy|findNodeHandle","Libraries/StyleSheet/processColor|*","Libraries/StyleSheet/processColor|default","Libraries/Core/registerCallableModule|default","Libraries/ReactNative/requireNativeComponent|*","Libraries/ReactNative/requireNativeComponent|default","src/private/components/virtualcollection/FlingConstants|DEFAULT_INITIAL_NUM_TO_RENDER","Libraries/Text/TextNativeComponent|NativeText","Libraries/Components/View/ViewNativeComponent|default","Libraries/Text/TextAncestorContext|default","src/private/components/virtualcollection/Virtual|VirtualArray","src/private/components/virtualcollection/column/VirtualColumn|default","src/private/components/virtualcollection/column/VirtualColumnGenerator|default","src/private/components/virtualcollection/row/VirtualRow|default","src/private/components/virtualview/VirtualView|default","Libraries/Renderer/shims/ReactNative|unstable_batchedUpdates","Libraries/ReactNative/RendererProxy|unstable_batchedUpdates","src/private/components/virtualcollection/VirtualCollectionView|createVirtualCollectionView","src/private/components/virtualcollection/dom/getScrollParent|default","Libraries/Animated/useAnimatedColor|default","Libraries/Animated/useAnimatedValue|default","Libraries/Animated/useAnimatedValueXY|default","Libraries/Utilities/useColorScheme|default","Libraries/Pressability/usePressability|default","Libraries/Utilities/useWindowDimensions|default"],"exports":{"AccessibilityInfo":0,"ActionSheetIOS":[["0.70.0","0.78.3",1],["0.79.0","0.88.1",2]],"ActivityIndicator":[["0.70.0","0.71.19",3],["0.72.0","0.88.1",4]],"Alert":[["0.70.0","0.78.3",5],["0.79.0","0.88.1",6]],"Animated":[["0.70.0","0.70.15",7],["0.71.0","0.88.1",8]],"AppRegistry":[["0.70.0","0.78.3",9],["0.79.0","0.79.7",10],["0.80.0","0.88.1",11]],"AppState":[["0.70.0","0.78.3",12],["0.79.0","0.88.1",13]],"Appearance":14,"AssetRegistry":[["0.87.0","0.88.1",15]],"AsyncStorage":[["0.70.0","0.70.15",16]],"BackHandler":[["0.70.0","0.78.3",17],["0.79.0","0.88.1",18]],"Button":[["0.70.0","0.73.11",19],["0.74.0","0.88.1",20]],"Clipboard":[["0.70.0","0.78.3",21],["0.79.0","0.88.1",22]],"ColorPropType":[["0.71.0","0.73.11",23]],"DatePickerIOS":[["0.70.0","0.71.19",24]],"DevMenu":[["0.77.0","0.78.3",25],["0.79.0","0.79.7",26],["0.80.0","0.88.1",27]],"DevSettings":[["0.70.0","0.78.3",28],["0.79.0","0.88.1",29]],"DeviceEventEmitter":30,"DeviceInfo":[["0.70.0","0.78.3",31],["0.79.0","0.88.1",32]],"Dimensions":[["0.70.0","0.71.19",33],["0.72.0","0.88.1",34]],"DrawerLayoutAndroid":[["0.70.0","0.78.3",35],["0.79.0","0.88.1",36]],"DynamicColorIOS":37,"Easing":[["0.70.0","0.70.15",38],["0.71.0","0.88.1",39]],"EdgeInsetsPropType":[["0.71.0","0.73.11",40]],"EventEmitter":[["0.85.0","0.88.1",41]],"FlatList":[["0.70.0","0.78.3",42],["0.79.0","0.88.1",43]],"I18nManager":[["0.70.0","0.78.3",44],["0.79.0","0.88.1",45]],"Image":[["0.70.0","0.78.3",46],["0.79.0","0.88.1",47]],"ImageBackground":[["0.70.0","0.78.3",48],["0.79.0","0.88.1",49]],"ImagePickerIOS":[["0.70.0","0.70.15",50]],"InputAccessoryView":[["0.70.0","0.73.11",51],["0.74.0","0.88.1",52]],"InteractionManager":[["0.70.0","0.78.3",53],["0.79.0","0.86.3",54]],"Keyboard":[["0.70.0","0.78.3",55],["0.79.0","0.88.1",56]],"KeyboardAvoidingView":57,"LayoutAnimation":[["0.70.0","0.78.3",58],["0.79.0","0.88.1",59]],"Linking":[["0.70.0","0.78.3",60],["0.79.0","0.88.1",61]],"LogBox":[["0.70.0","0.71.19",62],["0.72.0","0.88.1",63]],"MaskedViewIOS":[["0.70.0","0.70.15",64]],"Modal":[["0.70.0","0.78.3",65],["0.79.0","0.88.1",66]],"NativeAppEventEmitter":[["0.70.0","0.78.3",67],["0.79.0","0.88.1",68]],"NativeComponentRegistry":[["0.82.0","0.88.1",69]],"NativeDialogManagerAndroid":[["0.70.0","0.86.3",70]],"NativeEventEmitter":71,"NativeModules":[["0.70.0","0.78.3",72],["0.79.0","0.88.1",73]],"Networking":[["0.70.0","0.71.19",74],["0.72.0","0.88.1",75]],"PanResponder":[["0.70.0","0.71.19",76],["0.72.0","0.88.1",77]],"PermissionsAndroid":[["0.70.0","0.78.3",78],["0.79.0","0.88.1",79]],"PixelRatio":[["0.70.0","0.71.19",80],["0.72.0","0.88.1",81]],"Platform":[["0.70.0","0.78.3",82],["0.79.0","0.88.1",83]],"PlatformColor":84,"PointPropType":[["0.71.0","0.73.11",85]],"Pressable":86,"ProgressBarAndroid":[["0.70.0","0.78.3",87],["0.79.0","0.88.1",88]],"ProgressViewIOS":[["0.70.0","0.71.19",89]],"PushNotificationIOS":[["0.70.0","0.78.3",90],["0.79.0","0.88.1",91]],"ReactNativeVersion":[["0.82.0","0.88.1",92]],"RefreshControl":[["0.70.0","0.78.3",93],["0.79.0","0.88.1",94]],"RootTagContext":95,"SafeAreaView":96,"ScrollView":[["0.70.0","0.78.3",97],["0.79.0","0.88.1",98]],"SectionList":99,"Settings":[["0.70.0","0.78.3",100],["0.79.0","0.88.1",101]],"Share":[["0.70.0","0.78.3",102],["0.79.0","0.88.1",103]],"Slider":[["0.70.0","0.71.19",104]],"StatusBar":[["0.70.0","0.78.3",105],["0.79.0","0.88.1",106]],"StyleSheet":[["0.70.0","0.78.3",107],["0.79.0","0.88.1",108]],"Switch":109,"Systrace":110,"Text":[["0.70.0","0.78.3",111],["0.79.0","0.88.1",112]],"TextInput":[["0.70.0","0.78.3",113],["0.79.0","0.88.1",114]],"ToastAndroid":[["0.70.0","0.78.3",115],["0.79.0","0.88.1",116]],"Touchable":[["0.70.0","0.73.11",117],["0.74.0","0.88.1",118]],"TouchableHighlight":[["0.70.0","0.78.3",119],["0.79.0","0.88.1",120]],"TouchableNativeFeedback":[["0.70.0","0.78.3",121],["0.79.0","0.88.1",122]],"TouchableOpacity":[["0.70.0","0.78.3",123],["0.79.0","0.88.1",124]],"TouchableWithoutFeedback":[["0.70.0","0.78.3",125],["0.79.0","0.88.1",126]],"TurboModuleRegistry":127,"UIManager":[["0.70.0","0.78.3",128],["0.79.0","0.88.1",129]],"UTFSequence":[["0.70.0","0.71.19",130],["0.72.0","0.88.1",131]],"Vibration":[["0.70.0","0.78.3",132],["0.79.0","0.88.1",133]],"View":[["0.70.0","0.78.3",134],["0.79.0","0.88.1",135]],"ViewPropTypes":[["0.71.0","0.73.11",136]],"VirtualViewMode":[["0.81.0","0.88.1",137]],"VirtualizedList":[["0.70.0","0.70.15",138],["0.71.0","0.71.19",139],["0.72.0","0.78.3",138],["0.79.0","0.88.1",139]],"VirtualizedSectionList":[["0.70.0","0.78.3",140],["0.79.0","0.88.1",141]],"YellowBox":[["0.70.0","0.78.3",142]],"codegenNativeCommands":[["0.80.0","0.88.1",143]],"codegenNativeComponent":[["0.80.0","0.88.1",144]],"experimental_LayoutConformance":[["0.78.0","0.88.1",145]],"findNodeHandle":[["0.70.0","0.70.15",146],["0.71.0","0.88.1",147]],"processColor":[["0.70.0","0.71.19",148],["0.72.0","0.88.1",149]],"registerCallableModule":[["0.74.0","0.88.1",150]],"requireNativeComponent":[["0.70.0","0.71.19",151],["0.72.0","0.88.1",152]],"unstable_DEFAULT_INITIAL_NUM_TO_RENDER":[["0.86.0","0.88.1",153]],"unstable_NativeText":[["0.83.0","0.88.1",154]],"unstable_NativeView":[["0.83.0","0.88.1",155]],"unstable_TextAncestorContext":[["0.81.0","0.88.1",156]],"unstable_VirtualArray":[["0.86.0","0.88.1",157]],"unstable_VirtualColumn":[["0.86.0","0.88.1",158]],"unstable_VirtualColumnGenerator":[["0.86.0","0.88.1",159]],"unstable_VirtualRow":[["0.86.0","0.88.1",160]],"unstable_VirtualView":[["0.81.0","0.88.1",161]],"unstable_batchedUpdates":[["0.70.0","0.70.15",162],["0.71.0","0.85.3",163]],"unstable_createVirtualCollectionView":[["0.86.0","0.88.1",164]],"unstable_getScrollParent":[["0.86.0","0.88.1",165]],"useAnimatedColor":[["0.85.0","0.88.1",166]],"useAnimatedValue":[["0.71.0","0.88.1",167]],"useAnimatedValueXY":[["0.85.0","0.88.1",168]],"useColorScheme":169,"usePressability":[["0.84.0","0.88.1",170]],"useWindowDimensions":171}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-plugin-react-native-direct-imports",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Babel plugin that rewrites `react-native` barrel imports into direct module imports",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,14 +9,16 @@
9
9
  "main": "index.js",
10
10
  "files": [
11
11
  "index.js",
12
- "maps"
12
+ "maps.json"
13
13
  ],
14
14
  "scripts": {
15
- "test": "node --test",
15
+ "test": "node scripts/build-maps.js && node --test",
16
16
  "generate-maps": "node scripts/generate-maps.js",
17
17
  "changeset": "changeset",
18
18
  "version-packages": "changeset version && yarn install --mode=update-lockfile",
19
- "release": "changeset publish"
19
+ "release": "changeset publish",
20
+ "build-maps": "node scripts/build-maps.js",
21
+ "prepack": "node scripts/build-maps.js"
20
22
  },
21
23
  "keywords": [
22
24
  "babel",
package/maps/0.70.0.json DELETED
@@ -1,330 +0,0 @@
1
- {
2
- "AccessibilityInfo": [
3
- "Libraries/Components/AccessibilityInfo/AccessibilityInfo",
4
- "default"
5
- ],
6
- "ActivityIndicator": [
7
- "Libraries/Components/ActivityIndicator/ActivityIndicator",
8
- "*"
9
- ],
10
- "Button": [
11
- "Libraries/Components/Button",
12
- "*"
13
- ],
14
- "DatePickerIOS": [
15
- "Libraries/Components/DatePicker/DatePickerIOS",
16
- "*"
17
- ],
18
- "DrawerLayoutAndroid": [
19
- "Libraries/Components/DrawerAndroid/DrawerLayoutAndroid",
20
- "*"
21
- ],
22
- "FlatList": [
23
- "Libraries/Lists/FlatList",
24
- "*"
25
- ],
26
- "Image": [
27
- "Libraries/Image/Image",
28
- "*"
29
- ],
30
- "ImageBackground": [
31
- "Libraries/Image/ImageBackground",
32
- "*"
33
- ],
34
- "InputAccessoryView": [
35
- "Libraries/Components/TextInput/InputAccessoryView",
36
- "*"
37
- ],
38
- "KeyboardAvoidingView": [
39
- "Libraries/Components/Keyboard/KeyboardAvoidingView",
40
- "default"
41
- ],
42
- "MaskedViewIOS": [
43
- "Libraries/Components/MaskedView/MaskedViewIOS",
44
- "*"
45
- ],
46
- "Modal": [
47
- "Libraries/Modal/Modal",
48
- "*"
49
- ],
50
- "Pressable": [
51
- "Libraries/Components/Pressable/Pressable",
52
- "default"
53
- ],
54
- "ProgressBarAndroid": [
55
- "Libraries/Components/ProgressBarAndroid/ProgressBarAndroid",
56
- "*"
57
- ],
58
- "ProgressViewIOS": [
59
- "Libraries/Components/ProgressViewIOS/ProgressViewIOS",
60
- "*"
61
- ],
62
- "RefreshControl": [
63
- "Libraries/Components/RefreshControl/RefreshControl",
64
- "*"
65
- ],
66
- "SafeAreaView": [
67
- "Libraries/Components/SafeAreaView/SafeAreaView",
68
- "default"
69
- ],
70
- "ScrollView": [
71
- "Libraries/Components/ScrollView/ScrollView",
72
- "*"
73
- ],
74
- "SectionList": [
75
- "Libraries/Lists/SectionList",
76
- "default"
77
- ],
78
- "Slider": [
79
- "Libraries/Components/Slider/Slider",
80
- "*"
81
- ],
82
- "StatusBar": [
83
- "Libraries/Components/StatusBar/StatusBar",
84
- "*"
85
- ],
86
- "Switch": [
87
- "Libraries/Components/Switch/Switch",
88
- "default"
89
- ],
90
- "Text": [
91
- "Libraries/Text/Text",
92
- "*"
93
- ],
94
- "TextInput": [
95
- "Libraries/Components/TextInput/TextInput",
96
- "*"
97
- ],
98
- "Touchable": [
99
- "Libraries/Components/Touchable/Touchable",
100
- "*"
101
- ],
102
- "TouchableHighlight": [
103
- "Libraries/Components/Touchable/TouchableHighlight",
104
- "*"
105
- ],
106
- "TouchableNativeFeedback": [
107
- "Libraries/Components/Touchable/TouchableNativeFeedback",
108
- "*"
109
- ],
110
- "TouchableOpacity": [
111
- "Libraries/Components/Touchable/TouchableOpacity",
112
- "*"
113
- ],
114
- "TouchableWithoutFeedback": [
115
- "Libraries/Components/Touchable/TouchableWithoutFeedback",
116
- "*"
117
- ],
118
- "View": [
119
- "Libraries/Components/View/View",
120
- "*"
121
- ],
122
- "VirtualizedList": [
123
- "Libraries/Lists/VirtualizedList",
124
- "*"
125
- ],
126
- "VirtualizedSectionList": [
127
- "Libraries/Lists/VirtualizedSectionList",
128
- "*"
129
- ],
130
- "ActionSheetIOS": [
131
- "Libraries/ActionSheetIOS/ActionSheetIOS",
132
- "*"
133
- ],
134
- "Alert": [
135
- "Libraries/Alert/Alert",
136
- "*"
137
- ],
138
- "Animated": [
139
- "Libraries/Animated/Animated",
140
- "*"
141
- ],
142
- "Appearance": [
143
- "Libraries/Utilities/Appearance",
144
- "*"
145
- ],
146
- "AppRegistry": [
147
- "Libraries/ReactNative/AppRegistry",
148
- "*"
149
- ],
150
- "AppState": [
151
- "Libraries/AppState/AppState",
152
- "*"
153
- ],
154
- "AsyncStorage": [
155
- "Libraries/Storage/AsyncStorage",
156
- "*"
157
- ],
158
- "BackHandler": [
159
- "Libraries/Utilities/BackHandler",
160
- "*"
161
- ],
162
- "Clipboard": [
163
- "Libraries/Components/Clipboard/Clipboard",
164
- "*"
165
- ],
166
- "DeviceInfo": [
167
- "Libraries/Utilities/DeviceInfo",
168
- "*"
169
- ],
170
- "DevSettings": [
171
- "Libraries/Utilities/DevSettings",
172
- "*"
173
- ],
174
- "Dimensions": [
175
- "Libraries/Utilities/Dimensions",
176
- "*"
177
- ],
178
- "Easing": [
179
- "Libraries/Animated/Easing",
180
- "*"
181
- ],
182
- "findNodeHandle": [
183
- "Libraries/Renderer/shims/ReactNative",
184
- "findNodeHandle"
185
- ],
186
- "I18nManager": [
187
- "Libraries/ReactNative/I18nManager",
188
- "*"
189
- ],
190
- "ImagePickerIOS": [
191
- "Libraries/Image/ImagePickerIOS",
192
- "*"
193
- ],
194
- "InteractionManager": [
195
- "Libraries/Interaction/InteractionManager",
196
- "*"
197
- ],
198
- "Keyboard": [
199
- "Libraries/Components/Keyboard/Keyboard",
200
- "*"
201
- ],
202
- "LayoutAnimation": [
203
- "Libraries/LayoutAnimation/LayoutAnimation",
204
- "*"
205
- ],
206
- "Linking": [
207
- "Libraries/Linking/Linking",
208
- "*"
209
- ],
210
- "LogBox": [
211
- "Libraries/LogBox/LogBox",
212
- "*"
213
- ],
214
- "NativeDialogManagerAndroid": [
215
- "Libraries/NativeModules/specs/NativeDialogManagerAndroid",
216
- "default"
217
- ],
218
- "NativeEventEmitter": [
219
- "Libraries/EventEmitter/NativeEventEmitter",
220
- "default"
221
- ],
222
- "Networking": [
223
- "Libraries/Network/RCTNetworking",
224
- "*"
225
- ],
226
- "PanResponder": [
227
- "Libraries/Interaction/PanResponder",
228
- "*"
229
- ],
230
- "PermissionsAndroid": [
231
- "Libraries/PermissionsAndroid/PermissionsAndroid",
232
- "*"
233
- ],
234
- "PixelRatio": [
235
- "Libraries/Utilities/PixelRatio",
236
- "*"
237
- ],
238
- "PushNotificationIOS": [
239
- "Libraries/PushNotificationIOS/PushNotificationIOS",
240
- "*"
241
- ],
242
- "Settings": [
243
- "Libraries/Settings/Settings",
244
- "*"
245
- ],
246
- "Share": [
247
- "Libraries/Share/Share",
248
- "*"
249
- ],
250
- "StyleSheet": [
251
- "Libraries/StyleSheet/StyleSheet",
252
- "*"
253
- ],
254
- "Systrace": [
255
- "Libraries/Performance/Systrace",
256
- "*"
257
- ],
258
- "ToastAndroid": [
259
- "Libraries/Components/ToastAndroid/ToastAndroid",
260
- "*"
261
- ],
262
- "TurboModuleRegistry": [
263
- "Libraries/TurboModule/TurboModuleRegistry",
264
- "*"
265
- ],
266
- "UIManager": [
267
- "Libraries/ReactNative/UIManager",
268
- "*"
269
- ],
270
- "unstable_batchedUpdates": [
271
- "Libraries/Renderer/shims/ReactNative",
272
- "unstable_batchedUpdates"
273
- ],
274
- "useColorScheme": [
275
- "Libraries/Utilities/useColorScheme",
276
- "default"
277
- ],
278
- "useWindowDimensions": [
279
- "Libraries/Utilities/useWindowDimensions",
280
- "default"
281
- ],
282
- "UTFSequence": [
283
- "Libraries/UTFSequence",
284
- "*"
285
- ],
286
- "Vibration": [
287
- "Libraries/Vibration/Vibration",
288
- "*"
289
- ],
290
- "YellowBox": [
291
- "Libraries/YellowBox/YellowBoxDeprecated",
292
- "*"
293
- ],
294
- "DeviceEventEmitter": [
295
- "Libraries/EventEmitter/RCTDeviceEventEmitter",
296
- "default"
297
- ],
298
- "DynamicColorIOS": [
299
- "Libraries/StyleSheet/PlatformColorValueTypesIOS",
300
- "DynamicColorIOS"
301
- ],
302
- "NativeAppEventEmitter": [
303
- "Libraries/EventEmitter/RCTNativeAppEventEmitter",
304
- "*"
305
- ],
306
- "NativeModules": [
307
- "Libraries/BatchedBridge/NativeModules",
308
- "*"
309
- ],
310
- "Platform": [
311
- "Libraries/Utilities/Platform",
312
- "*"
313
- ],
314
- "PlatformColor": [
315
- "Libraries/StyleSheet/PlatformColorValueTypes",
316
- "PlatformColor"
317
- ],
318
- "processColor": [
319
- "Libraries/StyleSheet/processColor",
320
- "*"
321
- ],
322
- "requireNativeComponent": [
323
- "Libraries/ReactNative/requireNativeComponent",
324
- "*"
325
- ],
326
- "RootTagContext": [
327
- "Libraries/ReactNative/RootTag",
328
- "RootTagContext"
329
- ]
330
- }