react-native-ios-widget 0.0.12-beta.1 → 0.0.13-beta.1
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/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +3 -3
- package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +1 -1
- package/plugin/build/lib/getWidgetFiles.js +17 -7
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/build/withPodfile.js +17 -7
- package/plugin/build/withWidgetExtensionEntitlements.js +17 -7
- package/plugin/build/withXcode.js +17 -7
- package/plugin/build/xcode/addBuildPhases.js +18 -9
- package/plugin/build/xcode/addPbxGroup.js +1 -2
- package/plugin/build/xcode/addProductFile.js +1 -2
- package/plugin/build/xcode/addTargetDependency.js +1 -2
- package/plugin/build/xcode/addToPbxNativeTargetSection.js +1 -2
- package/plugin/build/xcode/addToPbxProjectSection.js +1 -2
- package/plugin/build/xcode/addXCConfigurationList.js +1 -2
- package/plugin/src/lib/getWidgetFiles.ts +1 -4
- package/plugin/src/withXcode.ts +39 -5
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE;IAC3B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE;IAC3B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IAC3C,IAAI,CAAC,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import { Platform } from \"react-native\";\nimport ExpoWidget from \"./ExpoModule\";\n\nconst supportWidgets = (() => {\n if (Platform.OS === \"ios\") {\n return parseInt(Platform.Version, 10) >= 14;\n }\n\n return false;\n})();\n\nexport const reloadAllTimelines = async () => {\n if (!supportWidgets || !ExpoWidget) {\n return;\n }\n\n await ExpoWidget.reloadAllTimelines();\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/expomodule.ts","../src/index.ts"],"version":"5.9.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ios-widget",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13-beta.1",
|
|
4
4
|
"description": "Expo config plugin to add widgets to a React Native app",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"homepage": "https://github.com/adrianso/react-native-ios-widget",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@expo/config-plugins": "~
|
|
25
|
+
"@expo/config-plugins": "~54.0.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/jest": "^29.5.2",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"jest": "^29.6.1",
|
|
36
36
|
"react": "18.2.0",
|
|
37
37
|
"react-native": "0.72.3",
|
|
38
|
-
"typescript": "5.
|
|
38
|
+
"typescript": "5.9.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"expo": "*",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportedConfig, InfoPlist } from "expo/config-plugins";
|
|
2
2
|
export declare const getWidgetExtensionEntitlements: (iosConfig: ExportedConfig["ios"], { groupIdentifier, }: {
|
|
3
|
-
groupIdentifier?: string
|
|
3
|
+
groupIdentifier?: string;
|
|
4
4
|
}) => InfoPlist;
|
|
5
5
|
export declare const addApplicationGroupsEntitlement: (entitlements: InfoPlist, groupIdentifier?: string) => InfoPlist;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.getWidgetFiles = void 0;
|
|
27
37
|
const fs = __importStar(require("fs"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/index.ts","../src/types.ts","../src/withconfig.ts","../src/withpodfile.ts","../src/withwidgetextensionentitlements.ts","../src/withxcode.ts","../src/lib/getwidgetextensionentitlements.ts","../src/lib/getwidgetfiles.ts","../src/xcode/addbuildphases.ts","../src/xcode/addpbxgroup.ts","../src/xcode/addproductfile.ts","../src/xcode/addtargetdependency.ts","../src/xcode/addtopbxnativetargetsection.ts","../src/xcode/addtopbxprojectsection.ts","../src/xcode/addxcconfigurationlist.ts"],"version":"5.9.3"}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.withPodfile = void 0;
|
|
27
37
|
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.withXcode = void 0;
|
|
27
37
|
const config_plugins_1 = require("expo/config-plugins");
|
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.addBuildPhases =
|
|
36
|
+
exports.addBuildPhases = addBuildPhases;
|
|
27
37
|
const util = __importStar(require("util"));
|
|
28
38
|
function addBuildPhases(xcodeProject, { targetUuid, groupName, productFile, widgetFiles, }) {
|
|
29
39
|
const buildPath = `""`;
|
|
@@ -45,4 +55,3 @@ function addBuildPhases(xcodeProject, { targetUuid, groupName, productFile, widg
|
|
|
45
55
|
// Resources build phase
|
|
46
56
|
xcodeProject.addBuildPhase([...assetDirectories, ...fontFiles], "PBXResourcesBuildPhase", groupName, targetUuid, folderType, buildPath);
|
|
47
57
|
}
|
|
48
|
-
exports.addBuildPhases = addBuildPhases;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addPbxGroup =
|
|
3
|
+
exports.addPbxGroup = addPbxGroup;
|
|
4
4
|
function addPbxGroup(xcodeProject, { targetName, widgetFiles, }) {
|
|
5
5
|
const { swiftFiles, assetDirectories, entitlementFiles, plistFiles, fontFiles, } = widgetFiles;
|
|
6
6
|
// Add PBX group
|
|
@@ -22,4 +22,3 @@ function addPbxGroup(xcodeProject, { targetName, widgetFiles, }) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.addPbxGroup = addPbxGroup;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addProductFile =
|
|
3
|
+
exports.addProductFile = addProductFile;
|
|
4
4
|
function addProductFile(xcodeProject, { targetName, groupName }) {
|
|
5
5
|
const options = {
|
|
6
6
|
basename: `${targetName}.appex`,
|
|
@@ -19,4 +19,3 @@ function addProductFile(xcodeProject, { targetName, groupName }) {
|
|
|
19
19
|
const productFile = xcodeProject.addProductFile(targetName, options);
|
|
20
20
|
return productFile;
|
|
21
21
|
}
|
|
22
|
-
exports.addProductFile = addProductFile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addTargetDependency =
|
|
3
|
+
exports.addTargetDependency = addTargetDependency;
|
|
4
4
|
function addTargetDependency(xcodeProject, target) {
|
|
5
5
|
if (!xcodeProject.hash.project.objects["PBXTargetDependency"]) {
|
|
6
6
|
xcodeProject.hash.project.objects["PBXTargetDependency"] = {};
|
|
@@ -12,4 +12,3 @@ function addTargetDependency(xcodeProject, target) {
|
|
|
12
12
|
target.uuid,
|
|
13
13
|
]);
|
|
14
14
|
}
|
|
15
|
-
exports.addTargetDependency = addTargetDependency;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addToPbxNativeTargetSection =
|
|
3
|
+
exports.addToPbxNativeTargetSection = addToPbxNativeTargetSection;
|
|
4
4
|
function addToPbxNativeTargetSection(xcodeProject, { targetName, targetUuid, productFile, xCConfigurationList, }) {
|
|
5
5
|
const target = {
|
|
6
6
|
uuid: targetUuid,
|
|
@@ -27,4 +27,3 @@ function addToPbxNativeTargetSection(xcodeProject, { targetName, targetUuid, pro
|
|
|
27
27
|
); */
|
|
28
28
|
return target;
|
|
29
29
|
}
|
|
30
|
-
exports.addToPbxNativeTargetSection = addToPbxNativeTargetSection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addToPbxProjectSection =
|
|
3
|
+
exports.addToPbxProjectSection = addToPbxProjectSection;
|
|
4
4
|
function addToPbxProjectSection(xcodeProject, target) {
|
|
5
5
|
xcodeProject.addToPbxProjectSection(target);
|
|
6
6
|
// Add target attributes to project section
|
|
@@ -12,4 +12,3 @@ function addToPbxProjectSection(xcodeProject, target) {
|
|
|
12
12
|
LastSwiftMigration: 1250,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
exports.addToPbxProjectSection = addToPbxProjectSection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addXCConfigurationList =
|
|
3
|
+
exports.addXCConfigurationList = addXCConfigurationList;
|
|
4
4
|
function addXCConfigurationList(xcodeProject, { targetName, currentProjectVersion, bundleIdentifier, deploymentTarget, marketingVersion, }) {
|
|
5
5
|
const commonBuildSettings = {
|
|
6
6
|
/* ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
|
@@ -59,4 +59,3 @@ function addXCConfigurationList(xcodeProject, { targetName, currentProjectVersio
|
|
|
59
59
|
const xCConfigurationList = xcodeProject.addXCConfigurationList(buildConfigurationsList, "Release", `Build configuration list for PBXNativeTarget "${targetName}"`);
|
|
60
60
|
return xCConfigurationList;
|
|
61
61
|
}
|
|
62
|
-
exports.addXCConfigurationList = addXCConfigurationList;
|
|
@@ -26,17 +26,15 @@ export const getWidgetFiles = (
|
|
|
26
26
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
// Ensure moduleRoot directory exists
|
|
30
29
|
if (!fs.existsSync(moduleRoot)) {
|
|
31
30
|
fs.mkdirSync(moduleRoot, { recursive: true });
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
// Check if Module.swift exists before proceeding
|
|
35
33
|
const moduleSwiftPath = path.join(widgetsPath, "Module.swift");
|
|
36
34
|
if (!fs.existsSync(moduleSwiftPath)) {
|
|
37
35
|
throw new Error(
|
|
38
36
|
`Module.swift not found at ${moduleSwiftPath}. ` +
|
|
39
|
-
|
|
37
|
+
"The widgets folder must contain Module.swift to build ReactNativeWidgetExtension."
|
|
40
38
|
);
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -73,7 +71,6 @@ export const getWidgetFiles = (
|
|
|
73
71
|
copyFileSync(source, targetPath);
|
|
74
72
|
});
|
|
75
73
|
|
|
76
|
-
// Copy Module.swift to moduleRoot (package ios directory)
|
|
77
74
|
copyFileSync(moduleSwiftPath, path.join(moduleRoot, "Module.swift"));
|
|
78
75
|
|
|
79
76
|
// Copy directories
|
package/plugin/src/withXcode.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigPlugin, withXcodeProject } from "expo/config-plugins";
|
|
2
|
+
import * as fs from "fs";
|
|
2
3
|
import * as path from "path";
|
|
3
4
|
|
|
4
5
|
import { addXCConfigurationList } from "./xcode/addXCConfigurationList";
|
|
@@ -18,18 +19,20 @@ export const withXcode: ConfigPlugin<Required<WidgetConfig>> = (
|
|
|
18
19
|
return withXcodeProject(config, (config) => {
|
|
19
20
|
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
20
21
|
|
|
21
|
-
if (!enabled) {
|
|
22
|
-
return config;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
22
|
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
26
|
-
const targetPath = path.join(platformProjectRoot, targetName);
|
|
27
23
|
const moduleRoot = path.join(
|
|
28
24
|
projectRoot,
|
|
29
25
|
"node_modules",
|
|
30
26
|
"react-native-ios-widget",
|
|
31
27
|
"ios"
|
|
32
28
|
);
|
|
29
|
+
|
|
30
|
+
if (!enabled) {
|
|
31
|
+
ensureModuleSwift(widgetsPath, moduleRoot);
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const targetPath = path.join(platformProjectRoot, targetName);
|
|
33
36
|
const widgetFiles = getWidgetFiles(widgetsPath, targetPath, moduleRoot);
|
|
34
37
|
|
|
35
38
|
const xcodeProject = config.modResults;
|
|
@@ -75,3 +78,34 @@ export const withXcode: ConfigPlugin<Required<WidgetConfig>> = (
|
|
|
75
78
|
return config;
|
|
76
79
|
});
|
|
77
80
|
};
|
|
81
|
+
|
|
82
|
+
const ensureModuleSwift = (widgetsPath: string, moduleRoot: string) => {
|
|
83
|
+
// Ensure the pod source dir exists for Module.swift.
|
|
84
|
+
if (!fs.existsSync(moduleRoot)) {
|
|
85
|
+
fs.mkdirSync(moduleRoot, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Prefer the real Module.swift from widgets if it exists.
|
|
89
|
+
const moduleSwiftPath = path.join(widgetsPath, "Module.swift");
|
|
90
|
+
const targetPath = path.join(moduleRoot, "Module.swift");
|
|
91
|
+
if (fs.existsSync(moduleSwiftPath)) {
|
|
92
|
+
fs.copyFileSync(moduleSwiftPath, targetPath);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// If widgets are disabled and no real Module.swift exists, write a stub
|
|
97
|
+
// so CocoaPods still builds a Swift module and avoids import errors.
|
|
98
|
+
if (!fs.existsSync(targetPath)) {
|
|
99
|
+
const stubModule = [
|
|
100
|
+
"import ExpoModulesCore",
|
|
101
|
+
"",
|
|
102
|
+
"public class ReactNativeWidgetExtensionModule: Module {",
|
|
103
|
+
" public func definition() -> ModuleDefinition {",
|
|
104
|
+
' Name("ReactNativeWidgetExtension")',
|
|
105
|
+
" }",
|
|
106
|
+
"}",
|
|
107
|
+
"",
|
|
108
|
+
].join("\n");
|
|
109
|
+
fs.writeFileSync(targetPath, stubModule);
|
|
110
|
+
}
|
|
111
|
+
};
|