You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 61051bf
Browse filesBrowse the repository at this point in the historyBrowse files
feat(metadata): apply native-api-usage.json rules in metadata trim
Declared rules are merged with what the bundle analysis finds, following
the same whitelist-plugins-usages semantics as ns prepare. Projects are
read automatically for iOS and Android; other hosts pass --native-api-usage.
Copy file name to clipboardExpand all lines: docs/man_pages/project/configuration/metadata-trim.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ position: 26
9
9
10
10
Reduces the native API metadata an app ships to what its JavaScript uses. The app's emitted bundle is analyzed for the native symbols it references, and the generator keeps those plus the types they depend on.
11
11
12
+
Rules in `native-api-usage.json` still apply. Entries from `whitelist` and from plugins' `uses` are kept in addition to what the analysis finds, and `blacklist` entries are removed. A blacklisted type that a kept API's signature needs can't be removed: on Apple platforms it stays in the metadata, and on Android the build fails and names it. In a NativeScript project these files are found automatically for iOS and Android; other hosts pass them with `--native-api-usage`.
13
+
12
14
If the bundle reads globals dynamically (an alias of `globalThis`, for example), its usage cannot be determined and nothing is trimmed.
13
15
14
16
### Commands
@@ -27,6 +29,7 @@ Write the whitelist for an Android project | `$ ns metadata trim android <Bundle
27
29
28
30
*`--out` - Output directory. Defaults to `metadata-trim`.
29
31
*`--keep` - A `Module:Symbol` pattern to keep regardless of the analysis. Repeat for several.
32
+
*`--native-api-usage` - A `native-api-usage.json` file to apply, in the app or plugin format. Repeat for several.
30
33
*`--analyzer` - `ns-metadata-symbols` on Apple platforms; overrides the runtime's `seed.js` on Android.
31
34
*`--generator` - `objc-metadata-generator`. Use the one from the runtime release the app ships.
32
35
*`--framework` - A `NativeScript.framework` to copy into the output directory with the trimmed metadata embedded.
0 commit comments