react-native-legal 1.5.2 → 1.6.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.
Files changed (48) hide show
  1. package/android/src/main/java/com/reactnativelegal/ReactNativeLegalModuleImpl.kt +1 -0
  2. package/bare-plugin/build/android/androidCommand.d.ts +2 -1
  3. package/bare-plugin/build/android/androidCommand.js +6 -2
  4. package/bare-plugin/build/index.d.ts +2 -1
  5. package/bare-plugin/build/index.js +5 -3
  6. package/bare-plugin/build/ios/iosCommand.d.ts +2 -1
  7. package/bare-plugin/build/ios/iosCommand.js +2 -2
  8. package/bare-plugin/src/android/androidCommand.ts +12 -3
  9. package/bare-plugin/src/index.ts +12 -3
  10. package/bare-plugin/src/ios/iosCommand.ts +3 -3
  11. package/ios/ReactNativeLegalModuleImpl.swift +23 -2
  12. package/lib/commonjs/NativeReactNativeLegal.js.map +1 -1
  13. package/lib/commonjs/package.json +1 -0
  14. package/lib/module/NativeReactNativeLegal.js +2 -0
  15. package/lib/module/NativeReactNativeLegal.js.map +1 -1
  16. package/lib/module/ReactNativeLegal.android.js +2 -0
  17. package/lib/module/ReactNativeLegal.android.js.map +1 -1
  18. package/lib/module/ReactNativeLegal.ios.js +2 -0
  19. package/lib/module/ReactNativeLegal.ios.js.map +1 -1
  20. package/lib/module/ReactNativeLegal.js +2 -0
  21. package/lib/module/ReactNativeLegal.js.map +1 -1
  22. package/lib/module/index.js +2 -0
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/typescript/NativeReactNativeLegal.d.ts +1 -0
  25. package/lib/typescript/NativeReactNativeLegal.d.ts.map +1 -1
  26. package/package.json +7 -7
  27. package/plugin/build/android/withAndroidLegal.d.ts +2 -1
  28. package/plugin/build/android/withAndroidLegal.js +2 -2
  29. package/plugin/build/index.d.ts +2 -1
  30. package/plugin/build/index.js +8 -2
  31. package/plugin/build/ios/withIosLegal.d.ts +2 -1
  32. package/plugin/build/ios/withIosLegal.js +2 -2
  33. package/plugin/build/types.d.ts +6 -0
  34. package/plugin/build/types.js +2 -0
  35. package/plugin/src/android/withAndroidLegal.ts +7 -2
  36. package/plugin/src/index.ts +14 -3
  37. package/plugin/src/ios/withIosLegal.ts +7 -2
  38. package/plugin/src/types.ts +9 -0
  39. package/plugin-utils/build/android.js +1 -1
  40. package/plugin-utils/build/common.d.ts +3 -0
  41. package/plugin-utils/build/common.js +37 -0
  42. package/plugin-utils/build/types.d.ts +5 -0
  43. package/plugin-utils/build/types.js +2 -0
  44. package/plugin-utils/src/android.ts +1 -1
  45. package/plugin-utils/src/common.ts +49 -0
  46. package/plugin-utils/src/types.ts +5 -0
  47. package/react-native.config.js +38 -2
  48. package/src/NativeReactNativeLegal.ts +1 -0
@@ -44,6 +44,7 @@ object ReactNativeLegalModuleImpl {
44
44
  bundleOf(
45
45
  "id" to library.uniqueId,
46
46
  "name" to library.name,
47
+ "version" to library.artifactVersion,
47
48
  "description" to library.description,
48
49
  "website" to library.website,
49
50
  "developers" to library.developers.joinToString(),
@@ -1,7 +1,8 @@
1
+ import { type Types as SharedTypes } from '@callstack/licenses';
1
2
  /**
2
3
  * Implementation of bare plugin's Android/Android TV setup
3
4
  *
4
5
  * It scans the NPM dependencies, generates AboutLibraries-compatible metadata for them,
5
6
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
6
7
  */
7
- export declare function androidCommand(androidProjectPath: string): void;
8
+ export declare function androidCommand(androidProjectPath: string, scanOptionsFactory: SharedTypes.ScanPackageOptionsFactory): void;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.androidCommand = androidCommand;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
7
8
  const node_path_1 = __importDefault(require("node:path"));
8
9
  const licenses_1 = require("@callstack/licenses");
9
10
  const addListActivity_1 = require("./addListActivity");
@@ -15,8 +16,11 @@ const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
15
16
  * It scans the NPM dependencies, generates AboutLibraries-compatible metadata for them,
16
17
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
17
18
  */
18
- function androidCommand(androidProjectPath) {
19
- const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(androidProjectPath, '..'), 'package.json'));
19
+ function androidCommand(androidProjectPath, scanOptionsFactory) {
20
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(androidProjectPath, '..'), 'package.json'), scanOptionsFactory);
21
+ const aboutLibrariesConfigDirPath = node_path_1.default.join(androidProjectPath, 'config');
22
+ // Cleanup metadata in case `scanOptionsFactory` changed
23
+ node_fs_1.default.rmSync(aboutLibrariesConfigDirPath, { recursive: true, force: true });
20
24
  (0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, androidProjectPath);
21
25
  (0, declareAboutLibrariesPlugin_1.declareAboutLibrariesPlugin)(androidProjectPath);
22
26
  (0, applyAndConfigureAboutLibrariesPlugin_1.applyAndConfigureAboutLibrariesPlugin)(androidProjectPath);
@@ -1,2 +1,3 @@
1
- declare function generateLegal(androidProjectPath: string | undefined, iosProjectPath: string | undefined): void;
1
+ import type { PluginScanOptions } from '../../plugin-utils/build/types';
2
+ declare function generateLegal(androidProjectPath: string | undefined, iosProjectPath: string | undefined, pluginScanOptions: PluginScanOptions): void;
2
3
  export default generateLegal;
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common_1 = require("../../plugin-utils/build/common");
3
4
  const androidCommand_1 = require("./android/androidCommand");
4
5
  const iosCommand_1 = require("./ios/iosCommand");
5
- function generateLegal(androidProjectPath, iosProjectPath) {
6
+ function generateLegal(androidProjectPath, iosProjectPath, pluginScanOptions) {
7
+ const scanOptionsFactory = (0, common_1.createPluginScanOptionsFactory)(pluginScanOptions);
6
8
  if (androidProjectPath) {
7
- (0, androidCommand_1.androidCommand)(androidProjectPath);
9
+ (0, androidCommand_1.androidCommand)(androidProjectPath, scanOptionsFactory);
8
10
  }
9
11
  if (iosProjectPath) {
10
- (0, iosCommand_1.iosCommand)(iosProjectPath);
12
+ (0, iosCommand_1.iosCommand)(iosProjectPath, scanOptionsFactory);
11
13
  }
12
14
  }
13
15
  exports.default = generateLegal;
@@ -1,7 +1,8 @@
1
+ import { type Types as SharedTypes } from '@callstack/licenses';
1
2
  /**
2
3
  * Implementation of bare plugin's iOS/tvOS setup
3
4
  *
4
5
  * It scans the NPM dependencies, generates LicensePlist-compatible metadata for them,
5
6
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
6
7
  */
7
- export declare function iosCommand(iosProjectPath: string): void;
8
+ export declare function iosCommand(iosProjectPath: string, scanOptionsFactory: SharedTypes.ScanPackageOptionsFactory): void;
@@ -14,8 +14,8 @@ const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPha
14
14
  * It scans the NPM dependencies, generates LicensePlist-compatible metadata for them,
15
15
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
16
16
  */
17
- function iosCommand(iosProjectPath) {
18
- const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(iosProjectPath, '..'), 'package.json'));
17
+ function iosCommand(iosProjectPath, scanOptionsFactory) {
18
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(iosProjectPath, '..'), 'package.json'), scanOptionsFactory);
19
19
  (0, licenses_1.writeLicensePlistNPMOutput)(licenses, iosProjectPath);
20
20
  (0, addSettingsBundle_1.addSettingsBundle)(iosProjectPath);
21
21
  (0, registerLicensePlistBuildPhase_1.registerLicensePlistBuildPhase)(iosProjectPath);
@@ -1,6 +1,7 @@
1
+ import fs from 'node:fs';
1
2
  import path from 'node:path';
2
3
 
3
- import { scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
4
+ import { type Types as SharedTypes, scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
4
5
 
5
6
  import { addListActivity } from './addListActivity';
6
7
  import { applyAndConfigureAboutLibrariesPlugin } from './applyAndConfigureAboutLibrariesPlugin';
@@ -12,8 +13,16 @@ import { declareAboutLibrariesPlugin } from './declareAboutLibrariesPlugin';
12
13
  * It scans the NPM dependencies, generates AboutLibraries-compatible metadata for them,
13
14
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
14
15
  */
15
- export function androidCommand(androidProjectPath: string) {
16
- const licenses = scanDependencies(path.join(path.resolve(androidProjectPath, '..'), 'package.json'));
16
+ export function androidCommand(androidProjectPath: string, scanOptionsFactory: SharedTypes.ScanPackageOptionsFactory) {
17
+ const licenses = scanDependencies(
18
+ path.join(path.resolve(androidProjectPath, '..'), 'package.json'),
19
+ scanOptionsFactory,
20
+ );
21
+
22
+ const aboutLibrariesConfigDirPath = path.join(androidProjectPath, 'config');
23
+
24
+ // Cleanup metadata in case `scanOptionsFactory` changed
25
+ fs.rmSync(aboutLibrariesConfigDirPath, { recursive: true, force: true });
17
26
 
18
27
  writeAboutLibrariesNPMOutput(licenses, androidProjectPath);
19
28
 
@@ -1,13 +1,22 @@
1
+ import { createPluginScanOptionsFactory } from '../../plugin-utils/build/common';
2
+ import type { PluginScanOptions } from '../../plugin-utils/build/types';
3
+
1
4
  import { androidCommand } from './android/androidCommand';
2
5
  import { iosCommand } from './ios/iosCommand';
3
6
 
4
- function generateLegal(androidProjectPath: string | undefined, iosProjectPath: string | undefined) {
7
+ function generateLegal(
8
+ androidProjectPath: string | undefined,
9
+ iosProjectPath: string | undefined,
10
+ pluginScanOptions: PluginScanOptions,
11
+ ) {
12
+ const scanOptionsFactory = createPluginScanOptionsFactory(pluginScanOptions);
13
+
5
14
  if (androidProjectPath) {
6
- androidCommand(androidProjectPath);
15
+ androidCommand(androidProjectPath, scanOptionsFactory);
7
16
  }
8
17
 
9
18
  if (iosProjectPath) {
10
- iosCommand(iosProjectPath);
19
+ iosCommand(iosProjectPath, scanOptionsFactory);
11
20
  }
12
21
  }
13
22
 
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
 
3
- import { scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
3
+ import { type Types as SharedTypes, scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
4
4
 
5
5
  import { addSettingsBundle } from './addSettingsBundle';
6
6
  import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase';
@@ -11,8 +11,8 @@ import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase
11
11
  * It scans the NPM dependencies, generates LicensePlist-compatible metadata for them,
12
12
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
13
13
  */
14
- export function iosCommand(iosProjectPath: string) {
15
- const licenses = scanDependencies(path.join(path.resolve(iosProjectPath, '..'), 'package.json'));
14
+ export function iosCommand(iosProjectPath: string, scanOptionsFactory: SharedTypes.ScanPackageOptionsFactory) {
15
+ const licenses = scanDependencies(path.join(path.resolve(iosProjectPath, '..'), 'package.json'), scanOptionsFactory);
16
16
 
17
17
  writeLicensePlistNPMOutput(licenses, iosProjectPath);
18
18
 
@@ -49,14 +49,35 @@ public class ReactNativeLegalModuleImpl: NSObject {
49
49
 
50
50
  return [
51
51
  "data": libraries.map({ library in
52
- [
53
- "id": "library-\(library.name ?? "")", "name": library.name ?? "",
52
+ let (name, version) = splitNameAndVersion(library.name)
53
+ return [
54
+ "id": "library-\(library.name ?? "")",
55
+ "name": name ?? "",
56
+ "version": version as Any,
54
57
  "licenses": [["licenseContent": library.content ?? ""]],
55
58
  ]
56
59
  })
57
60
  ]
58
61
  }
59
62
 
63
+ private static func splitNameAndVersion(_ nameAndVersionStr: String?) -> (
64
+ name: String?, version: String?
65
+ ) {
66
+ guard let nameAndVersion = nameAndVersionStr else {
67
+ return (nil, nil)
68
+ }
69
+ var elements = nameAndVersion.split(separator: " ")
70
+ if elements.count <= 1 {
71
+ return (nameAndVersion, nil)
72
+ }
73
+ var version = elements.removeLast()
74
+ version.removeFirst() // remove "("
75
+ version.removeLast() // remove ")"
76
+ let name = elements.joined(separator: " ")
77
+
78
+ return (name, String(version))
79
+ }
80
+
60
81
  private static func getChildPaneSpecifiers(dictArray: [[String: Any]]) -> [[String: Any]] {
61
82
  return
62
83
  dictArray
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAiDpCC,gCAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAkDpCC,gCAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import { TurboModuleRegistry } from 'react-native';
2
4
  export default TurboModuleRegistry.getEnforcing('ReactNativeLegalModule');
3
5
  //# sourceMappingURL=NativeReactNativeLegal.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAiDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAkDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import NativeReactNativeLegal from './NativeReactNativeLegal';
2
4
  export const ReactNativeLegal = {
3
5
  getLibrariesAsync: () => {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","getLibrariesAsync","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.android.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOF,sBAAsB,CAACE,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIJ,sBAAsB,CAACG,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","getLibrariesAsync","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.android.ts"],"mappings":";;AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOF,sBAAsB,CAACE,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIJ,sBAAsB,CAACG,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import NativeReactNativeLegal from './NativeReactNativeLegal';
2
4
  export const ReactNativeLegal = {
3
5
  getLibrariesAsync: () => {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","getLibrariesAsync","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ios.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOF,sBAAsB,CAACE,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIJ,sBAAsB,CAACG,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","getLibrariesAsync","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ios.ts"],"mappings":";;AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOF,sBAAsB,CAACE,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIJ,sBAAsB,CAACG,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  export const ReactNativeLegal = {
2
4
  getLibrariesAsync: () => {
3
5
  return Promise.resolve({
@@ -1 +1 @@
1
- {"version":3,"names":["ReactNativeLegal","getLibrariesAsync","Promise","resolve","data","launchLicenseListScreen","_licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOC,OAAO,CAACC,OAAO,CAAkB;MAAEC,IAAI,EAAE;IAAG,CAAC,CAAC;EACvD,CAAC;EACDC,uBAAuB,EAAGC,kBAA2B,IAAK;IACxD;EAAA;AAEJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ReactNativeLegal","getLibrariesAsync","Promise","resolve","data","launchLicenseListScreen","_licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":";;AAEA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOC,OAAO,CAACC,OAAO,CAAkB;MAAEC,IAAI,EAAE;IAAG,CAAC,CAAC;EACvD,CAAC;EACDC,uBAAuB,EAAGC,kBAA2B,IAAK;IACxD;EAAA;AAEJ,CAAC","ignoreList":[]}
@@ -1,2 +1,4 @@
1
+ "use strict";
2
+
1
3
  export { ReactNativeLegal } from './ReactNativeLegal';
2
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ReactNativeLegal"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["ReactNativeLegal"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,oBAAoB","ignoreList":[]}
@@ -18,6 +18,7 @@ export interface Library {
18
18
  id: string;
19
19
  name: string;
20
20
  licenses: License[];
21
+ version?: string;
21
22
  /**
22
23
  * @platform Android
23
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"NativeReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/NativeReactNativeLegal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;;AAED,wBAAgF"}
1
+ {"version":3,"file":"NativeReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/NativeReactNativeLegal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;;AAED,wBAAgF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-legal",
3
- "version": "1.5.2",
3
+ "version": "1.6.1",
4
4
  "description": "Acknowledge OSS libraries used in your React Native app",
5
5
  "keywords": [
6
6
  "react-native",
@@ -51,14 +51,14 @@
51
51
  "devDependencies": {
52
52
  "@types/glob": "^8.1.0",
53
53
  "@types/xml2js": "^0.4.11",
54
- "expo": "^53.0.0",
55
- "expo-module-scripts": "^4.1.5",
56
- "react": "19.0.0",
57
- "react-native": "0.79.5",
58
- "react-native-builder-bob": "0.23.1"
54
+ "expo": "^54.0.0",
55
+ "expo-module-scripts": "^5.0.7",
56
+ "react": "19.1.0",
57
+ "react-native": "0.81.4",
58
+ "react-native-builder-bob": "0.40.13"
59
59
  },
60
60
  "dependencies": {
61
- "@callstack/licenses": "^0.3.0",
61
+ "@callstack/licenses": "^0.3.1",
62
62
  "glob": "^7.1.3",
63
63
  "xcode": "^3.0.1",
64
64
  "xml2js": "^0.6.2"
@@ -1,8 +1,9 @@
1
1
  import { type ConfigPlugin } from 'expo/config-plugins';
2
+ import type { PlatformPluginOptions } from '../types';
2
3
  /**
3
4
  * Implementation of config plugin for Android setup
4
5
  *
5
6
  * It scans the NPM dependencies, generates AboutLibraries-compatible metadata,
6
7
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
7
8
  */
8
- export declare const withAndroidLegal: ConfigPlugin;
9
+ export declare const withAndroidLegal: ConfigPlugin<PlatformPluginOptions>;
@@ -16,9 +16,9 @@ const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
16
16
  * It scans the NPM dependencies, generates AboutLibraries-compatible metadata,
17
17
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
18
18
  */
19
- const withAndroidLegal = (config) => {
19
+ const withAndroidLegal = (config, { scanOptionsFactory }) => {
20
20
  (0, config_plugins_1.withAndroidManifest)(config, async (exportedConfig) => {
21
- const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
21
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'), scanOptionsFactory);
22
22
  (0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
23
23
  return exportedConfig;
24
24
  });
@@ -1,3 +1,4 @@
1
1
  import type { ConfigPlugin } from 'expo/config-plugins';
2
- declare const _default: ConfigPlugin<void>;
2
+ import type { PluginScanOptions } from '../../plugin-utils/build/types';
3
+ declare const _default: ConfigPlugin<PluginScanOptions>;
3
4
  export default _default;
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_plugins_1 = require("expo/config-plugins");
4
+ const common_1 = require("../../plugin-utils/build/common");
4
5
  const withAndroidLegal_1 = require("./android/withAndroidLegal");
5
6
  const withIosLegal_1 = require("./ios/withIosLegal");
6
7
  // eslint-disable-next-line import/no-extraneous-dependencies
7
8
  const pak = require('react-native-legal/package.json');
8
- const withReactNativeLegal = (config) => {
9
- return (0, config_plugins_1.withPlugins)(config, [withAndroidLegal_1.withAndroidLegal, withIosLegal_1.withIosLegal]);
9
+ const withReactNativeLegal = (config, options) => {
10
+ const { devDepsMode = 'none', includeOptionalDeps = true, transitiveDepsMode = 'all' } = options ?? {};
11
+ const pluginScanOptions = { devDepsMode, includeOptionalDeps, transitiveDepsMode };
12
+ const scanOptionsFactory = (0, common_1.createPluginScanOptionsFactory)(pluginScanOptions);
13
+ config = (0, withAndroidLegal_1.withAndroidLegal)(config, { scanOptionsFactory });
14
+ config = (0, withIosLegal_1.withIosLegal)(config, { scanOptionsFactory });
15
+ return config;
10
16
  };
11
17
  exports.default = (0, config_plugins_1.createRunOncePlugin)(withReactNativeLegal, pak.name, pak.version);
@@ -1,8 +1,9 @@
1
1
  import { type ConfigPlugin } from 'expo/config-plugins';
2
+ import type { PlatformPluginOptions } from '../types';
2
3
  /**
3
4
  * Implementation of config plugin for iOS setup
4
5
  *
5
6
  * It scans the NPM dependencies, generates LicensePlist-compatible metadata,
6
7
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
7
8
  */
8
- export declare const withIosLegal: ConfigPlugin;
9
+ export declare const withIosLegal: ConfigPlugin<PlatformPluginOptions>;
@@ -15,9 +15,9 @@ const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPha
15
15
  * It scans the NPM dependencies, generates LicensePlist-compatible metadata,
16
16
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
17
17
  */
18
- const withIosLegal = (config) => {
18
+ const withIosLegal = (config, { scanOptionsFactory }) => {
19
19
  (0, config_plugins_1.withXcodeProject)(config, async (exportedConfig) => {
20
- const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
20
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'), scanOptionsFactory);
21
21
  (0, licenses_1.writeLicensePlistNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
22
22
  return exportedConfig;
23
23
  });
@@ -0,0 +1,6 @@
1
+ import type { Types as SharedTypes } from '@callstack/licenses';
2
+ import type { PluginScanOptions } from '../../plugin-utils/build/types';
3
+ export type PluginOptions = PluginScanOptions;
4
+ export type PlatformPluginOptions = {
5
+ scanOptionsFactory: SharedTypes.ScanPackageOptionsFactory;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,6 +3,8 @@ import path from 'node:path';
3
3
  import { scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
4
4
  import { type ConfigPlugin, withAndroidManifest } from 'expo/config-plugins';
5
5
 
6
+ import type { PlatformPluginOptions } from '../types';
7
+
6
8
  import { addListActivity } from './addListActivity';
7
9
  import { applyAndConfigureAboutLibrariesPlugin } from './applyAndConfigureAboutLibrariesPlugin';
8
10
  import { declareAboutLibrariesPlugin } from './declareAboutLibrariesPlugin';
@@ -13,9 +15,12 @@ import { declareAboutLibrariesPlugin } from './declareAboutLibrariesPlugin';
13
15
  * It scans the NPM dependencies, generates AboutLibraries-compatible metadata,
14
16
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
15
17
  */
16
- export const withAndroidLegal: ConfigPlugin = (config) => {
18
+ export const withAndroidLegal: ConfigPlugin<PlatformPluginOptions> = (config, { scanOptionsFactory }) => {
17
19
  withAndroidManifest(config, async (exportedConfig) => {
18
- const licenses = scanDependencies(path.join(exportedConfig.modRequest.projectRoot, 'package.json'));
20
+ const licenses = scanDependencies(
21
+ path.join(exportedConfig.modRequest.projectRoot, 'package.json'),
22
+ scanOptionsFactory,
23
+ );
19
24
 
20
25
  writeAboutLibrariesNPMOutput(licenses, exportedConfig.modRequest.platformProjectRoot);
21
26
  return exportedConfig;
@@ -1,14 +1,25 @@
1
1
  import type { ConfigPlugin } from 'expo/config-plugins';
2
- import { createRunOncePlugin, withPlugins } from 'expo/config-plugins';
2
+ import { createRunOncePlugin } from 'expo/config-plugins';
3
+
4
+ import { createPluginScanOptionsFactory } from '../../plugin-utils/build/common';
5
+ import type { PluginScanOptions } from '../../plugin-utils/build/types';
3
6
 
4
7
  import { withAndroidLegal } from './android/withAndroidLegal';
5
8
  import { withIosLegal } from './ios/withIosLegal';
9
+ import type { PluginOptions } from './types';
6
10
 
7
11
  // eslint-disable-next-line import/no-extraneous-dependencies
8
12
  const pak = require('react-native-legal/package.json');
9
13
 
10
- const withReactNativeLegal: ConfigPlugin = (config) => {
11
- return withPlugins(config, [withAndroidLegal, withIosLegal]);
14
+ const withReactNativeLegal: ConfigPlugin<PluginOptions> = (config, options) => {
15
+ const { devDepsMode = 'none', includeOptionalDeps = true, transitiveDepsMode = 'all' } = options ?? {};
16
+ const pluginScanOptions: PluginScanOptions = { devDepsMode, includeOptionalDeps, transitiveDepsMode };
17
+ const scanOptionsFactory = createPluginScanOptionsFactory(pluginScanOptions);
18
+
19
+ config = withAndroidLegal(config, { scanOptionsFactory });
20
+ config = withIosLegal(config, { scanOptionsFactory });
21
+
22
+ return config;
12
23
  };
13
24
 
14
25
  export default createRunOncePlugin(withReactNativeLegal, pak.name, pak.version);
@@ -3,6 +3,8 @@ import path from 'node:path';
3
3
  import { scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
4
4
  import { type ConfigPlugin, withXcodeProject } from 'expo/config-plugins';
5
5
 
6
+ import type { PlatformPluginOptions } from '../types';
7
+
6
8
  import { addSettingsBundle } from './addSettingsBundle';
7
9
  import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase';
8
10
 
@@ -12,9 +14,12 @@ import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase
12
14
  * It scans the NPM dependencies, generates LicensePlist-compatible metadata,
13
15
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
14
16
  */
15
- export const withIosLegal: ConfigPlugin = (config) => {
17
+ export const withIosLegal: ConfigPlugin<PlatformPluginOptions> = (config, { scanOptionsFactory }) => {
16
18
  withXcodeProject(config, async (exportedConfig) => {
17
- const licenses = scanDependencies(path.join(exportedConfig.modRequest.projectRoot, 'package.json'));
19
+ const licenses = scanDependencies(
20
+ path.join(exportedConfig.modRequest.projectRoot, 'package.json'),
21
+ scanOptionsFactory,
22
+ );
18
23
 
19
24
  writeLicensePlistNPMOutput(licenses, exportedConfig.modRequest.platformProjectRoot);
20
25
  return exportedConfig;
@@ -0,0 +1,9 @@
1
+ import type { Types as SharedTypes } from '@callstack/licenses';
2
+
3
+ import type { PluginScanOptions } from '../../plugin-utils/build/types';
4
+
5
+ export type PluginOptions = PluginScanOptions;
6
+
7
+ export type PlatformPluginOptions = {
8
+ scanOptionsFactory: SharedTypes.ScanPackageOptionsFactory;
9
+ };
@@ -42,7 +42,7 @@ function applyAndConfigureAboutLibrariesPluginUtil(androidAppBuildGradleContent)
42
42
  // Configure plugin
43
43
  const pluginConfigRegex = /aboutLibraries {/;
44
44
  if (!androidAppBuildGradleContent.match(pluginConfigRegex)?.length) {
45
- androidAppBuildGradleContent += '\n\naboutLibraries {\n configPath = "config"\n prettyPrint = true\n}';
45
+ androidAppBuildGradleContent += '\n\naboutLibraries {\n configPath = "config"\n prettyPrint = true\n}\n';
46
46
  console.log('About Libraries Gradle Plugin - CONFIGURED');
47
47
  }
48
48
  else {
@@ -0,0 +1,3 @@
1
+ import type { Types as SharedTypes } from '@callstack/licenses';
2
+ import type { PluginScanOptions } from './types';
3
+ export declare function createPluginScanOptionsFactory(pluginScanOptions: PluginScanOptions): SharedTypes.ScanPackageOptionsFactory;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPluginScanOptionsFactory = createPluginScanOptionsFactory;
4
+ function createPluginScanOptionsFactory(pluginScanOptions) {
5
+ return function ({ isRoot, isWorkspacePackage }) {
6
+ let includeDevDependencies = false;
7
+ switch (pluginScanOptions.devDepsMode) {
8
+ case 'root-only':
9
+ includeDevDependencies = isRoot;
10
+ break;
11
+ case 'none':
12
+ includeDevDependencies = false;
13
+ break;
14
+ }
15
+ let includeTransitiveDependencies = true;
16
+ switch (pluginScanOptions.transitiveDepsMode) {
17
+ case 'all':
18
+ includeTransitiveDependencies = true;
19
+ break;
20
+ case 'from-external-only':
21
+ includeTransitiveDependencies = !isWorkspacePackage;
22
+ break;
23
+ case 'from-workspace-only':
24
+ includeTransitiveDependencies = isWorkspacePackage;
25
+ break;
26
+ case 'none':
27
+ includeTransitiveDependencies = false;
28
+ break;
29
+ }
30
+ const includeOptionalDependencies = pluginScanOptions.includeOptionalDeps;
31
+ return {
32
+ includeDevDependencies,
33
+ includeTransitiveDependencies,
34
+ includeOptionalDependencies,
35
+ };
36
+ };
37
+ }
@@ -0,0 +1,5 @@
1
+ export interface PluginScanOptions {
2
+ devDepsMode: 'root-only' | 'none';
3
+ includeOptionalDeps: boolean;
4
+ transitiveDepsMode: 'all' | 'from-external-only' | 'from-workspace-only' | 'none';
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -47,7 +47,7 @@ export function applyAndConfigureAboutLibrariesPluginUtil(androidAppBuildGradleC
47
47
  const pluginConfigRegex = /aboutLibraries {/;
48
48
 
49
49
  if (!androidAppBuildGradleContent.match(pluginConfigRegex)?.length) {
50
- androidAppBuildGradleContent += '\n\naboutLibraries {\n configPath = "config"\n prettyPrint = true\n}';
50
+ androidAppBuildGradleContent += '\n\naboutLibraries {\n configPath = "config"\n prettyPrint = true\n}\n';
51
51
  console.log('About Libraries Gradle Plugin - CONFIGURED');
52
52
  } else {
53
53
  console.log('About Libraries Gradle Plugin already configured - SKIP');
@@ -0,0 +1,49 @@
1
+ import type { Types as SharedTypes } from '@callstack/licenses';
2
+
3
+ import type { PluginScanOptions } from './types';
4
+
5
+ export function createPluginScanOptionsFactory(
6
+ pluginScanOptions: PluginScanOptions,
7
+ ): SharedTypes.ScanPackageOptionsFactory {
8
+ return function ({ isRoot, isWorkspacePackage }) {
9
+ let includeDevDependencies = false;
10
+
11
+ switch (pluginScanOptions.devDepsMode) {
12
+ case 'root-only':
13
+ includeDevDependencies = isRoot;
14
+ break;
15
+
16
+ case 'none':
17
+ includeDevDependencies = false;
18
+ break;
19
+ }
20
+
21
+ let includeTransitiveDependencies = true;
22
+
23
+ switch (pluginScanOptions.transitiveDepsMode) {
24
+ case 'all':
25
+ includeTransitiveDependencies = true;
26
+ break;
27
+
28
+ case 'from-external-only':
29
+ includeTransitiveDependencies = !isWorkspacePackage;
30
+ break;
31
+
32
+ case 'from-workspace-only':
33
+ includeTransitiveDependencies = isWorkspacePackage;
34
+ break;
35
+
36
+ case 'none':
37
+ includeTransitiveDependencies = false;
38
+ break;
39
+ }
40
+
41
+ const includeOptionalDependencies = pluginScanOptions.includeOptionalDeps;
42
+
43
+ return {
44
+ includeDevDependencies,
45
+ includeTransitiveDependencies,
46
+ includeOptionalDependencies,
47
+ };
48
+ };
49
+ }
@@ -0,0 +1,5 @@
1
+ export interface PluginScanOptions {
2
+ devDepsMode: 'root-only' | 'none';
3
+ includeOptionalDeps: boolean;
4
+ transitiveDepsMode: 'all' | 'from-external-only' | 'from-workspace-only' | 'none';
5
+ }
@@ -1,12 +1,48 @@
1
+ /** @type {import('@react-native-community/cli-types').Config} */
1
2
  module.exports = {
2
3
  commands: [
3
4
  {
4
5
  name: 'legal-generate',
5
6
  description: 'Set up all native boilerplate for OSS licenses notice',
6
- func: ([], { project: { android, ios } }, {}) => {
7
+ options: [
8
+ {
9
+ name: '--dm, --dev-deps-mode <string>',
10
+ description: 'Whether to include devDependencies in the scan',
11
+ parse: (val) => {
12
+ if (val === 'root-only') {
13
+ return val;
14
+ }
15
+
16
+ return 'none';
17
+ },
18
+ default: 'none',
19
+ },
20
+ {
21
+ name: '--od, --include-optional-deps [boolean]',
22
+ description:
23
+ 'Whether to include optionalDependencies in the scan; includeTransitiveDependencies option applies',
24
+ parse: (val) => val !== 'false',
25
+ default: true,
26
+ },
27
+ {
28
+ name: '--tm, --transitive-deps-mode <string>',
29
+ description: 'Whether transitive dependencies should be scanned',
30
+ parse: (val) => {
31
+ if (val === 'all' || val === 'from-external-only' || val === 'from-workspace-only' || val === 'none') {
32
+ return val;
33
+ }
34
+
35
+ return 'all';
36
+ },
37
+ default: 'all',
38
+ },
39
+ ],
40
+ func: ([], { project: { android, ios } }, args) => {
7
41
  const generateLegal = require('./bare-plugin/build').default;
42
+ /** @type {import('./plugin-utils/build/types').PluginScanOptions} */
43
+ const { devDepsMode, includeOptionalDeps, transitiveDepsMode } = args;
8
44
 
9
- generateLegal(android?.sourceDir, ios?.sourceDir);
45
+ generateLegal(android?.sourceDir, ios?.sourceDir, { devDepsMode, includeOptionalDeps, transitiveDepsMode });
10
46
  },
11
47
  },
12
48
  ],
@@ -21,6 +21,7 @@ export interface Library {
21
21
  id: string;
22
22
  name: string;
23
23
  licenses: License[];
24
+ version?: string;
24
25
  /**
25
26
  * @platform Android
26
27
  */