Skip to content

Commit 41f9ab3

Browse files
authored
update package.json files (#126)
1 parent 9d7250a commit 41f9ab3

File tree

9 files changed

+26
-9
lines changed

9 files changed

+26
-9
lines changed

.changeset/social-pigs-listen.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@granite-js/react-native': patch
3+
'@granite-js/style-utils': patch
4+
'@granite-js/lottie': patch
5+
'@granite-js/image': patch
6+
'@granite-js/jest': patch
7+
---
8+
9+
ensure polyfill setup during initialization and update package.json config for improve tree shaking

packages/image/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@
4343
},
4444
"dependencies": {
4545
"react-simplikit": "^0.0.40"
46-
}
46+
},
47+
"sideEffects": false
4748
}

packages/jest/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@
3535
"@granite-js/native": "*",
3636
"react": "*",
3737
"react-native": "*"
38-
}
38+
},
39+
"sideEffects": false
3940
}

packages/lottie/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434
"@types/react": "*",
3535
"react": "*",
3636
"react-native": "*"
37-
}
37+
},
38+
"sideEffects": false
3839
}

packages/react-native/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,9 @@
121121
"@granite-js/style-utils": "workspace:*",
122122
"es-toolkit": "^1.39.8",
123123
"react-native-url-polyfill": "1.3.0"
124-
}
124+
},
125+
"sideEffects": [
126+
"dist/async-bridges.*",
127+
"dist/constant-bridges.*"
128+
]
125129
}

packages/react-native/src/app/Granite.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { RouterProps, RequireContext } from '../router';
66
import { AppRoot } from './AppRoot';
77
import { HostAppRoot } from './HostAppRoot';
88
import { getSchemeUri } from '../constant-bridges';
9+
import { setupPolyfills } from '../rn-polyfills';
910

1011
export interface GraniteProps {
1112
/**
@@ -50,6 +51,8 @@ export interface GraniteProps {
5051
const createApp = () => {
5152
let _appName: string | null = null;
5253

54+
setupPolyfills();
55+
5356
function registerComponent(appKey: string, component: React.ComponentType<any>): string {
5457
if (AppRegistry.getAppKeys().includes(appKey)) {
5558
// `AppRegistry.registerComponent` returns the app key.

packages/react-native/src/dev-entrypoint/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import type { ComponentType } from 'react';
22
import { AppRegistry } from 'react-native';
33
import { ENTRY_BUNDLE_NAME } from '../constants';
4-
import { setup } from '../rn-polyfills';
5-
6-
setup();
74

85
export function register(Component: ComponentType<any>) {
96
if (AppRegistry.getAppKeys().includes(ENTRY_BUNDLE_NAME)) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { setup as setupSymbolAsyncIterator } from './symbol-asynciterator';
22
import { setup as setupURLPolyfill } from './url';
33

4-
export function setup() {
4+
export function setupPolyfills() {
55
setupSymbolAsyncIterator();
66
setupURLPolyfill();
77
}

packages/style-utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848
"@types/react": "*",
4949
"react": "*",
5050
"react-native": "*"
51-
}
51+
},
52+
"sideEffects": false
5253
}

0 commit comments

Comments
 (0)