@smileid/usesmileid_vision_document 12.0.2 → 12.1.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/CHANGELOG.md +12 -0
- package/README.md +33 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -34
- package/ios/UseSmileIDVisionDocumentExpo.podspec +2 -5
- package/ios/UseSmileIDVisionDocumentModule/ResizingFrameStorage.swift +1 -1
- package/ios/UseSmileIDVisionDocumentModule/UseSmileIDVisionDocumentKameraAnalysisTick.swift +80 -0
- package/ios/UseSmileIDVisionDocumentModule/UseSmileIDVisionDocumentModule.swift +9 -14
- package/package.json +13 -14
- package/plugin/build/index.d.ts +10 -1
- package/plugin/build/index.js +1 -124
- package/plugin/build/lib/deployment_target.js +1 -39
- package/plugin/build/lib/podfile.d.ts +15 -0
- package/plugin/build/lib/podfile.js +159 -130
- package/plugin/build/lib/signature_dedup.d.ts +14 -0
- package/plugin/build/lib/signature_dedup.js +2 -0
- package/plugin/build/lib/spm.d.ts +21 -0
- package/plugin/build/lib/spm.js +1 -196
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/ios/UseSmileIDVisionDocumentModule/UseSmileIDVisionDocumentFrameProcessorPlugin.swift +0 -149
- package/plugin/build/index.js.map +0 -1
- package/plugin/build/lib/deployment_target.js.map +0 -1
- package/plugin/build/lib/podfile.js.map +0 -1
- package/plugin/build/lib/spm.js.map +0 -1
- package/plugin/src/__tests__/deployment_target.test.ts +0 -41
- package/plugin/src/__tests__/podfile.test.ts +0 -138
- package/plugin/src/index.ts +0 -108
- package/plugin/src/lib/deployment_target.ts +0 -46
- package/plugin/src/lib/podfile.ts +0 -254
- package/plugin/src/lib/spm.ts +0 -314
- package/plugin/tsconfig.json +0 -24
- package/src/__tests__/use_smile_id_vision_document.test.ts +0 -79
- package/src/index.ts +0 -42
|
@@ -1,112 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.injectPodfileSpmBlock = injectPodfileSpmBlock;
|
|
9
|
-
const BEGIN_PREFIX = "# === BEGIN smileid-spm:";
|
|
10
|
-
const END_PREFIX = "# === END smileid-spm:";
|
|
11
|
-
/**
|
|
12
|
-
* Idempotently injects an SPM-linking Ruby block into the Podfile's
|
|
13
|
-
* top-level `post_install` block. Re-running on an already-injected
|
|
14
|
-
* Podfile rewrites the same marker block in place (so version /
|
|
15
|
-
* product changes flow through cleanly on the next prebuild).
|
|
16
|
-
*/
|
|
17
|
-
function injectPodfileSpmBlock(podfile, options) {
|
|
18
|
-
validateRubySafe(options);
|
|
19
|
-
const block = renderBlock(options);
|
|
20
|
-
const beginMarker = `${BEGIN_PREFIX} ${options.marker} ===`;
|
|
21
|
-
const endMarker = `${END_PREFIX} ${options.marker} ===`;
|
|
22
|
-
// The indentation is captured so a rewrite can restore it; dropping it would
|
|
23
|
-
// make every prebuild rewrite the Podfile.
|
|
24
|
-
const blockRegex = new RegExp(`([ \\t]*)${escapeRegExp(beginMarker)}[\\s\\S]*?${escapeRegExp(endMarker)}`, "m");
|
|
25
|
-
const existing = podfile.match(blockRegex);
|
|
26
|
-
if (existing) {
|
|
27
|
-
// A replacer function, so `$` in the Ruby block is never a replacement pattern.
|
|
28
|
-
return podfile.replace(blockRegex, () => indentBlock(block, existing[1] ?? ""));
|
|
29
|
-
}
|
|
30
|
-
// Inject at the *start* of the post_install body — right after
|
|
31
|
-
// `post_install do |installer|`. We tried matching the closing
|
|
32
|
-
// `end` pair instead, but a second plugin running on a Podfile
|
|
33
|
-
// already mutated by the first sees a non-flat body and the
|
|
34
|
-
// non-greedy `end…end` match latches onto inner block ends,
|
|
35
|
-
// nesting the second injection inside the first. Anchoring on
|
|
36
|
-
// the opening line removes that failure mode entirely. Order
|
|
37
|
-
// relative to `react_native_post_install` doesn't matter because
|
|
38
|
-
// CocoaPods persists the Pods project at the end of pod install
|
|
39
|
-
// regardless of what we explicitly save mid-block.
|
|
40
|
-
const headerRegex = /(post_install\s+do\s*\|\s*installer\s*\|)\r?\n/;
|
|
41
|
-
const headerMatch = podfile.match(headerRegex);
|
|
42
|
-
if (!headerMatch || headerMatch.index === undefined) {
|
|
43
|
-
throw new Error("[smileid-spm] Could not locate `post_install do |installer|` in Podfile. " +
|
|
44
|
-
"Refusing to append a top-level post_install hook because CocoaPods only honors one — adding a second " +
|
|
45
|
-
"would silently override the React Native post-install plumbing. Restore the Expo Podfile template " +
|
|
46
|
-
"or wire the SPM block in manually.");
|
|
47
|
-
}
|
|
48
|
-
const insertAt = headerMatch.index + headerMatch[0].length;
|
|
49
|
-
const indented = `${indentBlock(block, " ")}\n`;
|
|
50
|
-
return podfile.slice(0, insertAt) + indented + podfile.slice(insertAt);
|
|
51
|
-
}
|
|
52
|
-
function indentBlock(block, prefix) {
|
|
53
|
-
return block
|
|
54
|
-
.split("\n")
|
|
55
|
-
.map((line) => (line.length > 0 ? `${prefix}${line}` : line))
|
|
56
|
-
.join("\n");
|
|
57
|
-
}
|
|
58
|
-
// Injected strings land in Ruby literals, so a typo here could otherwise become
|
|
59
|
-
// code that runs during `pod install`. `#` and `"` are rejected alongside `'`,
|
|
60
|
-
// `\` and control chars because the diagnostics are double-quoted, where Ruby
|
|
61
|
-
// evaluates `#{...}`.
|
|
62
|
-
function validateRubySafe(options) {
|
|
63
|
-
const fields = [
|
|
64
|
-
["marker", options.marker],
|
|
65
|
-
["package.url", options.package.url],
|
|
66
|
-
["podTarget", options.podTarget],
|
|
67
|
-
];
|
|
68
|
-
for (const product of options.products) {
|
|
69
|
-
fields.push(["products[*]", product]);
|
|
70
|
-
}
|
|
71
|
-
switch (options.package.requirement.kind) {
|
|
72
|
-
case "upToNextMajorVersion":
|
|
73
|
-
case "upToNextMinorVersion":
|
|
74
|
-
fields.push([
|
|
75
|
-
"requirement.minimumVersion",
|
|
76
|
-
options.package.requirement.minimumVersion,
|
|
77
|
-
]);
|
|
78
|
-
break;
|
|
79
|
-
case "exactVersion":
|
|
80
|
-
fields.push(["requirement.version", options.package.requirement.version]);
|
|
81
|
-
break;
|
|
82
|
-
case "branch":
|
|
83
|
-
fields.push(["requirement.branch", options.package.requirement.branch]);
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
for (const [name, value] of fields) {
|
|
87
|
-
if (/['"#\\\n\r\t]/.test(value)) {
|
|
88
|
-
throw new Error(`[smileid-spm] Refusing to inject Podfile block: '${name}' contains an unsafe character (got: ${JSON.stringify(value)}).`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function renderBlock(options) {
|
|
93
|
-
const beginMarker = `${BEGIN_PREFIX} ${options.marker} ===`;
|
|
94
|
-
const endMarker = `${END_PREFIX} ${options.marker} ===`;
|
|
95
|
-
const requirement = renderRequirement(options.package.requirement);
|
|
96
|
-
const productList = options.products.map((p) => `'${p}'`).join(", ");
|
|
97
|
-
const missingTarget = options.required
|
|
98
|
-
? `raise "[smileid-spm] Pod target #{target_name} is missing from Pods.xcodeproj, so #{product_names.join(', ')} cannot be linked and the Smile ID bridge will not compile. Check that '@smileid/usesmileid_bridge' is installed and that its npm package ships its 'ios' directory."`
|
|
99
|
-
: `Pod::UI.warn "[smileid-spm] Pod target #{target_name} not found; skipping SPM link."`;
|
|
100
|
-
return `${beginMarker}
|
|
101
|
-
# Wires ${options.package.url} into Pods.xcodeproj and links its
|
|
102
|
-
# products to the '${options.podTarget}' pod target so the Swift
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.injectPodfileSpmBlock=injectPodfileSpmBlock,exports.injectPodfileKameraLinkBlock=injectPodfileKameraLinkBlock,exports.injectPodfileSignatureDedupBlock=injectPodfileSignatureDedupBlock;const signature_dedup_1=require("./signature_dedup"),BEGIN_PREFIX="# === BEGIN smileid-spm:",END_PREFIX="# === END smileid-spm:",SIGNATURE_DEDUP_MARKER="usesmileid_signature_dedup",KAMERA_LINK_MARKER="kamera_spm";function injectPodfileSpmBlock(e,r){return validateRubySafe(r),injectMarkerBlock(e,r.marker,renderBlock(r))}function injectPodfileKameraLinkBlock(e){return injectMarkerBlock(e,KAMERA_LINK_MARKER,renderKameraLinkBlock())}function injectPodfileSignatureDedupBlock(e){return injectMarkerBlock(e,SIGNATURE_DEDUP_MARKER,renderSignatureDedupBlock())}function injectMarkerBlock(e,r,a){const t=`${BEGIN_PREFIX} ${r} ===`,n=`${END_PREFIX} ${r} ===`,s=new RegExp(`([ \\t]*)${escapeRegExp(t)}[\\s\\S]*?${escapeRegExp(n)}`,"m"),o=e.match(s);if(o)return e.replace(s,()=>indentBlock(a,o[1]??""));const p=/(post_install\s+do\s*\|\s*installer\s*\|)\r?\n/,i=e.match(p);if(!i||i.index===void 0)throw new Error("[smileid-spm] Could not locate `post_install do |installer|` in Podfile. Refusing to append a top-level post_install hook because CocoaPods only honors one \u2014 adding a second would silently override the React Native post-install plumbing. Restore the Expo Podfile template or wire the SPM block in manually.");const d=i.index+i[0].length,c=`${indentBlock(a," ")}
|
|
2
|
+
`;return e.slice(0,d)+c+e.slice(d)}function indentBlock(e,r){return e.split(`
|
|
3
|
+
`).map(a=>a.length>0?`${r}${a}`:a).join(`
|
|
4
|
+
`)}function validateRubySafe(e){const r=[["marker",e.marker],["package.url",e.package.url],["podTarget",e.podTarget]];for(const a of e.products)r.push(["products[*]",a]);switch(e.package.requirement.kind){case"upToNextMajorVersion":case"upToNextMinorVersion":r.push(["requirement.minimumVersion",e.package.requirement.minimumVersion]);break;case"exactVersion":r.push(["requirement.version",e.package.requirement.version]);break;case"branch":r.push(["requirement.branch",e.package.requirement.branch]);break}for(const[a,t]of r)if(/['"#\\\n\r\t]/.test(t))throw new Error(`[smileid-spm] Refusing to inject Podfile block: '${a}' contains an unsafe character (got: ${JSON.stringify(t)}).`)}function renderBlock(e){const r=`${BEGIN_PREFIX} ${e.marker} ===`,a=`${END_PREFIX} ${e.marker} ===`,t=renderRequirement(e.package.requirement),n=e.products.map(o=>`'${o}'`).join(", "),s=e.required?`raise "[smileid-spm] Pod target #{target_name} is missing from Pods.xcodeproj, so #{product_names.join(', ')} cannot be linked and the Smile ID bridge will not compile. Check that '@smileid/usesmileid_bridge' is installed and that its npm package ships its 'ios' directory."`:'Pod::UI.warn "[smileid-spm] Pod target #{target_name} not found; skipping SPM link."';return`${r}
|
|
5
|
+
# Wires ${e.package.url} into Pods.xcodeproj and links its
|
|
6
|
+
# products to the '${e.podTarget}' pod target so the Swift
|
|
103
7
|
# bridge code can \`import\` them. Idempotent across pod installs.
|
|
104
8
|
#
|
|
105
9
|
# UUIDs are minted via SecureRandom rather than \`pods_project.new\`
|
|
106
10
|
# because \`prepare_react_native_project!\` sets
|
|
107
11
|
# \`:deterministic_uuids => false\`. With that flag off, CocoaPods
|
|
108
12
|
# skips its predictabilize step and \`stabilize_target_uuids\` resets
|
|
109
|
-
# \`@generated_uuids\` to a tiny leftover pool
|
|
13
|
+
# \`@generated_uuids\` to a tiny leftover pool \u2014 so any post_install
|
|
110
14
|
# call to \`pods_project.new\` restarts the sequential index near 0
|
|
111
15
|
# and re-mints UUIDs already in use. The collision then runs through
|
|
112
16
|
# \`add_referrer\`, which clobbers \`objects_by_uuid[uuid]\` and
|
|
@@ -116,10 +20,10 @@ function renderBlock(options) {
|
|
|
116
20
|
# hex IDs can't collide with the 14-char cocoapods scheme.
|
|
117
21
|
begin
|
|
118
22
|
pods_project = installer.pods_project
|
|
119
|
-
spm_url = '${
|
|
120
|
-
spm_requirement = ${
|
|
121
|
-
product_names = [${
|
|
122
|
-
target_name = '${
|
|
23
|
+
spm_url = '${e.package.url}'
|
|
24
|
+
spm_requirement = ${t}
|
|
25
|
+
product_names = [${n}]
|
|
26
|
+
target_name = '${e.podTarget}'
|
|
123
27
|
|
|
124
28
|
smileid_spm_safe_uuid = lambda do |project|
|
|
125
29
|
loop do
|
|
@@ -142,7 +46,7 @@ begin
|
|
|
142
46
|
|
|
143
47
|
target = pods_project.targets.find { |t| t.name == target_name }
|
|
144
48
|
if target.nil?
|
|
145
|
-
${
|
|
49
|
+
${s}
|
|
146
50
|
else
|
|
147
51
|
product_names.each do |product_name|
|
|
148
52
|
already = target.package_product_dependencies.any? do |d|
|
|
@@ -165,10 +69,17 @@ begin
|
|
|
165
69
|
end
|
|
166
70
|
|
|
167
71
|
# Every linking static pod absorbs ios-spm's source-target objects and the
|
|
168
|
-
# app's -ObjC link then sees duplicates
|
|
72
|
+
# app's -ObjC link then sees duplicates \u2014 the app keeps the single copy.
|
|
169
73
|
strip_name = '[smileid-spm] Strip absorbed SPM source objects'
|
|
170
74
|
unless target.shell_script_build_phases.any? { |p| p.name == strip_name }
|
|
171
|
-
|
|
75
|
+
# \`new_shell_script_build_phase\` mints through \`pods_project.new\`, whose
|
|
76
|
+
# reset index (see above) hands out 46EB2E00000000 \u2014 the rootObject's own
|
|
77
|
+
# UUID \u2014 and the overwrite makes Xcode reject the project as damaged.
|
|
78
|
+
phase_uuid = smileid_spm_safe_uuid.call(pods_project)
|
|
79
|
+
phase = Xcodeproj::Project::Object::PBXShellScriptBuildPhase.new(pods_project, phase_uuid)
|
|
80
|
+
phase.initialize_defaults
|
|
81
|
+
phase.name = strip_name
|
|
82
|
+
target.build_phases << phase
|
|
172
83
|
phase.shell_script = <<~'STRIPSH'
|
|
173
84
|
set -u
|
|
174
85
|
A="\${TARGET_BUILD_DIR}/\${EXECUTABLE_PATH}"
|
|
@@ -178,7 +89,7 @@ begin
|
|
|
178
89
|
ar -d "$1" "$2" && ranlib "$1" 2>/dev/null || true
|
|
179
90
|
}
|
|
180
91
|
ARCHS_IN=$(lipo -archs "$A" 2>/dev/null || true)
|
|
181
|
-
for OBJ in UseSmileIDSentrySupport.o UseSmileIDLottieSupport.o; do
|
|
92
|
+
for OBJ in UseSmileIDSentrySupport.o UseSmileIDLottieSupport.o UseSmileIDKameraSupport.o; do
|
|
182
93
|
if [ "$(echo "$ARCHS_IN" | wc -w)" -gt 1 ]; then
|
|
183
94
|
THIN=""
|
|
184
95
|
for ARCH in $ARCHS_IN; do
|
|
@@ -198,24 +109,142 @@ begin
|
|
|
198
109
|
|
|
199
110
|
pods_project.save
|
|
200
111
|
rescue => e
|
|
201
|
-
Pod::UI.warn "[smileid-spm] Failed to link SPM products for ${
|
|
112
|
+
Pod::UI.warn "[smileid-spm] Failed to link SPM products for ${e.podTarget}: #{e.message}"
|
|
113
|
+
raise
|
|
114
|
+
end
|
|
115
|
+
${a}`}function renderKameraLinkBlock(){return`${BEGIN_PREFIX} ${KAMERA_LINK_MARKER} ===
|
|
116
|
+
# Links kamera-spm's Kamera / KameraVision products into the kamera-rn pod target (and
|
|
117
|
+
# KameraTesting into kamera-testing when present) with the helper @smileid/kamera ships,
|
|
118
|
+
# pinned at the installed package's own version. The Smile ID SDK binaries link
|
|
119
|
+
# Kamera.framework dynamically and ios-spm declares kamera-spm for the app, so the pod
|
|
120
|
+
# must take Kamera from that same package rather than vendor a second copy.
|
|
121
|
+
require 'json'
|
|
122
|
+
require 'securerandom'
|
|
123
|
+
begin
|
|
124
|
+
kamera_package_json = \`node --print "require.resolve('@smileid/kamera/package.json')"\`.strip
|
|
125
|
+
if kamera_package_json.empty?
|
|
126
|
+
raise "[smileid-spm] @smileid/kamera is not installed, so its kamera-rn pod cannot be linked to kamera-spm."
|
|
127
|
+
end
|
|
128
|
+
kamera_spm_helper = File.join(File.dirname(kamera_package_json), 'ios', 'kamera_spm_link.rb')
|
|
129
|
+
if File.exist?(kamera_spm_helper)
|
|
130
|
+
require kamera_spm_helper
|
|
131
|
+
# The Smile ID provider pods import Kamera themselves. A SwiftPM product linked into the
|
|
132
|
+
# kamera-rn target does not reach the pods that depend on it the way a vendored framework's
|
|
133
|
+
# search path did, so those targets take the product directly (absent ones are skipped).
|
|
134
|
+
kamera_spm_link!(installer, targets: KAMERA_SPM_TARGETS.merge(
|
|
135
|
+
'UseSmileIDVisionFaceExpo' => %w[Kamera],
|
|
136
|
+
'UseSmileIDVisionDocumentExpo' => %w[Kamera],
|
|
137
|
+
))
|
|
138
|
+
# Two things only the app's own project can do, exactly as it does for ios-spm:
|
|
139
|
+
# 1. CocoaPods rewrites the Pods project after post_install and drops the package
|
|
140
|
+
# references the helper attaches to it (the product dependencies survive), so Xcode
|
|
141
|
+
# resolves kamera-spm only if a project in the workspace still lists it \u2014 otherwise
|
|
142
|
+
# the build stops at "Missing package product 'Kamera'".
|
|
143
|
+
# 2. Kamera and KameraVision are dynamic frameworks. Linked into static pod targets they
|
|
144
|
+
# are never embedded, and the app dies in dyld ("Library not loaded:
|
|
145
|
+
# @rpath/Kamera.framework/Kamera"). Xcode embeds a binary product only for an app
|
|
146
|
+
# target that depends on it, so the app target takes both products directly.
|
|
147
|
+
kamera_spm_url = 'https://github.com/smileidentity/kamera-spm'
|
|
148
|
+
kamera_spm_version = JSON.parse(File.read(kamera_package_json))['version'].sub(/-SNAPSHOT.*$/, '')
|
|
149
|
+
kamera_spm_app_products = %w[Kamera KameraVision]
|
|
150
|
+
# A reference an app added by hand may spell the same repository differently (.git suffix,
|
|
151
|
+
# trailing slash, case); a second reference to one repository fails Xcode's resolution.
|
|
152
|
+
normalize_url = ->(url) { url.to_s.downcase.chomp('/').sub(/\\.git\\z/, '') }
|
|
153
|
+
installer.aggregate_targets.group_by(&:user_project).each do |user_project, aggregate_targets|
|
|
154
|
+
next if user_project.nil? # integrate_targets: false \u2014 nothing to register on
|
|
155
|
+
# SecureRandom, not user_project.new: React Native's prepare_react_native_project!
|
|
156
|
+
# leaves Xcodeproj's UUID pool unusable for objects minted in post_install.
|
|
157
|
+
new_uuid = lambda do
|
|
158
|
+
loop do
|
|
159
|
+
candidate = SecureRandom.hex(12).upcase
|
|
160
|
+
break candidate unless user_project.objects_by_uuid.key?(candidate)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
changed = false
|
|
164
|
+
ref = user_project.root_object.package_references.find do |r|
|
|
165
|
+
r.respond_to?(:repositoryURL) && normalize_url.call(r.repositoryURL) == normalize_url.call(kamera_spm_url)
|
|
166
|
+
end
|
|
167
|
+
unless ref
|
|
168
|
+
ref = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference.new(user_project, new_uuid.call)
|
|
169
|
+
ref.initialize_defaults
|
|
170
|
+
ref.repositoryURL = kamera_spm_url
|
|
171
|
+
user_project.root_object.package_references << ref
|
|
172
|
+
changed = true
|
|
173
|
+
end
|
|
174
|
+
requirement = { 'kind' => 'exactVersion', 'version' => kamera_spm_version }
|
|
175
|
+
if ref.requirement != requirement
|
|
176
|
+
ref.requirement = requirement
|
|
177
|
+
changed = true
|
|
178
|
+
end
|
|
179
|
+
app_targets = aggregate_targets.flat_map(&:user_targets).uniq.select do |t|
|
|
180
|
+
t.respond_to?(:product_type) && t.product_type == 'com.apple.product-type.application'
|
|
181
|
+
end
|
|
182
|
+
app_targets.each do |app_target|
|
|
183
|
+
kamera_spm_app_products.each do |product_name|
|
|
184
|
+
next if app_target.package_product_dependencies.any? { |d| d.package == ref && d.product_name == product_name }
|
|
185
|
+
dep = Xcodeproj::Project::Object::XCSwiftPackageProductDependency.new(user_project, new_uuid.call)
|
|
186
|
+
dep.initialize_defaults
|
|
187
|
+
dep.package = ref
|
|
188
|
+
dep.product_name = product_name
|
|
189
|
+
app_target.package_product_dependencies << dep
|
|
190
|
+
build_file = Xcodeproj::Project::Object::PBXBuildFile.new(user_project, new_uuid.call)
|
|
191
|
+
build_file.initialize_defaults
|
|
192
|
+
build_file.product_ref = dep
|
|
193
|
+
app_target.frameworks_build_phase.files << build_file
|
|
194
|
+
changed = true
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
next unless changed
|
|
198
|
+
user_project.save
|
|
199
|
+
Pod::UI.puts "[smileid-spm] #{File.basename(user_project.path)}: #{app_targets.map(&:name).join(', ')} link kamera-spm #{kamera_spm_version} (#{kamera_spm_app_products.join(', ')}) so Xcode resolves and embeds it"
|
|
200
|
+
end
|
|
201
|
+
else
|
|
202
|
+
# Releases before the helper vendor Kamera.xcframework themselves, so the pod still
|
|
203
|
+
# compiles; but the app then embeds that copy next to the one ios-spm resolves.
|
|
204
|
+
Pod::UI.warn "[smileid-spm] @smileid/kamera at #{File.dirname(kamera_package_json)} ships no ios/kamera_spm_link.rb " \\
|
|
205
|
+
"(it still vendors Kamera.xcframework). Upgrade to a release that depends on kamera-spm so the app carries one Kamera.framework."
|
|
206
|
+
end
|
|
207
|
+
rescue => e
|
|
208
|
+
Pod::UI.warn "[smileid-spm] Failed to link kamera-spm into the kamera pods: #{e.message}"
|
|
209
|
+
raise
|
|
210
|
+
end
|
|
211
|
+
${END_PREFIX} ${KAMERA_LINK_MARKER} ===`}function renderSignatureDedupBlock(){return`${BEGIN_PREFIX} ${SIGNATURE_DEDUP_MARKER} ===
|
|
212
|
+
# For apps whose \`ios/\` is hand-maintained, so no config plugin ever runs.
|
|
213
|
+
# UUIDs come from SecureRandom for the same reason as above.
|
|
214
|
+
begin
|
|
215
|
+
dedup_name = '${signature_dedup_1.SIGNATURE_DEDUP_PHASE_NAME}'
|
|
216
|
+
smileid_dedup_safe_uuid = lambda do |project|
|
|
217
|
+
loop do
|
|
218
|
+
candidate = SecureRandom.hex(12).upcase
|
|
219
|
+
return candidate unless project.objects_by_uuid.key?(candidate)
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
installer.aggregate_targets.each do |aggregate_target|
|
|
224
|
+
user_project = aggregate_target.user_project
|
|
225
|
+
next unless user_project
|
|
226
|
+
|
|
227
|
+
added = false
|
|
228
|
+
aggregate_target.user_targets.each do |user_target|
|
|
229
|
+
next if user_target.shell_script_build_phases.any? { |p| p.name == dedup_name }
|
|
230
|
+
|
|
231
|
+
phase = Xcodeproj::Project::Object::PBXShellScriptBuildPhase.new(
|
|
232
|
+
user_project, smileid_dedup_safe_uuid.call(user_project)
|
|
233
|
+
)
|
|
234
|
+
phase.initialize_defaults
|
|
235
|
+
phase.name = dedup_name
|
|
236
|
+
phase.always_out_of_date = '1'
|
|
237
|
+
phase.shell_script = <<~'SMILEIDDEDUP'
|
|
238
|
+
${indentBlock(signature_dedup_1.SIGNATURE_DEDUP_SCRIPT," ")}
|
|
239
|
+
SMILEIDDEDUP
|
|
240
|
+
user_target.build_phases << phase
|
|
241
|
+
added = true
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
user_project.save if added
|
|
245
|
+
end
|
|
246
|
+
rescue => e
|
|
247
|
+
Pod::UI.warn "[smileid-spm] Failed to add the XCFramework signature dedup phase: #{e.message}"
|
|
202
248
|
raise
|
|
203
249
|
end
|
|
204
|
-
${
|
|
205
|
-
}
|
|
206
|
-
function renderRequirement(req) {
|
|
207
|
-
switch (req.kind) {
|
|
208
|
-
case "upToNextMajorVersion":
|
|
209
|
-
return `{ kind: 'upToNextMajorVersion', minimumVersion: '${req.minimumVersion}' }`;
|
|
210
|
-
case "upToNextMinorVersion":
|
|
211
|
-
return `{ kind: 'upToNextMinorVersion', minimumVersion: '${req.minimumVersion}' }`;
|
|
212
|
-
case "exactVersion":
|
|
213
|
-
return `{ kind: 'exactVersion', version: '${req.version}' }`;
|
|
214
|
-
case "branch":
|
|
215
|
-
return `{ kind: 'branch', branch: '${req.branch}' }`;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function escapeRegExp(s) {
|
|
219
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
220
|
-
}
|
|
221
|
-
//# sourceMappingURL=podfile.js.map
|
|
250
|
+
${END_PREFIX} ${SIGNATURE_DEDUP_MARKER} ===`}function renderRequirement(e){switch(e.kind){case"upToNextMajorVersion":return`{ kind: 'upToNextMajorVersion', minimumVersion: '${e.minimumVersion}' }`;case"upToNextMinorVersion":return`{ kind: 'upToNextMinorVersion', minimumVersion: '${e.minimumVersion}' }`;case"exactVersion":return`{ kind: 'exactVersion', version: '${e.version}' }`;case"branch":return`{ kind: 'branch', branch: '${e.branch}' }`}}function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { XcodeProject } from "expo/config-plugins";
|
|
2
|
+
export declare const SIGNATURE_DEDUP_PHASE_NAME = "[smileid-spm] Dedupe XCFramework signatures";
|
|
3
|
+
export declare const SIGNATURE_DEDUP_SCRIPT: string;
|
|
4
|
+
/**
|
|
5
|
+
* Appends the dedup phase, idempotently by name so both vision plugins and
|
|
6
|
+
* repeated prebuilds converge on one. It goes last because every pod target
|
|
7
|
+
* must have staged its signatures before it runs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureSignatureDedupPhase(project: XcodeProject, targetName: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Stops Xcode recording XCFramework signatures at all — the escape hatch behind
|
|
12
|
+
* `iosSignatureAggregation: "disabled"`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function disableSignatureAggregation(project: XcodeProject, targetName: string): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SIGNATURE_DEDUP_SCRIPT=exports.SIGNATURE_DEDUP_PHASE_NAME=void 0,exports.ensureSignatureDedupPhase=ensureSignatureDedupPhase,exports.disableSignatureAggregation=disableSignatureAggregation;const spm_1=require("./spm");exports.SIGNATURE_DEDUP_PHASE_NAME="[smileid-spm] Dedupe XCFramework signatures",exports.SIGNATURE_DEDUP_SCRIPT=["# Archive assembly sweeps staged *.signature files into one filename-keyed","# folder and aborts on the first duplicate; keep exactly one per name.","set -u",'case "${BUILT_PRODUCTS_DIR:-}" in'," */ArchiveIntermediates/*) ;;"," *) exit 0 ;;","esac",'seen=" "','for sig in "${BUILT_PRODUCTS_DIR}"/*/*.xcframework-*.signature; do',' [ -e "$sig" ] || continue',' name=$(basename "$sig")',' if [ -e "${BUILT_PRODUCTS_DIR}/${name}" ]; then',' rm -rf "$sig"'," else",' case "$seen" in',' *" ${name} "*) rm -rf "$sig" ;;',' *) seen="${seen}${name} " ;;'," esac"," fi","done","exit 0"].join(`
|
|
2
|
+
`);function ensureSignatureDedupPhase(e,i){const s=(0,spm_1.findNativeTarget)(e,i);if(!s)throw new Error(`[smileid-spm] Native target '${i}' not found in Xcode project.`);const t=(0,spm_1.section)(e,"PBXShellScriptBuildPhase");if(s.obj.buildPhases.some(n=>{const o=t[n.value];return o!==void 0&&typeof o=="object"&&o!==null&&o.name?.replace(/^"|"$/g,"")===exports.SIGNATURE_DEDUP_PHASE_NAME}))return;const r=(0,spm_1.generateUuid)(e);t[r]={isa:"PBXShellScriptBuildPhase",name:`"${exports.SIGNATURE_DEDUP_PHASE_NAME}"`,shellPath:"/bin/sh",shellScript:JSON.stringify(exports.SIGNATURE_DEDUP_SCRIPT),alwaysOutOfDate:"1",buildActionMask:"2147483647",files:[],inputPaths:[],outputPaths:[],runOnlyForDeploymentPostprocessing:"0"},t[`${r}_comment`]=exports.SIGNATURE_DEDUP_PHASE_NAME,s.obj.buildPhases.push({value:r,comment:exports.SIGNATURE_DEDUP_PHASE_NAME})}function disableSignatureAggregation(e,i){const s=(0,spm_1.findNativeTarget)(e,i);if(!s)throw new Error(`[smileid-spm] Native target '${i}' not found in Xcode project.`);const t=s.obj.buildConfigurationList;if(!t)throw new Error(`[smileid-spm] Native target '${i}' has no build configuration list.`);const u=(0,spm_1.section)(e,"XCConfigurationList"),r=(0,spm_1.section)(e,"XCBuildConfiguration"),n=u[t];if(!n||typeof n!="object"||!n.buildConfigurations)throw new Error(`[smileid-spm] Build configuration list for '${i}' is unreadable.`);for(const o of n.buildConfigurations){const a=r[o.value];!a||typeof a!="object"||(a.buildSettings??={},a.buildSettings.ENABLE_SIGNATURE_AGGREGATION="NO")}}
|
|
@@ -31,3 +31,24 @@ export interface SpmTargetLink {
|
|
|
31
31
|
* multiple plugins can compose without conflict.
|
|
32
32
|
*/
|
|
33
33
|
export declare function linkSpmPackage(project: XcodeProject, pkg: SpmPackage, link: SpmTargetLink): void;
|
|
34
|
+
export interface NativeTarget {
|
|
35
|
+
uuid: string;
|
|
36
|
+
obj: PbxNativeTarget;
|
|
37
|
+
}
|
|
38
|
+
interface PbxNativeTarget {
|
|
39
|
+
isa: "PBXNativeTarget";
|
|
40
|
+
name: string;
|
|
41
|
+
packageProductDependencies?: Array<{
|
|
42
|
+
value: string;
|
|
43
|
+
comment?: string;
|
|
44
|
+
}>;
|
|
45
|
+
buildPhases: Array<{
|
|
46
|
+
value: string;
|
|
47
|
+
comment?: string;
|
|
48
|
+
}>;
|
|
49
|
+
buildConfigurationList?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function section<T>(project: XcodeProject, isa: string): Record<string, T>;
|
|
52
|
+
export declare function generateUuid(project: XcodeProject): string;
|
|
53
|
+
export declare function findNativeTarget(project: XcodeProject, name: string): NativeTarget | undefined;
|
|
54
|
+
export {};
|
package/plugin/build/lib/spm.js
CHANGED
|
@@ -1,196 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Shared plumbing for wiring a remote Swift Package into both the
|
|
3
|
-
// consuming Expo app's Xcode project and the autogenerated CocoaPods
|
|
4
|
-
// project for a specific bridge pod target.
|
|
5
|
-
//
|
|
6
|
-
// Why this exists: `expo-modules-autolinking@55.0.x`'s
|
|
7
|
-
// `RawModuleConfigApple` schema does not surface a `dependencies`
|
|
8
|
-
// field, so listing SPM products in `expo-module.config.json` is a
|
|
9
|
-
// silent no-op. This module fills that gap.
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.linkSpmPackage = linkSpmPackage;
|
|
12
|
-
/**
|
|
13
|
-
* Adds (or reuses) a remote Swift Package reference on the given
|
|
14
|
-
* Xcode project and links the requested products to the target.
|
|
15
|
-
* Idempotent: existing package refs and product deps are reused so
|
|
16
|
-
* multiple plugins can compose without conflict.
|
|
17
|
-
*/
|
|
18
|
-
function linkSpmPackage(project, pkg, link) {
|
|
19
|
-
const pkgRef = upsertPackageReference(project, pkg);
|
|
20
|
-
const target = findNativeTarget(project, link.targetName);
|
|
21
|
-
if (!target) {
|
|
22
|
-
throw new Error(`[smileid-spm] Native target '${link.targetName}' not found in Xcode project.`);
|
|
23
|
-
}
|
|
24
|
-
for (const product of link.products) {
|
|
25
|
-
upsertProductDependency(project, target.uuid, pkgRef, product);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function objects(project) {
|
|
29
|
-
const hash = project.hash.project.objects;
|
|
30
|
-
return hash;
|
|
31
|
-
}
|
|
32
|
-
function section(project, isa) {
|
|
33
|
-
const objs = objects(project);
|
|
34
|
-
if (!objs[isa]) {
|
|
35
|
-
objs[isa] = {};
|
|
36
|
-
}
|
|
37
|
-
return objs[isa];
|
|
38
|
-
}
|
|
39
|
-
function generateUuid(project) {
|
|
40
|
-
return project.generateUuid();
|
|
41
|
-
}
|
|
42
|
-
function upsertPackageReference(project, pkg) {
|
|
43
|
-
const refs = section(project, "XCRemoteSwiftPackageReference");
|
|
44
|
-
for (const [uuid, ref] of Object.entries(refs)) {
|
|
45
|
-
if (uuid.endsWith("_comment"))
|
|
46
|
-
continue;
|
|
47
|
-
if (typeof ref !== "object" || ref === null)
|
|
48
|
-
continue;
|
|
49
|
-
if (ref.repositoryURL?.replace(/^"|"$/g, "") === pkg.url) {
|
|
50
|
-
return { uuid };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const uuid = generateUuid(project);
|
|
54
|
-
refs[uuid] = {
|
|
55
|
-
isa: "XCRemoteSwiftPackageReference",
|
|
56
|
-
repositoryURL: `"${pkg.url}"`,
|
|
57
|
-
requirement: serializeRequirement(pkg.requirement),
|
|
58
|
-
};
|
|
59
|
-
refs[`${uuid}_comment`] =
|
|
60
|
-
`XCRemoteSwiftPackageReference "${repoName(pkg.url)}"`;
|
|
61
|
-
// Attach to the PBXProject's packageReferences list.
|
|
62
|
-
const projectSection = section(project, "PBXProject");
|
|
63
|
-
for (const [projUuid, proj] of Object.entries(projectSection)) {
|
|
64
|
-
if (projUuid.endsWith("_comment"))
|
|
65
|
-
continue;
|
|
66
|
-
if (typeof proj !== "object" || proj === null)
|
|
67
|
-
continue;
|
|
68
|
-
if (proj.isa !== "PBXProject")
|
|
69
|
-
continue;
|
|
70
|
-
proj.packageReferences ??= [];
|
|
71
|
-
if (!proj.packageReferences.some((r) => r.value === uuid)) {
|
|
72
|
-
proj.packageReferences.push({
|
|
73
|
-
value: uuid,
|
|
74
|
-
comment: `XCRemoteSwiftPackageReference "${repoName(pkg.url)}"`,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return { uuid };
|
|
79
|
-
}
|
|
80
|
-
function upsertProductDependency(project, targetUuid, pkgRef, productName) {
|
|
81
|
-
const targetSection = section(project, "PBXNativeTarget");
|
|
82
|
-
const target = targetSection[targetUuid];
|
|
83
|
-
if (!target || typeof target !== "object") {
|
|
84
|
-
throw new Error(`[smileid-spm] Target ${targetUuid} disappeared between lookups.`);
|
|
85
|
-
}
|
|
86
|
-
const productDeps = section(project, "XCSwiftPackageProductDependency");
|
|
87
|
-
// Each target owns its own XCSwiftPackageProductDependency entry —
|
|
88
|
-
// sharing one across targets is not how Xcode writes pbxproj and
|
|
89
|
-
// would cause downstream tools (and re-runs of this plugin) to
|
|
90
|
-
// silently drop the second target's binding. Look up the dep
|
|
91
|
-
// *within this target's* packageProductDependencies, never globally.
|
|
92
|
-
target.packageProductDependencies ??= [];
|
|
93
|
-
let depUuid = target.packageProductDependencies.find((d) => {
|
|
94
|
-
const entry = productDeps[d.value];
|
|
95
|
-
return (entry !== undefined &&
|
|
96
|
-
typeof entry === "object" &&
|
|
97
|
-
entry !== null &&
|
|
98
|
-
entry.package === pkgRef.uuid &&
|
|
99
|
-
entry.productName === productName);
|
|
100
|
-
})?.value;
|
|
101
|
-
if (!depUuid) {
|
|
102
|
-
depUuid = generateUuid(project);
|
|
103
|
-
productDeps[depUuid] = {
|
|
104
|
-
isa: "XCSwiftPackageProductDependency",
|
|
105
|
-
package: pkgRef.uuid,
|
|
106
|
-
productName,
|
|
107
|
-
};
|
|
108
|
-
productDeps[`${depUuid}_comment`] = productName;
|
|
109
|
-
target.packageProductDependencies.push({
|
|
110
|
-
value: depUuid,
|
|
111
|
-
comment: productName,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
ensureFrameworkLink(project, target, depUuid, productName);
|
|
115
|
-
}
|
|
116
|
-
function ensureFrameworkLink(project, target, productDepUuid, productName) {
|
|
117
|
-
const frameworksPhase = findFrameworksBuildPhase(project, target);
|
|
118
|
-
if (!frameworksPhase) {
|
|
119
|
-
throw new Error(`[smileid-spm] Target '${target.name}' has no PBXFrameworksBuildPhase; cannot link ${productName}.`);
|
|
120
|
-
}
|
|
121
|
-
const buildFiles = section(project, "PBXBuildFile");
|
|
122
|
-
// Scope the existence check to *this target's* frameworks phase.
|
|
123
|
-
// A globally-scoped check would early-return when a sibling target
|
|
124
|
-
// already linked the same product, leaving this target unlinked.
|
|
125
|
-
frameworksPhase.obj.files ??= [];
|
|
126
|
-
for (const fileRef of frameworksPhase.obj.files) {
|
|
127
|
-
const bf = buildFiles[fileRef.value];
|
|
128
|
-
if (bf !== undefined &&
|
|
129
|
-
typeof bf === "object" &&
|
|
130
|
-
bf !== null &&
|
|
131
|
-
bf.productRef === productDepUuid) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const buildFileUuid = generateUuid(project);
|
|
136
|
-
buildFiles[buildFileUuid] = {
|
|
137
|
-
isa: "PBXBuildFile",
|
|
138
|
-
productRef: productDepUuid,
|
|
139
|
-
};
|
|
140
|
-
buildFiles[`${buildFileUuid}_comment`] =
|
|
141
|
-
`${productName} in Frameworks`;
|
|
142
|
-
frameworksPhase.obj.files.push({
|
|
143
|
-
value: buildFileUuid,
|
|
144
|
-
comment: `${productName} in Frameworks`,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function findFrameworksBuildPhase(project, target) {
|
|
148
|
-
const phaseSection = section(project, "PBXFrameworksBuildPhase");
|
|
149
|
-
for (const phaseRef of target.buildPhases) {
|
|
150
|
-
const phase = phaseSection[phaseRef.value];
|
|
151
|
-
if (phase &&
|
|
152
|
-
typeof phase === "object" &&
|
|
153
|
-
phase.isa === "PBXFrameworksBuildPhase") {
|
|
154
|
-
return { uuid: phaseRef.value, obj: phase };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
function findNativeTarget(project, name) {
|
|
160
|
-
const targets = section(project, "PBXNativeTarget");
|
|
161
|
-
for (const [uuid, t] of Object.entries(targets)) {
|
|
162
|
-
if (uuid.endsWith("_comment"))
|
|
163
|
-
continue;
|
|
164
|
-
if (typeof t !== "object" || t === null)
|
|
165
|
-
continue;
|
|
166
|
-
if (t.isa !== "PBXNativeTarget")
|
|
167
|
-
continue;
|
|
168
|
-
if (t.name === name || t.name === `"${name}"`) {
|
|
169
|
-
return { uuid, obj: t };
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return undefined;
|
|
173
|
-
}
|
|
174
|
-
function serializeRequirement(req) {
|
|
175
|
-
switch (req.kind) {
|
|
176
|
-
case "upToNextMajorVersion":
|
|
177
|
-
return {
|
|
178
|
-
kind: "upToNextMajorVersion",
|
|
179
|
-
minimumVersion: req.minimumVersion,
|
|
180
|
-
};
|
|
181
|
-
case "upToNextMinorVersion":
|
|
182
|
-
return {
|
|
183
|
-
kind: "upToNextMinorVersion",
|
|
184
|
-
minimumVersion: req.minimumVersion,
|
|
185
|
-
};
|
|
186
|
-
case "exactVersion":
|
|
187
|
-
return { kind: "exactVersion", version: req.version };
|
|
188
|
-
case "branch":
|
|
189
|
-
return { kind: "branch", branch: req.branch };
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function repoName(url) {
|
|
193
|
-
const match = url.replace(/\.git$/, "").match(/\/([^/]+)$/);
|
|
194
|
-
return match?.[1] ?? url;
|
|
195
|
-
}
|
|
196
|
-
//# sourceMappingURL=spm.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.linkSpmPackage=linkSpmPackage,exports.section=section,exports.generateUuid=generateUuid,exports.findNativeTarget=findNativeTarget;function linkSpmPackage(e,n,o){const t=upsertPackageReference(e,n),i=findNativeTarget(e,o.targetName);if(!i)throw new Error(`[smileid-spm] Native target '${o.targetName}' not found in Xcode project.`);for(const c of o.products)upsertProductDependency(e,i.uuid,t,c)}function objects(e){return e.hash.project.objects}function section(e,n){const o=objects(e);return o[n]||(o[n]={}),o[n]}function generateUuid(e){return e.generateUuid()}function upsertPackageReference(e,n){const o=section(e,"XCRemoteSwiftPackageReference");for(const[c,r]of Object.entries(o))if(!c.endsWith("_comment")&&!(typeof r!="object"||r===null)&&r.repositoryURL?.replace(/^"|"$/g,"")===n.url)return{uuid:c};const t=generateUuid(e);o[t]={isa:"XCRemoteSwiftPackageReference",repositoryURL:`"${n.url}"`,requirement:serializeRequirement(n.requirement)},o[`${t}_comment`]=`XCRemoteSwiftPackageReference "${repoName(n.url)}"`;const i=section(e,"PBXProject");for(const[c,r]of Object.entries(i))c.endsWith("_comment")||typeof r!="object"||r===null||r.isa==="PBXProject"&&(r.packageReferences??=[],r.packageReferences.some(s=>s.value===t)||r.packageReferences.push({value:t,comment:`XCRemoteSwiftPackageReference "${repoName(n.url)}"`}));return{uuid:t}}function upsertProductDependency(e,n,o,t){const c=section(e,"PBXNativeTarget")[n];if(!c||typeof c!="object")throw new Error(`[smileid-spm] Target ${n} disappeared between lookups.`);const r=section(e,"XCSwiftPackageProductDependency");c.packageProductDependencies??=[];let s=c.packageProductDependencies.find(a=>{const u=r[a.value];return u!==void 0&&typeof u=="object"&&u!==null&&u.package===o.uuid&&u.productName===t})?.value;s||(s=generateUuid(e),r[s]={isa:"XCSwiftPackageProductDependency",package:o.uuid,productName:t},r[`${s}_comment`]=t,c.packageProductDependencies.push({value:s,comment:t})),ensureFrameworkLink(e,c,s,t)}function ensureFrameworkLink(e,n,o,t){const i=findFrameworksBuildPhase(e,n);if(!i)throw new Error(`[smileid-spm] Target '${n.name}' has no PBXFrameworksBuildPhase; cannot link ${t}.`);const c=section(e,"PBXBuildFile");i.obj.files??=[];for(const s of i.obj.files){const a=c[s.value];if(a!==void 0&&typeof a=="object"&&a!==null&&a.productRef===o)return}const r=generateUuid(e);c[r]={isa:"PBXBuildFile",productRef:o},c[`${r}_comment`]=`${t} in Frameworks`,i.obj.files.push({value:r,comment:`${t} in Frameworks`})}function findFrameworksBuildPhase(e,n){const o=section(e,"PBXFrameworksBuildPhase");for(const t of n.buildPhases){const i=o[t.value];if(i&&typeof i=="object"&&i.isa==="PBXFrameworksBuildPhase")return{uuid:t.value,obj:i}}}function findNativeTarget(e,n){const o=section(e,"PBXNativeTarget");for(const[t,i]of Object.entries(o))if(!t.endsWith("_comment")&&!(typeof i!="object"||i===null)&&i.isa==="PBXNativeTarget"&&(i.name===n||i.name===`"${n}"`))return{uuid:t,obj:i}}function serializeRequirement(e){switch(e.kind){case"upToNextMajorVersion":return{kind:"upToNextMajorVersion",minimumVersion:e.minimumVersion};case"upToNextMinorVersion":return{kind:"upToNextMinorVersion",minimumVersion:e.minimumVersion};case"exactVersion":return{kind:"exactVersion",version:e.version};case"branch":return{kind:"branch",branch:e.branch}}}function repoName(e){return e.replace(/\.git$/,"").match(/\/([^/]+)$/)?.[1]??e}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAGpC;;;;;;;;;;;;;;;;;GAiBG;AACH;;;;GAIG;AACH,eAAO,MAAM,mCAAmC;;;CAGtC,CAAC;AAEX,eAAO,MAAM,wBAAwB,mEAKnC,CAAC;AAEH,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF;;;;;;;;;;;;;;;;;GAiBG;AACH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,gBAAgB,EAAE,0BAA0B;IAC5C,wBAAwB,EAAE,wCAAwC;CAC1D,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;IACjE,gBAAgB,EAAE,mCAAmC,CAAC,gBAAgB;IACtE,wBAAwB,EACtB,mCAAmC,CAAC,wBAAwB;IAC9D,IAAI,EAAE,UAAU;CACjB,CAAC,CAAC"}
|