New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/package-extractor

Package Overview
Dependencies
Maintainers
0
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/package-extractor - npm Package Compare versions

Comparing version 0.9.9 to 0.10.0

lib/scripts/createLinks/cli/actions/CreateLinksAction.d.ts

9

CHANGELOG.md
# Change Log - @rushstack/package-extractor
This log was last generated on Thu, 24 Oct 2024 00:15:48 GMT and should not be manually modified.
This log was last generated on Thu, 24 Oct 2024 15:11:19 GMT and should not be manually modified.
## 0.10.0
Thu, 24 Oct 2024 15:11:19 GMT
### Minor changes
- Add bin linking support when calling the create-links.js script with the "--link-bins" parameter
## 0.9.9

@@ -6,0 +13,0 @@ Thu, 24 Oct 2024 00:15:48 GMT

45

lib/PackageExtractor.js

@@ -36,3 +36,2 @@ "use strict";

const npm_packlist_1 = __importDefault(require("npm-packlist"));
const link_bins_1 = __importDefault(require("@pnpm/link-bins"));
const ignore_1 = __importDefault(require("ignore"));

@@ -45,2 +44,3 @@ const node_core_library_1 = require("@rushstack/node-core-library");

const PathConstants_1 = require("./PathConstants");
const constants_1 = require("./scripts/createLinks/utilities/constants");
exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';

@@ -180,3 +180,3 @@ /**

}, {
concurrency: 10
concurrency: constants_1.MAX_CONCURRENCY
});

@@ -306,3 +306,3 @@ if (additionalFolderToCopy) {

}, {
concurrency: 10
concurrency: constants_1.MAX_CONCURRENCY
});

@@ -420,3 +420,3 @@ }

}, {
concurrency: 10
concurrency: constants_1.MAX_CONCURRENCY
});

@@ -483,3 +483,3 @@ }

}, {
concurrency: 10
concurrency: constants_1.MAX_CONCURRENCY
});

@@ -494,7 +494,6 @@ }

const { projectConfigurationsByPath } = state;
const extractorMetadataFileName = 'extractor-metadata.json';
const extractorMetadataFolderPath = linkCreation === 'script' && linkCreationScriptPath
? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath))
: targetRootFolder;
const extractorMetadataFilePath = path.join(extractorMetadataFolderPath, extractorMetadataFileName);
const extractorMetadataFilePath = path.join(extractorMetadataFolderPath, PathConstants_1.EXTRACTOR_METADATA_FILENAME);
const extractorMetadataJson = {

@@ -533,21 +532,11 @@ mainProjectName,

const { terminal } = options;
const extractedProjectFolders = Array.from(state.projectConfigurationsByPath.keys()).filter((folderPath) => state.foldersToCopy.has(folderPath));
await node_core_library_1.Async.forEachAsync(extractedProjectFolders, async (projectFolder) => {
const extractedProjectFolder = (0, Utils_1.remapSourcePathForTargetFolder)(Object.assign(Object.assign({}, options), { sourcePath: projectFolder }));
const extractedProjectNodeModulesFolder = path.join(extractedProjectFolder, 'node_modules');
const extractedProjectBinFolder = path.join(extractedProjectNodeModulesFolder, '.bin');
const linkedBinPackageNames = await (0, link_bins_1.default)(extractedProjectNodeModulesFolder, extractedProjectBinFolder, {
warn: (msg) => terminal.writeLine(terminal_1.Colorize.yellow(msg))
});
if (linkedBinPackageNames.length) {
const binFolderItems = await node_core_library_1.FileSystem.readFolderItemNamesAsync(extractedProjectBinFolder);
for (const binFolderItem of binFolderItems) {
const binFilePath = path.resolve(extractedProjectBinFolder, binFolderItem);
await state.assetHandler.includeAssetAsync({
targetFilePath: binFilePath
});
}
const extractedProjectFolderPaths = [];
for (const folderPath of state.projectConfigurationsByPath.keys()) {
if (state.foldersToCopy.has(folderPath)) {
extractedProjectFolderPaths.push((0, Utils_1.remapSourcePathForTargetFolder)(Object.assign(Object.assign({}, options), { sourcePath: folderPath })));
}
}, {
concurrency: 10
}
const binFilePaths = await (0, Utils_1.makeBinLinksAsync)(terminal, extractedProjectFolderPaths);
await node_core_library_1.Async.forEachAsync(binFilePaths, (targetFilePath) => state.assetHandler.includeAssetAsync({ targetFilePath }), {
concurrency: constants_1.MAX_CONCURRENCY
});

@@ -558,5 +547,5 @@ }

const { assetHandler } = state;
terminal.writeLine(`Creating ${PathConstants_1.createLinksScriptFilename}`);
const createLinksSourceFilePath = `${PathConstants_1.scriptsFolderPath}/${PathConstants_1.createLinksScriptFilename}`;
const createLinksTargetFilePath = path.resolve(targetRootFolder, linkCreationScriptPath || PathConstants_1.createLinksScriptFilename);
terminal.writeLine(`Creating ${PathConstants_1.CREATE_LINKS_SCRIPT_FILENAME}`);
const createLinksSourceFilePath = `${PathConstants_1.SCRIPTS_FOLDER_PATH}/${PathConstants_1.CREATE_LINKS_SCRIPT_FILENAME}`;
const createLinksTargetFilePath = path.resolve(targetRootFolder, linkCreationScriptPath || PathConstants_1.CREATE_LINKS_SCRIPT_FILENAME);
let createLinksScriptContent = await node_core_library_1.FileSystem.readFileAsync(createLinksSourceFilePath);

@@ -563,0 +552,0 @@ createLinksScriptContent = createLinksScriptContent.replace(exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING, node_core_library_1.Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder)));

@@ -1,3 +0,4 @@

export declare const createLinksScriptFilename: 'create-links.js';
export declare const scriptsFolderPath: string;
export declare const CREATE_LINKS_SCRIPT_FILENAME: 'create-links.js';
export declare const EXTRACTOR_METADATA_FILENAME: 'extractor-metadata.json';
export declare const SCRIPTS_FOLDER_PATH: string;
//# sourceMappingURL=PathConstants.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.scriptsFolderPath = exports.createLinksScriptFilename = void 0;
exports.SCRIPTS_FOLDER_PATH = exports.EXTRACTOR_METADATA_FILENAME = exports.CREATE_LINKS_SCRIPT_FILENAME = void 0;
const node_core_library_1 = require("@rushstack/node-core-library");
exports.CREATE_LINKS_SCRIPT_FILENAME = 'create-links.js';
exports.EXTRACTOR_METADATA_FILENAME = 'extractor-metadata.json';
const packageExtractorFolderRootPath = node_core_library_1.PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname);
exports.createLinksScriptFilename = 'create-links.js';
exports.scriptsFolderPath = `${packageExtractorFolderRootPath}/dist/scripts`;
exports.SCRIPTS_FOLDER_PATH = `${packageExtractorFolderRootPath}/dist/scripts`;
//# sourceMappingURL=PathConstants.js.map

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

import { type ITerminal } from '@rushstack/terminal';
export declare function matchesWithStar(patternWithStar: string, input: string): boolean;

@@ -22,2 +23,9 @@ export interface IRemapPathForTargetFolder {

export declare function remapPathForExtractorMetadata(folderPath: string, filePath: string): string;
/**
* Creates the .bin files for the extracted projects and returns the paths to the created .bin files.
*
* @param terminal - The terminal to write to
* @param extractedProjectFolderPaths - The paths to the extracted projects
*/
export declare function makeBinLinksAsync(terminal: ITerminal, extractedProjectFolderPaths: string[]): Promise<string[]>;
//# sourceMappingURL=Utils.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.remapPathForExtractorMetadata = exports.remapSourcePathForTargetFolder = exports.matchesWithStar = void 0;
exports.makeBinLinksAsync = exports.remapPathForExtractorMetadata = exports.remapSourcePathForTargetFolder = exports.matchesWithStar = void 0;
const node_path_1 = __importDefault(require("node:path"));
const link_bins_1 = __importDefault(require("@pnpm/link-bins"));
const node_core_library_1 = require("@rushstack/node-core-library");
const terminal_1 = require("@rushstack/terminal");
const constants_1 = require("./scripts/createLinks/utilities/constants");
function matchesWithStar(patternWithStar, input) {

@@ -56,2 +59,30 @@ // Map "@types/*" --> "^\@types\/.*$"

exports.remapPathForExtractorMetadata = remapPathForExtractorMetadata;
/**
* Creates the .bin files for the extracted projects and returns the paths to the created .bin files.
*
* @param terminal - The terminal to write to
* @param extractedProjectFolderPaths - The paths to the extracted projects
*/
async function makeBinLinksAsync(terminal, extractedProjectFolderPaths) {
const binFilePaths = [];
await node_core_library_1.Async.forEachAsync(extractedProjectFolderPaths, async (extractedProjectFolderPath) => {
const extractedProjectNodeModulesFolderPath = `${extractedProjectFolderPath}/node_modules`;
const extractedProjectBinFolderPath = `${extractedProjectNodeModulesFolderPath}/.bin`;
const linkedBinPackageNames = await (0, link_bins_1.default)(extractedProjectNodeModulesFolderPath, extractedProjectBinFolderPath, {
warn: (msg) => terminal.writeLine(terminal_1.Colorize.yellow(msg))
});
if (linkedBinPackageNames.length) {
const binFolderItems = await node_core_library_1.FileSystem.readFolderItemNamesAsync(extractedProjectBinFolderPath);
for (const binFolderItem of binFolderItems) {
const binFilePath = `${extractedProjectBinFolderPath}/${binFolderItem}`;
terminal.writeVerboseLine(`Created .bin file: ${binFilePath}`);
binFilePaths.push(binFilePath);
}
}
}, {
concurrency: constants_1.MAX_CONCURRENCY
});
return binFilePaths;
}
exports.makeBinLinksAsync = makeBinLinksAsync;
//# sourceMappingURL=Utils.js.map
{
"name": "@rushstack/package-extractor",
"version": "0.9.9",
"version": "0.10.0",
"description": "A library for bundling selected files and dependencies into a deployable package.",

@@ -21,2 +21,3 @@ "main": "lib/index.js",

"@rushstack/node-core-library": "5.9.0",
"@rushstack/ts-command-line": "4.23.0",
"@rushstack/terminal": "0.14.2"

@@ -23,0 +24,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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

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