New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0.3 to 1.1.0

lib/output/json.d.ts

17

CHANGELOG.json

@@ -5,3 +5,18 @@ {

{
"date": "Thu, 29 Jul 2021 19:41:14 GMT",
"date": "Fri, 30 Jul 2021 18:00:42 GMT",
"tag": "@rnx-kit/third-party-notices_v1.1.0",
"version": "1.1.0",
"comments": {
"minor": [
{
"author": "4123478+tido64@users.noreply.github.com",
"package": "@rnx-kit/third-party-notices",
"comment": "Add JSON output format",
"commit": "dd66becefd2a7e26e96d06c607a127700ecda9bc"
}
]
}
},
{
"date": "Thu, 29 Jul 2021 19:42:04 GMT",
"tag": "@rnx-kit/third-party-notices_v1.0.3",

@@ -8,0 +23,0 @@ "version": "1.0.3",

# Change Log - @rnx-kit/third-party-notices
This log was last generated on Thu, 29 Jul 2021 19:41:14 GMT and should not be manually modified.
This log was last generated on Fri, 30 Jul 2021 18:00:42 GMT and should not be manually modified.
<!-- Start content -->
## 1.1.0
Fri, 30 Jul 2021 18:00:42 GMT
### Minor changes
- Add JSON output format (4123478+tido64@users.noreply.github.com)
## 1.0.3
Thu, 29 Jul 2021 19:41:14 GMT
Thu, 29 Jul 2021 19:42:04 GMT

@@ -11,0 +19,0 @@ ### Patches

16

lib/cli.js

@@ -30,12 +30,9 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const console_1 = require("@rnx-kit/console");
const path = __importStar(require("path"));
const chalk_1 = __importDefault(require("chalk"));
const yargs = __importStar(require("yargs"));
const write_third_party_notices_1 = require("./write-third-party-notices");
function fail(message) {
console.error(chalk_1.default.red(message));
console_1.error(message);
process.exit(1);

@@ -56,2 +53,7 @@ }

},
json: {
type: "boolean",
describe: "Output license information as a JSON",
default: false,
},
outputFile: {

@@ -96,5 +98,3 @@ type: "string",

}
main().catch((err) => {
fail(`Error encountered: ${err}`);
});
main().catch((err) => fail(err));
//# sourceMappingURL=cli.js.map

@@ -1,2 +0,3 @@

export { writeThirdPartyNotices, IWriteThirdPartyNoticesOptions, } from "./write-third-party-notices";
export { WriteThirdPartyNoticesOptions as IWriteThirdPartyNoticesOptions, WriteThirdPartyNoticesOptions, } from "./types";
export { writeThirdPartyNotices } from "./write-third-party-notices";
//# sourceMappingURL=index.d.ts.map

@@ -1,24 +0,2 @@

export interface IWriteThirdPartyNoticesOptions {
rootPath: string;
sourceMapFile?: string;
outputFile?: string;
ignoreScopes?: string[];
ignoreModules?: string[];
preambleText?: string[];
additionalText?: string[];
}
interface ISourceMap {
sources: string[];
sections?: ISourceSection[];
}
interface ISourceSection {
map: ISourceMap;
}
export interface ILicense {
path: string;
licenseURLs: string[];
licenseText?: string;
license?: string;
version: string;
}
import type { License, SourceMap, WriteThirdPartyNoticesOptions } from "./types";
/**

@@ -42,11 +20,9 @@ * Function to write third party notices based on the specified source map.

*/
export declare function writeThirdPartyNotices(options: IWriteThirdPartyNoticesOptions): Promise<void>;
export declare function writeThirdPartyNotices(options: WriteThirdPartyNoticesOptions): Promise<void>;
export declare function normalizePath(p: string): string;
export declare function splitSourcePath(rootPath: string, p: string): string[];
export declare function parseModule(options: IWriteThirdPartyNoticesOptions, moduleNameToPath: Map<string, string>, p: string): void;
export declare function parseSourceMap(options: IWriteThirdPartyNoticesOptions, moduleNameToPath: Map<string, string>, sourceMap: ISourceMap): void;
export declare function extractModuleNameToPathMap(options: IWriteThirdPartyNoticesOptions, sourceMap: ISourceMap): Map<string, string>;
export declare function extractLicenses(moduleNameToPathMap: Map<string, string>): Promise<ILicense[]>;
export declare function createLicenseFileContents(moduleNameToPath: Map<string, string>, licenses: ILicense[], preambleText?: string[], additionalText?: string[]): string;
export {};
export declare function parseModule(options: WriteThirdPartyNoticesOptions, moduleNameToPath: Map<string, string>, p: string): void;
export declare function parseSourceMap(options: WriteThirdPartyNoticesOptions, moduleNameToPath: Map<string, string>, sourceMap: SourceMap): void;
export declare function extractModuleNameToPathMap(options: WriteThirdPartyNoticesOptions, sourceMap: SourceMap): Map<string, string>;
export declare function extractLicenses(moduleNameToPathMap: Map<string, string>): Promise<License[]>;
//# sourceMappingURL=write-third-party-notices.d.ts.map

@@ -15,5 +15,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createLicenseFileContents = exports.extractLicenses = exports.extractModuleNameToPathMap = exports.parseSourceMap = exports.parseModule = exports.splitSourcePath = exports.normalizePath = exports.writeThirdPartyNotices = void 0;
exports.extractLicenses = exports.extractModuleNameToPathMap = exports.parseSourceMap = exports.parseModule = exports.splitSourcePath = exports.normalizePath = exports.writeThirdPartyNotices = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = require("path");
const os_1 = __importDefault(require("os"));
const util_1 = require("util");
const json_1 = require("./output/json");
const text_1 = require("./output/text");
const modulesRoot = "node_modules/";

@@ -40,13 +43,19 @@ /**

return __awaiter(this, void 0, void 0, function* () {
const util = require("util");
const fs = require("fs");
const readFileAsync = util.promisify(fs.readFile);
const writeFileAsync = util.promisify(fs.writeFile);
const readFileAsync = util_1.promisify(fs_1.default.readFile);
const { additionalText, json, outputFile, preambleText, sourceMapFile } = options;
// Parse source map file
const sourceMapJson = yield readFileAsync(options.sourceMapFile, "utf8");
const sourceMapJson = yield readFileAsync(sourceMapFile, "utf8");
const sourceMap = JSON.parse(sourceMapJson);
const moduleNameToPathMap = extractModuleNameToPathMap(options, sourceMap);
const licenses = yield extractLicenses(moduleNameToPathMap);
const outputText = createLicenseFileContents(moduleNameToPathMap, licenses, options.preambleText, options.additionalText);
yield writeFileAsync(options.outputFile, outputText, "utf8");
const outputText = json
? json_1.createLicenseJSON(licenses)
: text_1.createLicenseFileContents(licenses, preambleText, additionalText);
if (outputFile) {
const writeFileAsync = util_1.promisify(fs_1.default.writeFile);
yield writeFileAsync(outputFile, outputText, "utf8");
}
else {
console.log(outputText);
}
});

@@ -153,49 +162,6 @@ }

// Extract licenses of all modules we found
return yield licenseExtractors.nodeModule(moduleNamePathPairs);
return yield licenseExtractors.nodeModule(moduleNamePathPairs.sort(({ name: lhs }, { name: rhs }) => lhs < rhs ? -1 : lhs > rhs ? 1 : 0));
});
}
exports.extractLicenses = extractLicenses;
function createLicenseFileContents(moduleNameToPath, licenses, preambleText, additionalText) {
let outputText = "";
const writeLine = (s) => {
outputText += `${s || ""}${os_1.default.EOL}`;
};
const writeMultipleLines = (s) => {
const lines = s.split(/\r\n|\r|\n/g);
lines.forEach((line) => {
writeLine(line);
});
};
if (preambleText) {
writeMultipleLines(preambleText.join(os_1.default.EOL));
}
// Look up licenses and emit combined license text
Array.from(moduleNameToPath.keys())
.sort()
.forEach((moduleName) => {
const modulePath = moduleNameToPath.get(moduleName);
const license = licenses.find((_) => _.path === modulePath);
if (!license) {
throw new Error(`Cannot find license information for ${moduleName}`);
}
if (!license.licenseText) {
if (!license.license &&
(!license.licenseURLs || license.licenseURLs.length === 0)) {
throw new Error(`No license text or URL for ${moduleName}`);
}
license.licenseText = `${license.license} (${license.licenseURLs.join(" ")})`;
}
writeLine("================================================");
writeLine(`${moduleName} ${license.version}`);
writeLine("=====");
writeMultipleLines(license.licenseText.trim());
writeLine("================================================");
writeLine("");
});
if (additionalText) {
writeMultipleLines(additionalText.join(os_1.default.EOL));
}
return outputText;
}
exports.createLicenseFileContents = createLicenseFileContents;
//# sourceMappingURL=write-third-party-notices.js.map
{
"name": "@rnx-kit/third-party-notices",
"version": "1.0.3",
"version": "1.1.0",
"description": "Library and tool to build a third party notices file based on a js bundle's source map",

@@ -27,3 +27,3 @@ "homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/third-party-notices#readme",

"dependencies": {
"chalk": "^4.1.0",
"@rnx-kit/console": "^1.0.0",
"spdx-expression-parse": "^3.0.1",

@@ -33,6 +33,6 @@ "yargs": "^16.0.0"

"devDependencies": {
"@rnx-kit/eslint-config": "*",
"@rnx-kit/jest-preset": "*",
"@types/jest": "^26.0.0",
"@types/yargs": "^15.0.0",
"prettier": "^2.0.0",
"@types/yargs": "^16.0.0",
"rnx-kit-scripts": "*",

@@ -39,0 +39,0 @@ "typescript": "^4.0.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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