@expo/prebuild-config 3.0.6 → 3.0.10
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/build/getPrebuildConfig.d.ts +3 -10
- package/build/getPrebuildConfig.js +6 -1
- package/build/getPrebuildConfig.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/plugins/icons/withAndroidIcons.js +5 -3
- package/build/plugins/icons/withAndroidIcons.js.map +1 -1
- package/build/plugins/icons/withIosIcons.js +2 -1
- package/build/plugins/icons/withIosIcons.js.map +1 -1
- package/build/plugins/unversioned/createLegacyPlugin.js +16 -9
- package/build/plugins/unversioned/createLegacyPlugin.js.map +1 -1
- package/build/plugins/unversioned/expo-apple-authentication.js +8 -15
- package/build/plugins/unversioned/expo-apple-authentication.js.map +1 -1
- package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.js +3 -3
- package/build/plugins/unversioned/expo-facebook/withIosFacebook.js +8 -8
- package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.js +3 -3
- package/build/plugins/unversioned/expo-notifications/withAndroidNotifications.js +4 -3
- package/build/plugins/unversioned/expo-notifications/withAndroidNotifications.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +11 -4
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js +30 -17
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js +2 -2
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js +38 -11
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
- package/build/plugins/unversioned/expo-system-ui/expo-system-ui.d.ts +2 -0
- package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js +64 -0
- package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.d.ts +6 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js +70 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.d.ts +2 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js +34 -0
- package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.d.ts +8 -0
- package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js +109 -0
- package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js.map +1 -0
- package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.d.ts +5 -0
- package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js +65 -0
- package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js.map +1 -0
- package/build/plugins/unversioned/expo-updates.js +1 -1
- package/build/plugins/unversioned/react-native-maps.js +8 -5
- package/build/plugins/unversioned/react-native-maps.js.map +1 -1
- package/build/plugins/withDefaultPlugins.js +19 -7
- package/build/plugins/withDefaultPlugins.js.map +1 -1
- package/package.json +10 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/InterfaceBuilder.ts"],"names":["createConstraint","firstItem","firstAttribute","secondItem","secondAttribute","$","id","applyImageToSplashScreenXML","xml","imageName","contentMode","imageId","containerId","width","height","imageView","userLabel","image","horizontalHuggingPriority","verticalHuggingPriority","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","rect","key","x","y","document","scenes","scene","objects","viewController","view","subviews","push","constraints","constraint","resources","name","createTemplateSplashScreenAsync","contents","Parser","parseStringPromise","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAmKA,SAASA,gBAAT,CACE,CAACC,SAAD,EAAYC,cAAZ,CADF,EAEE,CAACC,UAAD,EAAaC,eAAb,CAFF,EAGgB;AACd,SAAO;AACLC,IAAAA,CAAC,EAAE;AACDJ,MAAAA,SADC;AAEDC,MAAAA,cAFC;AAGDC,MAAAA,UAHC;AAIDC,MAAAA,eAJC;AAKDE,MAAAA,EAAE,EAAE;AALH;AADE,GAAP;AASD;;AAEM,SAASC,2BAAT,CACLC,GADK,EAEL;AACEC,EAAAA,SADF;AAEEC,EAAAA;AAFF,CAFK,EASmB;AACxB,QAAMC,OAAO,GAAG,mBAAhB;AACA,QAAMC,WAAW,GAAG,oBAApB;AACA,QAAMC,KAAK,GAAG,GAAd;AACA,QAAMC,MAAM,GAAG,GAAf;AAEA,QAAMC,SAAsB,GAAG;AAC7BV,IAAAA,CAAC,EAAE;AACDC,MAAAA,EAAE,EAAEK,OADH;AAEDK,MAAAA,SAAS,EAAEP,SAFV;AAGDQ,MAAAA,KAAK,EAAER,SAHN;AAIDC,MAAAA,WAJC;AAKDQ,MAAAA,yBAAyB,EAAE,GAL1B;AAMDC,MAAAA,uBAAuB,EAAE,GANxB;AAODC,MAAAA,aAAa,EAAE,IAPd;AAQDC,MAAAA,sBAAsB,EAAE,KARvB;AASDC,MAAAA,yCAAyC,EAAE;AAT1C,KAD0B;AAY7BC,IAAAA,IAAI,EAAE,CACJ;AACElB,MAAAA,CAAC,EAAE;AACDmB,QAAAA,GAAG,EAAE,OADJ;AAEDC,QAAAA,CAAC,EAAE,GAFF;AAGDC,QAAAA,CAAC,EAAE,GAHF;AAIDb,QAAAA,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,GAAP;AACD;;AAEM,eAAe+B,+BAAf,GAAkF;AACvF,QAAMC,QAAQ,GAAI;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAzEE;AA0EA,SAAO,MAAM,KAAIC,gBAAJ,IAAaC,kBAAb,CAAgCF,QAAhC,CAAb;AACD,C,CAED;;;AACO,SAASG,QAAT,CAAkBnC,GAAlB,EAAoC;AACzC,QAAMoC,OAAO,GAAG,KAAIC,iBAAJ,EAAY;AAC1BC,IAAAA,qBAAqB,EAAE,IADG;AAE1BC,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE,KADH;AAENC,MAAAA,QAAQ,EAAE;AAFJ,KAFkB;AAM1BC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,IADE;AAEVC,MAAAA,MAAM,EAAE;AAFE;AANc,GAAZ,CAAhB;AAWA,SAAOR,OAAO,CAACS,WAAR,CAAoB7C,GAApB,CAAP;AACD","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\nimport { Builder, Parser } from 'xml2js';\n\nexport type IBBoolean = 'YES' | 'NO' | boolean;\n\nexport type IBItem<\n H extends Record<string, any>,\n B extends Record<string, any[]> = { [key: string]: any }\n> = {\n $: H;\n} & B;\n\nexport type Rect = {\n key: string;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport type IBRect = IBItem<Rect>;\n\nexport type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';\n\nexport type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';\n\nexport type IBImageView = IBItem<\n {\n id: string;\n userLabel: string;\n image: string;\n clipsSubviews?: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleAspectFill';\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n insetsLayoutMarginsFromSafeArea?: IBBoolean;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n rect: IBRect[];\n }\n>;\n\nexport type IBConstraint = IBItem<{\n firstItem: string;\n firstAttribute: ConstraintAttribute;\n secondItem: string;\n secondAttribute: ConstraintAttribute;\n id: string;\n}>;\n\nexport type IBViewController = IBItem<\n {\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n },\n {\n view: IBItem<\n {\n id: string;\n key: string;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleToFill';\n insetsLayoutMarginsFromSafeArea: IBBoolean;\n userLabel: string;\n },\n {\n rect: IBRect[];\n autoresizingMask: IBItem<{\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n }>[];\n\n subviews: IBItem<\n object,\n {\n imageView: IBImageView[];\n }\n >[];\n color: IBItem<{\n key: string | 'backgroundColor';\n systemColor: string | 'systemBackgroundColor';\n }>[];\n constraints: IBItem<\n object,\n {\n constraint: IBConstraint[];\n }\n >[];\n viewLayoutGuide: IBItem<{\n id: string;\n key: string | 'safeArea';\n }>[];\n }\n >[];\n }\n>;\n\nexport type IBPoint = IBItem<{\n key: string | 'canvasLocation';\n x: number;\n y: number;\n}>;\n\nexport type IBScene = IBItem<\n { sceneID: string },\n {\n objects: {\n viewController: IBViewController[];\n placeholder: IBItem<{\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n }>[];\n }[];\n point: IBPoint[];\n }\n>;\n\ntype IBResourceImage = IBItem<{\n name: string;\n width: number;\n height: number;\n}>;\n\ntype IBDevice = IBItem<{\n id: string;\n orientation: string | 'portrait';\n appearance: string | 'light';\n}>;\n\nexport type IBSplashScreenDocument = {\n document: IBItem<\n {\n type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;\n version: '3.0' | string;\n toolsVersion: number;\n targetRuntime: 'iOS.CocoaTouch' | string;\n propertyAccessControl: 'none' | string;\n useAutolayout: IBBoolean;\n launchScreen: IBBoolean;\n useTraitCollections: IBBoolean;\n useSafeAreas: IBBoolean;\n colorMatched: IBBoolean;\n initialViewController: string;\n },\n {\n device: IBDevice[];\n dependencies: unknown[];\n scenes: {\n scene: IBScene[];\n }[];\n resources: {\n image: IBResourceImage[];\n }[];\n }\n >;\n};\n\nfunction createConstraint(\n [firstItem, firstAttribute]: [string, ConstraintAttribute],\n [secondItem, secondAttribute]: [string, ConstraintAttribute]\n): IBConstraint {\n return {\n $: {\n firstItem,\n firstAttribute,\n secondItem,\n secondAttribute,\n id: uuidv4(),\n },\n };\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n }\n): IBSplashScreenDocument {\n const imageId = 'EXPO-SplashScreen';\n const containerId = 'EXPO-ContainerView';\n const width = 414;\n const height = 736;\n\n const imageView: IBImageView = {\n $: {\n id: imageId,\n userLabel: imageName,\n image: imageName,\n contentMode,\n horizontalHuggingPriority: 251,\n verticalHuggingPriority: 251,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x: 0.0,\n y: 0.0,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].subviews[0].imageView.push(\n imageView\n );\n\n // Add Constraints\n xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].constraints[0].constraint.push(\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n createConstraint([imageId, 'top'], [containerId, 'top']),\n createConstraint([imageId, 'leading'], [containerId, 'leading']),\n createConstraint([imageId, 'trailing'], [containerId, 'trailing']),\n createConstraint([imageId, 'bottom'], [containerId, 'bottom'])\n );\n\n // Add resource\n xml.document.resources[0].image.push({\n // <image name=\"SplashScreen\" width=\"414\" height=\"736\"/>\n $: {\n name: imageName,\n width,\n height,\n },\n });\n\n return xml;\n}\n\nexport async function createTemplateSplashScreenAsync(): Promise<IBSplashScreenDocument> {\n const contents = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <document\n type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\"\n version=\"3.0\"\n toolsVersion=\"16096\"\n targetRuntime=\"iOS.CocoaTouch\"\n propertyAccessControl=\"none\"\n useAutolayout=\"YES\"\n launchScreen=\"YES\"\n useTraitCollections=\"YES\"\n useSafeAreas=\"YES\"\n colorMatched=\"YES\"\n initialViewController=\"EXPO-VIEWCONTROLLER-1\"\n >\n <device id=\"retina5_5\" orientation=\"portrait\" appearance=\"light\"/>\n <dependencies>\n <deployment identifier=\"iOS\"/>\n <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"16087\"/>\n <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n </dependencies>\n <scenes>\n <!--View Controller-->\n <scene sceneID=\"EXPO-SCENE-1\">\n <objects>\n <viewController\n storyboardIdentifier=\"SplashScreenViewController\"\n id=\"EXPO-VIEWCONTROLLER-1\"\n sceneMemberID=\"viewController\"\n >\n <view\n key=\"view\"\n userInteractionEnabled=\"NO\"\n contentMode=\"scaleToFill\"\n insetsLayoutMarginsFromSafeArea=\"NO\"\n id=\"EXPO-ContainerView\"\n userLabel=\"ContainerView\"\n >\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"736\"/>\n <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n <subviews>\n <imageView\n userInteractionEnabled=\"NO\"\n contentMode=\"scaleAspectFill\"\n horizontalHuggingPriority=\"251\"\n verticalHuggingPriority=\"251\"\n insetsLayoutMarginsFromSafeArea=\"NO\"\n image=\"SplashScreenBackground\"\n translatesAutoresizingMaskIntoConstraints=\"NO\"\n id=\"EXPO-SplashScreenBackground\"\n userLabel=\"SplashScreenBackground\"\n >\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"736\"/>\n </imageView>\n </subviews>\n <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\"/>\n <constraints>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"1gX-mQ-vu6\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"leading\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"leading\" id=\"6tX-OG-Sck\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"trailing\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"trailing\" id=\"ABX-8g-7v4\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"bottom\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"bottom\" id=\"jkI-2V-eW5\"/>\n </constraints>\n <viewLayoutGuide key=\"safeArea\" id=\"Rmq-lb-GrQ\"/>\n </view>\n </viewController>\n <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"EXPO-PLACEHOLDER-1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n </objects>\n <point key=\"canvasLocation\" x=\"140.625\" y=\"129.4921875\"/>\n </scene>\n </scenes>\n <resources>\n <image name=\"SplashScreenBackground\" width=\"1\" height=\"1\"/>\n </resources>\n </document>`;\n return await new Parser().parseStringPromise(contents);\n}\n\n// Attempt to copy Xcode formatting.\nexport function toString(xml: any): string {\n const builder = new Builder({\n preserveChildrenOrder: true,\n xmldec: {\n version: '1.0',\n encoding: 'UTF-8',\n },\n renderOpts: {\n pretty: true,\n indent: ' ',\n },\n });\n return builder.buildObject(xml);\n}\n"],"file":"InterfaceBuilder.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/InterfaceBuilder.ts"],"names":["createConstraint","firstItem","firstAttribute","secondItem","secondAttribute","$","id","createConstraintId","attributes","crypto","createHash","update","join","digest","applyImageToSplashScreenXML","xml","imageName","contentMode","imageId","containerId","width","height","imageView","userLabel","image","horizontalHuggingPriority","verticalHuggingPriority","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","rect","key","x","y","document","scenes","scene","objects","viewController","view","subviews","push","constraints","constraint","resources","name","createTemplateSplashScreenAsync","contents","Parser","parseStringPromise","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAmKA,SAASA,gBAAT,CACE,CAACC,SAAD,EAAYC,cAAZ,CADF,EAEE,CAACC,UAAD,EAAaC,eAAb,CAFF,EAGgB;AACd,SAAO;AACLC,IAAAA,CAAC,EAAE;AACDJ,MAAAA,SADC;AAEDC,MAAAA,cAFC;AAGDC,MAAAA,UAHC;AAIDC,MAAAA,eAJC;AAKD;AACAE,MAAAA,EAAE,EAAEC,kBAAkB,CAACN,SAAD,EAAYC,cAAZ,EAA4BC,UAA5B,EAAwCC,eAAxC;AANrB;AADE,GAAP;AAUD;;AAED,SAASG,kBAAT,CAA4B,GAAGC,UAA/B,EAAqD;AACnD,SAAOC,kBAAOC,UAAP,CAAkB,MAAlB,EAA0BC,MAA1B,CAAiCH,UAAU,CAACI,IAAX,CAAgB,GAAhB,CAAjC,EAAuDC,MAAvD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,IAAaC,kBAAb,CAAgCF,QAAhC,CAAb;AACD,C,CAED;;;AACO,SAASG,QAAT,CAAkBnC,GAAlB,EAAoC;AACzC,QAAMoC,OAAO,GAAG,KAAIC,iBAAJ,EAAY;AAC1BC,IAAAA,qBAAqB,EAAE,IADG;AAE1BC,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE,KADH;AAENC,MAAAA,QAAQ,EAAE;AAFJ,KAFkB;AAM1BC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,IADE;AAEVC,MAAAA,MAAM,EAAE;AAFE;AANc,GAAZ,CAAhB;AAWA,SAAOR,OAAO,CAACS,WAAR,CAAoB7C,GAApB,CAAP;AACD","sourcesContent":["import crypto from 'crypto';\nimport { Builder, Parser } from 'xml2js';\n\nexport type IBBoolean = 'YES' | 'NO' | boolean;\n\nexport type IBItem<\n H extends Record<string, any>,\n B extends Record<string, any[]> = { [key: string]: any }\n> = {\n $: H;\n} & B;\n\nexport type Rect = {\n key: string;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport type IBRect = IBItem<Rect>;\n\nexport type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';\n\nexport type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';\n\nexport type IBImageView = IBItem<\n {\n id: string;\n userLabel: string;\n image: string;\n clipsSubviews?: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleAspectFill';\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n insetsLayoutMarginsFromSafeArea?: IBBoolean;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n rect: IBRect[];\n }\n>;\n\nexport type IBConstraint = IBItem<{\n firstItem: string;\n firstAttribute: ConstraintAttribute;\n secondItem: string;\n secondAttribute: ConstraintAttribute;\n id: string;\n}>;\n\nexport type IBViewController = IBItem<\n {\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n },\n {\n view: IBItem<\n {\n id: string;\n key: string;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleToFill';\n insetsLayoutMarginsFromSafeArea: IBBoolean;\n userLabel: string;\n },\n {\n rect: IBRect[];\n autoresizingMask: IBItem<{\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n }>[];\n\n subviews: IBItem<\n object,\n {\n imageView: IBImageView[];\n }\n >[];\n color: IBItem<{\n key: string | 'backgroundColor';\n systemColor: string | 'systemBackgroundColor';\n }>[];\n constraints: IBItem<\n object,\n {\n constraint: IBConstraint[];\n }\n >[];\n viewLayoutGuide: IBItem<{\n id: string;\n key: string | 'safeArea';\n }>[];\n }\n >[];\n }\n>;\n\nexport type IBPoint = IBItem<{\n key: string | 'canvasLocation';\n x: number;\n y: number;\n}>;\n\nexport type IBScene = IBItem<\n { sceneID: string },\n {\n objects: {\n viewController: IBViewController[];\n placeholder: IBItem<{\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n }>[];\n }[];\n point: IBPoint[];\n }\n>;\n\ntype IBResourceImage = IBItem<{\n name: string;\n width: number;\n height: number;\n}>;\n\ntype IBDevice = IBItem<{\n id: string;\n orientation: string | 'portrait';\n appearance: string | 'light';\n}>;\n\nexport type IBSplashScreenDocument = {\n document: IBItem<\n {\n type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;\n version: '3.0' | string;\n toolsVersion: number;\n targetRuntime: 'iOS.CocoaTouch' | string;\n propertyAccessControl: 'none' | string;\n useAutolayout: IBBoolean;\n launchScreen: IBBoolean;\n useTraitCollections: IBBoolean;\n useSafeAreas: IBBoolean;\n colorMatched: IBBoolean;\n initialViewController: string;\n },\n {\n device: IBDevice[];\n dependencies: unknown[];\n scenes: {\n scene: IBScene[];\n }[];\n resources: {\n image: IBResourceImage[];\n }[];\n }\n >;\n};\n\nfunction createConstraint(\n [firstItem, firstAttribute]: [string, ConstraintAttribute],\n [secondItem, secondAttribute]: [string, ConstraintAttribute]\n): IBConstraint {\n return {\n $: {\n firstItem,\n firstAttribute,\n secondItem,\n secondAttribute,\n // Prevent updating between runs\n id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute),\n },\n };\n}\n\nfunction createConstraintId(...attributes: string[]) {\n return crypto.createHash('sha1').update(attributes.join('-')).digest('hex');\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n }\n): IBSplashScreenDocument {\n const imageId = 'EXPO-SplashScreen';\n const containerId = 'EXPO-ContainerView';\n const width = 414;\n const height = 736;\n\n const imageView: IBImageView = {\n $: {\n id: imageId,\n userLabel: imageName,\n image: imageName,\n contentMode,\n horizontalHuggingPriority: 251,\n verticalHuggingPriority: 251,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x: 0.0,\n y: 0.0,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].subviews[0].imageView.push(\n imageView\n );\n\n // Add Constraints\n xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].constraints[0].constraint.push(\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n createConstraint([imageId, 'top'], [containerId, 'top']),\n createConstraint([imageId, 'leading'], [containerId, 'leading']),\n createConstraint([imageId, 'trailing'], [containerId, 'trailing']),\n createConstraint([imageId, 'bottom'], [containerId, 'bottom'])\n );\n\n // Add resource\n xml.document.resources[0].image.push({\n // <image name=\"SplashScreen\" width=\"414\" height=\"736\"/>\n $: {\n name: imageName,\n width,\n height,\n },\n });\n\n return xml;\n}\n\nexport async function createTemplateSplashScreenAsync(): Promise<IBSplashScreenDocument> {\n const contents = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <document\n type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\"\n version=\"3.0\"\n toolsVersion=\"16096\"\n targetRuntime=\"iOS.CocoaTouch\"\n propertyAccessControl=\"none\"\n useAutolayout=\"YES\"\n launchScreen=\"YES\"\n useTraitCollections=\"YES\"\n useSafeAreas=\"YES\"\n colorMatched=\"YES\"\n initialViewController=\"EXPO-VIEWCONTROLLER-1\"\n >\n <device id=\"retina5_5\" orientation=\"portrait\" appearance=\"light\"/>\n <dependencies>\n <deployment identifier=\"iOS\"/>\n <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"16087\"/>\n <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n </dependencies>\n <scenes>\n <!--View Controller-->\n <scene sceneID=\"EXPO-SCENE-1\">\n <objects>\n <viewController\n storyboardIdentifier=\"SplashScreenViewController\"\n id=\"EXPO-VIEWCONTROLLER-1\"\n sceneMemberID=\"viewController\"\n >\n <view\n key=\"view\"\n userInteractionEnabled=\"NO\"\n contentMode=\"scaleToFill\"\n insetsLayoutMarginsFromSafeArea=\"NO\"\n id=\"EXPO-ContainerView\"\n userLabel=\"ContainerView\"\n >\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"736\"/>\n <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n <subviews>\n <imageView\n userInteractionEnabled=\"NO\"\n contentMode=\"scaleAspectFill\"\n horizontalHuggingPriority=\"251\"\n verticalHuggingPriority=\"251\"\n insetsLayoutMarginsFromSafeArea=\"NO\"\n image=\"SplashScreenBackground\"\n translatesAutoresizingMaskIntoConstraints=\"NO\"\n id=\"EXPO-SplashScreenBackground\"\n userLabel=\"SplashScreenBackground\"\n >\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"736\"/>\n </imageView>\n </subviews>\n <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\"/>\n <constraints>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"1gX-mQ-vu6\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"leading\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"leading\" id=\"6tX-OG-Sck\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"trailing\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"trailing\" id=\"ABX-8g-7v4\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"bottom\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"bottom\" id=\"jkI-2V-eW5\"/>\n </constraints>\n <viewLayoutGuide key=\"safeArea\" id=\"Rmq-lb-GrQ\"/>\n </view>\n </viewController>\n <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"EXPO-PLACEHOLDER-1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n </objects>\n <point key=\"canvasLocation\" x=\"140.625\" y=\"129.4921875\"/>\n </scene>\n </scenes>\n <resources>\n <image name=\"SplashScreenBackground\" width=\"1\" height=\"1\"/>\n </resources>\n </document>`;\n return await new Parser().parseStringPromise(contents);\n}\n\n// Attempt to copy Xcode formatting.\nexport function toString(xml: any): string {\n const builder = new Builder({\n preserveChildrenOrder: true,\n xmldec: {\n version: '1.0',\n encoding: 'UTF-8',\n },\n renderOpts: {\n pretty: true,\n indent: ' ',\n },\n });\n return builder.buildObject(xml);\n}\n"],"file":"InterfaceBuilder.js"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getAndroidSplashConfig = getAndroidSplashConfig;
|
|
7
6
|
exports.getAndroidDarkSplashConfig = getAndroidDarkSplashConfig;
|
|
7
|
+
exports.getAndroidSplashConfig = getAndroidSplashConfig;
|
|
8
8
|
const defaultResizeMode = 'contain';
|
|
9
9
|
|
|
10
10
|
function getAndroidSplashConfig(config) {
|
|
@@ -17,6 +17,16 @@ function _configPlugins() {
|
|
|
17
17
|
return data;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function _imageUtils() {
|
|
21
|
+
const data = require("@expo/image-utils");
|
|
22
|
+
|
|
23
|
+
_imageUtils = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
function _fsExtra() {
|
|
21
31
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
22
32
|
|
|
@@ -49,6 +59,7 @@ function _getAndroidSplashConfig() {
|
|
|
49
59
|
|
|
50
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
61
|
|
|
62
|
+
const IMAGE_CACHE_NAME = 'splash-android';
|
|
52
63
|
const SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';
|
|
53
64
|
const DRAWABLES_CONFIGS = {
|
|
54
65
|
default: {
|
|
@@ -169,27 +180,29 @@ async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot)
|
|
|
169
180
|
const image = config[imageKey];
|
|
170
181
|
|
|
171
182
|
if (image) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
183
|
+
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
|
184
|
+
// this method also supports remote URLs and using the global sharp instance.
|
|
185
|
+
const {
|
|
186
|
+
source
|
|
187
|
+
} = await (0, _imageUtils().generateImageAsync)({
|
|
188
|
+
projectRoot,
|
|
189
|
+
cacheType: IMAGE_CACHE_NAME
|
|
190
|
+
}, {
|
|
191
|
+
src: image
|
|
192
|
+
}); // Get output path for drawable.
|
|
175
193
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* @param srcPath Absolute path
|
|
181
|
-
* @param dstPath Absolute path
|
|
182
|
-
*/
|
|
194
|
+
const outputPath = _path().default.join(androidMainPath, // @ts-ignore
|
|
195
|
+
DRAWABLES_CONFIGS[imageKey].modes[theme].path); // Ensure directory exists.
|
|
183
196
|
|
|
184
197
|
|
|
185
|
-
|
|
186
|
-
if (!srcPath) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
198
|
+
const folder = _path().default.dirname(outputPath);
|
|
189
199
|
|
|
190
|
-
|
|
200
|
+
await _fsExtra().default.ensureDir(folder); // Write image buffer to the file system.
|
|
191
201
|
|
|
192
|
-
|
|
193
|
-
|
|
202
|
+
await _fsExtra().default.writeFile(outputPath, source);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return null;
|
|
206
|
+
}));
|
|
194
207
|
}
|
|
195
208
|
//# sourceMappingURL=withAndroidSplashImages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"names":["SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","default","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","setSplashImageDrawablesAsync","modRequest","projectRoot","clearAllExistingSplashImagesAsync","splash","darkSplash","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"names":["IMAGE_CACHE_NAME","SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","default","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","setSplashImageDrawablesAsync","modRequest","projectRoot","clearAllExistingSplashImagesAsync","splash","darkSplash","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","source","cacheType","src","outputPath","folder","dirname","ensureDir","writeFile"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AASA,MAAMA,gBAAgB,GAAG,gBAAzB;AACA,MAAMC,sBAAsB,GAAG,wBAA/B;AACA,MAAMC,iBASL,GAAG;AACFC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE;AACLC,QAAAA,IAAI,EAAG,kBAAiBL,sBAAuB;AAD1C,OADF;AAILM,MAAAA,IAAI,EAAE;AACJD,QAAAA,IAAI,EAAG,wBAAuBL,sBAAuB;AADjD;AAJD,KADA;AASPO,IAAAA,oBAAoB,EAAE;AATf,GADP;AAYFC,EAAAA,IAAI,EAAE;AACJL,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE;AACLC,QAAAA,IAAI,EAAG,uBAAsBL,sBAAuB;AAD/C,OADF;AAILM,MAAAA,IAAI,EAAE;AACJD,QAAAA,IAAI,EAAG,6BAA4BL,sBAAuB;AADtD;AAJD,KADH;AASJO,IAAAA,oBAAoB,EAAE;AATlB,GAZJ;AAuBFE,EAAAA,IAAI,EAAE;AACJN,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE;AACLC,QAAAA,IAAI,EAAG,uBAAsBL,sBAAuB;AAD/C,OADF;AAILM,MAAAA,IAAI,EAAE;AACJD,QAAAA,IAAI,EAAG,6BAA4BL,sBAAuB;AADtD;AAJD,KADH;AASJO,IAAAA,oBAAoB,EAAE;AATlB,GAvBJ;AAk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,QAAD,CAApB;;AACA,QAAIC,KAAJ,EAAW;AACT;AACA;AACA,YAAM;AAAEC,QAAAA;AAAF,UAAa,MAAM,sCAAmB;AAAEpB,QAAAA,WAAF;AAAeqB,QAAAA,SAAS,EAAEvC;AAA1B,OAAnB,EAAiE;AACxFwC,QAAAA,GAAG,EAAEH;AADmF,OAAjE,CAAzB,CAHS,CAOT;;AACA,YAAMI,UAAU,GAAGnC,gBAAKoB,IAAL,CACjBD,eADiB,EAEjB;AACAvB,MAAAA,iBAAiB,CAACkC,QAAD,CAAjB,CAA4BhC,KAA5B,CAAkC+B,KAAlC,EAAyC7B,IAHxB,CAAnB,CARS,CAaT;;;AACA,YAAMoC,MAAM,GAAGpC,gBAAKqC,OAAL,CAAaF,UAAb,CAAf;;AACA,YAAMV,mBAAGa,SAAH,CAAaF,MAAb,CAAN,CAfS,CAgBT;;AACA,YAAMX,mBAAGc,SAAH,CAAaJ,UAAb,EAAyBH,MAAzB,CAAN;AACD;;AACD,WAAO,IAAP;AACD,GAvBD,CADI,CAAN;AA0BD","sourcesContent":["import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport { generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n SplashScreenConfig,\n} from './getAndroidSplashConfig';\n\ntype DRAWABLE_SIZE = 'default' | 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype THEME = 'light' | 'dark';\n\nconst IMAGE_CACHE_NAME = 'splash-android';\nconst SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';\nconst DRAWABLES_CONFIGS: {\n [key in DRAWABLE_SIZE]: {\n modes: {\n [key in THEME]: {\n path: string;\n };\n };\n dimensionsMultiplier: number;\n };\n} = {\n default: {\n modes: {\n light: {\n path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n mdpi: {\n modes: {\n light: {\n path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n hdpi: {\n modes: {\n light: {\n path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1.5,\n },\n xhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 2,\n },\n xxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 3,\n },\n xxxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 4,\n },\n};\n\nexport const withAndroidSplashImages: ConfigPlugin = config => {\n return withDangerousMod(config, [\n 'android',\n async config => {\n await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\n/**\n * Deletes all previous splash_screen_images and copies new one to desired drawable directory.\n * If path isn't provided then no new image is placed in drawable directories.\n * @see https://developer.android.com/training/multiscreen/screendensities\n *\n * @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.\n */\nexport async function setSplashImageDrawablesAsync(\n config: Pick<ExpoConfig, 'android' | 'splash'>,\n projectRoot: string\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config);\n const darkSplash = getAndroidDarkSplashConfig(config);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot),\n ]);\n}\n\nasync function clearAllExistingSplashImagesAsync(projectRoot: string) {\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n Object.values(DRAWABLES_CONFIGS).map(async ({ modes }) => {\n await Promise.all(\n Object.values(modes).map(async ({ path: filePath }) => {\n if (await fs.pathExists(path.resolve(androidMainPath, filePath))) {\n await fs.remove(path.resolve(androidMainPath, filePath));\n }\n })\n );\n })\n );\n}\n\nexport async function setSplashImageDrawablesForThemeAsync(\n config: SplashScreenConfig | null,\n theme: 'dark' | 'light',\n projectRoot: string\n) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'].map(async imageKey => {\n // @ts-ignore\n const image = config[imageKey];\n if (image) {\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: image,\n } as any);\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n // @ts-ignore\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n // Ensure directory exists.\n const folder = path.dirname(outputPath);\n await fs.ensureDir(folder);\n // Write image buffer to the file system.\n await fs.writeFile(outputPath, source);\n }\n return null;\n })\n );\n}\n"],"file":"withAndroidSplashImages.js"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.removeOldSplashStyleGroup = removeOldSplashStyleGroup;
|
|
7
6
|
exports.getSplashBackgroundColor = getSplashBackgroundColor;
|
|
8
7
|
exports.getSplashDarkBackgroundColor = getSplashDarkBackgroundColor;
|
|
9
|
-
exports.
|
|
8
|
+
exports.removeOldSplashStyleGroup = removeOldSplashStyleGroup;
|
|
10
9
|
exports.setSplashColorsForTheme = setSplashColorsForTheme;
|
|
10
|
+
exports.setSplashStylesForTheme = setSplashStylesForTheme;
|
|
11
11
|
exports.withAndroidSplashStyles = void 0;
|
|
12
12
|
|
|
13
13
|
function _configPlugins() {
|
|
@@ -16,6 +16,16 @@ function _configPlugins() {
|
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
function _imageUtils() {
|
|
20
|
+
const data = require("@expo/image-utils");
|
|
21
|
+
|
|
22
|
+
_imageUtils = function () {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
function _debug() {
|
|
20
30
|
const data = _interopRequireDefault(require("debug"));
|
|
21
31
|
|
|
@@ -74,6 +84,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
74
84
|
|
|
75
85
|
// @ts-ignore
|
|
76
86
|
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios:assets');
|
|
87
|
+
const IMAGE_CACHE_NAME = 'splash-ios';
|
|
77
88
|
const IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';
|
|
78
89
|
const BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';
|
|
79
90
|
const PNG_FILENAME = 'image.png';
|
|
@@ -89,14 +100,15 @@ const withIosSplashAssets = (config, splash) => {
|
|
|
89
100
|
return (0, _configPlugins().withDangerousMod)(config, ['ios', async config => {
|
|
90
101
|
var _splash$dark, _splash$dark2;
|
|
91
102
|
|
|
92
|
-
const
|
|
103
|
+
const iosNamedProjectRoot = _configPlugins().IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);
|
|
93
104
|
|
|
94
105
|
await createSplashScreenBackgroundImageAsync({
|
|
95
|
-
iosNamedProjectRoot
|
|
106
|
+
iosNamedProjectRoot,
|
|
96
107
|
splash
|
|
97
108
|
});
|
|
98
109
|
await configureImageAssets({
|
|
99
|
-
|
|
110
|
+
projectRoot: config.modRequest.projectRoot,
|
|
111
|
+
iosNamedProjectRoot,
|
|
100
112
|
image: splash.image,
|
|
101
113
|
darkImage: (_splash$dark = splash.dark) === null || _splash$dark === void 0 ? void 0 : _splash$dark.image,
|
|
102
114
|
tabletImage: splash.tabletImage,
|
|
@@ -113,13 +125,14 @@ const withIosSplashAssets = (config, splash) => {
|
|
|
113
125
|
exports.withIosSplashAssets = withIosSplashAssets;
|
|
114
126
|
|
|
115
127
|
async function configureImageAssets({
|
|
116
|
-
|
|
128
|
+
projectRoot,
|
|
129
|
+
iosNamedProjectRoot,
|
|
117
130
|
image,
|
|
118
131
|
darkImage,
|
|
119
132
|
tabletImage,
|
|
120
133
|
darkTabletImage
|
|
121
134
|
}) {
|
|
122
|
-
const imageSetPath = path().resolve(
|
|
135
|
+
const imageSetPath = path().resolve(iosNamedProjectRoot, IMAGESET_PATH); // ensure old SplashScreen imageSet is removed
|
|
123
136
|
|
|
124
137
|
await _fsExtra().default.remove(imageSetPath);
|
|
125
138
|
|
|
@@ -135,7 +148,8 @@ async function configureImageAssets({
|
|
|
135
148
|
darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null
|
|
136
149
|
});
|
|
137
150
|
await copyImageFiles({
|
|
138
|
-
|
|
151
|
+
projectRoot,
|
|
152
|
+
iosNamedProjectRoot,
|
|
139
153
|
image,
|
|
140
154
|
darkImage,
|
|
141
155
|
tabletImage,
|
|
@@ -149,7 +163,7 @@ async function createPngFileAsync(color, filePath) {
|
|
|
149
163
|
}
|
|
150
164
|
|
|
151
165
|
async function createBackgroundImagesAsync({
|
|
152
|
-
|
|
166
|
+
iosNamedProjectRoot,
|
|
153
167
|
color,
|
|
154
168
|
darkColor,
|
|
155
169
|
tabletColor,
|
|
@@ -157,7 +171,7 @@ async function createBackgroundImagesAsync({
|
|
|
157
171
|
}) {
|
|
158
172
|
await generateImagesAssetsAsync({
|
|
159
173
|
async generateImageAsset(item, fileName) {
|
|
160
|
-
await createPngFileAsync(item, path().resolve(
|
|
174
|
+
await createPngFileAsync(item, path().resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH, fileName));
|
|
161
175
|
},
|
|
162
176
|
|
|
163
177
|
anyItem: color,
|
|
@@ -168,7 +182,8 @@ async function createBackgroundImagesAsync({
|
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
async function copyImageFiles({
|
|
171
|
-
|
|
185
|
+
projectRoot,
|
|
186
|
+
iosNamedProjectRoot,
|
|
172
187
|
image,
|
|
173
188
|
darkImage,
|
|
174
189
|
tabletImage,
|
|
@@ -176,7 +191,19 @@ async function copyImageFiles({
|
|
|
176
191
|
}) {
|
|
177
192
|
await generateImagesAssetsAsync({
|
|
178
193
|
async generateImageAsset(item, fileName) {
|
|
179
|
-
|
|
194
|
+
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
|
195
|
+
// this method also supports remote URLs and using the global sharp instance.
|
|
196
|
+
const {
|
|
197
|
+
source
|
|
198
|
+
} = await (0, _imageUtils().generateImageAsync)({
|
|
199
|
+
projectRoot,
|
|
200
|
+
cacheType: IMAGE_CACHE_NAME
|
|
201
|
+
}, {
|
|
202
|
+
src: item
|
|
203
|
+
}); // Write image buffer to the file system.
|
|
204
|
+
// const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);
|
|
205
|
+
|
|
206
|
+
await _fsExtra().default.writeFile(path().resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);
|
|
180
207
|
},
|
|
181
208
|
|
|
182
209
|
anyItem: image,
|
|
@@ -212,7 +239,7 @@ async function createSplashScreenBackgroundImageAsync({
|
|
|
212
239
|
await _fsExtra().default.remove(imagesetPath);
|
|
213
240
|
await _fsExtra().default.ensureDir(imagesetPath);
|
|
214
241
|
await createBackgroundImagesAsync({
|
|
215
|
-
|
|
242
|
+
iosNamedProjectRoot,
|
|
216
243
|
color,
|
|
217
244
|
darkColor: darkColor ? darkColor : null,
|
|
218
245
|
tabletColor: tabletColor ? tabletColor : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"names":["debug","IMAGESET_PATH","BACKGROUND_IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","projectPath","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","createSplashScreenBackgroundImageAsync","iosNamedProjectRoot","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","createPngFileAsync","color","filePath","png","Jimp","writeAsync","createBackgroundImagesAsync","darkColor","tabletColor","darkTabletColor","generateImagesAssetsAsync","generateImageAsset","item","fileName","anyItem","darkItem","tabletItem","darkTabletItem","copyFile","items","filter","Promise","all","map","backgroundColor","tabletBackgroundColor","imagesetPath","join","ensureDir","darkAppearances","appearance","value","buildContentsJsonImages","idiom","filename","scale","appearances","undefined","Boolean","images"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAJA;AAYA,MAAMA,KAAK,GAAG,sBAAM,oDAAN,CAAd;AAEA,MAAMC,aAAa,GAAG,uCAAtB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AAA,KAAK,EAAE,MADc;AAErBG,IAAAA,WAAW,EAAEP,eAFQ;AAGrBK,IAAAA,QAAQ,EAAE3C,eAAF,aAAEA,eAAF,cAAEA,eAAF,GAAqB8C,SAHR;AAIrBF,IAAAA,KAAK,EAAE;AAJc,GAAvB,CAjDG,EAuDL5C,eAAe,IACb,6CAAuB;AACrB0C,IAAAA,KAAK,EAAE,MADc;AAErBG,IAAAA,WAAW,EAAEP,eAFQ;AAGrBM,IAAAA,KAAK,EAAE;AAHc,GAAvB,CAxDG,EA6DLf,MA7DK,CA6DEkB,OA7DF,CAAP;AA8DD;;AAED,eAAezC,0BAAf,CAA0C;AACxCC,EAAAA,SADwC;AAExCX,EAAAA,KAFwC;AAGxCC,EAAAA,SAHwC;AAIxCE,EAAAA,WAJwC;AAKxCC,EAAAA;AALwC,CAA1C,EAYG;AACD,QAAMgD,MAAM,GAAGP,uBAAuB,CAAC;AAAE7C,IAAAA,KAAF;AAASC,IAAAA,SAAT;AAAoBE,IAAAA,WAApB;AAAiCC,IAAAA;AAAjC,GAAD,CAAtC;AAEAvB,EAAAA,KAAK,CAAE,uBAAF,EAA0B8B,SAA1B,CAAL;AACA9B,EAAAA,KAAK,CAAE,aAAF,EAAgBuE,MAAhB,CAAL;AACA,QAAM,6CAAuBzC,SAAvB,EAAkC;AAAEyC,IAAAA;AAAF,GAAlC,CAAN;AACD","sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport Jimp from 'jimp-compact';\nimport * as path from 'path';\n\nimport {\n ContentsJsonImage,\n ContentsJsonImageAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\nimport { IOSSplashConfig } from './getIosSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';\nconst BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';\nconst PNG_FILENAME = 'image.png';\nconst DARK_PNG_FILENAME = 'dark_image.png';\nconst TABLET_PNG_FILENAME = 'tablet_image.png';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image.png';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const projectPath = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot: projectPath,\n splash,\n });\n\n await configureImageAssets({\n projectPath,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectPath: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n}) {\n const imageSetPath = path.resolve(projectPath, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({ projectPath, image, darkImage, tabletImage, darkTabletImage });\n}\n\nasync function createPngFileAsync(color: string, filePath: string) {\n const png = new Jimp(1, 1, color);\n return png.writeAsync(filePath);\n}\n\nasync function createBackgroundImagesAsync({\n projectPath,\n color,\n darkColor,\n tabletColor,\n darkTabletColor,\n}: {\n projectPath: string;\n color: string;\n darkColor: string | null;\n tabletColor: string | null;\n darkTabletColor: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n await createPngFileAsync(item, path.resolve(projectPath, BACKGROUND_IMAGESET_PATH, fileName));\n },\n anyItem: color,\n darkItem: darkColor,\n tabletItem: tabletColor,\n darkTabletItem: darkTabletColor,\n });\n}\n\nasync function copyImageFiles({\n projectPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectPath: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n await fs.copyFile(item, path.resolve(projectPath, IMAGESET_PATH, fileName));\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = ([\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown) as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nasync function createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot,\n splash,\n}: {\n // Something like projectRoot/ios/MyApp/\n iosNamedProjectRoot: string;\n splash: IOSSplashConfig;\n}) {\n const color = splash.backgroundColor;\n const darkColor = splash.dark?.backgroundColor;\n const tabletColor = splash.tabletBackgroundColor;\n const darkTabletColor = splash.dark?.tabletBackgroundColor;\n\n const imagesetPath = path.join(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH);\n // Ensure the Images.xcassets/... path exists\n await fs.remove(imagesetPath);\n await fs.ensureDir(imagesetPath);\n\n await createBackgroundImagesAsync({\n projectPath: iosNamedProjectRoot,\n color,\n darkColor: darkColor ? darkColor : null,\n tabletColor: tabletColor ? tabletColor : null,\n darkTabletColor: darkTabletColor ? darkTabletColor : null,\n });\n\n await writeContentsJsonFileAsync({\n assetPath: path.resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH),\n image: PNG_FILENAME,\n darkImage: darkColor ? DARK_PNG_FILENAME : null,\n tabletImage: tabletColor ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletColor ? DARK_TABLET_PNG_FILENAME : null,\n });\n}\n\nconst darkAppearances: ContentsJsonImageAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonImageAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: image,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n filename: darkImage,\n scale: '1x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: tabletImage,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: darkTabletImage ?? undefined,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"file":"withIosSplashAssets.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"names":["debug","IMAGE_CACHE_NAME","IMAGESET_PATH","BACKGROUND_IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","createSplashScreenBackgroundImageAsync","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","createPngFileAsync","color","filePath","png","Jimp","writeAsync","createBackgroundImagesAsync","darkColor","tabletColor","darkTabletColor","generateImagesAssetsAsync","generateImageAsset","item","fileName","anyItem","darkItem","tabletItem","darkTabletItem","source","cacheType","src","writeFile","items","filter","Promise","all","map","backgroundColor","tabletBackgroundColor","imagesetPath","join","ensureDir","darkAppearances","appearance","value","buildContentsJsonImages","idiom","filename","scale","appearances","undefined","Boolean","images"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AA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B,EAAAA,KAAK,CAAE,uBAAF,EAA0B8B,SAA1B,CAAL;AACA9B,EAAAA,KAAK,CAAE,aAAF,EAAgB0E,MAAhB,CAAL;AACA,QAAM,6CAAuB5C,SAAvB,EAAkC;AAAE4C,IAAAA;AAAF,GAAlC,CAAN;AACD","sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport { generateImageAsync } from '@expo/image-utils';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport Jimp from 'jimp-compact';\nimport * as path from 'path';\n\nimport {\n ContentsJsonImage,\n ContentsJsonImageAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\nimport { IOSSplashConfig } from './getIosSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGE_CACHE_NAME = 'splash-ios';\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';\nconst BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';\nconst PNG_FILENAME = 'image.png';\nconst DARK_PNG_FILENAME = 'dark_image.png';\nconst TABLET_PNG_FILENAME = 'tablet_image.png';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image.png';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot,\n splash,\n });\n\n await configureImageAssets({\n projectRoot: config.modRequest.projectRoot,\n iosNamedProjectRoot,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n}) {\n const imageSetPath = path.resolve(iosNamedProjectRoot, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n });\n}\n\nasync function createPngFileAsync(color: string, filePath: string) {\n const png = new Jimp(1, 1, color);\n return png.writeAsync(filePath);\n}\n\nasync function createBackgroundImagesAsync({\n iosNamedProjectRoot,\n color,\n darkColor,\n tabletColor,\n darkTabletColor,\n}: {\n iosNamedProjectRoot: string;\n color: string;\n darkColor: string | null;\n tabletColor: string | null;\n darkTabletColor: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n await createPngFileAsync(\n item,\n path.resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH, fileName)\n );\n },\n anyItem: color,\n darkItem: darkColor,\n tabletItem: tabletColor,\n darkTabletItem: darkTabletColor,\n });\n}\n\nasync function copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: item,\n } as any);\n // Write image buffer to the file system.\n // const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);\n await fs.writeFile(path.resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = ([\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown) as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nasync function createSplashScreenBackgroundImageAsync({\n iosNamedProjectRoot,\n splash,\n}: {\n // Something like projectRoot/ios/MyApp/\n iosNamedProjectRoot: string;\n splash: IOSSplashConfig;\n}) {\n const color = splash.backgroundColor;\n const darkColor = splash.dark?.backgroundColor;\n const tabletColor = splash.tabletBackgroundColor;\n const darkTabletColor = splash.dark?.tabletBackgroundColor;\n\n const imagesetPath = path.join(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH);\n // Ensure the Images.xcassets/... path exists\n await fs.remove(imagesetPath);\n await fs.ensureDir(imagesetPath);\n\n await createBackgroundImagesAsync({\n iosNamedProjectRoot,\n color,\n darkColor: darkColor ? darkColor : null,\n tabletColor: tabletColor ? tabletColor : null,\n darkTabletColor: darkTabletColor ? darkTabletColor : null,\n });\n\n await writeContentsJsonFileAsync({\n assetPath: path.resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH),\n image: PNG_FILENAME,\n darkImage: darkColor ? DARK_PNG_FILENAME : null,\n tabletImage: tabletColor ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletColor ? DARK_TABLET_PNG_FILENAME : null,\n });\n}\n\nconst darkAppearances: ContentsJsonImageAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonImageAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: image,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n filename: darkImage,\n scale: '1x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: tabletImage,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: darkTabletImage ?? undefined,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"file":"withIosSplashAssets.js"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _createLegacyPlugin() {
|
|
9
|
+
const data = require("../createLegacyPlugin");
|
|
10
|
+
|
|
11
|
+
_createLegacyPlugin = function () {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _withAndroidRootViewBackgroundColor() {
|
|
19
|
+
const data = require("./withAndroidRootViewBackgroundColor");
|
|
20
|
+
|
|
21
|
+
_withAndroidRootViewBackgroundColor = function () {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _withAndroidUserInterfaceStyle() {
|
|
29
|
+
const data = require("./withAndroidUserInterfaceStyle");
|
|
30
|
+
|
|
31
|
+
_withAndroidUserInterfaceStyle = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _withIosRootViewBackgroundColor() {
|
|
39
|
+
const data = require("./withIosRootViewBackgroundColor");
|
|
40
|
+
|
|
41
|
+
_withIosRootViewBackgroundColor = function () {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _withIosUserInterfaceStyle() {
|
|
49
|
+
const data = require("./withIosUserInterfaceStyle");
|
|
50
|
+
|
|
51
|
+
_withIosUserInterfaceStyle = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var _default = (0, _createLegacyPlugin().createLegacyPlugin)({
|
|
59
|
+
packageName: 'expo-system-ui',
|
|
60
|
+
fallback: [_withAndroidRootViewBackgroundColor().withAndroidRootViewBackgroundColor, _withIosRootViewBackgroundColor().withIosRootViewBackgroundColor, _withAndroidUserInterfaceStyle().withAndroidUserInterfaceStyle, _withIosUserInterfaceStyle().withIosUserInterfaceStyle]
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
exports.default = _default;
|
|
64
|
+
//# sourceMappingURL=expo-system-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-system-ui/expo-system-ui.ts"],"names":["packageName","fallback","withAndroidRootViewBackgroundColor","withIosRootViewBackgroundColor","withAndroidUserInterfaceStyle","withIosUserInterfaceStyle"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAEe,8CAAmB;AAChCA,EAAAA,WAAW,EAAE,gBADmB;AAEhCC,EAAAA,QAAQ,EAAE,CACRC,wEADQ,EAERC,gEAFQ,EAGRC,8DAHQ,EAIRC,sDAJQ;AAFsB,CAAnB,C","sourcesContent":["import { createLegacyPlugin } from '../createLegacyPlugin';\nimport { withAndroidRootViewBackgroundColor } from './withAndroidRootViewBackgroundColor';\nimport { withAndroidUserInterfaceStyle } from './withAndroidUserInterfaceStyle';\nimport { withIosRootViewBackgroundColor } from './withIosRootViewBackgroundColor';\nimport { withIosUserInterfaceStyle } from './withIosUserInterfaceStyle';\n\nexport default createLegacyPlugin({\n packageName: 'expo-system-ui',\n fallback: [\n withAndroidRootViewBackgroundColor,\n withIosRootViewBackgroundColor,\n withAndroidUserInterfaceStyle,\n withIosUserInterfaceStyle,\n ],\n});\n"],"file":"expo-system-ui.js"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { ExpoConfig } from '@expo/config-types';
|
|
3
|
+
export declare const withAndroidRootViewBackgroundColor: ConfigPlugin;
|
|
4
|
+
export declare const withRootViewBackgroundColorColors: ConfigPlugin;
|
|
5
|
+
export declare const withRootViewBackgroundColorStyles: ConfigPlugin;
|
|
6
|
+
export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'android' | 'backgroundColor'>): string | null;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
|
|
7
|
+
exports.withRootViewBackgroundColorStyles = exports.withRootViewBackgroundColorColors = exports.withAndroidRootViewBackgroundColor = void 0;
|
|
8
|
+
|
|
9
|
+
function _configPlugins() {
|
|
10
|
+
const data = require("@expo/config-plugins");
|
|
11
|
+
|
|
12
|
+
_configPlugins = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
assignColorValue
|
|
21
|
+
} = _configPlugins().AndroidConfig.Colors;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
assignStylesValue,
|
|
25
|
+
getAppThemeLightNoActionBarGroup
|
|
26
|
+
} = _configPlugins().AndroidConfig.Styles;
|
|
27
|
+
|
|
28
|
+
const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
|
|
29
|
+
const WINDOW_BACKGROUND_COLOR = 'activityBackground';
|
|
30
|
+
|
|
31
|
+
const withAndroidRootViewBackgroundColor = config => {
|
|
32
|
+
config = withRootViewBackgroundColorColors(config);
|
|
33
|
+
config = withRootViewBackgroundColorStyles(config);
|
|
34
|
+
return config;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.withAndroidRootViewBackgroundColor = withAndroidRootViewBackgroundColor;
|
|
38
|
+
|
|
39
|
+
const withRootViewBackgroundColorColors = config => {
|
|
40
|
+
return (0, _configPlugins().withAndroidColors)(config, async config => {
|
|
41
|
+
config.modResults = assignColorValue(config.modResults, {
|
|
42
|
+
value: getRootViewBackgroundColor(config),
|
|
43
|
+
name: WINDOW_BACKGROUND_COLOR
|
|
44
|
+
});
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
|
|
50
|
+
|
|
51
|
+
const withRootViewBackgroundColorStyles = config => {
|
|
52
|
+
return (0, _configPlugins().withAndroidStyles)(config, async config => {
|
|
53
|
+
config.modResults = assignStylesValue(config.modResults, {
|
|
54
|
+
add: !!getRootViewBackgroundColor(config),
|
|
55
|
+
parent: getAppThemeLightNoActionBarGroup(),
|
|
56
|
+
name: ANDROID_WINDOW_BACKGROUND,
|
|
57
|
+
value: `@color/${WINDOW_BACKGROUND_COLOR}`
|
|
58
|
+
});
|
|
59
|
+
return config;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.withRootViewBackgroundColorStyles = withRootViewBackgroundColorStyles;
|
|
64
|
+
|
|
65
|
+
function getRootViewBackgroundColor(config) {
|
|
66
|
+
var _config$android;
|
|
67
|
+
|
|
68
|
+
return ((_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.backgroundColor) || config.backgroundColor || null;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=withAndroidRootViewBackgroundColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.ts"],"names":["assignColorValue","AndroidConfig","Colors","assignStylesValue","getAppThemeLightNoActionBarGroup","Styles","ANDROID_WINDOW_BACKGROUND","WINDOW_BACKGROUND_COLOR","withAndroidRootViewBackgroundColor","config","withRootViewBackgroundColorColors","withRootViewBackgroundColorStyles","modResults","value","getRootViewBackgroundColor","name","add","parent","android","backgroundColor"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAuBC,+BAAcC,MAA3C;;AACA,MAAM;AAAEC,EAAAA,iBAAF;AAAqBC,EAAAA;AAArB,IAA0DH,+BAAcI,MAA9E;;AAEA,MAAMC,yBAAyB,GAAG,0BAAlC;AACA,MAAMC,uBAAuB,GAAG,oBAAhC;;AAEO,MAAMC,kCAAgD,GAAGC,MAAM,IAAI;AACxEA,EAAAA,MAAM,GAAGC,iCAAiC,CAACD,MAAD,CAA1C;AACAA,EAAAA,MAAM,GAAGE,iCAAiC,CAACF,MAAD,CAA1C;AACA,SAAOA,MAAP;AACD,CAJM;;;;AAMA,MAAMC,iCAA+C,GAAGD,MAAM,IAAI;AACvE,SAAO,wCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoBZ,gBAAgB,CAACS,MAAM,CAACG,UAAR,EAAoB;AACtDC,MAAAA,KAAK,EAAEC,0BAA0B,CAACL,MAAD,CADqB;AAEtDM,MAAAA,IAAI,EAAER;AAFgD,KAApB,CAApC;AAIA,WAAOE,MAAP;AACD,GANM,CAAP;AAOD,CARM;;;;AAUA,MAAME,iCAA+C,GAAGF,MAAM,IAAI;AACvE,SAAO,wCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoBT,iBAAiB,CAACM,MAAM,CAACG,UAAR,EAAoB;AACvDI,MAAAA,GAAG,EAAE,CAAC,CAACF,0BAA0B,CAACL,MAAD,CADsB;AAEvDQ,MAAAA,MAAM,EAAEb,gCAAgC,EAFe;AAGvDW,MAAAA,IAAI,EAAET,yBAHiD;AAIvDO,MAAAA,KAAK,EAAG,UAASN,uBAAwB;AAJc,KAApB,CAArC;AAMA,WAAOE,MAAP;AACD,GARM,CAAP;AASD,CAVM;;;;AAYA,SAASK,0BAAT,CACLL,MADK,EAEL;AAAA;;AACA,SAAO,oBAAAA,MAAM,CAACS,OAAP,oEAAgBC,eAAhB,KAAmCV,MAAM,CAACU,eAA1C,IAA6D,IAApE;AACD","sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withAndroidStyles,\n} from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nconst { assignColorValue } = AndroidConfig.Colors;\nconst { assignStylesValue, getAppThemeLightNoActionBarGroup } = AndroidConfig.Styles;\n\nconst ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';\nconst WINDOW_BACKGROUND_COLOR = 'activityBackground';\n\nexport const withAndroidRootViewBackgroundColor: ConfigPlugin = config => {\n config = withRootViewBackgroundColorColors(config);\n config = withRootViewBackgroundColorStyles(config);\n return config;\n};\n\nexport const withRootViewBackgroundColorColors: ConfigPlugin = config => {\n return withAndroidColors(config, async config => {\n config.modResults = assignColorValue(config.modResults, {\n value: getRootViewBackgroundColor(config),\n name: WINDOW_BACKGROUND_COLOR,\n });\n return config;\n });\n};\n\nexport const withRootViewBackgroundColorStyles: ConfigPlugin = config => {\n return withAndroidStyles(config, async config => {\n config.modResults = assignStylesValue(config.modResults, {\n add: !!getRootViewBackgroundColor(config),\n parent: getAppThemeLightNoActionBarGroup(),\n name: ANDROID_WINDOW_BACKGROUND,\n value: `@color/${WINDOW_BACKGROUND_COLOR}`,\n });\n return config;\n });\n};\n\nexport function getRootViewBackgroundColor(\n config: Pick<ExpoConfig, 'android' | 'backgroundColor'>\n) {\n return config.android?.backgroundColor || config.backgroundColor || null;\n}\n"],"file":"withAndroidRootViewBackgroundColor.js"}
|