Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rnx-kit/third-party-notices

Package Overview
Dependencies
Maintainers
7
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rnx-kit/third-party-notices - npm Package Compare versions

Comparing version 1.3.4 to 1.4.0

6

lib/cli.js

@@ -76,2 +76,8 @@ "use strict";

},
fullLicenseText: {
type: "boolean",
describe: "Include full license text in the JSON output",
default: false,
implies: "json",
},
}).argv;

@@ -78,0 +84,0 @@ const writeTpnArgs = argv;

27

lib/extractors.js

@@ -42,4 +42,3 @@ /**

function _getPackageJsonInformations(modules) {
for (let i = 0; i < modules.length; i++) {
let module = modules[i];
for (const module of modules) {
let pkg = readPackage(module.path);

@@ -61,7 +60,7 @@ module.version = pkg.version;

let licenseList = [];
for (var j = 0; j < licenses.length; j++) {
licenseList.push(licenses[j].type || licenses[j].name);
for (const license of licenses) {
licenseList.push(license.type || license.name);
module.license = licenseList.join(" / ");
if (licenses[j].url) {
module.licenseURLs.push(licenses[j].url);
if (license.url) {
module.licenseURLs.push(license.url);
}

@@ -80,13 +79,12 @@ }

function _findLicenseFiles(modules) {
for (let i = 0; i < modules.length; i++) {
let module = modules[i];
for (const module of modules) {
var files = fs.readdirSync(module.path);
for (var j = 0; j < files.length; j++) {
if (files[j].match(/(LICENSE|LICENCE|COPYING)/i)) {
module.licenseFile = files[j];
for (const file of files) {
if (file.match(/(LICENSE|LICENCE|COPYING)/i)) {
module.licenseFile = file;
if (module.noticeFile)
break;
}
else if (files[j].match(/NOTICE/i)) {
module.noticeFile = files[j];
else if (file.match(/NOTICE/i)) {
module.noticeFile = file;
if (module.licenseFile)

@@ -127,4 +125,3 @@ break;

function _readLicenseText(modules) {
for (let i = 0; i < modules.length; i++) {
let module = modules[i];
for (const module of modules) {
if (module.licenseFile) {

@@ -131,0 +128,0 @@ module.licenseText = fs

@@ -25,3 +25,5 @@ "use strict";

ThirdPartyNotices.type = "serializer";
// `export default` required for plugin interface
// eslint-disable-next-line no-restricted-exports
exports.default = ThirdPartyNotices;
//# sourceMappingURL=index.js.map
import type { License } from "../types";
export declare function createLicenseJSON(licenses: License[]): string;
export declare function createLicenseJSON(licenses: License[], fullLicenseText?: boolean): string;
//# sourceMappingURL=json.d.ts.map

@@ -25,3 +25,3 @@ "use strict";

}
function createLicenseJSON(licenses) {
function createLicenseJSON(licenses, fullLicenseText) {
return JSON.stringify({

@@ -32,3 +32,3 @@ packages: licenses.map(({ name, path: modulePath, version, license, licenseText }) => {

}
return {
const info = {
name,

@@ -39,6 +39,10 @@ version,

};
if (fullLicenseText) {
info.text = licenseText === null || licenseText === void 0 ? void 0 : licenseText.replace(/\r\n|\r|\n/g, "\n").trim();
}
return info;
}),
});
}, null, 2);
}
exports.createLicenseJSON = createLicenseJSON;
//# sourceMappingURL=json.js.map

@@ -14,2 +14,9 @@ export type ModuleNamePathPair = {

};
export type LicenseJSONInfo = {
name: string;
version: string;
license: string;
copyright: string;
text?: string;
};
export type SourceMap = {

@@ -31,3 +38,4 @@ sources: string[];

additionalText?: string[];
fullLicenseText?: boolean;
};
//# sourceMappingURL=types.d.ts.map

@@ -54,3 +54,3 @@ "use strict";

const fileOptions = { encoding: "utf-8" };
const { additionalText, json, outputFile, preambleText, sourceMapFile } = options;
const { additionalText, json, outputFile, preambleText, sourceMapFile, fullLicenseText, } = options;
// Parse source map file

@@ -63,3 +63,3 @@ const sourceMapJson = fs.readFileSync(sourceMapFile, fileOptions);

const outputText = json
? (0, json_1.createLicenseJSON)(licenses)
? (0, json_1.createLicenseJSON)(licenses, fullLicenseText)
: (0, text_1.createLicenseFileContents)(licenses, preambleText, additionalText);

@@ -76,7 +76,7 @@ if (outputFile) {

var _a;
const { additionalText, json, preambleText, sourceMapFile } = options;
const { additionalText, json, preambleText, sourceMapFile, fullLicenseText } = options;
let { outputFile } = options;
const licenses = await extractLicenses(moduleNameToPathMap);
const outputText = json
? (0, json_1.createLicenseJSON)(licenses)
? (0, json_1.createLicenseJSON)(licenses, fullLicenseText)
: (0, text_1.createLicenseFileContents)(licenses, preambleText, additionalText);

@@ -83,0 +83,0 @@ if (!outputFile) {

{
"name": "@rnx-kit/third-party-notices",
"version": "1.3.4",
"version": "1.4.0",
"description": "Library and tool to build a third party notices file based on a js bundle's source map",
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/third-party-notices#readme",
"license": "MIT",
"author": {
"name": "Microsoft Open Source",
"email": "microsoftopensource@users.noreply.github.com"
},
"files": [
"bin",
"lib"
"lib/**/*.d.ts",
"lib/**/*.js"
],

@@ -30,3 +35,3 @@ "main": "lib/index.js",

"@rnx-kit/tools-node": "^2.0.0",
"spdx-expression-parse": "^3.0.1",
"spdx-expression-parse": "^4.0.0",
"yargs": "^16.0.0"

@@ -36,23 +41,18 @@ },

"@rnx-kit/eslint-config": "*",
"@rnx-kit/jest-preset": "*",
"@rnx-kit/metro-serializer": "*",
"@rnx-kit/scripts": "*",
"@rnx-kit/tsconfig": "*",
"@types/jest": "^29.2.1",
"@types/metro-source-map": "^0.76.0",
"@types/node": "^20.0.0",
"@types/yargs": "^16.0.0",
"eslint": "^8.0.0",
"eslint": "^8.56.0",
"jest": "^29.2.1",
"metro-source-map": "^0.80.0",
"prettier": "^3.0.0",
"typescript": "^5.0.0"
},
"depcheck": {
"ignoreMatches": [
"metro-source-map"
]
},
"eslintConfig": {
"extends": "@rnx-kit/eslint-config"
},
"jest": {
"preset": "@rnx-kit/scripts"
"preset": "@rnx-kit/jest-preset/private"
}
}

@@ -19,6 +19,2 @@ # @rnx-kit/third-party-notices

At the moment this package only supports webpack based bundles, there is nothing
preventing adding metro support, the current customers of this module are
basedon webpack at the moment.
## Usage

@@ -36,19 +32,21 @@

Options:
--help Show help [boolean]
--version Show version number [boolean]
--rootPath The root of the repo where to start resolving modules from.
--help Show help [boolean]
--version Show version number [boolean]
--rootPath The root of the repo where to start resolving modules from.
[string] [required]
--sourceMapFile The sourceMap file to generate licence contents for.
--sourceMapFile The sourceMap file to generate license contents for.
[string] [required]
--outputFile The output file to write the licence file to. [string]
--json Output license information as a JSON
--json Output license information as a JSON
[boolean] [default: false]
--ignoreScopes Npm scopes to ignore and not emit licence information for
--outputFile The output file to write the license file to. [string]
--ignoreScopes Npm scopes to ignore and not emit license information for
[array]
--ignoreModules Modules (js packages) to not emit licence information for
--ignoreModules Modules (js packages) to not emit license information for
[array]
--preambleText A list of lines to prepend at the start of the generated
licence file. [array]
--additionalText A list of lines to append at the end of the generated
licence file. [array]
--preambleText A list of lines to prepend at the start of the generated
license file. [array]
--additionalText A list of lines to append at the end of the generated
license file. [array]
--fullLicenseText Include full license text in the JSON output
[boolean] [default: false]
```

@@ -55,0 +53,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc