@expo/config-plugins 7.9.0 → 7.9.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/ios/PrivacyInfo.js
CHANGED
|
@@ -13,16 +13,16 @@ function _plist() {
|
|
|
13
13
|
};
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const data = _interopRequireDefault(require("
|
|
18
|
-
|
|
16
|
+
function _fs() {
|
|
17
|
+
const data = _interopRequireDefault(require("fs"));
|
|
18
|
+
_fs = function () {
|
|
19
19
|
return data;
|
|
20
20
|
};
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const data = require("
|
|
25
|
-
|
|
23
|
+
function _path() {
|
|
24
|
+
const data = _interopRequireDefault(require("path"));
|
|
25
|
+
_path = function () {
|
|
26
26
|
return data;
|
|
27
27
|
};
|
|
28
28
|
return data;
|
|
@@ -53,24 +53,44 @@ function withPrivacyInfo(config) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function setPrivacyInfo(projectConfig, privacyManifests) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
const {
|
|
57
|
+
projectRoot,
|
|
58
|
+
platformProjectRoot
|
|
59
|
+
} = projectConfig.modRequest;
|
|
60
|
+
const projectName = (0, _Xcodeproj().getProjectName)(projectRoot);
|
|
61
|
+
const privacyFilePath = _path().default.join(platformProjectRoot, projectName, 'PrivacyInfo.xcprivacy');
|
|
62
|
+
const existingFileContent = getFileContents(privacyFilePath);
|
|
62
63
|
const parsedContent = existingFileContent ? _plist().default.parse(existingFileContent) : {};
|
|
63
64
|
const mergedContent = mergePrivacyInfo(parsedContent, privacyManifests);
|
|
64
65
|
const contents = _plist().default.build(mergedContent);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
ensureFileExists(privacyFilePath, contents);
|
|
67
|
+
if (!projectConfig.modResults.hasFile(privacyFilePath)) {
|
|
68
|
+
projectConfig.modResults = (0, _Xcodeproj().addResourceFileToGroup)({
|
|
69
|
+
filepath: privacyFilePath,
|
|
70
|
+
groupName: projectName,
|
|
71
|
+
project: projectConfig.modResults,
|
|
72
|
+
isBuildFile: true,
|
|
73
|
+
verbose: true
|
|
74
|
+
});
|
|
75
|
+
}
|
|
72
76
|
return projectConfig;
|
|
73
77
|
}
|
|
78
|
+
function getFileContents(filePath) {
|
|
79
|
+
if (!_fs().default.existsSync(filePath)) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return _fs().default.readFileSync(filePath, {
|
|
83
|
+
encoding: 'utf8'
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function ensureFileExists(filePath, contents) {
|
|
87
|
+
if (!_fs().default.existsSync(_path().default.dirname(filePath))) {
|
|
88
|
+
_fs().default.mkdirSync(_path().default.dirname(filePath), {
|
|
89
|
+
recursive: true
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
_fs().default.writeFileSync(filePath, contents);
|
|
93
|
+
}
|
|
74
94
|
function mergePrivacyInfo(existing, privacyManifests) {
|
|
75
95
|
var _ref, _privacyManifests$NSP, _privacyManifests$NSP2, _privacyManifests$NSP3, _privacyManifests$NSP4;
|
|
76
96
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivacyInfo.js","names":["_plist","data","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"PrivacyInfo.js","names":["_plist","data","_interopRequireDefault","require","_fs","_path","_Xcodeproj","_","obj","__esModule","default","withPrivacyInfo","config","_config$ios","privacyManifests","ios","withXcodeProject","projectConfig","setPrivacyInfo","projectRoot","platformProjectRoot","modRequest","projectName","getProjectName","privacyFilePath","path","join","existingFileContent","getFileContents","parsedContent","plist","parse","mergedContent","mergePrivacyInfo","contents","build","ensureFileExists","modResults","hasFile","addResourceFileToGroup","filepath","groupName","project","isBuildFile","verbose","filePath","fs","existsSync","readFileSync","encoding","dirname","mkdirSync","recursive","writeFileSync","existing","_ref","_privacyManifests$NSP","_privacyManifests$NSP2","_privacyManifests$NSP3","_privacyManifests$NSP4","NSPrivacyAccessedAPITypes","NSPrivacyCollectedDataTypes","NSPrivacyTracking","NSPrivacyTrackingDomains","structuredClone","forEach","newType","existingType","find","t","NSPrivacyAccessedAPIType","push","_existingType$NSPriva","NSPrivacyAccessedAPITypeReasons","Set","concat","NSPrivacyCollectedDataType","_existingType$NSPriva2","NSPrivacyCollectedDataTypePurposes"],"sources":["../../src/ios/PrivacyInfo.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport plist from '@expo/plist';\nimport fs from 'fs';\nimport path from 'path';\nimport type { XcodeProject } from 'xcode';\n\nimport { addResourceFileToGroup, getProjectName } from './utils/Xcodeproj';\nimport { ExportedConfigWithProps, withXcodeProject } from '..';\n\nexport type PrivacyInfo = {\n NSPrivacyAccessedAPITypes: {\n NSPrivacyAccessedAPIType: string;\n NSPrivacyAccessedAPITypeReasons: string[];\n }[];\n NSPrivacyCollectedDataTypes: {\n NSPrivacyCollectedDataType: string;\n NSPrivacyCollectedDataTypeLinked: boolean;\n NSPrivacyCollectedDataTypeTracking: boolean;\n NSPrivacyCollectedDataTypePurposes: string[];\n }[];\n NSPrivacyTracking: boolean;\n NSPrivacyTrackingDomains: string[];\n};\n\nexport function withPrivacyInfo(config: ExpoConfig): ExpoConfig {\n const privacyManifests = config.ios?.privacyManifests;\n if (!privacyManifests) {\n return config;\n }\n\n return withXcodeProject(config, (projectConfig: ExportedConfigWithProps<XcodeProject>) => {\n return setPrivacyInfo(projectConfig, privacyManifests);\n });\n}\n\nexport function setPrivacyInfo(\n projectConfig: ExportedConfigWithProps<XcodeProject>,\n privacyManifests: Partial<PrivacyInfo>\n) {\n const { projectRoot, platformProjectRoot } = projectConfig.modRequest;\n\n const projectName = getProjectName(projectRoot);\n\n const privacyFilePath = path.join(platformProjectRoot, projectName, 'PrivacyInfo.xcprivacy');\n\n const existingFileContent = getFileContents(privacyFilePath);\n\n const parsedContent = existingFileContent ? plist.parse(existingFileContent) : {};\n const mergedContent = mergePrivacyInfo(parsedContent, privacyManifests);\n const contents = plist.build(mergedContent);\n\n ensureFileExists(privacyFilePath, contents);\n\n if (!projectConfig.modResults.hasFile(privacyFilePath)) {\n projectConfig.modResults = addResourceFileToGroup({\n filepath: privacyFilePath,\n groupName: projectName,\n project: projectConfig.modResults,\n isBuildFile: true,\n verbose: true,\n });\n }\n\n return projectConfig;\n}\n\nfunction getFileContents(filePath: string): string | null {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n return fs.readFileSync(filePath, { encoding: 'utf8' });\n}\n\nfunction ensureFileExists(filePath: string, contents: string) {\n if (!fs.existsSync(path.dirname(filePath))) {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n }\n fs.writeFileSync(filePath, contents);\n}\n\nexport function mergePrivacyInfo(\n existing: Partial<PrivacyInfo>,\n privacyManifests: Partial<PrivacyInfo>\n): PrivacyInfo {\n let {\n NSPrivacyAccessedAPITypes = [],\n NSPrivacyCollectedDataTypes = [],\n NSPrivacyTracking = false,\n NSPrivacyTrackingDomains = [],\n } = structuredClone(existing);\n // tracking is a boolean, so we can just overwrite it\n NSPrivacyTracking = privacyManifests.NSPrivacyTracking ?? existing.NSPrivacyTracking ?? false;\n // merge the api types – for each type ensure the key is in the array, and if it is add the reason if it's not there\n privacyManifests.NSPrivacyAccessedAPITypes?.forEach((newType) => {\n const existingType = NSPrivacyAccessedAPITypes.find(\n (t) => t.NSPrivacyAccessedAPIType === newType.NSPrivacyAccessedAPIType\n );\n if (!existingType) {\n NSPrivacyAccessedAPITypes.push(newType);\n } else {\n existingType.NSPrivacyAccessedAPITypeReasons = [\n ...new Set(\n existingType?.NSPrivacyAccessedAPITypeReasons?.concat(\n ...newType.NSPrivacyAccessedAPITypeReasons\n )\n ),\n ];\n }\n });\n // merge the collected data types – for each type ensure the key is in the array, and if it is add the purposes if it's not there\n privacyManifests.NSPrivacyCollectedDataTypes?.forEach((newType) => {\n const existingType = NSPrivacyCollectedDataTypes.find(\n (t) => t.NSPrivacyCollectedDataType === newType.NSPrivacyCollectedDataType\n );\n if (!existingType) {\n NSPrivacyCollectedDataTypes.push(newType);\n } else {\n existingType.NSPrivacyCollectedDataTypePurposes = [\n ...new Set(\n existingType?.NSPrivacyCollectedDataTypePurposes?.concat(\n ...newType.NSPrivacyCollectedDataTypePurposes\n )\n ),\n ];\n }\n });\n // merge the tracking domains\n NSPrivacyTrackingDomains = [\n ...new Set(NSPrivacyTrackingDomains.concat(privacyManifests.NSPrivacyTrackingDomains ?? [])),\n ];\n\n return {\n NSPrivacyAccessedAPITypes,\n NSPrivacyCollectedDataTypes,\n NSPrivacyTracking,\n NSPrivacyTrackingDomains,\n };\n}\n"],"mappings":";;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,EAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,CAAA,YAAAA,CAAA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H;EACF,CAAC,CAAC;EACF;EACAf,wBAAwB,GAAG,CACzB,GAAG,IAAIW,GAAG,CAACX,wBAAwB,CAACY,MAAM,EAAAhB,sBAAA,GAAC7C,gBAAgB,CAACiD,wBAAwB,cAAAJ,sBAAA,cAAAA,sBAAA,GAAI,EAAE,CAAC,CAAC,CAC7F;EAED,OAAO;IACLC,yBAAyB;IACzBC,2BAA2B;IAC3BC,iBAAiB;IACjBC;EACF,CAAC;AACH"}
|
|
@@ -29,14 +29,3 @@ export declare function createBuildSourceFile({ project, nativeProjectRoot, file
|
|
|
29
29
|
fileContents: string;
|
|
30
30
|
overwrite?: boolean;
|
|
31
31
|
}): XcodeProject;
|
|
32
|
-
/**
|
|
33
|
-
* Read a source file from the Xcode project
|
|
34
|
-
*
|
|
35
|
-
* @param nativeProjectRoot absolute path to the native app root `user/app/ios`
|
|
36
|
-
* @param filePath path relative to the `nativeProjectRoot` for the file to read `user/app/ios/myapp/foobar.swift`
|
|
37
|
-
*/
|
|
38
|
-
export declare function readBuildSourceFile({ project, nativeProjectRoot, filePath, }: {
|
|
39
|
-
project: XcodeProject;
|
|
40
|
-
nativeProjectRoot: string;
|
|
41
|
-
filePath: string;
|
|
42
|
-
}): string | null;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createBuildSourceFile = createBuildSourceFile;
|
|
7
|
-
exports.readBuildSourceFile = readBuildSourceFile;
|
|
8
7
|
exports.withBuildSourceFile = void 0;
|
|
9
8
|
function _fs() {
|
|
10
9
|
const data = _interopRequireDefault(require("fs"));
|
|
@@ -97,24 +96,4 @@ function createBuildSourceFile({
|
|
|
97
96
|
}
|
|
98
97
|
return project;
|
|
99
98
|
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Read a source file from the Xcode project
|
|
103
|
-
*
|
|
104
|
-
* @param nativeProjectRoot absolute path to the native app root `user/app/ios`
|
|
105
|
-
* @param filePath path relative to the `nativeProjectRoot` for the file to read `user/app/ios/myapp/foobar.swift`
|
|
106
|
-
*/
|
|
107
|
-
function readBuildSourceFile({
|
|
108
|
-
project,
|
|
109
|
-
nativeProjectRoot,
|
|
110
|
-
filePath
|
|
111
|
-
}) {
|
|
112
|
-
const absoluteFilePath = _path().default.join(nativeProjectRoot, filePath);
|
|
113
|
-
if (!_fs().default.existsSync(absoluteFilePath)) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
return _fs().default.readFileSync(absoluteFilePath, {
|
|
117
|
-
encoding: 'utf8'
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
99
|
//# sourceMappingURL=XcodeProjectFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XcodeProjectFile.js","names":["_fs","data","_interopRequireDefault","require","_path","_Xcodeproj","_iosPlugins","obj","__esModule","default","withBuildSourceFile","config","filePath","contents","overwrite","withXcodeProject","projectName","getProjectName","modRequest","projectRoot","modResults","createBuildSourceFile","project","nativeProjectRoot","platformProjectRoot","fileContents","path","join","exports","absoluteFilePath","fs","existsSync","writeFileSync","groupName","dirname","hasFile","addBuildSourceFileToGroup","filepath"
|
|
1
|
+
{"version":3,"file":"XcodeProjectFile.js","names":["_fs","data","_interopRequireDefault","require","_path","_Xcodeproj","_iosPlugins","obj","__esModule","default","withBuildSourceFile","config","filePath","contents","overwrite","withXcodeProject","projectName","getProjectName","modRequest","projectRoot","modResults","createBuildSourceFile","project","nativeProjectRoot","platformProjectRoot","fileContents","path","join","exports","absoluteFilePath","fs","existsSync","writeFileSync","groupName","dirname","hasFile","addBuildSourceFileToGroup","filepath"],"sources":["../../src/ios/XcodeProjectFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { addBuildSourceFileToGroup, getProjectName } from './utils/Xcodeproj';\nimport { ConfigPlugin, XcodeProject } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\n\n/**\n * Create a build source file and link it to Xcode.\n *\n * @param config\n * @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.\n * @param props.contents file contents to write.\n * @param props.overwrite should the contents overwrite any existing file in the same location on disk.\n * @returns\n */\nexport const withBuildSourceFile: ConfigPlugin<{\n filePath: string;\n contents: string;\n overwrite?: boolean;\n}> = (config, { filePath, contents, overwrite }) => {\n return withXcodeProject(config, (config) => {\n const projectName = getProjectName(config.modRequest.projectRoot);\n\n config.modResults = createBuildSourceFile({\n project: config.modResults,\n nativeProjectRoot: config.modRequest.platformProjectRoot,\n fileContents: contents,\n filePath: path.join(projectName, filePath),\n overwrite,\n });\n return config;\n });\n};\n\n/**\n * Add a source file to the Xcode project and write it to the file system.\n *\n * @param nativeProjectRoot absolute path to the native app root `user/app/ios`\n * @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`\n * @param fileContents string file contents to write to the `filePath`\n * @param overwrite should write file even if one already exists\n */\nexport function createBuildSourceFile({\n project,\n nativeProjectRoot,\n filePath,\n fileContents,\n overwrite,\n}: {\n project: XcodeProject;\n nativeProjectRoot: string;\n filePath: string;\n fileContents: string;\n overwrite?: boolean;\n}): XcodeProject {\n const absoluteFilePath = path.join(nativeProjectRoot, filePath);\n if (overwrite || !fs.existsSync(absoluteFilePath)) {\n // Create the file\n fs.writeFileSync(absoluteFilePath, fileContents, 'utf8');\n }\n\n // `myapp`\n const groupName = path.dirname(filePath);\n\n // Ensure the file is linked with Xcode resource files\n if (!project.hasFile(filePath)) {\n project = addBuildSourceFileToGroup({\n filepath: filePath,\n groupName,\n project,\n });\n }\n return project;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA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ACZX;AAOF,CAAC,EAAgB;EACf,MAAMe,gBAAgB,GAAGH,eAAI,CAACC,IAAI,CAACJ,iBAAiB,EAAEX,QAAQ,CAAC;EAC/D,IAAIE,SAAS,IAAI,CAACgB,aAAE,CAACC,UAAU,CAACF,gBAAgB,CAAC,EAAE;IACjD;IACAC,aAAE,CAACE,aAAa,CAACH,gBAAgB,EAAEJ,YAAY,EAAE,MAAM,CAAC;EAC1D;;EAEA;EACA,MAAMQ,SAAS,GAAGP,eAAI,CAACQ,OAAO,CAACtB,QAAQ,CAAC;;EAExC;EACA,IAAI,CAACU,OAAO,CAACa,OAAO,CAACvB,QAAQ,CAAC,EAAE;IAC9BU,OAAO,GAAG,IAAAc,sCAAyB,EAAC;MAClCC,QAAQ,EAAEzB,QAAQ;MAClBqB,SAAS;MACTX;IACF,CAAC,CAAC;EACJ;EACA,OAAOA,OAAO;AAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.1",
|
|
4
4
|
"description": "A library for Expo config plugins",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "5f7f4d441164282e590bf28dae4f05779da32d8a"
|
|
64
64
|
}
|