-
Notifications
You must be signed in to change notification settings - Fork 213
fix: Bump expo from 45 to 48 #2706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export default { | ||
| plugins: ['expo-localization'], | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ module.exports = { | |
| ['@babel/plugin-transform-class-properties', { loose: true }], | ||
| ], | ||
| presets: [ | ||
| 'module:metro-react-native-babel-preset', | ||
| 'babel-preset-expo', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does that make expo mandatory? we should support bare bones react native as well |
||
| '@babel/env', | ||
| '@babel/preset-typescript', | ||
| ['@babel/preset-react', { runtime: 'automatic' }], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,32 +44,31 @@ | |
| "devDependencies": { | ||
| "@babel/cli": "^7.19.3", | ||
| "@babel/plugin-transform-private-property-in-object": "^7.27.1", | ||
| "@expo/metro-config": "~0.7.0", | ||
| "@posthog-tooling/rollup-utils": "workspace:*", | ||
| "@posthog-tooling/tsconfig-base": "workspace:*", | ||
| "@react-native-async-storage/async-storage": "^1.17.10", | ||
| "@react-native/babel-preset": "^0.80.1", | ||
| "@react-navigation/native": "^5.0.10", | ||
| "@types/react": "^17.0.87", | ||
| "@types/react-native": "^0.69.1", | ||
| "@types/jest": "catalog:", | ||
| "expo": "^45.0.6", | ||
| "expo-application": "^4.0.0", | ||
| "expo-device": "^4.0.0", | ||
| "expo-file-system": "^13.0.0", | ||
| "expo-localization": "^11.0.0", | ||
| "@types/react": "^18.2.79", | ||
| "babel-preset-expo": "~9.3.2", | ||
| "expo": "^48.0.21", | ||
| "expo-application": "^5.1.1", | ||
| "expo-device": "^5.2.1", | ||
| "expo-file-system": "^15.2.2", | ||
| "expo-localization": "^14.1.1", | ||
| "jest": "catalog:", | ||
| "jest-environment-node": "catalog:", | ||
| "jest-expo": "catalog:", | ||
| "metro": "0.83.1", | ||
| "@expo/metro-config": "~0.20.0", | ||
| "metro": "0.73.10", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://posthog.com/docs/error-tracking/upload-source-maps/react-native#inject we need because of the 'Expo 50 or later' note.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh interesting! It seems like the easiest approach might be to kill this PR and go all the way to 50 (or 53, latest) then?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, i am not sure what would be the correct min. version of metro here |
||
| "posthog-react-native-session-replay": "^1.2.0", | ||
| "react": "18.2.0", | ||
| "react-native": "^0.69.1", | ||
| "react-native": "^0.71.14", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should support >= 0.73 beause of this expo 50 uses rn 0.73 |
||
| "react-native-device-info": "^10.3.0", | ||
| "react-native-localize": "^3.0.0", | ||
| "react-native-navigation": "^6.0.0", | ||
| "react-native-safe-area-context": "^4.10.1", | ||
| "react-native-svg": "^15.0.0", | ||
| "react-native-safe-area-context": "^4.5.0", | ||
| "react-native-svg": "^13.4.0", | ||
| "ts-jest": "catalog:", | ||
| "typescript": "catalog:" | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,77 @@ | ||
| // Vendored / modified from @facebook/metro | ||
| // Type declarations for metro 0.73.x (used by Expo 48 / React Native 0.71.x) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comments here https://github.com/PostHog/posthog-js/pull/2706/files#r2601914572 |
||
|
|
||
| // https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067 | ||
|
|
||
| // MIT License | ||
| declare module 'metro' { | ||
| export interface MixedOutput { | ||
| type: string | ||
| data: { | ||
| code: string | ||
| lineCount?: number | ||
| map?: unknown[] | ||
| functionMap?: unknown | ||
| } | ||
| } | ||
|
|
||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| export interface Module<T = MixedOutput> { | ||
| dependencies: Map<string, { absolutePath: string }> | ||
| getSource: () => Buffer | ||
| inverseDependencies: Set<string> | ||
| output: readonly T[] | ||
| path: string | ||
| } | ||
|
|
||
| // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| // of this software and associated documentation files (the "Software"), to deal | ||
| // in the Software without restriction, including without limitation the rights | ||
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| // copies of the Software, and to permit persons to whom the Software is | ||
| // furnished to do so, subject to the following conditions: | ||
| export interface ReadOnlyGraph<T = MixedOutput> { | ||
| dependencies: ReadonlyMap<string, Module<T>> | ||
| entryPoints: readonly string[] | ||
| importBundleNames: ReadonlySet<string> | ||
| transformOptions: { | ||
| hot: boolean | ||
| dev: boolean | ||
| minify: boolean | ||
| platform?: string | null | ||
| type: string | ||
| [key: string]: unknown | ||
| } | ||
| } | ||
|
|
||
| // The above copyright notice and this permission notice shall be included in all | ||
| // copies or substantial portions of the Software. | ||
| export interface SerializerOptions { | ||
| asyncRequireModulePath: string | ||
| createModuleId: (path: string) => number | ||
| dev: boolean | ||
| getRunModuleStatement: (moduleId: string | number) => string | ||
| includeAsyncPaths: boolean | ||
| inlineSourceMap?: boolean | ||
| modulesOnly: boolean | ||
| processModuleFilter: (module: Module<MixedOutput>) => boolean | ||
| projectRoot: string | ||
| runBeforeMainModule: readonly string[] | ||
| runModule: boolean | ||
| serverRoot: string | ||
| shouldAddToIgnoreList: (module: Module<MixedOutput>) => boolean | ||
| sourceMapUrl?: string | ||
| sourceUrl?: string | ||
| } | ||
|
|
||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| // SOFTWARE. | ||
| export interface BundleMetadata { | ||
| pre: number | ||
| post: number | ||
| modules: [number, number][] | ||
| } | ||
|
|
||
| // All exports were moved from src to private in Metro 0.83.0. | ||
| // https://github.com/facebook/metro/commit/ae6f42372ed361611b5672705f22081c2022cf28 | ||
| export interface MetroConfig { | ||
| serializer?: { | ||
| customSerializer?: ( | ||
| entryPoint: string, | ||
| preModules: readonly Module<MixedOutput>[], | ||
| graph: ReadOnlyGraph<MixedOutput>, | ||
| options: SerializerOptions | ||
| ) => Promise<string | { code: string; map: string }> | ||
| } | ||
| [key: string]: unknown | ||
| } | ||
| } | ||
|
|
||
| declare module 'metro/private/DeltaBundler/Serializers/baseJSBundle' { | ||
| // https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/Serializers/baseJSBundle.js#L25 | ||
| declare module 'metro/src/DeltaBundler/Serializers/baseJSBundle' { | ||
| import type { Module, ReadOnlyGraph, SerializerOptions } from 'metro' | ||
| const baseJSBundle: ( | ||
| entryPoint: string, | ||
| premodules: ReadonlyArray<Module>, | ||
|
|
@@ -42,26 +85,29 @@ declare module 'metro/private/DeltaBundler/Serializers/baseJSBundle' { | |
| export = baseJSBundle | ||
| } | ||
|
|
||
| declare module 'metro/private/lib/bundleToString' { | ||
| // https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/lib/bundleToString.js#L22 | ||
| const baseJSBundle: (bundle: { modules: [number, string][]; post: string; pre: string }) => { | ||
| declare module 'metro/src/lib/bundleToString' { | ||
| import type { BundleMetadata } from 'metro' | ||
| const bundleToString: (bundle: { modules: [number, string][]; post: string; pre: string }) => { | ||
| code: string | ||
| metadata: BundleMetadata | ||
| } | ||
|
|
||
| export = baseJSBundle | ||
| export = bundleToString | ||
| } | ||
|
|
||
| declare module 'metro/private/lib/countLines' { | ||
| // https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/lib/countLines.js#L16 | ||
| declare module 'metro/src/lib/countLines' { | ||
| const countLines: (code: string) => number | ||
| export = countLines | ||
| } | ||
|
|
||
| declare module 'metro/private/DeltaBundler/Serializers/sourceMapString' { | ||
| import type { MixedOutput, Module } from 'metro' | ||
| declare module 'metro/src/lib/CountingSet' { | ||
| class CountingSet<T> extends Set<T> { | ||
| constructor(items?: Iterable<T>) | ||
| } | ||
| export = CountingSet | ||
| } | ||
|
|
||
| // https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/Serializers/sourceMapString.js#L19 | ||
| declare module 'metro/src/DeltaBundler/Serializers/sourceMapString' { | ||
| import type { MixedOutput, Module } from 'metro' | ||
| const sourceMapString: ( | ||
| bundle: Module<MixedOutput>[], | ||
| options: { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expo-localization is an optional dep so i think we should not have this here