babel-plugin-react-native-direct-imports 1.0.3 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # babel-plugin-react-native-direct-imports
2
+
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cc962c5`](https://github.com/retyui/babel-plugin-react-native-direct-imports/commit/cc962c50b402247d6fce371fe1a8afc2dd429ca3) Thanks [@retyui](https://github.com/retyui)! - Publish via npm trusted publishing with provenance
package/README.md CHANGED
@@ -4,57 +4,54 @@
4
4
  [![npm downloads](https://badgen.net/npm/dm/babel-plugin-react-native-direct-imports)](https://www.npmtrends.com/babel-plugin-react-native-direct-imports)
5
5
  [![license](https://badgen.net/npm/license/babel-plugin-react-native-direct-imports)](https://www.npmjs.com/package/babel-plugin-react-native-direct-imports)
6
6
 
7
- Babel plugin that rewrites named imports from `react-native` into direct imports of the underlying modules, so Metro doesn't have to load the whole `react-native` barrel file.
7
+ Babel plugin that replaces `react-native` imports with direct requires of the underlying modules, so only what you use ends up in the bundle.
8
+
9
+ > [!WARNING]
10
+ > This plugin is in an early stage. Expect rough edges and breaking changes, and please [report issues](https://github.com/retyui/babel-plugin-react-native-direct-imports/issues) if you run into any.
11
+
12
+ ![How the plugin works](./assets/how-it-works.png)
8
13
 
9
14
  ```js
10
15
  import { View, AppRegistry, Systrace } from 'react-native';
11
16
 
12
17
  // ↓ becomes
13
18
 
14
- import View from 'react-native/Libraries/Components/View/View';
15
- import { AppRegistry } from 'react-native/Libraries/ReactNative/AppRegistry';
16
- import * as Systrace from 'react-native/Libraries/Performance/Systrace';
19
+ const View = require('react-native/Libraries/Components/View/View').default;
20
+ const AppRegistry = require('react-native/Libraries/ReactNative/AppRegistry').AppRegistry;
21
+ const Systrace = require('react-native/Libraries/Performance/Systrace');
17
22
  ```
18
23
 
19
24
  ## Why
20
25
 
21
- React Native's entry file (`react-native/index.js`) is a CommonJS barrel: one `module.exports` object with a lazy `require()` getter for every public API. The getters only delay running a module. Every module they reference still ends up in your bundle.
26
+ `react-native/index.js` is a CommonJS barrel with a lazy `require()` getter for every public API. Bundlers can't tree-shake it, so a single `import { View } from 'react-native'` pulls in all of React Native (`VirtualView`, `PushNotificationIOS`, ...).
22
27
 
23
- Bundlers can't tree-shake CommonJS getters. Metro doesn't tree-shake at all, and even [Re.Pack](https://re-pack.dev) with tree-shaking enabled can't remove them. So a single `import { View } from 'react-native'` pulls in all of React Native's public API, including modules your app probably never uses, like `VirtualView`, `UTFSequence` or `PushNotificationIOS`.
28
+ Bundle with only `import { ReactNativeVersion } from 'react-native'`, before and after:
24
29
 
25
- This plugin skips the barrel and imports each module directly, so only the modules you actually import end up in the bundle.
30
+ ![Bundle before and after the plugin](./assets/before-after.png)
26
31
 
27
- For example, here is a bundle that only does `import { ReactNativeVersion } from 'react-native'`, before and after:
32
+ To measure your own bundle, use [react-native-bundle-discovery](https://github.com/retyui/react-native-bundle-discovery).
28
33
 
29
- ![Bundle before and after the plugin](./assets/before-after.png)
34
+ ### Why `require()` and not `import`?
35
+
36
+ React Native's modules are CommonJS. If the plugin emitted `import View from '...'`, Babel's CommonJS transform would wrap every one in `_interopRequireDefault()` / `_interopRequireWildcard()` and add those helpers to each file. A plain `require(...).default` gives the same value without the extra code.
30
37
 
31
38
  ## Install
32
39
 
33
40
  ```bash
34
41
  npm install --save-dev babel-plugin-react-native-direct-imports
35
- # or
36
- yarn add -D babel-plugin-react-native-direct-imports
37
42
  ```
38
43
 
39
44
  ## Usage
40
45
 
41
- Add the plugin to your `babel.config.js`:
42
-
43
46
  ```js
44
- const isTest = process.env.NODE_ENV === 'test';
45
-
47
+ // babel.config.js
46
48
  module.exports = {
47
49
  presets: [
48
- [
49
- 'module:@react-native/babel-preset',
50
- {
51
- disableDeepImportWarnings: true, // <-- add this, the plugin generates deep imports on purpose
52
- },
53
- ],
50
+ // the plugin generates deep imports on purpose
51
+ ['module:@react-native/babel-preset', { disableDeepImportWarnings: true }],
54
52
  ],
55
53
  plugins: [
56
- // Skip the plugin in test environments
57
- !isTest && [
54
+ process.env.NODE_ENV !== 'test' && [
58
55
  'react-native-direct-imports',
59
56
  { reactNativeVersion: require('react-native/package.json').version },
60
57
  ],
@@ -62,50 +59,30 @@ module.exports = {
62
59
  };
63
60
  ```
64
61
 
65
- Then clear the Metro cache once:
62
+ Then reset the Metro cache once (`npx react-native start --reset-cache` or `npx expo start --clear`).
66
63
 
67
- ```bash
68
- npx react-native start --reset-cache
69
- # or, with Expo
70
- npx expo start --clear
71
- ```
72
-
73
- ### Options
74
-
75
- | Option | Type | Default | Description |
76
- | -------------------- | -------- | ----------------------------- | -------------------------------------------------------------------- |
77
- | `reactNativeVersion` | `string` | latest map in [`maps/`](maps) | React Native version to use. Loads `maps/<reactNativeVersion>.json`. |
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.
78
65
 
79
- Maps are available for every stable React Native release from `0.70.0` on. The version must match a map exactly. If it doesn't, the build fails with an error listing the available versions. After upgrading React Native to a release that has no map yet, update this plugin as well.
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.
80
67
 
81
68
  ## Notes
82
69
 
83
- - Only names listed in the map are rewritten. Unknown names stay on the original `react-native` import.
84
- - `unstable_batchedUpdates` has no module of its own since React Native 0.86 (it's a plain method in `index.js`), so it is inlined as `const unstable_batchedUpdates = (fn, bookkeeping) => fn(bookkeeping);`, matching React Native's implementation.
85
- - Type-only imports (`import type { ... }`, `import { type ... }`) are left untouched.
86
- - Metro's `Platform.OS` / `Platform.select` inlining (`inlinePlatform`) keeps working, as it matches the local name `Platform`. Aliased imports (`import { Platform as P }`) are not inlined.
87
- - Aliases are preserved: `import { Text as RNText }` → `import RNText from 'react-native/Libraries/Text/Text'`.
88
- - Re-exports are rewritten too: `export { findNodeHandle } from 'react-native'` → `const _findNodeHandle = require('react-native/Libraries/ReactNative/RendererProxy').findNodeHandle; export { _findNodeHandle as findNodeHandle };`. `export * from 'react-native'` is left untouched.
89
- - `require('react-native')` in compiled CommonJS code (e.g. TypeScript/Babel output in `node_modules`) is rewritten too: `x.Alert` on `var x = require('react-native')`, `const { View } = require('react-native')` and `require('react-native').Linking`. Each `x.Name` usage becomes its own inline `require()`, so modules are still loaded lazily, like the barrel's getters. The `require('react-native')` itself is kept if any usage can't be rewritten (unknown names, `foo(x)`, ...). `x.Platform` is the exception: it's pointed at a single `var Platform = require('react-native/Libraries/Utilities/Platform').default;` added at the top of the file, so Metro's `inlinePlatform` still matches `Platform.OS` / `Platform.select` (if `Platform` is already declared in that scope, the `require()` is inlined instead).
90
- - `import * as RN from 'react-native'` and `module.exports = require('react-native')` throw a build error. Use named imports / exports instead.
91
- - The generated paths point to React Native internals (`Libraries/...`, `src/private/...`). They are not public API, which is why every React Native version has its own map.
70
+ - Unknown names and type-only imports are left untouched.
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
+ - `Platform` stays a local `Platform` variable, so Metro's `Platform.OS` / `Platform.select` inlining keeps working (not for aliases like `Platform as P`).
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.
92
75
 
93
- ## Limitations
76
+ ## Compatibility
94
77
 
95
- ### `react-native-worklets` bundle mode
96
-
97
- In bundle mode, `react-native-worklets` uses `getBundleModeMetroConfig` to resolve every `react-native` import to its own [`reactNativeShim.js`](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/bundleMode/shims/reactNativeShim.js). The shim sets up `globalThis.__RUNTIME_KIND` (and, on worklet runtimes in dev, guards `__fbBatchedBridgeConfig`) before re-exporting `require('react-native')`.
98
-
99
- This plugin rewrites `react-native` imports to deep `react-native/Libraries/...` paths, so they no longer resolve to the shim and its setup is skipped. Don't use the plugin together with worklets bundle mode.
78
+ - ✅ [Uniwind](https://github.com/uni-stack/uniwind): `withUniwindConfig` also redirects deep `react-native/Libraries/...` imports of the components it styles, so `className` keeps working.
79
+ - ⚠️ `react-native-worklets` bundle mode: before `0.14.0`, `getBundleModeMetroConfig` resolves `react-native` to its own [shim](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/bundleMode/shims/reactNativeShim.js), which sets up the worklet runtime. The deep paths skip it, so don't combine them on `react-native-worklets` < `0.14.0`; upgrade to `0.14.0` or newer.
100
80
 
101
81
  ## Generating maps (development)
102
82
 
103
- Maps are generated from each version's `react-native/index.js`:
104
-
105
83
  ```bash
106
- yarn generate-maps
107
- # or for specific versions:
108
- yarn generate-maps 0.87.1 0.86.3
84
+ yarn generate-maps # all versions
85
+ yarn generate-maps 0.88.0 # specific versions
109
86
  ```
110
87
 
111
88
  ## License
package/index.js CHANGED
@@ -39,6 +39,8 @@
39
39
  *
40
40
  * Options:
41
41
  * reactNativeVersion - picks `maps/<version>.json` (defaults to the latest map)
42
+ * silenceBatchedUpdatesWarning - hides the `unstable_batchedUpdates` no-op
43
+ * warning on 0.86+
42
44
  */
43
45
 
44
46
  const fs = require('fs');
@@ -48,6 +50,8 @@ const RN = 'react-native';
48
50
 
49
51
  const MAPS_DIR = nodePath.join(__dirname, 'maps');
50
52
 
53
+ let warnedBatchedUpdates = false;
54
+
51
55
  const compareVersions = (a, b) => {
52
56
  const pa = a.split('.').map(Number);
53
57
  const pb = b.split('.').map(Number);
@@ -80,7 +84,7 @@ const loadMap = (version) => {
80
84
 
81
85
  module.exports = function reactNativeDirectImports(
82
86
  { types: t },
83
- { reactNativeVersion } = {},
87
+ { reactNativeVersion, silenceBatchedUpdatesWarning = false } = {},
84
88
  ) {
85
89
  const MAP = loadMap(reactNativeVersion);
86
90
 
@@ -99,6 +103,12 @@ module.exports = function reactNativeDirectImports(
99
103
  // `react-native/index.js` (no getter, no module to require), so it gets
100
104
  // inlined: `(fn, bookkeeping) => fn(bookkeeping)`.
101
105
  const buildBatchedUpdates = () => {
106
+ if (!silenceBatchedUpdatesWarning && !warnedBatchedUpdates) {
107
+ warnedBatchedUpdates = true;
108
+ console.warn(
109
+ '[react-native-direct-imports] `unstable_batchedUpdates` does nothing since react-native 0.86, it just calls the callback: https://github.com/react/react-native/commit/1a623a826654db4238cddc22fb958ccb76207a74. Pass `silenceBatchedUpdatesWarning: true` to hide this warning.',
110
+ );
111
+ }
102
112
  const fn = t.identifier('fn');
103
113
  const bookkeeping = t.identifier('bookkeeping');
104
114
  return t.arrowFunctionExpression(
@@ -0,0 +1,390 @@
1
+ {
2
+ "ActivityIndicator": [
3
+ "Libraries/Components/ActivityIndicator/ActivityIndicator",
4
+ "default"
5
+ ],
6
+ "Button": [
7
+ "Libraries/Components/Button",
8
+ "default"
9
+ ],
10
+ "DrawerLayoutAndroid": [
11
+ "Libraries/Components/DrawerAndroid/DrawerLayoutAndroid",
12
+ "default"
13
+ ],
14
+ "EventEmitter": [
15
+ "Libraries/vendor/emitter/EventEmitter",
16
+ "default"
17
+ ],
18
+ "FlatList": [
19
+ "Libraries/Lists/FlatList",
20
+ "default"
21
+ ],
22
+ "Image": [
23
+ "Libraries/Image/Image",
24
+ "default"
25
+ ],
26
+ "ImageBackground": [
27
+ "Libraries/Image/ImageBackground",
28
+ "default"
29
+ ],
30
+ "InputAccessoryView": [
31
+ "Libraries/Components/TextInput/InputAccessoryView",
32
+ "default"
33
+ ],
34
+ "KeyboardAvoidingView": [
35
+ "Libraries/Components/Keyboard/KeyboardAvoidingView",
36
+ "default"
37
+ ],
38
+ "experimental_LayoutConformance": [
39
+ "Libraries/Components/LayoutConformance/LayoutConformance",
40
+ "default"
41
+ ],
42
+ "Modal": [
43
+ "Libraries/Modal/Modal",
44
+ "default"
45
+ ],
46
+ "unstable_NativeText": [
47
+ "Libraries/Text/TextNativeComponent",
48
+ "NativeText"
49
+ ],
50
+ "unstable_NativeView": [
51
+ "Libraries/Components/View/ViewNativeComponent",
52
+ "default"
53
+ ],
54
+ "Pressable": [
55
+ "Libraries/Components/Pressable/Pressable",
56
+ "default"
57
+ ],
58
+ "ProgressBarAndroid": [
59
+ "Libraries/Components/ProgressBarAndroid/ProgressBarAndroid",
60
+ "default"
61
+ ],
62
+ "RefreshControl": [
63
+ "Libraries/Components/RefreshControl/RefreshControl",
64
+ "default"
65
+ ],
66
+ "SafeAreaView": [
67
+ "Libraries/Components/SafeAreaView/SafeAreaView",
68
+ "default"
69
+ ],
70
+ "ScrollView": [
71
+ "Libraries/Components/ScrollView/ScrollView",
72
+ "default"
73
+ ],
74
+ "SectionList": [
75
+ "Libraries/Lists/SectionList",
76
+ "default"
77
+ ],
78
+ "StatusBar": [
79
+ "Libraries/Components/StatusBar/StatusBar",
80
+ "default"
81
+ ],
82
+ "Switch": [
83
+ "Libraries/Components/Switch/Switch",
84
+ "default"
85
+ ],
86
+ "Text": [
87
+ "Libraries/Text/Text",
88
+ "default"
89
+ ],
90
+ "unstable_TextAncestorContext": [
91
+ "Libraries/Text/TextAncestorContext",
92
+ "default"
93
+ ],
94
+ "TextInput": [
95
+ "Libraries/Components/TextInput/TextInput",
96
+ "default"
97
+ ],
98
+ "TouchableHighlight": [
99
+ "Libraries/Components/Touchable/TouchableHighlight",
100
+ "default"
101
+ ],
102
+ "TouchableNativeFeedback": [
103
+ "Libraries/Components/Touchable/TouchableNativeFeedback",
104
+ "default"
105
+ ],
106
+ "TouchableOpacity": [
107
+ "Libraries/Components/Touchable/TouchableOpacity",
108
+ "default"
109
+ ],
110
+ "TouchableWithoutFeedback": [
111
+ "Libraries/Components/Touchable/TouchableWithoutFeedback",
112
+ "default"
113
+ ],
114
+ "View": [
115
+ "Libraries/Components/View/View",
116
+ "default"
117
+ ],
118
+ "VirtualizedList": [
119
+ "Libraries/Lists/VirtualizedList",
120
+ "default"
121
+ ],
122
+ "VirtualizedSectionList": [
123
+ "Libraries/Lists/VirtualizedSectionList",
124
+ "default"
125
+ ],
126
+ "unstable_VirtualView": [
127
+ "src/private/components/virtualview/VirtualView",
128
+ "default"
129
+ ],
130
+ "unstable_VirtualArray": [
131
+ "src/private/components/virtualcollection/Virtual",
132
+ "VirtualArray"
133
+ ],
134
+ "unstable_createVirtualCollectionView": [
135
+ "src/private/components/virtualcollection/VirtualCollectionView",
136
+ "createVirtualCollectionView"
137
+ ],
138
+ "unstable_VirtualColumn": [
139
+ "src/private/components/virtualcollection/column/VirtualColumn",
140
+ "default"
141
+ ],
142
+ "unstable_VirtualColumnGenerator": [
143
+ "src/private/components/virtualcollection/column/VirtualColumnGenerator",
144
+ "default"
145
+ ],
146
+ "unstable_VirtualRow": [
147
+ "src/private/components/virtualcollection/row/VirtualRow",
148
+ "default"
149
+ ],
150
+ "unstable_getScrollParent": [
151
+ "src/private/components/virtualcollection/dom/getScrollParent",
152
+ "default"
153
+ ],
154
+ "unstable_DEFAULT_INITIAL_NUM_TO_RENDER": [
155
+ "src/private/components/virtualcollection/FlingConstants",
156
+ "DEFAULT_INITIAL_NUM_TO_RENDER"
157
+ ],
158
+ "AccessibilityInfo": [
159
+ "Libraries/Components/AccessibilityInfo/AccessibilityInfo",
160
+ "default"
161
+ ],
162
+ "ActionSheetIOS": [
163
+ "Libraries/ActionSheetIOS/ActionSheetIOS",
164
+ "default"
165
+ ],
166
+ "Alert": [
167
+ "Libraries/Alert/Alert",
168
+ "default"
169
+ ],
170
+ "Animated": [
171
+ "Libraries/Animated/Animated",
172
+ "default"
173
+ ],
174
+ "Appearance": [
175
+ "Libraries/Utilities/Appearance",
176
+ "*"
177
+ ],
178
+ "AppRegistry": [
179
+ "Libraries/ReactNative/AppRegistry",
180
+ "AppRegistry"
181
+ ],
182
+ "AppState": [
183
+ "Libraries/AppState/AppState",
184
+ "default"
185
+ ],
186
+ "AssetRegistry": [
187
+ "src/private/assets/AssetRegistry",
188
+ "AssetRegistry"
189
+ ],
190
+ "BackHandler": [
191
+ "Libraries/Utilities/BackHandler",
192
+ "default"
193
+ ],
194
+ "Clipboard": [
195
+ "Libraries/Components/Clipboard/Clipboard",
196
+ "default"
197
+ ],
198
+ "codegenNativeCommands": [
199
+ "Libraries/Utilities/codegenNativeCommands",
200
+ "default"
201
+ ],
202
+ "codegenNativeComponent": [
203
+ "Libraries/Utilities/codegenNativeComponent",
204
+ "default"
205
+ ],
206
+ "DeviceEventEmitter": [
207
+ "Libraries/EventEmitter/RCTDeviceEventEmitter",
208
+ "default"
209
+ ],
210
+ "DeviceInfo": [
211
+ "Libraries/Utilities/DeviceInfo",
212
+ "default"
213
+ ],
214
+ "DevMenu": [
215
+ "src/private/devsupport/devmenu/DevMenu",
216
+ "default"
217
+ ],
218
+ "DevSettings": [
219
+ "Libraries/Utilities/DevSettings",
220
+ "default"
221
+ ],
222
+ "Dimensions": [
223
+ "Libraries/Utilities/Dimensions",
224
+ "default"
225
+ ],
226
+ "DynamicColorIOS": [
227
+ "Libraries/StyleSheet/PlatformColorValueTypesIOS",
228
+ "DynamicColorIOS"
229
+ ],
230
+ "Easing": [
231
+ "Libraries/Animated/Easing",
232
+ "default"
233
+ ],
234
+ "findNodeHandle": [
235
+ "Libraries/ReactNative/RendererProxy",
236
+ "findNodeHandle"
237
+ ],
238
+ "I18nManager": [
239
+ "Libraries/ReactNative/I18nManager",
240
+ "default"
241
+ ],
242
+ "Keyboard": [
243
+ "Libraries/Components/Keyboard/Keyboard",
244
+ "default"
245
+ ],
246
+ "LayoutAnimation": [
247
+ "Libraries/LayoutAnimation/LayoutAnimation",
248
+ "default"
249
+ ],
250
+ "Linking": [
251
+ "Libraries/Linking/Linking",
252
+ "default"
253
+ ],
254
+ "LogBox": [
255
+ "Libraries/LogBox/LogBox",
256
+ "default"
257
+ ],
258
+ "NativeAppEventEmitter": [
259
+ "Libraries/EventEmitter/RCTNativeAppEventEmitter",
260
+ "default"
261
+ ],
262
+ "NativeComponentRegistry": [
263
+ "Libraries/NativeComponent/NativeComponentRegistry",
264
+ "*"
265
+ ],
266
+ "NativeEventEmitter": [
267
+ "Libraries/EventEmitter/NativeEventEmitter",
268
+ "default"
269
+ ],
270
+ "NativeModules": [
271
+ "Libraries/BatchedBridge/NativeModules",
272
+ "default"
273
+ ],
274
+ "Networking": [
275
+ "Libraries/Network/RCTNetworking",
276
+ "default"
277
+ ],
278
+ "PanResponder": [
279
+ "Libraries/Interaction/PanResponder",
280
+ "default"
281
+ ],
282
+ "PermissionsAndroid": [
283
+ "Libraries/PermissionsAndroid/PermissionsAndroid",
284
+ "default"
285
+ ],
286
+ "PixelRatio": [
287
+ "Libraries/Utilities/PixelRatio",
288
+ "default"
289
+ ],
290
+ "Platform": [
291
+ "Libraries/Utilities/Platform",
292
+ "default"
293
+ ],
294
+ "PlatformColor": [
295
+ "Libraries/StyleSheet/PlatformColorValueTypes",
296
+ "PlatformColor"
297
+ ],
298
+ "PushNotificationIOS": [
299
+ "Libraries/PushNotificationIOS/PushNotificationIOS",
300
+ "default"
301
+ ],
302
+ "processColor": [
303
+ "Libraries/StyleSheet/processColor",
304
+ "default"
305
+ ],
306
+ "registerCallableModule": [
307
+ "Libraries/Core/registerCallableModule",
308
+ "default"
309
+ ],
310
+ "requireNativeComponent": [
311
+ "Libraries/ReactNative/requireNativeComponent",
312
+ "default"
313
+ ],
314
+ "ReactNativeVersion": [
315
+ "Libraries/Core/ReactNativeVersion",
316
+ "default"
317
+ ],
318
+ "RootTagContext": [
319
+ "Libraries/ReactNative/RootTag",
320
+ "RootTagContext"
321
+ ],
322
+ "Settings": [
323
+ "Libraries/Settings/Settings",
324
+ "default"
325
+ ],
326
+ "Share": [
327
+ "Libraries/Share/Share",
328
+ "default"
329
+ ],
330
+ "StyleSheet": [
331
+ "Libraries/StyleSheet/StyleSheet",
332
+ "default"
333
+ ],
334
+ "Systrace": [
335
+ "Libraries/Performance/Systrace",
336
+ "*"
337
+ ],
338
+ "ToastAndroid": [
339
+ "Libraries/Components/ToastAndroid/ToastAndroid",
340
+ "default"
341
+ ],
342
+ "TurboModuleRegistry": [
343
+ "Libraries/TurboModule/TurboModuleRegistry",
344
+ "*"
345
+ ],
346
+ "UIManager": [
347
+ "Libraries/ReactNative/UIManager",
348
+ "default"
349
+ ],
350
+ "useAnimatedValue": [
351
+ "Libraries/Animated/useAnimatedValue",
352
+ "default"
353
+ ],
354
+ "useAnimatedValueXY": [
355
+ "Libraries/Animated/useAnimatedValueXY",
356
+ "default"
357
+ ],
358
+ "useAnimatedColor": [
359
+ "Libraries/Animated/useAnimatedColor",
360
+ "default"
361
+ ],
362
+ "useColorScheme": [
363
+ "Libraries/Utilities/useColorScheme",
364
+ "default"
365
+ ],
366
+ "usePressability": [
367
+ "Libraries/Pressability/usePressability",
368
+ "default"
369
+ ],
370
+ "useWindowDimensions": [
371
+ "Libraries/Utilities/useWindowDimensions",
372
+ "default"
373
+ ],
374
+ "UTFSequence": [
375
+ "Libraries/UTFSequence",
376
+ "default"
377
+ ],
378
+ "Vibration": [
379
+ "Libraries/Vibration/Vibration",
380
+ "default"
381
+ ],
382
+ "VirtualViewMode": [
383
+ "src/private/components/virtualview/VirtualView",
384
+ "VirtualViewMode"
385
+ ],
386
+ "Touchable": [
387
+ "Libraries/Components/Touchable/Touchable",
388
+ "default"
389
+ ]
390
+ }
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "babel-plugin-react-native-direct-imports",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "description": "Babel plugin that rewrites `react-native` barrel imports into direct module imports",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/retyui/babel-plugin-react-native-direct-imports.git"
8
+ },
5
9
  "main": "index.js",
6
10
  "files": [
7
11
  "index.js",
@@ -9,7 +13,10 @@
9
13
  ],
10
14
  "scripts": {
11
15
  "test": "node --test",
12
- "generate-maps": "node scripts/generate-maps.js"
16
+ "generate-maps": "node scripts/generate-maps.js",
17
+ "changeset": "changeset",
18
+ "version-packages": "changeset version && yarn install --mode=update-lockfile",
19
+ "release": "changeset publish"
13
20
  },
14
21
  "keywords": [
15
22
  "babel",
@@ -34,8 +41,13 @@
34
41
  "devDependencies": {
35
42
  "@babel/core": "^7.26.10",
36
43
  "@babel/plugin-transform-modules-commonjs": "^8.0.1",
44
+ "@changesets/changelog-github": "^1.0.1",
45
+ "@changesets/cli": "^3.0.3",
37
46
  "hermes-parser": "^0.37.0"
38
47
  },
39
48
  "license": "MIT",
40
- "packageManager": "yarn@4.18.1"
41
- }
49
+ "packageManager": "yarn@4.18.1",
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }