react-native-ios-widget 0.0.3

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.
Files changed (109) hide show
  1. package/.eslintrc.js +5 -0
  2. package/README.md +100 -0
  3. package/_widgets/EmojiRanger/AdventureActivityConfiguration.swift +71 -0
  4. package/_widgets/EmojiRanger/AllCharactersView.swift +43 -0
  5. package/_widgets/EmojiRanger/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  6. package/_widgets/EmojiRanger/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  7. package/_widgets/EmojiRanger/Assets.xcassets/Contents.json +6 -0
  8. package/_widgets/EmojiRanger/Assets.xcassets/WidgetBackground.colorset/Contents.json +11 -0
  9. package/_widgets/EmojiRanger/Attributes.swift +21 -0
  10. package/_widgets/EmojiRanger/EmojiRanger.swift +248 -0
  11. package/_widgets/EmojiRanger/EmojiRangersWidget.intentdefinition +118 -0
  12. package/_widgets/EmojiRanger/EmojiRangersWidget.swift +189 -0
  13. package/_widgets/EmojiRanger/EmojiRangersWidgetBundle.swift +21 -0
  14. package/_widgets/EmojiRanger/ImageURLProtocol.swift +66 -0
  15. package/_widgets/EmojiRanger/Info.plist +11 -0
  16. package/_widgets/EmojiRanger/LeaderboardWidget.swift +93 -0
  17. package/_widgets/EmojiRanger/Module.swift +94 -0
  18. package/_widgets/PizzaDelivery/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  19. package/_widgets/PizzaDelivery/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  20. package/_widgets/PizzaDelivery/Assets.xcassets/Contents.json +6 -0
  21. package/_widgets/PizzaDelivery/Assets.xcassets/WidgetBackground.colorset/Contents.json +11 -0
  22. package/_widgets/PizzaDelivery/Attributes.swift +15 -0
  23. package/_widgets/PizzaDelivery/Info.plist +11 -0
  24. package/_widgets/PizzaDelivery/LiveActivity.swift +108 -0
  25. package/_widgets/PizzaDelivery/Module.swift +94 -0
  26. package/_widgets/PizzaDelivery/WidgetBundle.swift +13 -0
  27. package/_widgets/PizzaDelivery/Widgets.swift +59 -0
  28. package/app.plugin.js +1 -0
  29. package/build/ExpoWidget.d.ts +3 -0
  30. package/build/ExpoWidget.d.ts.map +1 -0
  31. package/build/ExpoWidget.js +3 -0
  32. package/build/ExpoWidget.js.map +1 -0
  33. package/build/ReactNativeWidgetExtensionModule.d.ts +3 -0
  34. package/build/ReactNativeWidgetExtensionModule.d.ts.map +1 -0
  35. package/build/ReactNativeWidgetExtensionModule.js +5 -0
  36. package/build/ReactNativeWidgetExtensionModule.js.map +1 -0
  37. package/build/Widget.d.ts +2 -0
  38. package/build/Widget.d.ts.map +1 -0
  39. package/build/Widget.js +19 -0
  40. package/build/Widget.js.map +1 -0
  41. package/expo-module.config.json +6 -0
  42. package/ios/ReactNativeWidgetExtension.podspec +27 -0
  43. package/package.json +48 -0
  44. package/plugin/build/android/index.d.ts +10 -0
  45. package/plugin/build/android/index.js +18 -0
  46. package/plugin/build/android/withWidgetAndroidManifest.d.ts +5 -0
  47. package/plugin/build/android/withWidgetAndroidManifest.js +55 -0
  48. package/plugin/build/android/withWidgetAppBuildGradle.d.ts +7 -0
  49. package/plugin/build/android/withWidgetAppBuildGradle.js +20 -0
  50. package/plugin/build/android/withWidgetProjectBuildGradle.d.ts +8 -0
  51. package/plugin/build/android/withWidgetProjectBuildGradle.js +21 -0
  52. package/plugin/build/android/withWidgetSourceCode.d.ts +5 -0
  53. package/plugin/build/android/withWidgetSourceCode.js +51 -0
  54. package/plugin/build/index.d.ts +10 -0
  55. package/plugin/build/index.js +34 -0
  56. package/plugin/build/ios/index.d.ts +9 -0
  57. package/plugin/build/ios/index.js +34 -0
  58. package/plugin/build/ios/withConfig.d.ts +6 -0
  59. package/plugin/build/ios/withConfig.js +55 -0
  60. package/plugin/build/ios/withPodfile.d.ts +5 -0
  61. package/plugin/build/ios/withPodfile.js +83 -0
  62. package/plugin/build/ios/withWidgetExtensionEntitlements.d.ts +7 -0
  63. package/plugin/build/ios/withWidgetExtensionEntitlements.js +47 -0
  64. package/plugin/build/ios/withXcode.d.ts +7 -0
  65. package/plugin/build/ios/withXcode.js +79 -0
  66. package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +5 -0
  67. package/plugin/build/lib/getWidgetExtensionEntitlements.js +20 -0
  68. package/plugin/build/lib/getWidgetFiles.d.ts +9 -0
  69. package/plugin/build/lib/getWidgetFiles.js +117 -0
  70. package/plugin/build/withConfig.d.ts +6 -0
  71. package/plugin/build/withConfig.js +55 -0
  72. package/plugin/build/withPodfile.d.ts +5 -0
  73. package/plugin/build/withPodfile.js +83 -0
  74. package/plugin/build/withWidgetExtensionEntitlements.d.ts +7 -0
  75. package/plugin/build/withWidgetExtensionEntitlements.js +47 -0
  76. package/plugin/build/withXcode.d.ts +7 -0
  77. package/plugin/build/withXcode.js +79 -0
  78. package/plugin/build/xcode/addBuildPhases.d.ts +13 -0
  79. package/plugin/build/xcode/addBuildPhases.js +48 -0
  80. package/plugin/build/xcode/addPbxGroup.d.ts +6 -0
  81. package/plugin/build/xcode/addPbxGroup.js +25 -0
  82. package/plugin/build/xcode/addProductFile.d.ts +5 -0
  83. package/plugin/build/xcode/addProductFile.js +22 -0
  84. package/plugin/build/xcode/addTargetDependency.d.ts +4 -0
  85. package/plugin/build/xcode/addTargetDependency.js +15 -0
  86. package/plugin/build/xcode/addToPbxNativeTargetSection.d.ts +24 -0
  87. package/plugin/build/xcode/addToPbxNativeTargetSection.js +30 -0
  88. package/plugin/build/xcode/addToPbxProjectSection.d.ts +4 -0
  89. package/plugin/build/xcode/addToPbxProjectSection.js +15 -0
  90. package/plugin/build/xcode/addXCConfigurationList.d.ts +8 -0
  91. package/plugin/build/xcode/addXCConfigurationList.js +62 -0
  92. package/plugin/src/index.ts +52 -0
  93. package/plugin/src/lib/getWidgetExtensionEntitlements.ts +33 -0
  94. package/plugin/src/lib/getWidgetFiles.ts +109 -0
  95. package/plugin/src/withConfig.ts +71 -0
  96. package/plugin/src/withPodfile.ts +73 -0
  97. package/plugin/src/withWidgetExtensionEntitlements.ts +30 -0
  98. package/plugin/src/withXcode.ts +73 -0
  99. package/plugin/src/xcode/addBuildPhases.ts +83 -0
  100. package/plugin/src/xcode/addPbxGroup.ts +46 -0
  101. package/plugin/src/xcode/addProductFile.ts +25 -0
  102. package/plugin/src/xcode/addTargetDependency.ts +17 -0
  103. package/plugin/src/xcode/addToPbxNativeTargetSection.ts +46 -0
  104. package/plugin/src/xcode/addToPbxProjectSection.ts +23 -0
  105. package/plugin/src/xcode/addXCConfigurationList.ts +83 -0
  106. package/plugin/tsconfig.json +16 -0
  107. package/src/ReactNativeWidgetExtensionModule.ts +5 -0
  108. package/src/Widget.ts +25 -0
  109. package/tsconfig.json +10 -0
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withConfig = void 0;
4
+ const getWidgetExtensionEntitlements_1 = require("../lib/getWidgetExtensionEntitlements");
5
+ const withConfig = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
6
+ let configIndex = null;
7
+ config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach((ext, index) => {
8
+ if (ext.targetName === targetName) {
9
+ configIndex = index;
10
+ }
11
+ });
12
+ if (!configIndex) {
13
+ config.extra = {
14
+ ...config.extra,
15
+ eas: {
16
+ ...config.extra?.eas,
17
+ build: {
18
+ ...config.extra?.eas?.build,
19
+ experimental: {
20
+ ...config.extra?.eas?.build?.experimental,
21
+ ios: {
22
+ ...config.extra?.eas?.build?.experimental?.ios,
23
+ appExtensions: [
24
+ ...(config.extra?.eas?.build?.experimental?.ios
25
+ ?.appExtensions ?? []),
26
+ {
27
+ targetName,
28
+ bundleIdentifier,
29
+ },
30
+ ],
31
+ },
32
+ },
33
+ },
34
+ },
35
+ };
36
+ configIndex = 0;
37
+ }
38
+ if (configIndex != null && config.extra) {
39
+ const widgetsExtensionConfig = config.extra.eas.build.experimental.ios.appExtensions[configIndex];
40
+ widgetsExtensionConfig.entitlements = {
41
+ ...widgetsExtensionConfig.entitlements,
42
+ ...(0, getWidgetExtensionEntitlements_1.getWidgetExtensionEntitlements)(config.ios, {
43
+ groupIdentifier,
44
+ }),
45
+ };
46
+ config.ios = {
47
+ ...config.ios,
48
+ entitlements: {
49
+ ...(0, getWidgetExtensionEntitlements_1.addApplicationGroupsEntitlement)(config.ios?.entitlements ?? {}, groupIdentifier),
50
+ },
51
+ };
52
+ }
53
+ return config;
54
+ };
55
+ exports.withConfig = withConfig;
@@ -0,0 +1,5 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withPodfile: ConfigPlugin<{
3
+ targetName: string;
4
+ pods?: string[];
5
+ }>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.withPodfile = void 0;
27
+ const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
28
+ const config_plugins_1 = require("expo/config-plugins");
29
+ const fs = __importStar(require("fs"));
30
+ const path = __importStar(require("path"));
31
+ const withPodfile = (config, { targetName, pods = [] }) => {
32
+ return (0, config_plugins_1.withDangerousMod)(config, [
33
+ "ios",
34
+ (config) => {
35
+ const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
36
+ let podFileContent = fs.readFileSync(podFilePath).toString();
37
+ /* podFileContent = mergeContents({
38
+ tag: "withWidgetExtensionPodfile1999999999",
39
+ src: podFileContent,
40
+ newSrc: ` target '${targetName}' do\n \n end`,
41
+ anchor: /post_install/,
42
+ offset: 0,
43
+ comment: "#",
44
+ }).contents; */
45
+ /* podFileContent = podFileContent.replace(
46
+ /use_expo_modules!/,
47
+ `use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
48
+ ); */
49
+ podFileContent = (0, generateCode_1.mergeContents)({
50
+ tag: "react-native-widget-extension-1",
51
+ src: podFileContent,
52
+ newSrc: `installer.pods_project.targets.each do |target|
53
+ target.build_configurations.each do |config|
54
+ config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
55
+ end
56
+ end`,
57
+ anchor: /installer.target_installation_results.pod_target_installation_results/,
58
+ offset: 0,
59
+ comment: "#",
60
+ }).contents;
61
+ /* podFileContent = mergeContents({
62
+ tag: "react-native-widget-extension-2",
63
+ src: podFileContent,
64
+ newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
65
+ anchor: /use_react_native/,
66
+ offset: -1,
67
+ comment: "#",
68
+ }).contents; */
69
+ podFileContent = podFileContent
70
+ .concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
71
+ .concat(`target '${targetName}' do
72
+ use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
73
+ use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
74
+
75
+ ${pods.map((pod) => `pod '${pod}'`).join("\n")}
76
+ end`)
77
+ .concat(`\n# >>> Inserted by react-native-widget-extension`);
78
+ fs.writeFileSync(podFilePath, podFileContent);
79
+ return config;
80
+ },
81
+ ]);
82
+ };
83
+ exports.withPodfile = withPodfile;
@@ -0,0 +1,7 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withWidgetExtensionEntitlements: ConfigPlugin<{
3
+ targetName: string;
4
+ targetPath: string;
5
+ groupIdentifier: string;
6
+ appleSignin: boolean;
7
+ }>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.withWidgetExtensionEntitlements = void 0;
30
+ const plist_1 = __importDefault(require("@expo/plist"));
31
+ const config_plugins_1 = require("expo/config-plugins");
32
+ const fs = __importStar(require("fs"));
33
+ const path = __importStar(require("path"));
34
+ const getWidgetExtensionEntitlements_1 = require("../lib/getWidgetExtensionEntitlements");
35
+ const withWidgetExtensionEntitlements = (config, { targetName, groupIdentifier }) => {
36
+ return (0, config_plugins_1.withInfoPlist)(config, (config) => {
37
+ const targetPath = path.join(config.modRequest.platformProjectRoot, targetName);
38
+ const filePath = path.join(targetPath, `${targetName}.entitlements`);
39
+ const appClipEntitlements = (0, getWidgetExtensionEntitlements_1.getWidgetExtensionEntitlements)(config.ios, {
40
+ groupIdentifier,
41
+ });
42
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
43
+ fs.writeFileSync(filePath, plist_1.default.build(appClipEntitlements));
44
+ return config;
45
+ });
46
+ };
47
+ exports.withWidgetExtensionEntitlements = withWidgetExtensionEntitlements;
@@ -0,0 +1,7 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withXcode: ConfigPlugin<{
3
+ targetName: string;
4
+ bundleIdentifier: string;
5
+ deploymentTarget: string;
6
+ widgetsFolder: string;
7
+ }>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.withXcode = void 0;
27
+ const config_plugins_1 = require("expo/config-plugins");
28
+ const path = __importStar(require("path"));
29
+ const addXCConfigurationList_1 = require("../xcode/addXCConfigurationList");
30
+ const addProductFile_1 = require("../xcode/addProductFile");
31
+ const addToPbxNativeTargetSection_1 = require("../xcode/addToPbxNativeTargetSection");
32
+ const addToPbxProjectSection_1 = require("../xcode/addToPbxProjectSection");
33
+ const addTargetDependency_1 = require("../xcode/addTargetDependency");
34
+ const addPbxGroup_1 = require("../xcode/addPbxGroup");
35
+ const addBuildPhases_1 = require("../xcode/addBuildPhases");
36
+ const getWidgetFiles_1 = require("../lib/getWidgetFiles");
37
+ const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
38
+ return (0, config_plugins_1.withXcodeProject)(config, (config) => {
39
+ const xcodeProject = config.modResults;
40
+ const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
41
+ const targetUuid = xcodeProject.generateUuid();
42
+ const groupName = "Embed Foundation Extensions";
43
+ const { platformProjectRoot } = config.modRequest;
44
+ const marketingVersion = config.version;
45
+ const targetPath = path.join(platformProjectRoot, targetName);
46
+ const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath);
47
+ const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
48
+ targetName,
49
+ currentProjectVersion: config.ios.buildNumber || "1",
50
+ bundleIdentifier,
51
+ deploymentTarget,
52
+ marketingVersion,
53
+ });
54
+ const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
55
+ targetName,
56
+ groupName,
57
+ });
58
+ const target = (0, addToPbxNativeTargetSection_1.addToPbxNativeTargetSection)(xcodeProject, {
59
+ targetName,
60
+ targetUuid,
61
+ productFile,
62
+ xCConfigurationList,
63
+ });
64
+ (0, addToPbxProjectSection_1.addToPbxProjectSection)(xcodeProject, target);
65
+ (0, addTargetDependency_1.addTargetDependency)(xcodeProject, target);
66
+ (0, addBuildPhases_1.addBuildPhases)(xcodeProject, {
67
+ targetUuid,
68
+ groupName,
69
+ productFile,
70
+ widgetFiles,
71
+ });
72
+ (0, addPbxGroup_1.addPbxGroup)(xcodeProject, {
73
+ targetName,
74
+ widgetFiles,
75
+ });
76
+ return config;
77
+ });
78
+ };
79
+ exports.withXcode = withXcode;
@@ -0,0 +1,5 @@
1
+ import { ExportedConfig, InfoPlist } from "expo/config-plugins";
2
+ export declare function getWidgetExtensionEntitlements(iosConfig: ExportedConfig["ios"], { groupIdentifier, }: {
3
+ groupIdentifier?: string;
4
+ }): InfoPlist;
5
+ export declare function addApplicationGroupsEntitlement(entitlements: InfoPlist, groupIdentifier?: string): InfoPlist;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addApplicationGroupsEntitlement = exports.getWidgetExtensionEntitlements = void 0;
4
+ function getWidgetExtensionEntitlements(iosConfig, { groupIdentifier, }) {
5
+ const entitlements = {};
6
+ addApplicationGroupsEntitlement(entitlements, groupIdentifier);
7
+ return entitlements;
8
+ }
9
+ exports.getWidgetExtensionEntitlements = getWidgetExtensionEntitlements;
10
+ function addApplicationGroupsEntitlement(entitlements, groupIdentifier) {
11
+ if (groupIdentifier) {
12
+ const existingApplicationGroups = entitlements["com.apple.security.application-groups"] ?? [];
13
+ entitlements["com.apple.security.application-groups"] = [
14
+ groupIdentifier,
15
+ ...existingApplicationGroups,
16
+ ];
17
+ }
18
+ return entitlements;
19
+ }
20
+ exports.addApplicationGroupsEntitlement = addApplicationGroupsEntitlement;
@@ -0,0 +1,9 @@
1
+ export type WidgetFiles = {
2
+ swiftFiles: string[];
3
+ entitlementFiles: string[];
4
+ plistFiles: string[];
5
+ fontFiles: string[];
6
+ assetDirectories: string[];
7
+ };
8
+ export declare function getWidgetFiles(widgetsPath: string, targetPath: string): WidgetFiles;
9
+ export declare function copyFileSync(source: string, target: string): void;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.copyFileSync = exports.getWidgetFiles = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const path = __importStar(require("path"));
29
+ function getWidgetFiles(widgetsPath, targetPath) {
30
+ const widgetFiles = {
31
+ swiftFiles: [],
32
+ entitlementFiles: [],
33
+ plistFiles: [],
34
+ fontFiles: [],
35
+ assetDirectories: [],
36
+ };
37
+ if (!fs.existsSync(targetPath)) {
38
+ fs.mkdirSync(targetPath, { recursive: true });
39
+ }
40
+ if (fs.lstatSync(widgetsPath).isDirectory()) {
41
+ const files = fs.readdirSync(widgetsPath);
42
+ files.forEach((file) => {
43
+ const fileExtension = file.split(".").pop();
44
+ if (fileExtension === "swift") {
45
+ if (file !== "Module.swift") {
46
+ widgetFiles.swiftFiles.push(file);
47
+ }
48
+ }
49
+ else if (fileExtension === "entitlements") {
50
+ widgetFiles.entitlementFiles.push(file);
51
+ }
52
+ else if (fileExtension === "plist") {
53
+ widgetFiles.plistFiles.push(file);
54
+ }
55
+ else if (fileExtension === "ttf" || fileExtension === "otf") {
56
+ widgetFiles.fontFiles.push(file);
57
+ }
58
+ else if (fileExtension === "xcassets") {
59
+ widgetFiles.assetDirectories.push(file);
60
+ }
61
+ });
62
+ }
63
+ // Copy files
64
+ [
65
+ ...widgetFiles.swiftFiles,
66
+ ...widgetFiles.entitlementFiles,
67
+ ...widgetFiles.plistFiles,
68
+ ...widgetFiles.fontFiles,
69
+ ].forEach((file) => {
70
+ const source = path.join(widgetsPath, file);
71
+ copyFileSync(source, targetPath);
72
+ });
73
+ // Copy Module.swift and Attributes.swift
74
+ const modulePath = path.join(__dirname, "../../../ios");
75
+ copyFileSync(path.join(widgetsPath, "Module.swift"), path.join(modulePath, "Module.swift"));
76
+ // console.log(
77
+ // path.join(widgetsPath, "Module.swift"),
78
+ // path.join(modulePath, "Module.swift")
79
+ // );
80
+ // copyFileSync(
81
+ // path.join(widgetsPath, "Attributes.swift"),
82
+ // path.join(modulePath, "Attributes.swift")
83
+ // );
84
+ // Copy directories
85
+ widgetFiles.assetDirectories.forEach((directory) => {
86
+ const imagesXcassetsSource = path.join(widgetsPath, directory);
87
+ copyFolderRecursiveSync(imagesXcassetsSource, targetPath);
88
+ });
89
+ return widgetFiles;
90
+ }
91
+ exports.getWidgetFiles = getWidgetFiles;
92
+ function copyFileSync(source, target) {
93
+ let targetFile = target;
94
+ if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
95
+ targetFile = path.join(target, path.basename(source));
96
+ }
97
+ fs.writeFileSync(targetFile, fs.readFileSync(source));
98
+ }
99
+ exports.copyFileSync = copyFileSync;
100
+ function copyFolderRecursiveSync(source, target) {
101
+ const targetPath = path.join(target, path.basename(source));
102
+ if (!fs.existsSync(targetPath)) {
103
+ fs.mkdirSync(targetPath, { recursive: true });
104
+ }
105
+ if (fs.lstatSync(source).isDirectory()) {
106
+ const files = fs.readdirSync(source);
107
+ files.forEach((file) => {
108
+ const currentPath = path.join(source, file);
109
+ if (fs.lstatSync(currentPath).isDirectory()) {
110
+ copyFolderRecursiveSync(currentPath, targetPath);
111
+ }
112
+ else {
113
+ copyFileSync(currentPath, targetPath);
114
+ }
115
+ });
116
+ }
117
+ }
@@ -0,0 +1,6 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withConfig: ConfigPlugin<{
3
+ bundleIdentifier: string;
4
+ targetName: string;
5
+ groupIdentifier?: string;
6
+ }>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withConfig = void 0;
4
+ const getWidgetExtensionEntitlements_1 = require("./lib/getWidgetExtensionEntitlements");
5
+ const withConfig = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
6
+ let configIndex = null;
7
+ config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach((ext, index) => {
8
+ if (ext.targetName === targetName) {
9
+ configIndex = index;
10
+ }
11
+ });
12
+ if (!configIndex) {
13
+ config.extra = {
14
+ ...config.extra,
15
+ eas: {
16
+ ...config.extra?.eas,
17
+ build: {
18
+ ...config.extra?.eas?.build,
19
+ experimental: {
20
+ ...config.extra?.eas?.build?.experimental,
21
+ ios: {
22
+ ...config.extra?.eas?.build?.experimental?.ios,
23
+ appExtensions: [
24
+ ...(config.extra?.eas?.build?.experimental?.ios
25
+ ?.appExtensions ?? []),
26
+ {
27
+ targetName,
28
+ bundleIdentifier,
29
+ },
30
+ ],
31
+ },
32
+ },
33
+ },
34
+ },
35
+ };
36
+ configIndex = 0;
37
+ }
38
+ if (configIndex != null && config.extra) {
39
+ const widgetsExtensionConfig = config.extra.eas.build.experimental.ios.appExtensions[configIndex];
40
+ widgetsExtensionConfig.entitlements = {
41
+ ...widgetsExtensionConfig.entitlements,
42
+ ...(0, getWidgetExtensionEntitlements_1.getWidgetExtensionEntitlements)(config.ios, {
43
+ groupIdentifier,
44
+ }),
45
+ };
46
+ config.ios = {
47
+ ...config.ios,
48
+ entitlements: {
49
+ ...(0, getWidgetExtensionEntitlements_1.addApplicationGroupsEntitlement)(config.ios?.entitlements ?? {}, groupIdentifier),
50
+ },
51
+ };
52
+ }
53
+ return config;
54
+ };
55
+ exports.withConfig = withConfig;
@@ -0,0 +1,5 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withPodfile: ConfigPlugin<{
3
+ targetName: string;
4
+ pods?: string[];
5
+ }>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.withPodfile = void 0;
27
+ const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
28
+ const config_plugins_1 = require("expo/config-plugins");
29
+ const fs = __importStar(require("fs"));
30
+ const path = __importStar(require("path"));
31
+ const withPodfile = (config, { targetName, pods = [] }) => {
32
+ return (0, config_plugins_1.withDangerousMod)(config, [
33
+ "ios",
34
+ (config) => {
35
+ const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
36
+ let podFileContent = fs.readFileSync(podFilePath).toString();
37
+ /* podFileContent = mergeContents({
38
+ tag: "withWidgetExtensionPodfile1999999999",
39
+ src: podFileContent,
40
+ newSrc: ` target '${targetName}' do\n \n end`,
41
+ anchor: /post_install/,
42
+ offset: 0,
43
+ comment: "#",
44
+ }).contents; */
45
+ /* podFileContent = podFileContent.replace(
46
+ /use_expo_modules!/,
47
+ `use_expo_modules!(searchPaths: ["./node_modules", "../../node_modules", "../../../WidgetExtension"])`
48
+ ); */
49
+ podFileContent = (0, generateCode_1.mergeContents)({
50
+ tag: "react-native-widget-extension-1",
51
+ src: podFileContent,
52
+ newSrc: `installer.pods_project.targets.each do |target|
53
+ target.build_configurations.each do |config|
54
+ config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
55
+ end
56
+ end`,
57
+ anchor: /installer.target_installation_results.pod_target_installation_results/,
58
+ offset: 0,
59
+ comment: "#",
60
+ }).contents;
61
+ /* podFileContent = mergeContents({
62
+ tag: "react-native-widget-extension-2",
63
+ src: podFileContent,
64
+ newSrc: `pod 'WidgetExtension', :path => '../WidgetExtension/ios'`,
65
+ anchor: /use_react_native/,
66
+ offset: -1,
67
+ comment: "#",
68
+ }).contents; */
69
+ podFileContent = podFileContent
70
+ .concat(`\n\n# >>> Inserted by react-native-widget-extension\n`)
71
+ .concat(`target '${targetName}' do
72
+ use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
73
+ use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
74
+
75
+ ${pods.map((pod) => `pod '${pod}'`).join("\n")}
76
+ end`)
77
+ .concat(`\n# >>> Inserted by react-native-widget-extension`);
78
+ fs.writeFileSync(podFilePath, podFileContent);
79
+ return config;
80
+ },
81
+ ]);
82
+ };
83
+ exports.withPodfile = withPodfile;
@@ -0,0 +1,7 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withWidgetExtensionEntitlements: ConfigPlugin<{
3
+ targetName: string;
4
+ targetPath: string;
5
+ groupIdentifier: string;
6
+ appleSignin: boolean;
7
+ }>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.withWidgetExtensionEntitlements = void 0;
30
+ const plist_1 = __importDefault(require("@expo/plist"));
31
+ const config_plugins_1 = require("expo/config-plugins");
32
+ const fs = __importStar(require("fs"));
33
+ const path = __importStar(require("path"));
34
+ const getWidgetExtensionEntitlements_1 = require("./lib/getWidgetExtensionEntitlements");
35
+ const withWidgetExtensionEntitlements = (config, { targetName, groupIdentifier }) => {
36
+ return (0, config_plugins_1.withInfoPlist)(config, (config) => {
37
+ const targetPath = path.join(config.modRequest.platformProjectRoot, targetName);
38
+ const filePath = path.join(targetPath, `${targetName}.entitlements`);
39
+ const appClipEntitlements = (0, getWidgetExtensionEntitlements_1.getWidgetExtensionEntitlements)(config.ios, {
40
+ groupIdentifier,
41
+ });
42
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
43
+ fs.writeFileSync(filePath, plist_1.default.build(appClipEntitlements));
44
+ return config;
45
+ });
46
+ };
47
+ exports.withWidgetExtensionEntitlements = withWidgetExtensionEntitlements;
@@ -0,0 +1,7 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ export declare const withXcode: ConfigPlugin<{
3
+ targetName: string;
4
+ bundleIdentifier: string;
5
+ deploymentTarget: string;
6
+ widgetsFolder: string;
7
+ }>;