@expo/inline-modules 0.0.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/LICENSE +21 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +5 -0
- package/build/xcodeProjectUpdates.d.ts +7 -0
- package/build/xcodeProjectUpdates.js +67 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { updateXcodeProject, InlineModulesXcodeParams } from './xcodeProjectUpdates';
|
package/build/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateXcodeProject = void 0;
|
|
4
|
+
var xcodeProjectUpdates_1 = require("./xcodeProjectUpdates");
|
|
5
|
+
Object.defineProperty(exports, "updateXcodeProject", { enumerable: true, get: function () { return xcodeProjectUpdates_1.updateXcodeProject; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface InlineModulesXcodeParams {
|
|
2
|
+
watchedDirectories: string[];
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Add watched directories as PBXFileSystemSynchronizedRootGroups to pbxproj file in the project and save the changes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateXcodeProject(projectRoot: string, inlineModulesXcodeParams: InlineModulesXcodeParams): Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updateXcodeProject = updateXcodeProject;
|
|
7
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
/**
|
|
11
|
+
* Add watched directories as PBXFileSystemSynchronizedRootGroups to pbxproj file in the project and save the changes.
|
|
12
|
+
*/
|
|
13
|
+
async function updateXcodeProject(projectRoot, inlineModulesXcodeParams) {
|
|
14
|
+
const swiftWatchedDirectories = inlineModulesXcodeParams.watchedDirectories;
|
|
15
|
+
// Only perform changes to pbxproj if necessary
|
|
16
|
+
if (swiftWatchedDirectories.length === 0) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const pbxProject = config_plugins_1.IOSConfig.XcodeUtils.getPbxproj(projectRoot);
|
|
20
|
+
const mainGroupUUID = pbxProject.getFirstProject().firstProject.mainGroup;
|
|
21
|
+
const mainTarget = pbxProject.getFirstProject().firstProject.targets[0];
|
|
22
|
+
const objects = pbxProject.hash.project.objects;
|
|
23
|
+
const projectRootRelativeToIos = '..';
|
|
24
|
+
const fsSynchronizedRootGroups = new Set();
|
|
25
|
+
if (objects.PBXFileSystemSynchronizedRootGroup) {
|
|
26
|
+
for (const key of Object.keys(objects.PBXFileSystemSynchronizedRootGroup)) {
|
|
27
|
+
if (key.endsWith('_comment')) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
fsSynchronizedRootGroups.add(objects.PBXFileSystemSynchronizedRootGroup[key].path);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
objects.PBXFileSystemSynchronizedRootGroup = {};
|
|
35
|
+
}
|
|
36
|
+
let projectHasChanged = false;
|
|
37
|
+
for (const dir of swiftWatchedDirectories) {
|
|
38
|
+
const dirRelativeToIos = path_1.default.join(projectRootRelativeToIos, dir);
|
|
39
|
+
if (fsSynchronizedRootGroups.has(dirRelativeToIos)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
projectHasChanged = true;
|
|
43
|
+
const newUUID = pbxProject.generateUuid();
|
|
44
|
+
objects.PBXGroup[mainGroupUUID].children.push({
|
|
45
|
+
value: newUUID,
|
|
46
|
+
comment: dir,
|
|
47
|
+
});
|
|
48
|
+
objects.PBXFileSystemSynchronizedRootGroup[newUUID] = {
|
|
49
|
+
isa: 'PBXFileSystemSynchronizedRootGroup',
|
|
50
|
+
explicitFileTypes: {},
|
|
51
|
+
explicitFolders: [],
|
|
52
|
+
name: dir,
|
|
53
|
+
path: dirRelativeToIos,
|
|
54
|
+
sourceTree: 'SOURCE_ROOT',
|
|
55
|
+
};
|
|
56
|
+
if (mainTarget) {
|
|
57
|
+
const nativeTargetGroup = objects.PBXNativeTarget[mainTarget.value];
|
|
58
|
+
if (!nativeTargetGroup.fileSystemSynchronizedGroups) {
|
|
59
|
+
nativeTargetGroup.fileSystemSynchronizedGroups = [];
|
|
60
|
+
}
|
|
61
|
+
nativeTargetGroup.fileSystemSynchronizedGroups.push({ value: newUUID, comment: dir });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (projectHasChanged) {
|
|
65
|
+
await fs_1.default.promises.writeFile(pbxProject.filepath, pbxProject.writeSync());
|
|
66
|
+
}
|
|
67
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@expo/inline-modules",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "The Expo inline modules",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"build"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/expo/expo.git",
|
|
12
|
+
"directory": "packages/@expo/inline-modules"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"expo",
|
|
16
|
+
"inline",
|
|
17
|
+
"inline-modules"
|
|
18
|
+
],
|
|
19
|
+
"author": "Expo",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/expo/expo/issues"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/jest": "^29.2.1",
|
|
26
|
+
"@types/node": "^22.14.0",
|
|
27
|
+
"expo-module-scripts": "55.0.2"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"expo": "55.0.2"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "expo-module build",
|
|
34
|
+
"clean": "expo-module clean",
|
|
35
|
+
"lint": "expo-module lint",
|
|
36
|
+
"test": "expo-module test",
|
|
37
|
+
"expo-module": "expo-module"
|
|
38
|
+
}
|
|
39
|
+
}
|