expo-invoke 2.6.15 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/expo/modules/invoke/ExpoInvokeModule.kt +35 -0
- package/android/src/main/java/expo/modules/invoke/InvokeSliceProvider.kt +9 -0
- package/build/plugin/codegen/generateSwiftIntents.js +22 -0
- package/build/plugin/codegen/generateSwiftIntents.js.map +1 -1
- package/build/plugin/codegen/generateSwiftLiveActivities.d.ts +17 -0
- package/build/plugin/codegen/generateSwiftLiveActivities.js +165 -0
- package/build/plugin/codegen/generateSwiftLiveActivities.js.map +1 -0
- package/build/plugin/codegen/generateSwiftWidget.d.ts +5 -0
- package/build/plugin/codegen/generateSwiftWidget.js.map +1 -1
- package/build/plugin/ios/widgets/withAppGroupEntitlements.d.ts +6 -0
- package/build/plugin/ios/widgets/withAppGroupEntitlements.js +27 -0
- package/build/plugin/ios/widgets/withAppGroupEntitlements.js.map +1 -0
- package/build/plugin/ios/widgets/withAppInfoPlist.d.ts +7 -0
- package/build/plugin/ios/widgets/withAppInfoPlist.js +12 -0
- package/build/plugin/ios/widgets/withAppInfoPlist.js.map +1 -0
- package/build/plugin/ios/widgets/withEasConfig.d.ts +8 -0
- package/build/plugin/ios/widgets/withEasConfig.js +52 -0
- package/build/plugin/ios/widgets/withEasConfig.js.map +1 -0
- package/build/plugin/ios/widgets/withIosWarning.d.ts +7 -0
- package/build/plugin/ios/widgets/withIosWarning.js +10 -0
- package/build/plugin/ios/widgets/withIosWarning.js.map +1 -0
- package/build/plugin/ios/widgets/withIosWidgets.d.ts +11 -0
- package/build/plugin/ios/widgets/withIosWidgets.js +83 -0
- package/build/plugin/ios/widgets/withIosWidgets.js.map +1 -0
- package/build/plugin/ios/widgets/withPodsLinking.d.ts +6 -0
- package/build/plugin/ios/widgets/withPodsLinking.js +102 -0
- package/build/plugin/ios/widgets/withPodsLinking.js.map +1 -0
- package/build/plugin/ios/widgets/withPushNotifications.d.ts +6 -0
- package/build/plugin/ios/widgets/withPushNotifications.js +12 -0
- package/build/plugin/ios/widgets/withPushNotifications.js.map +1 -0
- package/build/plugin/ios/widgets/withWidgetSourceFiles.d.ts +10 -0
- package/build/plugin/ios/widgets/withWidgetSourceFiles.js +379 -0
- package/build/plugin/ios/widgets/withWidgetSourceFiles.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addBuildPhases.d.ts +12 -0
- package/build/plugin/ios/widgets/xcode/addBuildPhases.js +41 -0
- package/build/plugin/ios/widgets/xcode/addBuildPhases.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addPbxGroup.d.ts +5 -0
- package/build/plugin/ios/widgets/xcode/addPbxGroup.js +20 -0
- package/build/plugin/ios/widgets/xcode/addPbxGroup.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addProductFile.d.ts +7 -0
- package/build/plugin/ios/widgets/xcode/addProductFile.js +41 -0
- package/build/plugin/ios/widgets/xcode/addProductFile.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addTargetDependency.d.ts +4 -0
- package/build/plugin/ios/widgets/xcode/addTargetDependency.js +17 -0
- package/build/plugin/ios/widgets/xcode/addTargetDependency.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addToPbxNativeTargetSection.d.ts +14 -0
- package/build/plugin/ios/widgets/xcode/addToPbxNativeTargetSection.js +29 -0
- package/build/plugin/ios/widgets/xcode/addToPbxNativeTargetSection.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addToPbxProjectSection.d.ts +4 -0
- package/build/plugin/ios/widgets/xcode/addToPbxProjectSection.js +20 -0
- package/build/plugin/ios/widgets/xcode/addToPbxProjectSection.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/addXCConfigurationList.d.ts +11 -0
- package/build/plugin/ios/widgets/xcode/addXCConfigurationList.js +37 -0
- package/build/plugin/ios/widgets/xcode/addXCConfigurationList.js.map +1 -0
- package/build/plugin/ios/widgets/xcode/withTargetXcodeProject.d.ts +10 -0
- package/build/plugin/ios/widgets/xcode/withTargetXcodeProject.js +86 -0
- package/build/plugin/ios/widgets/xcode/withTargetXcodeProject.js.map +1 -0
- package/build/plugin/ios/withIOSInvoke.d.ts +6 -15
- package/build/plugin/ios/withIOSInvoke.js +54 -25
- package/build/plugin/ios/withIOSInvoke.js.map +1 -1
- package/build/plugin/ios/withWidgetExtension.d.ts +5 -0
- package/build/plugin/ios/withWidgetExtension.js +5 -0
- package/build/plugin/ios/withWidgetExtension.js.map +1 -1
- package/build/plugin/src/withInvoke.d.ts +34 -23
- package/build/plugin/src/withInvoke.js +16 -27
- package/build/plugin/src/withInvoke.js.map +1 -1
- package/build/plugin/types/WidgetConfig.type.d.ts +54 -0
- package/build/plugin/types/WidgetConfig.type.js +3 -0
- package/build/plugin/types/WidgetConfig.type.js.map +1 -0
- package/build/plugin/types/WidgetFamily.type.d.ts +10 -0
- package/build/plugin/types/WidgetFamily.type.js +13 -0
- package/build/plugin/types/WidgetFamily.type.js.map +1 -0
- package/build/src/hooks/useLiveActivity.d.ts +20 -10
- package/build/src/hooks/useLiveActivity.d.ts.map +1 -1
- package/build/src/hooks/useLiveActivity.js +20 -10
- package/build/src/hooks/useLiveActivity.js.map +1 -1
- package/build/src/index.d.ts +2 -0
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +5 -0
- package/build/src/index.js.map +1 -1
- package/build/src/module.d.ts +4 -0
- package/build/src/module.d.ts.map +1 -1
- package/build/src/module.js +8 -0
- package/build/src/module.js.map +1 -1
- package/build/src/web/index.d.ts +10 -1
- package/build/src/web/index.d.ts.map +1 -1
- package/build/src/web/index.js +4 -0
- package/build/src/web/index.js.map +1 -1
- package/build/src/widgets/ExpoWidgets.d.ts +12 -0
- package/build/src/widgets/ExpoWidgets.d.ts.map +1 -0
- package/build/src/widgets/ExpoWidgets.ios.d.ts +12 -0
- package/build/src/widgets/ExpoWidgets.ios.d.ts.map +1 -0
- package/build/src/widgets/ExpoWidgets.ios.js +3 -0
- package/build/src/widgets/ExpoWidgets.ios.js.map +1 -0
- package/build/src/widgets/ExpoWidgets.js +42 -0
- package/build/src/widgets/ExpoWidgets.js.map +1 -0
- package/build/src/widgets/Widgets.d.ts +119 -0
- package/build/src/widgets/Widgets.d.ts.map +1 -0
- package/build/src/widgets/Widgets.js +158 -0
- package/build/src/widgets/Widgets.js.map +1 -0
- package/build/src/widgets/Widgets.types.d.ts +263 -0
- package/build/src/widgets/Widgets.types.d.ts.map +1 -0
- package/build/src/widgets/Widgets.types.js +2 -0
- package/build/src/widgets/Widgets.types.js.map +1 -0
- package/build/src/widgets/index.d.ts +3 -0
- package/build/src/widgets/index.d.ts.map +1 -0
- package/build/src/widgets/index.js +2 -0
- package/build/src/widgets/index.js.map +1 -0
- package/bundle/__tests__/decorator.test.ts +89 -0
- package/bundle/decorator.ts +61 -0
- package/bundle/expo-modules-core-stub.ts +1 -0
- package/bundle/expo-stub.ts +15 -0
- package/bundle/index.ts +69 -0
- package/bundle/jsx-runtime-stub.ts +71 -0
- package/bundle/react-native-stub.ts +3 -0
- package/bundle/react-stub.ts +13 -0
- package/expo-module.config.json +1 -1
- package/ios/LiveActivity/LiveActivityManager.swift +15 -14
- package/ios/Module/ExpoInvokeModule.swift +124 -0
- package/ios/Widget/WidgetManager.swift +25 -8
- package/ios/Widgets/LiveActivity.swift +81 -0
- package/ios/Widgets/LiveActivityFactory.swift +49 -0
- package/ios/Widgets/Widget/AppIntent.swift +130 -0
- package/ios/Widgets/Widget/Buttons.swift +62 -0
- package/ios/Widgets/Widget/DynamicView.swift +161 -0
- package/ios/Widgets/Widget/EntryView.swift +36 -0
- package/ios/Widgets/Widget/Fragment.swift +13 -0
- package/ios/Widgets/Widget/LiveActivityBanner.swift +19 -0
- package/ios/Widgets/Widget/RedBoxView.swift +83 -0
- package/ios/Widgets/Widget/TimelineEntry.swift +8 -0
- package/ios/Widgets/Widget/TimelineProvider.swift +45 -0
- package/ios/Widgets/Widget/Type.swift +6 -0
- package/ios/Widgets/Widget/Utils.swift +116 -0
- package/ios/Widgets/Widget/WidgetLiveActivity.swift +104 -0
- package/ios/Widgets/Widget/WidgetsJSRuntime.swift +148 -0
- package/ios/Widgets/WidgetObject.swift +31 -0
- package/ios/Widgets/WidgetsContext.swift +7 -0
- package/ios/Widgets/WidgetsEvents.swift +16 -0
- package/ios/Widgets/WidgetsExceptions.swift +25 -0
- package/ios/Widgets/WidgetsModule.swift +149 -0
- package/ios/Widgets/WidgetsRecords.swift +22 -0
- package/ios/Widgets/WidgetsStorage.swift +58 -0
- package/metro.widget.config.js +76 -0
- package/package.json +11 -1
- package/scripts/autolinking.rb +34 -0
- package/scripts/build-bundle.mjs +69 -0
- package/scripts/with-node.sh +44 -0
- package/scripts/xcode-build-bundle.sh +23 -0
- package/spm.config.json +40 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const { getDefaultConfig } = require('expo/metro-config');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { resolveWorkspaceRoot } = require('resolve-workspace-root');
|
|
4
|
+
|
|
5
|
+
const projectRoot = process.cwd();
|
|
6
|
+
const config = getDefaultConfig(projectRoot);
|
|
7
|
+
|
|
8
|
+
const expoStubPath = path.resolve(__dirname, './bundle/expo-stub.ts');
|
|
9
|
+
const expoModulesCoreStubPath = path.resolve(__dirname, './bundle/expo-modules-core-stub.ts');
|
|
10
|
+
const reactStubPath = path.resolve(__dirname, './bundle/react-stub.ts');
|
|
11
|
+
const reactNativeStubPath = path.resolve(__dirname, './bundle/react-native-stub.ts');
|
|
12
|
+
const jsxRuntimeStubPath = path.resolve(__dirname, './bundle/jsx-runtime-stub.ts');
|
|
13
|
+
|
|
14
|
+
// The `projectRoot` won't be included by default, since we alter it to be `__dirname`
|
|
15
|
+
// to bundle from `expo-widgets` as the main module
|
|
16
|
+
// NOTE: We check the `watchFolders` to start with `projectRoot`, since `expo/metro-config`
|
|
17
|
+
// might add folders if we're in a monorepo
|
|
18
|
+
const watchFolders = config.watchFolders;
|
|
19
|
+
if (!watchFolders.some((entry) => !entry.startsWith(projectRoot))) {
|
|
20
|
+
watchFolders.push(projectRoot);
|
|
21
|
+
}
|
|
22
|
+
// If expo-widgets is outside the user's project (e.g., symlinked, in a different monorepo,
|
|
23
|
+
// or as an installed dependency), add its workspace root so Metro can resolve its dependencies.
|
|
24
|
+
const rel = path.relative(projectRoot, __dirname);
|
|
25
|
+
if (rel.startsWith('..') || path.isAbsolute(rel)) {
|
|
26
|
+
const widgetWorkspaceRoot = resolveWorkspaceRoot(__dirname);
|
|
27
|
+
if (widgetWorkspaceRoot && !watchFolders.includes(widgetWorkspaceRoot)) {
|
|
28
|
+
watchFolders.push(widgetWorkspaceRoot);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const buildConfig = {
|
|
33
|
+
...config,
|
|
34
|
+
projectRoot: __dirname, // Override root to be expo-widgets
|
|
35
|
+
watchFolders,
|
|
36
|
+
resolver: {
|
|
37
|
+
...config.resolver,
|
|
38
|
+
resolveRequest(context, moduleName, platform) {
|
|
39
|
+
const fileSpecifierRe = /^[\\/]|^\.\.?(?:$|[\\/])/i;
|
|
40
|
+
if (fileSpecifierRe.test(moduleName)) {
|
|
41
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
42
|
+
}
|
|
43
|
+
switch (moduleName) {
|
|
44
|
+
case 'expo':
|
|
45
|
+
return { type: 'sourceFile', filePath: expoStubPath };
|
|
46
|
+
case 'expo-modules-core':
|
|
47
|
+
return { type: 'sourceFile', filePath: expoModulesCoreStubPath };
|
|
48
|
+
case 'react':
|
|
49
|
+
return { type: 'sourceFile', filePath: reactStubPath };
|
|
50
|
+
case 'react/jsx-runtime':
|
|
51
|
+
case 'react/jsx-dev-runtime':
|
|
52
|
+
return { type: 'sourceFile', filePath: jsxRuntimeStubPath };
|
|
53
|
+
case 'react-native':
|
|
54
|
+
return { type: 'sourceFile', filePath: reactNativeStubPath };
|
|
55
|
+
case 'react-native-worklets':
|
|
56
|
+
case 'react-native-reanimated':
|
|
57
|
+
return { type: 'empty' };
|
|
58
|
+
default:
|
|
59
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
transformer: {
|
|
64
|
+
...config.transformer,
|
|
65
|
+
enableBabelRCLookup: false,
|
|
66
|
+
getTransformOptions: async () => ({
|
|
67
|
+
transform: { experimentalImportSupport: false, inlineRequires: false },
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
serializer: {
|
|
71
|
+
...config.serializer,
|
|
72
|
+
getPolyfills: () => [],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
module.exports = buildConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-invoke",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "The complete native-surface-to-JS bridge for Expo. One intent config → Siri, Google Assistant, home screen widgets, Dynamic Island, app icon menus, notification actions, NFC, QR, deep links and more — all through a single useInvoke() hook.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"module": "build/src/index.js",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"ios",
|
|
25
25
|
"android/src",
|
|
26
26
|
"android/build.gradle",
|
|
27
|
+
"bundle",
|
|
28
|
+
"scripts",
|
|
29
|
+
"metro.widget.config.js",
|
|
30
|
+
"spm.config.json",
|
|
27
31
|
"expo-module.config.json",
|
|
28
32
|
"README.md",
|
|
29
33
|
"MIGRATION.md",
|
|
@@ -77,6 +81,7 @@
|
|
|
77
81
|
},
|
|
78
82
|
"peerDependencies": {
|
|
79
83
|
"@expo/config-plugins": ">=7.0.0",
|
|
84
|
+
"@expo/ui": ">=56.0.0",
|
|
80
85
|
"expo": ">=50.0.0",
|
|
81
86
|
"expo-modules-core": ">=1.12.0",
|
|
82
87
|
"react": ">=18.0.0",
|
|
@@ -86,6 +91,9 @@
|
|
|
86
91
|
"@expo/config-plugins": {
|
|
87
92
|
"optional": false
|
|
88
93
|
},
|
|
94
|
+
"@expo/ui": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
89
97
|
"expo-modules-core": {
|
|
90
98
|
"optional": true
|
|
91
99
|
},
|
|
@@ -94,6 +102,8 @@
|
|
|
94
102
|
}
|
|
95
103
|
},
|
|
96
104
|
"devDependencies": {
|
|
105
|
+
"@expo/plist": "^0.7.0",
|
|
106
|
+
"@expo/spawn-async": "^1.7.2",
|
|
97
107
|
"@types/jest": "^29.5.14",
|
|
98
108
|
"@types/node": "^20.19.41",
|
|
99
109
|
"@types/react": "^19.2.16",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'pathname'
|
|
3
|
+
require 'colored2' # dependency of CocoaPods
|
|
4
|
+
|
|
5
|
+
require File.join(File.dirname(`node --print "require.resolve('expo-modules-autolinking/package.json', { paths: ['#{__dir__}'] })"`), "scripts/ios/autolinking_manager")
|
|
6
|
+
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
|
|
7
|
+
|
|
8
|
+
def use_expo_modules_widgets!(options = {})
|
|
9
|
+
output = Expo::AutolinkingManager.new(self, @current_target_definition, options).resolve
|
|
10
|
+
|
|
11
|
+
all_packages = output["modules"].map { |mod| mod["packageName"] }
|
|
12
|
+
used_packages = ["expo", "expo-invoke", "@expo/ui"]
|
|
13
|
+
packages_to_exclude = all_packages - used_packages
|
|
14
|
+
|
|
15
|
+
options[:exclude] = packages_to_exclude
|
|
16
|
+
use_expo_modules!(options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def use_expo_native_module!(config_command = $default_command)
|
|
20
|
+
config = list_native_modules!(config_command)
|
|
21
|
+
config[:ios_packages].select! { |package| package[:name] == "expo" }
|
|
22
|
+
|
|
23
|
+
return link_native_modules!(config)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def expo_widgets_post_install(installer)
|
|
27
|
+
installer.pods_project.targets.each do |target|
|
|
28
|
+
if target.name == 'ExpoModulesCore' || target.name == 'ExpoUI' || target.name.start_with?('React-')
|
|
29
|
+
target.build_configurations.each do |config|
|
|
30
|
+
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Build the ExpoWidgets.bundle.
|
|
4
|
+
// Use `yarn build:bundle` to run this script.
|
|
5
|
+
|
|
6
|
+
import spawn from '@expo/spawn-async';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { argv } from 'node:process';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
|
|
13
|
+
// NOTE: Modified from expo-constants/expo-updates entrypoint. We cd into the right folder anyway
|
|
14
|
+
const [, , possibleProjectRoot = process.cwd(), platform = 'ios', bundleOutput] = argv;
|
|
15
|
+
|
|
16
|
+
// TODO: Verify we can remove projectRoot validation, now that we no longer
|
|
17
|
+
// support React Native <= 62
|
|
18
|
+
let projectRoot;
|
|
19
|
+
if (fs.existsSync(path.join(possibleProjectRoot, 'package.json'))) {
|
|
20
|
+
projectRoot = possibleProjectRoot;
|
|
21
|
+
} else if (fs.existsSync(path.join(possibleProjectRoot, '..', 'package.json'))) {
|
|
22
|
+
projectRoot = path.resolve(possibleProjectRoot, '..');
|
|
23
|
+
} else {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Unable to locate project (no package.json found) at path: ${possibleProjectRoot}`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
30
|
+
const __dirname = path.dirname(__filename);
|
|
31
|
+
const require = createRequire(__dirname);
|
|
32
|
+
|
|
33
|
+
// NODE_BINARY is set for Xcode builds via the `with-node.sh` script.
|
|
34
|
+
const nodePath = process.env.NODE_BINARY || 'node';
|
|
35
|
+
const outputDir = path.join(__dirname, '../bundle/build');
|
|
36
|
+
const defaultBundleOutput = path.join(outputDir, 'ExpoWidgets.bundle');
|
|
37
|
+
const appBundlePath = path.resolve(projectRoot, bundleOutput ?? defaultBundleOutput);
|
|
38
|
+
|
|
39
|
+
await fs.promises.rm(appBundlePath, { recursive: true, force: true });
|
|
40
|
+
await fs.promises.mkdir(path.dirname(appBundlePath), { recursive: true });
|
|
41
|
+
|
|
42
|
+
const result = await spawn(
|
|
43
|
+
nodePath,
|
|
44
|
+
[
|
|
45
|
+
require.resolve('expo/bin/cli'),
|
|
46
|
+
'export:embed',
|
|
47
|
+
'--platform',
|
|
48
|
+
platform,
|
|
49
|
+
'--bundle-output',
|
|
50
|
+
appBundlePath,
|
|
51
|
+
'--entry-file',
|
|
52
|
+
path.join(__dirname, '../bundle/index.ts'),
|
|
53
|
+
'--dev',
|
|
54
|
+
'false',
|
|
55
|
+
'--skip-server',
|
|
56
|
+
],
|
|
57
|
+
{
|
|
58
|
+
stdio: 'inherit',
|
|
59
|
+
cwd: projectRoot,
|
|
60
|
+
env: {
|
|
61
|
+
...process.env,
|
|
62
|
+
EXPO_OVERRIDE_METRO_CONFIG: path.join(__dirname, '../metro.widget.config.js'),
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
if (result.error) {
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
# Copyright 2018-present 650 Industries. All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# @generated by expo-module-scripts
|
|
6
|
+
#
|
|
7
|
+
# USAGE:
|
|
8
|
+
# ./with-node.sh command
|
|
9
|
+
|
|
10
|
+
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
11
|
+
|
|
12
|
+
# Start with a default
|
|
13
|
+
NODE_BINARY=$(command -v node)
|
|
14
|
+
export NODE_BINARY
|
|
15
|
+
|
|
16
|
+
# Override the default with the global environment
|
|
17
|
+
ENV_PATH="$PODS_ROOT/../.xcode.env"
|
|
18
|
+
if [[ -f "$ENV_PATH" ]]; then
|
|
19
|
+
source "$ENV_PATH"
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Override the global with the local environment
|
|
23
|
+
LOCAL_ENV_PATH="${ENV_PATH}.local"
|
|
24
|
+
if [[ -f "$LOCAL_ENV_PATH" ]]; then
|
|
25
|
+
source "$LOCAL_ENV_PATH"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [[ -n "$NODE_BINARY" && -x "$NODE_BINARY" ]]; then
|
|
29
|
+
echo "Node found at: ${NODE_BINARY}"
|
|
30
|
+
else
|
|
31
|
+
cat >&2 << EOF
|
|
32
|
+
[ERROR] Could not find "node" while running an Xcode build script. You need to specify the path to your Node.js executable by defining an environment variable named NODE_BINARY in your project's .xcode.env or .xcode.env.local file. You can set this up quickly by running:
|
|
33
|
+
|
|
34
|
+
echo "export NODE_BINARY=\$(command -v node)" >> .xcode.env
|
|
35
|
+
|
|
36
|
+
in the ios folder of your project.
|
|
37
|
+
EOF
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Execute argument, if present
|
|
42
|
+
if [[ "$#" -gt 0 ]]; then
|
|
43
|
+
"$NODE_BINARY" "$@"
|
|
44
|
+
fi
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -eo pipefail
|
|
4
|
+
|
|
5
|
+
EXPO_WIDGETS_PACKAGE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
|
6
|
+
|
|
7
|
+
# For classic main project build phases integration, will be no-op to prevent duplicated bundle creation.
|
|
8
|
+
#
|
|
9
|
+
# `$PROJECT_DIR` is passed by Xcode as the directory to the xcodeproj file.
|
|
10
|
+
# in classic main project setup it is something like /path/to/app/ios
|
|
11
|
+
# in new style pod project setup it is something like /path/to/app/ios/Pods
|
|
12
|
+
PROJECT_DIR_BASENAME=$(basename $PROJECT_DIR)
|
|
13
|
+
if [ "x$PROJECT_DIR_BASENAME" != "xPods" ]; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# If PROJECT_ROOT is not specified, fallback to use Xcode PROJECT_DIR
|
|
18
|
+
PROJECT_ROOT=${PROJECT_ROOT:-"$PROJECT_DIR/../.."}
|
|
19
|
+
PROJECT_ROOT=${PROJECT_ROOT:-"$EXPO_WIDGETS_PACKAGE_DIR/../.."}
|
|
20
|
+
|
|
21
|
+
cd "$PROJECT_ROOT" || exit
|
|
22
|
+
|
|
23
|
+
"${EXPO_WIDGETS_PACKAGE_DIR}/scripts/with-node.sh" "${EXPO_WIDGETS_PACKAGE_DIR}/scripts/build-bundle.mjs" "$PROJECT_ROOT"
|
package/spm.config.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../tools/src/prebuilds/schemas/spm.config.schema.json",
|
|
3
|
+
"products": [
|
|
4
|
+
{
|
|
5
|
+
"name": "ExpoWidgets",
|
|
6
|
+
"podName": "ExpoWidgets",
|
|
7
|
+
"platforms": [
|
|
8
|
+
"iOS(.v16)"
|
|
9
|
+
],
|
|
10
|
+
"externalDependencies": [
|
|
11
|
+
"ReactNativeDependencies",
|
|
12
|
+
"React",
|
|
13
|
+
"Hermes",
|
|
14
|
+
"expo-modules-core/ExpoModulesCore",
|
|
15
|
+
"expo-modules-core/ExpoModulesWorklets",
|
|
16
|
+
"@expo/ui/ExpoUI"
|
|
17
|
+
],
|
|
18
|
+
"targets": [
|
|
19
|
+
{
|
|
20
|
+
"type": "swift",
|
|
21
|
+
"name": "ExpoWidgets",
|
|
22
|
+
"path": "ios",
|
|
23
|
+
"pattern": "**/*.swift",
|
|
24
|
+
"dependencies": [
|
|
25
|
+
"ReactNativeDependencies",
|
|
26
|
+
"React",
|
|
27
|
+
"Hermes",
|
|
28
|
+
"expo-modules-core/ExpoModulesCore",
|
|
29
|
+
"expo-modules-core/ExpoModulesWorklets",
|
|
30
|
+
"@expo/ui/ExpoUI"
|
|
31
|
+
],
|
|
32
|
+
"linkedFrameworks": [
|
|
33
|
+
"Foundation",
|
|
34
|
+
"UIKit"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|