File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ interface INativeApiUsagePluginConfiguration {
2828 * Defines APIs which are used by the plugin and which should be whitelisted by the application using this plugin.
2929 */
3030 uses : string [ ] ;
31+ /**
32+ * Defines APIs which can be safely ignored by this plugin
33+ */
34+ blacklist ?: string [ ] ;
3135}
3236
3337/**
Original file line number Diff line number Diff line change @@ -116,7 +116,40 @@ export class MetadataFilteringService implements IMetadataFilteringService {
116116 ) ;
117117 if ( nativeApiConfiguration ) {
118118 const blacklistedItems : string [ ] = nativeApiConfiguration . blacklist || [ ] ;
119-
119+ if ( nativeApiConfiguration [ "whitelist-plugins-usages" ] ) {
120+ const plugins = this . $pluginsService . getAllProductionPlugins (
121+ projectData ,
122+ platform
123+ ) ;
124+ for ( const pluginData of plugins ) {
125+ const pathToPlatformsDir = pluginData . pluginPlatformsFolderPath (
126+ platform
127+ ) ;
128+ const pathToPluginsMetadataConfig = path . join (
129+ pathToPlatformsDir ,
130+ MetadataFilteringConstants . NATIVE_API_USAGE_FILE_NAME
131+ ) ;
132+ if ( this . $fs . exists ( pathToPluginsMetadataConfig ) ) {
133+ const pluginConfig : INativeApiUsagePluginConfiguration =
134+ this . $fs . readJson ( pathToPluginsMetadataConfig ) || { } ;
135+ this . $logger . trace (
136+ `Adding content of ${ pathToPluginsMetadataConfig } to whitelisted items of metadata filtering: ${ JSON . stringify (
137+ pluginConfig ,
138+ null ,
139+ 2
140+ ) } `
141+ ) ;
142+ const itemsToAdd = pluginConfig . blacklist || [ ] ;
143+ blacklistedItems . push (
144+ `// Added from: ${ pathToPluginsMetadataConfig } `
145+ ) ;
146+ blacklistedItems . push ( ...itemsToAdd ) ;
147+ blacklistedItems . push (
148+ `// Finished part from ${ pathToPluginsMetadataConfig } ${ os . EOL } `
149+ ) ;
150+ }
151+ }
152+ }
120153 if ( blacklistedItems . length ) {
121154 this . $fs . writeFile ( pathToBlacklistFile , blacklistedItems . join ( os . EOL ) ) ;
122155 }
You can’t perform that action at this time.
0 commit comments