File tree 2 files changed +38
-1
lines changed 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ interface INativeApiUsagePluginConfiguration {
28
28
* Defines APIs which are used by the plugin and which should be whitelisted by the application using this plugin.
29
29
*/
30
30
uses : string [ ] ;
31
+ /**
32
+ * Defines APIs which can be safely ignored by this plugin
33
+ */
34
+ blacklist ?: string [ ] ;
31
35
}
32
36
33
37
/**
Original file line number Diff line number Diff line change @@ -116,7 +116,40 @@ export class MetadataFilteringService implements IMetadataFilteringService {
116
116
) ;
117
117
if ( nativeApiConfiguration ) {
118
118
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
+ }
120
153
if ( blacklistedItems . length ) {
121
154
this . $fs . writeFile ( pathToBlacklistFile , blacklistedItems . join ( os . EOL ) ) ;
122
155
}
You can’t perform that action at this time.
0 commit comments