( assets: QuickAddPackageAsset[], )
| 187 | } |
| 188 | |
| 189 | function buildSecretOptionNamesByPath( |
| 190 | assets: QuickAddPackageAsset[], |
| 191 | ): Map<string, ReadonlySet<string> | null> { |
| 192 | const secretOptionNamesByPath = new Map<string, ReadonlySet<string> | null>(); |
| 193 | |
| 194 | for (const asset of assets) { |
| 195 | if (asset.kind !== "user-script") continue; |
| 196 | |
| 197 | try { |
| 198 | const detection = detectUserScriptSecretOptions( |
| 199 | decodeFromBase64(asset.content), |
| 200 | asset.originalPath, |
| 201 | ); |
| 202 | secretOptionNamesByPath.set( |
| 203 | asset.originalPath, |
| 204 | detection.foundSecretOptions && detection.names.size === 0 |
| 205 | ? null |
| 206 | : detection.names, |
| 207 | ); |
| 208 | } catch (error) { |
| 209 | log.logWarning( |
| 210 | `QuickAdd export could not inspect user-script settings '${asset.originalPath}': ${ |
| 211 | (error as Error)?.message ?? error |
| 212 | }`, |
| 213 | ); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | return secretOptionNamesByPath; |
| 218 | } |
| 219 | |
| 220 | function pruneChoiceTree( |
| 221 | choice: IChoice, |
no test coverage detected