@rushstack/package-extractor 0.9.9 → 0.10.0

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 (44) hide show
  1. package/CHANGELOG.json +12 -0
  2. package/CHANGELOG.md +8 -1
  3. package/dist/scripts/create-links.js +69059 -20314
  4. package/dist/scripts/create-links.js.map +1 -1
  5. package/lib/PackageExtractor.d.ts.map +1 -1
  6. package/lib/PackageExtractor.js +17 -28
  7. package/lib/PackageExtractor.js.map +1 -1
  8. package/lib/PathConstants.d.ts +3 -2
  9. package/lib/PathConstants.d.ts.map +1 -1
  10. package/lib/PathConstants.js +4 -3
  11. package/lib/PathConstants.js.map +1 -1
  12. package/lib/Utils.d.ts +8 -0
  13. package/lib/Utils.d.ts.map +1 -1
  14. package/lib/Utils.js +32 -1
  15. package/lib/Utils.js.map +1 -1
  16. package/lib/scripts/createLinks/cli/CreateLinksCommandLineParser.d.ts +8 -0
  17. package/lib/scripts/createLinks/cli/CreateLinksCommandLineParser.d.ts.map +1 -0
  18. package/lib/scripts/createLinks/cli/CreateLinksCommandLineParser.js +36 -0
  19. package/lib/scripts/createLinks/cli/CreateLinksCommandLineParser.js.map +1 -0
  20. package/lib/scripts/createLinks/cli/actions/CreateLinksAction.d.ts +10 -0
  21. package/lib/scripts/createLinks/cli/actions/CreateLinksAction.d.ts.map +1 -0
  22. package/lib/scripts/createLinks/cli/actions/CreateLinksAction.js +91 -0
  23. package/lib/scripts/createLinks/cli/actions/CreateLinksAction.js.map +1 -0
  24. package/lib/scripts/createLinks/cli/actions/RemoveLinksAction.d.ts +10 -0
  25. package/lib/scripts/createLinks/cli/actions/RemoveLinksAction.d.ts.map +1 -0
  26. package/lib/scripts/createLinks/cli/actions/RemoveLinksAction.js +38 -0
  27. package/lib/scripts/createLinks/cli/actions/RemoveLinksAction.js.map +1 -0
  28. package/lib/scripts/createLinks/start.d.ts +2 -0
  29. package/lib/scripts/createLinks/start.d.ts.map +1 -0
  30. package/lib/scripts/createLinks/start.js +10 -0
  31. package/lib/scripts/createLinks/start.js.map +1 -0
  32. package/lib/scripts/createLinks/utilities/CreateLinksUtilities.d.ts +3 -0
  33. package/lib/scripts/createLinks/utilities/CreateLinksUtilities.d.ts.map +1 -0
  34. package/lib/scripts/createLinks/utilities/CreateLinksUtilities.js +15 -0
  35. package/lib/scripts/createLinks/utilities/CreateLinksUtilities.js.map +1 -0
  36. package/lib/scripts/createLinks/utilities/constants.d.ts +34 -0
  37. package/lib/scripts/createLinks/utilities/constants.d.ts.map +1 -0
  38. package/lib/scripts/createLinks/utilities/constants.js +43 -0
  39. package/lib/scripts/createLinks/utilities/constants.js.map +1 -0
  40. package/package.json +2 -1
  41. package/lib/scripts/create-links.d.ts +0 -2
  42. package/lib/scripts/create-links.d.ts.map +0 -1
  43. package/lib/scripts/create-links.js +0 -119
  44. package/lib/scripts/create-links.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PackageExtractor.d.ts","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":"AASA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAmB,KAAK,SAAS,EAAiB,MAAM,mBAAmB,CAAC;AAMnF,OAAO,QAAQ,cAAc,CAAC;IAC5B,MAAa,MAAM;QACjB,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;oBACd,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE;QAClC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,MAAM;QAC/D,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM;QAC5D,KAAK,IAAI,IAAI;KACrB;CACF;AAED,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;YACW,4BAA4B;YAoD5B,kBAAkB;YAsBlB,4BAA4B;CAuB3C"}
@@ -33,7 +33,6 @@ const path = __importStar(require("path"));
33
33
  const minimatch_1 = require("minimatch");
34
34
  const semver_1 = __importDefault(require("semver"));
35
35
  const npm_packlist_1 = __importDefault(require("npm-packlist"));
36
- const link_bins_1 = __importDefault(require("@pnpm/link-bins"));
37
36
  const ignore_1 = __importDefault(require("ignore"));
38
37
  const node_core_library_1 = require("@rushstack/node-core-library");
39
38
  const terminal_1 = require("@rushstack/terminal");
@@ -41,6 +40,7 @@ const SymlinkAnalyzer_1 = require("./SymlinkAnalyzer");
41
40
  const AssetHandler_1 = require("./AssetHandler");
42
41
  const Utils_1 = require("./Utils");
43
42
  const PathConstants_1 = require("./PathConstants");
43
+ const constants_1 = require("./scripts/createLinks/utilities/constants");
44
44
  exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';
45
45
  /**
46
46
  * Manages the business logic for the "rush deploy" command.
@@ -175,7 +175,7 @@ class PackageExtractor {
175
175
  await node_core_library_1.Async.forEachAsync(foldersToCopy, async (folderToCopy) => {
176
176
  await this._extractFolderAsync(folderToCopy, options, state);
177
177
  }, {
178
- concurrency: 10
178
+ concurrency: constants_1.MAX_CONCURRENCY
179
179
  });
180
180
  if (additionalFolderToCopy) {
181
181
  // Copy the additional folder directly into the root of the target folder by setting the sourceRootFolder
@@ -300,7 +300,7 @@ class PackageExtractor {
300
300
  }
301
301
  callback();
302
302
  }, {
303
- concurrency: 10
303
+ concurrency: constants_1.MAX_CONCURRENCY
304
304
  });
305
305
  }
306
306
  _applyDependencyFilters(terminal, allDependencyNames, additionalDependenciesToInclude = [], dependenciesToExclude = []) {
@@ -413,7 +413,7 @@ class PackageExtractor {
413
413
  });
414
414
  }
415
415
  }, {
416
- concurrency: 10
416
+ concurrency: constants_1.MAX_CONCURRENCY
417
417
  });
418
418
  }
419
419
  else {
@@ -475,7 +475,7 @@ class PackageExtractor {
475
475
  }
476
476
  callback();
477
477
  }, {
478
- concurrency: 10
478
+ concurrency: constants_1.MAX_CONCURRENCY
479
479
  });
480
480
  }
481
481
  }
@@ -485,11 +485,10 @@ class PackageExtractor {
485
485
  async _writeExtractorMetadataAsync(options, state) {
486
486
  const { mainProjectName, sourceRootFolder, targetRootFolder, linkCreation, linkCreationScriptPath } = options;
487
487
  const { projectConfigurationsByPath } = state;
488
- const extractorMetadataFileName = 'extractor-metadata.json';
489
488
  const extractorMetadataFolderPath = linkCreation === 'script' && linkCreationScriptPath
490
489
  ? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath))
491
490
  : targetRootFolder;
492
- const extractorMetadataFilePath = path.join(extractorMetadataFolderPath, extractorMetadataFileName);
491
+ const extractorMetadataFilePath = path.join(extractorMetadataFolderPath, PathConstants_1.EXTRACTOR_METADATA_FILENAME);
493
492
  const extractorMetadataJson = {
494
493
  mainProjectName,
495
494
  projects: [],
@@ -523,33 +522,23 @@ class PackageExtractor {
523
522
  }
524
523
  async _makeBinLinksAsync(options, state) {
525
524
  const { terminal } = options;
526
- const extractedProjectFolders = Array.from(state.projectConfigurationsByPath.keys()).filter((folderPath) => state.foldersToCopy.has(folderPath));
527
- await node_core_library_1.Async.forEachAsync(extractedProjectFolders, async (projectFolder) => {
528
- const extractedProjectFolder = (0, Utils_1.remapSourcePathForTargetFolder)(Object.assign(Object.assign({}, options), { sourcePath: projectFolder }));
529
- const extractedProjectNodeModulesFolder = path.join(extractedProjectFolder, 'node_modules');
530
- const extractedProjectBinFolder = path.join(extractedProjectNodeModulesFolder, '.bin');
531
- const linkedBinPackageNames = await (0, link_bins_1.default)(extractedProjectNodeModulesFolder, extractedProjectBinFolder, {
532
- warn: (msg) => terminal.writeLine(terminal_1.Colorize.yellow(msg))
533
- });
534
- if (linkedBinPackageNames.length) {
535
- const binFolderItems = await node_core_library_1.FileSystem.readFolderItemNamesAsync(extractedProjectBinFolder);
536
- for (const binFolderItem of binFolderItems) {
537
- const binFilePath = path.resolve(extractedProjectBinFolder, binFolderItem);
538
- await state.assetHandler.includeAssetAsync({
539
- targetFilePath: binFilePath
540
- });
541
- }
525
+ const extractedProjectFolderPaths = [];
526
+ for (const folderPath of state.projectConfigurationsByPath.keys()) {
527
+ if (state.foldersToCopy.has(folderPath)) {
528
+ extractedProjectFolderPaths.push((0, Utils_1.remapSourcePathForTargetFolder)(Object.assign(Object.assign({}, options), { sourcePath: folderPath })));
542
529
  }
543
- }, {
544
- concurrency: 10
530
+ }
531
+ const binFilePaths = await (0, Utils_1.makeBinLinksAsync)(terminal, extractedProjectFolderPaths);
532
+ await node_core_library_1.Async.forEachAsync(binFilePaths, (targetFilePath) => state.assetHandler.includeAssetAsync({ targetFilePath }), {
533
+ concurrency: constants_1.MAX_CONCURRENCY
545
534
  });
546
535
  }
547
536
  async _writeCreateLinksScriptAsync(options, state) {
548
537
  const { terminal, targetRootFolder, linkCreationScriptPath } = options;
549
538
  const { assetHandler } = state;
550
- terminal.writeLine(`Creating ${PathConstants_1.createLinksScriptFilename}`);
551
- const createLinksSourceFilePath = `${PathConstants_1.scriptsFolderPath}/${PathConstants_1.createLinksScriptFilename}`;
552
- const createLinksTargetFilePath = path.resolve(targetRootFolder, linkCreationScriptPath || PathConstants_1.createLinksScriptFilename);
539
+ terminal.writeLine(`Creating ${PathConstants_1.CREATE_LINKS_SCRIPT_FILENAME}`);
540
+ const createLinksSourceFilePath = `${PathConstants_1.SCRIPTS_FOLDER_PATH}/${PathConstants_1.CREATE_LINKS_SCRIPT_FILENAME}`;
541
+ const createLinksTargetFilePath = path.resolve(targetRootFolder, linkCreationScriptPath || PathConstants_1.CREATE_LINKS_SCRIPT_FILENAME);
553
542
  let createLinksScriptContent = await node_core_library_1.FileSystem.readFileAsync(createLinksSourceFilePath);
554
543
  createLinksScriptContent = createLinksScriptContent.replace(exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING, node_core_library_1.Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder)));
555
544
  await assetHandler.includeAssetAsync({
@@ -1 +1 @@
1
- {"version":3,"file":"PackageExtractor.js","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,yCAAuD;AACvD,oDAA4B;AAC5B,gEAAuC;AACvC,gEAA2C;AAC3C,oDAA6C;AAC7C,oEAQsC;AACtC,kDAA+D;AAE/D,uDAAmF;AACnF,iDAA8C;AAC9C,mCAAyG;AACzG,mDAA+E;AAalE,QAAA,gDAAgD,GAC3D,oCAAoC,CAAC;AAyQvC;;;;GAIG;AACH,MAAa,gBAAgB;IAC3B;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,eAAuB;QACtE,qGAAqG;QACrG,+CAA+C;QAC/C,MAAM,aAAa,GAAsB,IAAI,OAAO,CAClD,CAAC,OAAmC,EAAE,MAA8B,EAAE,EAAE;YACtE,MAAM,MAAM,GAAuB,IAAI,sBAAW,CAAC,MAAM,CAAC;gBACxD,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QACzD,CAAC,CACF,CAAC;QACF,MAAM,YAAY,GAAa,MAAM,aAAa,CAAC;QACnD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAY,CAAC,OAA0B;QAClD,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,EACJ,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACb,GAAG,OAAO,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,GAAG,OAAO,CAAC;QACvE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;QAE/B,QAAQ,CAAC,SAAS,CAAC,YAAY,yCAAyB,EAAE,CAAC,CAAC;QAC5D,MAAM,yBAAyB,GAAW,GAAG,iCAAiB,IAAI,yCAAyB,EAAE,CAAC;QAC9F,MAAM,yBAAyB,GAAW,IAAI,CAAC,OAAO,CACpD,gBAAgB,EAChB,sBAAsB,IAAI,yCAAyB,CACpD,CAAC;QACF,IAAI,wBAAwB,GAAW,MAAM,8BAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACjG,wBAAwB,GAAG,wBAAwB,CAAC,OAAO,CACzD,wDAAgD,EAChD,wBAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAChG,CAAC;QACF,MAAM,YAAY,CAAC,iBAAiB,CAAC;YACnC,iBAAiB,EAAE,wBAAwB;YAC3C,cAAc,EAAE,yBAAyB;SAC1C,CAAC,CAAC;IACL,CAAC;CACF;AAjrBD,4CAirBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { type IMinimatch, Minimatch } from 'minimatch';\nimport semver from 'semver';\nimport npmPacklist from 'npm-packlist';\nimport pnpmLinkBins from '@pnpm/link-bins';\nimport ignore, { type Ignore } from 'ignore';\nimport {\n Async,\n AsyncQueue,\n Path,\n FileSystem,\n Import,\n JsonFile,\n type IPackageJson\n} from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\n\nimport { SymlinkAnalyzer, type ILinkInfo, type PathNode } from './SymlinkAnalyzer';\nimport { AssetHandler } from './AssetHandler';\nimport { matchesWithStar, remapSourcePathForTargetFolder, remapPathForExtractorMetadata } from './Utils';\nimport { createLinksScriptFilename, scriptsFolderPath } from './PathConstants';\n\n// (@types/npm-packlist is missing this API)\ndeclare module 'npm-packlist' {\n export class Walker {\n public readonly result: string[];\n public constructor(opts: { path: string });\n public on(event: 'done', callback: (result: string[]) => void): Walker;\n public on(event: 'error', callback: (error: Error) => void): Walker;\n public start(): void;\n }\n}\n\nexport const TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING: '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}' =\n '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';\n\n/**\n * Part of the extractor-matadata.json file format. Represents an extracted project.\n *\n * @public\n */\nexport interface IProjectInfoJson {\n /**\n * The name of the project as specified in its package.json file.\n */\n projectName: string;\n /**\n * This path is relative to the root of the extractor output folder\n */\n path: string;\n}\n\n/**\n * The extractor-metadata.json file format.\n *\n * @public\n */\nexport interface IExtractorMetadataJson {\n /**\n * The name of the main project the extraction was performed for.\n */\n mainProjectName: string;\n /**\n * A list of all projects that were extracted.\n */\n projects: IProjectInfoJson[];\n /**\n * A list of all links that are part of the extracted project.\n */\n links: ILinkInfo[];\n /**\n * A list of all files that are part of the extracted project.\n */\n files: string[];\n}\n\n/**\n * The extractor subspace configurations\n *\n * @public\n */\nexport interface IExtractorSubspace {\n /**\n * The subspace name\n */\n subspaceName: string;\n /**\n * The folder where the PNPM \"node_modules\" folder is located. This is used to resolve packages linked\n * to the PNPM virtual store.\n */\n pnpmInstallFolder?: string;\n /**\n * The pnpmfile configuration if using PNPM, otherwise undefined. The configuration will be used to\n * transform the package.json prior to extraction.\n */\n transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;\n}\n\ninterface IExtractorState {\n foldersToCopy: Set<string>;\n packageJsonByPath: Map<string, IPackageJson>;\n projectConfigurationsByPath: Map<string, IExtractorProjectConfiguration>;\n projectConfigurationsByName: Map<string, IExtractorProjectConfiguration>;\n dependencyConfigurationsByName: Map<string, IExtractorDependencyConfiguration[]>;\n symlinkAnalyzer: SymlinkAnalyzer;\n assetHandler: AssetHandler;\n}\n\n/**\n * The extractor configuration for individual projects.\n *\n * @public\n */\nexport interface IExtractorProjectConfiguration {\n /**\n * The name of the project.\n */\n projectName: string;\n /**\n * The absolute path to the project.\n */\n projectFolder: string;\n /**\n * A list of glob patterns to include when extracting this project. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, all paths will be included.\n */\n patternsToInclude?: string[];\n /**\n * A list of glob patterns to exclude when extracting this project. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, no paths will be excluded.\n */\n patternsToExclude?: string[];\n /**\n * The names of additional projects to include when extracting this project.\n */\n additionalProjectsToInclude?: string[];\n /**\n * The names of additional dependencies to include when extracting this project.\n */\n additionalDependenciesToInclude?: string[];\n /**\n * The names of additional dependencies to exclude when extracting this project.\n */\n dependenciesToExclude?: string[];\n}\n\n/**\n * The extractor configuration for individual dependencies.\n *\n * @public\n */\nexport interface IExtractorDependencyConfiguration {\n /**\n * The name of dependency\n */\n dependencyName: string;\n /**\n * The semver version range of dependency\n */\n dependencyVersionRange: string;\n /**\n * A list of glob patterns to exclude when extracting this dependency. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, no paths will be excluded.\n */\n patternsToExclude?: string[];\n /**\n * A list of glob patterns to include when extracting this dependency. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, all paths will be included.\n */\n patternsToInclude?: string[];\n}\n\n/**\n * The mode to use for link creation.\n *\n * @public\n */\nexport type LinkCreationMode = 'default' | 'script' | 'none';\n\n/**\n * Options that can be provided to the extractor.\n *\n * @public\n */\nexport interface IExtractorOptions {\n /**\n * A terminal to log extraction progress.\n */\n terminal: ITerminal;\n\n /**\n * The main project to include in the extraction operation.\n */\n mainProjectName: string;\n\n /**\n * The source folder that copying originates from. Generally it is the repo root folder.\n */\n sourceRootFolder: string;\n\n /**\n * The target folder for the extraction.\n */\n targetRootFolder: string;\n\n /**\n * Whether to overwrite the target folder if it already exists.\n */\n overwriteExisting: boolean;\n\n /**\n * The desired path to be used when archiving the target folder. Supported file extensions: .zip.\n */\n createArchiveFilePath?: string;\n\n /**\n * Whether to skip copying files to the extraction target directory, and only create an extraction\n * archive. This is only supported when {@link IExtractorOptions.linkCreation} is 'script' or 'none'.\n */\n createArchiveOnly?: boolean;\n\n /**\n * The pnpmfile configuration if using PNPM, otherwise `undefined`. The configuration will be used to\n * transform the package.json prior to extraction.\n *\n * @remarks\n * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure\n * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches\n * cannot be combined.\n */\n transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;\n\n /**\n * If dependencies from the \"devDependencies\" package.json field should be included in the extraction.\n */\n includeDevDependencies?: boolean;\n\n /**\n * If files ignored by the .npmignore file should be included in the extraction.\n */\n includeNpmIgnoreFiles?: boolean;\n\n /**\n * The folder where the PNPM \"node_modules\" folder is located. This is used to resolve packages linked\n * to the PNPM virtual store.\n *\n * @remarks\n * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure\n * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches\n * cannot be combined.\n */\n pnpmInstallFolder?: string;\n\n /**\n * The link creation mode to use.\n * \"default\": Create the links while copying the files; this is the default behavior. Use this setting\n * if your file copy tool can handle links correctly.\n * \"script\": A Node.js script called create-links.js will be written to the target folder. Use this setting\n * to create links on the server machine, after the files have been uploaded.\n * \"none\": Do nothing; some other tool may create the links later, based on the extractor-metadata.json file.\n */\n linkCreation?: LinkCreationMode;\n\n /**\n * The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation}\n * is 'script'.\n */\n linkCreationScriptPath?: string;\n\n /**\n * An additional folder containing files which will be copied into the root of the extraction.\n */\n folderToCopy?: string;\n\n /**\n * Configurations for individual projects, keyed by the project path relative to the sourceRootFolder.\n */\n projectConfigurations: IExtractorProjectConfiguration[];\n\n /**\n * Configurations for individual dependencies.\n */\n dependencyConfigurations?: IExtractorDependencyConfiguration[];\n\n /**\n * When using Rush subspaces, this setting can be used to provide configuration information for each\n * individual subspace.\n *\n * @remarks\n * To avoid confusion, if this setting is used, then the {@link IExtractorOptions.transformPackageJson} and\n * {@link IExtractorOptions.pnpmInstallFolder} settings must not be used.\n */\n subspaces?: IExtractorSubspace[];\n}\n\n/**\n * Manages the business logic for the \"rush deploy\" command.\n *\n * @public\n */\nexport class PackageExtractor {\n /**\n * Get a list of files that would be included in a package created from the provided package root path.\n *\n * @beta\n */\n public static async getPackageIncludedFilesAsync(packageRootPath: string): Promise<string[]> {\n // Use npm-packlist to filter the files. Using the Walker class (instead of the default API) ensures\n // that \"bundledDependencies\" are not included.\n const walkerPromise: Promise<string[]> = new Promise<string[]>(\n (resolve: (result: string[]) => void, reject: (error: Error) => void) => {\n const walker: npmPacklist.Walker = new npmPacklist.Walker({\n path: packageRootPath\n });\n walker.on('done', resolve).on('error', reject).start();\n }\n );\n const npmPackFiles: string[] = await walkerPromise;\n return npmPackFiles;\n }\n\n /**\n * Extract a package using the provided options\n */\n public async extractAsync(options: IExtractorOptions): Promise<void> {\n options = PackageExtractor._normalizeOptions(options);\n const {\n terminal,\n projectConfigurations,\n sourceRootFolder,\n targetRootFolder,\n mainProjectName,\n overwriteExisting,\n dependencyConfigurations,\n linkCreation\n } = options;\n\n terminal.writeLine(Colorize.cyan(`Extracting to target folder: ${targetRootFolder}`));\n terminal.writeLine(Colorize.cyan(`Main project for extraction: ${mainProjectName}`));\n\n await FileSystem.ensureFolderAsync(targetRootFolder);\n const existingExtraction: boolean =\n (await FileSystem.readFolderItemNamesAsync(targetRootFolder)).length > 0;\n if (existingExtraction) {\n if (!overwriteExisting) {\n throw new Error('The extraction target folder is not empty. Overwrite must be explicitly requested');\n }\n terminal.writeLine('Deleting target folder contents...');\n terminal.writeLine('');\n await FileSystem.ensureEmptyFolderAsync(targetRootFolder);\n }\n\n // Create a new state for each run\n const symlinkAnalyzer: SymlinkAnalyzer = new SymlinkAnalyzer({\n requiredSourceParentPath: sourceRootFolder\n });\n const state: IExtractorState = {\n symlinkAnalyzer,\n assetHandler: new AssetHandler({ ...options, symlinkAnalyzer }),\n foldersToCopy: new Set(),\n packageJsonByPath: new Map(),\n projectConfigurationsByName: new Map(projectConfigurations.map((p) => [p.projectName, p])),\n projectConfigurationsByPath: new Map(projectConfigurations.map((p) => [p.projectFolder, p])),\n dependencyConfigurationsByName: new Map()\n };\n\n // set state dependencyConfigurationsByName\n for (const dependencyConfiguration of dependencyConfigurations || []) {\n const { dependencyName } = dependencyConfiguration;\n let existingDependencyConfigurations: IExtractorDependencyConfiguration[] | undefined =\n state.dependencyConfigurationsByName.get(dependencyName);\n if (!existingDependencyConfigurations) {\n existingDependencyConfigurations = [];\n state.dependencyConfigurationsByName.set(dependencyName, existingDependencyConfigurations);\n }\n existingDependencyConfigurations.push(dependencyConfiguration);\n }\n\n await this._performExtractionAsync(options, state);\n await state.assetHandler.finalizeAsync({\n onAfterExtractSymlinksAsync: async () => {\n // We need the symlinks to be created before attempting to create the bin links, since it requires\n // the node_modules folder to be realized. While we're here, we may as well perform some specific\n // link creation tasks and write the extractor-metadata.json file before the asset handler finalizes.\n if (linkCreation === 'default') {\n await this._makeBinLinksAsync(options, state);\n } else if (linkCreation === 'script') {\n await this._writeCreateLinksScriptAsync(options, state);\n }\n\n terminal.writeLine('Creating extractor-metadata.json');\n await this._writeExtractorMetadataAsync(options, state);\n }\n });\n }\n\n private static _normalizeOptions(options: IExtractorOptions): IExtractorOptions {\n if (options.subspaces) {\n if (options.pnpmInstallFolder !== undefined) {\n throw new Error(\n 'IExtractorOptions.pnpmInstallFolder cannot be combined with IExtractorOptions.subspaces'\n );\n }\n if (options.transformPackageJson !== undefined) {\n throw new Error(\n 'IExtractorOptions.transformPackageJson cannot be combined with IExtractorOptions.subspaces'\n );\n }\n return options;\n }\n\n const normalizedOptions: IExtractorOptions = { ...options };\n delete normalizedOptions.pnpmInstallFolder;\n delete normalizedOptions.transformPackageJson;\n\n normalizedOptions.subspaces = [\n {\n subspaceName: 'default',\n pnpmInstallFolder: options.pnpmInstallFolder,\n transformPackageJson: options.transformPackageJson\n }\n ];\n\n return normalizedOptions;\n }\n\n private async _performExtractionAsync(options: IExtractorOptions, state: IExtractorState): Promise<void> {\n const {\n terminal,\n mainProjectName,\n sourceRootFolder,\n targetRootFolder,\n folderToCopy: additionalFolderToCopy,\n createArchiveOnly\n } = options;\n const { projectConfigurationsByName, foldersToCopy } = state;\n\n const mainProjectConfiguration: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByName.get(mainProjectName);\n if (!mainProjectConfiguration) {\n throw new Error(`Main project \"${mainProjectName}\" was not found in the list of projects`);\n }\n\n // Calculate the set with additionalProjectsToInclude\n const includedProjectsSet: Set<IExtractorProjectConfiguration> = new Set([mainProjectConfiguration]);\n for (const { additionalProjectsToInclude } of includedProjectsSet) {\n if (additionalProjectsToInclude) {\n for (const additionalProjectNameToInclude of additionalProjectsToInclude) {\n const additionalProjectToInclude: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByName.get(additionalProjectNameToInclude);\n if (!additionalProjectToInclude) {\n throw new Error(\n `Project \"${additionalProjectNameToInclude}\" was not found in the list of projects.`\n );\n }\n includedProjectsSet.add(additionalProjectToInclude);\n }\n }\n }\n\n for (const { projectName, projectFolder } of includedProjectsSet) {\n terminal.writeLine(Colorize.cyan(`Analyzing project: ${projectName}`));\n await this._collectFoldersAsync(projectFolder, options, state);\n }\n\n if (!createArchiveOnly) {\n terminal.writeLine(`Copying folders to target folder \"${targetRootFolder}\"`);\n }\n await Async.forEachAsync(\n foldersToCopy,\n async (folderToCopy: string) => {\n await this._extractFolderAsync(folderToCopy, options, state);\n },\n {\n concurrency: 10\n }\n );\n\n if (additionalFolderToCopy) {\n // Copy the additional folder directly into the root of the target folder by setting the sourceRootFolder\n // to the root of the folderToCopy\n const additionalFolderPath: string = path.resolve(sourceRootFolder, additionalFolderToCopy);\n const additionalFolderExtractorOptions: IExtractorOptions = {\n ...options,\n sourceRootFolder: additionalFolderPath,\n targetRootFolder\n };\n await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state);\n }\n }\n\n /**\n * Recursively crawl the node_modules dependencies and collect the result in IExtractorState.foldersToCopy.\n */\n private async _collectFoldersAsync(\n packageJsonFolder: string,\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { terminal, subspaces } = options;\n const { projectConfigurationsByPath } = state;\n\n const packageJsonFolderPathQueue: AsyncQueue<string> = new AsyncQueue([packageJsonFolder]);\n\n await Async.forEachAsync(\n packageJsonFolderPathQueue,\n async ([packageJsonFolderPath, callback]: [string, () => void]) => {\n const packageJsonRealFolderPath: string = await FileSystem.getRealPathAsync(packageJsonFolderPath);\n if (state.foldersToCopy.has(packageJsonRealFolderPath)) {\n // we've already seen this folder\n callback();\n return;\n }\n state.foldersToCopy.add(packageJsonRealFolderPath);\n\n const originalPackageJson: IPackageJson = await JsonFile.loadAsync(\n path.join(packageJsonRealFolderPath, 'package.json')\n );\n\n const targetSubspace: IExtractorSubspace | undefined = subspaces?.find(\n (subspace) =>\n subspace.pnpmInstallFolder && Path.isUnder(packageJsonFolderPath, subspace.pnpmInstallFolder)\n );\n\n // Transform packageJson using the provided transformer, if requested\n const packageJson: IPackageJson =\n targetSubspace?.transformPackageJson?.(originalPackageJson) ?? originalPackageJson;\n\n state.packageJsonByPath.set(packageJsonRealFolderPath, packageJson);\n // Union of keys from regular dependencies, peerDependencies, optionalDependencies\n // (and possibly devDependencies if includeDevDependencies=true)\n const dependencyNamesToProcess: Set<string> = new Set<string>();\n\n // Just the keys from optionalDependencies and peerDependencies\n const optionalDependencyNames: Set<string> = new Set<string>();\n\n for (const name of Object.keys(packageJson.dependencies || {})) {\n dependencyNamesToProcess.add(name);\n }\n for (const name of Object.keys(packageJson.peerDependencies || {})) {\n dependencyNamesToProcess.add(name);\n optionalDependencyNames.add(name); // consider peers optional, since they are so frequently broken\n }\n for (const name of Object.keys(packageJson.optionalDependencies || {})) {\n dependencyNamesToProcess.add(name);\n optionalDependencyNames.add(name);\n }\n\n // Check to see if this is a local project\n const projectConfiguration: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByPath.get(packageJsonRealFolderPath);\n\n if (projectConfiguration) {\n if (options.includeDevDependencies) {\n for (const name of Object.keys(packageJson.devDependencies || {})) {\n dependencyNamesToProcess.add(name);\n }\n }\n\n this._applyDependencyFilters(\n terminal,\n dependencyNamesToProcess,\n projectConfiguration.additionalDependenciesToInclude,\n projectConfiguration.dependenciesToExclude\n );\n }\n\n for (const dependencyPackageName of dependencyNamesToProcess) {\n try {\n const dependencyPackageFolderPath: string = await Import.resolvePackageAsync({\n packageName: dependencyPackageName,\n baseFolderPath: packageJsonRealFolderPath,\n getRealPathAsync: async (filePath: string) => {\n try {\n return (await state.symlinkAnalyzer.analyzePathAsync({ inputPath: filePath })).nodePath;\n } catch (error: unknown) {\n if (FileSystem.isFileDoesNotExistError(error as Error)) {\n return filePath;\n }\n throw error;\n }\n }\n });\n packageJsonFolderPathQueue.push(dependencyPackageFolderPath);\n } catch (resolveErr) {\n if (optionalDependencyNames.has(dependencyPackageName)) {\n // Ignore missing optional dependency\n continue;\n }\n throw resolveErr;\n }\n }\n\n // Replicate the links to the virtual store. Note that if the package has not been hoisted by\n // PNPM, the package will not be resolvable from here.\n // Only apply this logic for packages that were actually installed under the common/temp folder.\n const realPnpmInstallFolder: string | undefined = targetSubspace?.pnpmInstallFolder;\n if (realPnpmInstallFolder && Path.isUnder(packageJsonFolderPath, realPnpmInstallFolder)) {\n try {\n // The PNPM virtual store links are created in this folder. We will resolve the current package\n // from that location and collect any additional links encountered along the way.\n // TODO: This can be configured via NPMRC. We should support that.\n const pnpmDotFolderPath: string = path.join(realPnpmInstallFolder, 'node_modules', '.pnpm');\n\n // TODO: Investigate how package aliases are handled by PNPM in this case. For example:\n //\n // \"dependencies\": {\n // \"alias-name\": \"npm:real-name@^1.2.3\"\n // }\n const dependencyPackageFolderPath: string = await Import.resolvePackageAsync({\n packageName: packageJson.name,\n baseFolderPath: pnpmDotFolderPath,\n getRealPathAsync: async (filePath: string) => {\n try {\n return (await state.symlinkAnalyzer.analyzePathAsync({ inputPath: filePath })).nodePath;\n } catch (error: unknown) {\n if (FileSystem.isFileDoesNotExistError(error as Error)) {\n return filePath;\n }\n throw error;\n }\n }\n });\n packageJsonFolderPathQueue.push(dependencyPackageFolderPath);\n } catch (resolveErr) {\n // The virtual store link isn't guaranteed to exist, so ignore if it's missing\n // NOTE: If you encounter this warning a lot, please report it to the Rush maintainers.\n // eslint-disable-next-line no-console\n console.log('Ignoring missing PNPM virtual store link for ' + packageJsonFolderPath);\n }\n }\n\n callback();\n },\n {\n concurrency: 10\n }\n );\n }\n\n private _applyDependencyFilters(\n terminal: ITerminal,\n allDependencyNames: Set<string>,\n additionalDependenciesToInclude: string[] = [],\n dependenciesToExclude: string[] = []\n ): Set<string> {\n // Track packages that got added/removed for reporting purposes\n const extraIncludedPackageNames: string[] = [];\n const extraExcludedPackageNames: string[] = [];\n\n for (const patternWithStar of dependenciesToExclude) {\n for (const dependency of allDependencyNames) {\n if (matchesWithStar(patternWithStar, dependency)) {\n if (allDependencyNames.delete(dependency)) {\n extraExcludedPackageNames.push(dependency);\n }\n }\n }\n }\n\n for (const dependencyToInclude of additionalDependenciesToInclude) {\n if (!allDependencyNames.has(dependencyToInclude)) {\n allDependencyNames.add(dependencyToInclude);\n extraIncludedPackageNames.push(dependencyToInclude);\n }\n }\n\n if (extraIncludedPackageNames.length > 0) {\n extraIncludedPackageNames.sort();\n terminal.writeLine(`Extra dependencies included by settings: ${extraIncludedPackageNames.join(', ')}`);\n }\n\n if (extraExcludedPackageNames.length > 0) {\n extraExcludedPackageNames.sort();\n terminal.writeLine(`Extra dependencies excluded by settings: ${extraExcludedPackageNames.join(', ')}`);\n }\n\n return allDependencyNames;\n }\n\n /**\n * Copy one package folder to the extractor target folder.\n */\n private async _extractFolderAsync(\n sourceFolderPath: string,\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { includeNpmIgnoreFiles } = options;\n const { projectConfigurationsByPath, packageJsonByPath, dependencyConfigurationsByName, assetHandler } =\n state;\n let useNpmIgnoreFilter: boolean = false;\n\n const sourceFolderRealPath: string = await FileSystem.getRealPathAsync(sourceFolderPath);\n const sourceProjectConfiguration: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByPath.get(sourceFolderRealPath);\n\n const packagesJson: IPackageJson | undefined = packageJsonByPath.get(sourceFolderRealPath);\n // As this function will be used to copy folder for both project inside monorepo and third party\n // dependencies insides node_modules. Third party dependencies won't have project configurations\n const isLocalProject: boolean = !!sourceProjectConfiguration;\n\n // Function to filter files inside local project or third party dependencies.\n const isFileExcluded = (filePath: string): boolean => {\n // Encapsulate exclude logic into a function, so it can be reused.\n const excludeFileByPatterns = (\n patternsToInclude: string[] | undefined,\n patternsToExclude: string[] | undefined\n ): boolean => {\n let includeFilters: IMinimatch[] | undefined;\n let excludeFilters: IMinimatch[] | undefined;\n if (patternsToInclude?.length) {\n includeFilters = patternsToInclude?.map((p) => new Minimatch(p, { dot: true }));\n }\n if (patternsToExclude?.length) {\n excludeFilters = patternsToExclude?.map((p) => new Minimatch(p, { dot: true }));\n }\n // If there are no filters, then we can't exclude anything.\n if (!includeFilters && !excludeFilters) {\n return false;\n }\n\n const isIncluded: boolean = !includeFilters || includeFilters.some((m) => m.match(filePath));\n\n // If the file is not included, then we don't need to check the excludeFilter. If it is included\n // and there is no exclude filter, then we know that the file is not excluded. If it is included\n // and there is an exclude filter, then we need to check for a match.\n return !isIncluded || !!excludeFilters?.some((m) => m.match(filePath));\n };\n\n if (isLocalProject) {\n return excludeFileByPatterns(\n sourceProjectConfiguration?.patternsToInclude,\n sourceProjectConfiguration?.patternsToExclude\n );\n } else {\n if (!packagesJson) {\n return false;\n }\n const dependenciesConfigurations: IExtractorDependencyConfiguration[] | undefined =\n dependencyConfigurationsByName.get(packagesJson.name);\n if (!dependenciesConfigurations) {\n return false;\n }\n const matchedDependenciesConfigurations: IExtractorDependencyConfiguration[] =\n dependenciesConfigurations.filter((d) =>\n semver.satisfies(packagesJson.version, d.dependencyVersionRange)\n );\n return matchedDependenciesConfigurations.some((d) =>\n excludeFileByPatterns(d.patternsToInclude, d.patternsToExclude)\n );\n }\n };\n\n if (sourceProjectConfiguration && !includeNpmIgnoreFiles) {\n // Only use the npmignore filter if the project configuration explicitly asks for it\n useNpmIgnoreFilter = true;\n }\n\n const targetFolderPath: string = remapSourcePathForTargetFolder({\n ...options,\n sourcePath: sourceFolderPath\n });\n if (useNpmIgnoreFilter) {\n const npmPackFiles: string[] = await PackageExtractor.getPackageIncludedFilesAsync(sourceFolderPath);\n await Async.forEachAsync(\n npmPackFiles,\n async (npmPackFile: string) => {\n // In issue https://github.com/microsoft/rushstack/issues/2121 we found that npm-packlist sometimes returns\n // duplicate file paths, for example:\n //\n // 'dist//index.js'\n // 'dist/index.js'\n //\n\n // Filter out files that are excluded by the project configuration or dependency configuration.\n if (isFileExcluded(npmPackFile)) {\n return;\n }\n\n const sourceFilePath: string = path.resolve(sourceFolderPath, npmPackFile);\n const { kind, linkStats: sourceFileStats } = await state.symlinkAnalyzer.analyzePathAsync({\n inputPath: sourceFilePath\n });\n if (kind === 'file') {\n const targetFilePath: string = path.resolve(targetFolderPath, npmPackFile);\n await assetHandler.includeAssetAsync({\n sourceFilePath,\n sourceFileStats,\n targetFilePath\n });\n }\n },\n {\n concurrency: 10\n }\n );\n } else {\n // use a simplistic \"ignore\" ruleset to filter the files\n const ignoreFilter: Ignore = ignore();\n ignoreFilter.add([\n // The top-level node_modules folder is always excluded\n '/node_modules',\n // Also exclude well-known folders that can contribute a lot of unnecessary files\n '**/.git',\n '**/.svn',\n '**/.hg',\n '**/.DS_Store'\n ]);\n\n // Do a breadth-first search of the source folder, copying each file to the target folder\n const queue: AsyncQueue<string> = new AsyncQueue([sourceFolderPath]);\n await Async.forEachAsync(\n queue,\n async ([sourcePath, callback]: [string, () => void]) => {\n const relativeSourcePath: string = path.relative(sourceFolderPath, sourcePath);\n if (relativeSourcePath !== '' && ignoreFilter.ignores(relativeSourcePath)) {\n callback();\n return;\n }\n\n const sourcePathNode: PathNode | undefined = await state.symlinkAnalyzer.analyzePathAsync({\n inputPath: sourcePath,\n // Treat all links to external paths as if they are files for this scenario. In the future, we may\n // want to explore the target of the external link to see if all files within the target are\n // excluded, and throw if they are not.\n shouldIgnoreExternalLink: (linkSourcePath: string) => {\n // Ignore the provided linkSourcePath since it may not be the first link in the chain. Instead,\n // we will consider only the relativeSourcePath, since that would be our entrypoint into the\n // link chain.\n return isFileExcluded(relativeSourcePath);\n }\n });\n\n if (sourcePathNode === undefined) {\n // The target was a symlink that is excluded. We don't need to do anything.\n callback();\n return;\n } else if (sourcePathNode.kind === 'file') {\n // Only ignore files and not folders to ensure that we traverse the contents of all folders. This is\n // done so that we can match against subfolder patterns, ex. \"src/subfolder/**/*\"\n if (relativeSourcePath !== '' && isFileExcluded(relativeSourcePath)) {\n callback();\n return;\n }\n\n const targetFilePath: string = path.resolve(targetFolderPath, relativeSourcePath);\n await assetHandler.includeAssetAsync({\n sourceFilePath: sourcePath,\n sourceFileStats: sourcePathNode.linkStats,\n targetFilePath\n });\n } else if (sourcePathNode.kind === 'folder') {\n const children: string[] = await FileSystem.readFolderItemNamesAsync(sourcePath);\n for (const child of children) {\n queue.push(path.join(sourcePath, child));\n }\n }\n\n callback();\n },\n {\n concurrency: 10\n }\n );\n }\n }\n\n /**\n * Write the common/deploy/deploy-metadata.json file.\n */\n private async _writeExtractorMetadataAsync(\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { mainProjectName, sourceRootFolder, targetRootFolder, linkCreation, linkCreationScriptPath } =\n options;\n const { projectConfigurationsByPath } = state;\n\n const extractorMetadataFileName: string = 'extractor-metadata.json';\n const extractorMetadataFolderPath: string =\n linkCreation === 'script' && linkCreationScriptPath\n ? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath))\n : targetRootFolder;\n const extractorMetadataFilePath: string = path.join(\n extractorMetadataFolderPath,\n extractorMetadataFileName\n );\n const extractorMetadataJson: IExtractorMetadataJson = {\n mainProjectName,\n projects: [],\n links: [],\n files: []\n };\n\n for (const { projectFolder, projectName } of projectConfigurationsByPath.values()) {\n if (state.foldersToCopy.has(projectFolder)) {\n extractorMetadataJson.projects.push({\n projectName,\n path: remapPathForExtractorMetadata(sourceRootFolder, projectFolder)\n });\n }\n }\n\n // Remap the links to be relative to target folder\n for (const { kind, linkPath, targetPath } of state.symlinkAnalyzer.reportSymlinks()) {\n extractorMetadataJson.links.push({\n kind,\n linkPath: remapPathForExtractorMetadata(sourceRootFolder, linkPath),\n targetPath: remapPathForExtractorMetadata(sourceRootFolder, targetPath)\n });\n }\n\n for (const assetPath of state.assetHandler.assetPaths) {\n extractorMetadataJson.files.push(remapPathForExtractorMetadata(targetRootFolder, assetPath));\n }\n\n const extractorMetadataFileContent: string = JSON.stringify(extractorMetadataJson, undefined, 0);\n await state.assetHandler.includeAssetAsync({\n sourceFileContent: extractorMetadataFileContent,\n targetFilePath: extractorMetadataFilePath\n });\n }\n\n private async _makeBinLinksAsync(options: IExtractorOptions, state: IExtractorState): Promise<void> {\n const { terminal } = options;\n\n const extractedProjectFolders: string[] = Array.from(state.projectConfigurationsByPath.keys()).filter(\n (folderPath: string) => state.foldersToCopy.has(folderPath)\n );\n\n await Async.forEachAsync(\n extractedProjectFolders,\n async (projectFolder: string) => {\n const extractedProjectFolder: string = remapSourcePathForTargetFolder({\n ...options,\n sourcePath: projectFolder\n });\n const extractedProjectNodeModulesFolder: string = path.join(extractedProjectFolder, 'node_modules');\n const extractedProjectBinFolder: string = path.join(extractedProjectNodeModulesFolder, '.bin');\n\n const linkedBinPackageNames: string[] = await pnpmLinkBins(\n extractedProjectNodeModulesFolder,\n extractedProjectBinFolder,\n {\n warn: (msg: string) => terminal.writeLine(Colorize.yellow(msg))\n }\n );\n\n if (linkedBinPackageNames.length) {\n const binFolderItems: string[] =\n await FileSystem.readFolderItemNamesAsync(extractedProjectBinFolder);\n for (const binFolderItem of binFolderItems) {\n const binFilePath: string = path.resolve(extractedProjectBinFolder, binFolderItem);\n await state.assetHandler.includeAssetAsync({\n targetFilePath: binFilePath\n });\n }\n }\n },\n {\n concurrency: 10\n }\n );\n }\n\n private async _writeCreateLinksScriptAsync(\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { terminal, targetRootFolder, linkCreationScriptPath } = options;\n const { assetHandler } = state;\n\n terminal.writeLine(`Creating ${createLinksScriptFilename}`);\n const createLinksSourceFilePath: string = `${scriptsFolderPath}/${createLinksScriptFilename}`;\n const createLinksTargetFilePath: string = path.resolve(\n targetRootFolder,\n linkCreationScriptPath || createLinksScriptFilename\n );\n let createLinksScriptContent: string = await FileSystem.readFileAsync(createLinksSourceFilePath);\n createLinksScriptContent = createLinksScriptContent.replace(\n TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING,\n Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder))\n );\n await assetHandler.includeAssetAsync({\n sourceFileContent: createLinksScriptContent,\n targetFilePath: createLinksTargetFilePath\n });\n }\n}\n"]}
1
+ {"version":3,"file":"PackageExtractor.js","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,yCAAuD;AACvD,oDAA4B;AAC5B,gEAAuC;AACvC,oDAA6C;AAC7C,oEAQsC;AACtC,kDAA+D;AAE/D,uDAAmF;AACnF,iDAA8C;AAC9C,mCAKiB;AACjB,mDAIyB;AACzB,yEAA4E;AAa/D,QAAA,gDAAgD,GAC3D,oCAAoC,CAAC;AAyQvC;;;;GAIG;AACH,MAAa,gBAAgB;IAC3B;;;;OAIG;IACI,MAAM,CAAC,KAAK,C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B,EAC1B,KAAsB;QAEtB,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC;QACvE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;QAE/B,QAAQ,CAAC,SAAS,CAAC,YAAY,4CAA4B,EAAE,CAAC,CAAC;QAC/D,MAAM,yBAAyB,GAAW,GAAG,mCAAmB,IAAI,4CAA4B,EAAE,CAAC;QACnG,MAAM,yBAAyB,GAAW,IAAI,CAAC,OAAO,CACpD,gBAAgB,EAChB,sBAAsB,IAAI,4CAA4B,CACvD,CAAC;QACF,IAAI,wBAAwB,GAAW,MAAM,8BAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACjG,wBAAwB,GAAG,wBAAwB,CAAC,OAAO,CACzD,wDAAgD,EAChD,wBAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAChG,CAAC;QACF,MAAM,YAAY,CAAC,iBAAiB,CAAC;YACnC,iBAAiB,EAAE,wBAAwB;YAC3C,cAAc,EAAE,yBAAyB;SAC1C,CAAC,CAAC;IACL,CAAC;CACF;AA5pBD,4CA4pBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { type IMinimatch, Minimatch } from 'minimatch';\nimport semver from 'semver';\nimport npmPacklist from 'npm-packlist';\nimport ignore, { type Ignore } from 'ignore';\nimport {\n Async,\n AsyncQueue,\n Path,\n FileSystem,\n Import,\n JsonFile,\n type IPackageJson\n} from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\n\nimport { SymlinkAnalyzer, type ILinkInfo, type PathNode } from './SymlinkAnalyzer';\nimport { AssetHandler } from './AssetHandler';\nimport {\n matchesWithStar,\n remapSourcePathForTargetFolder,\n remapPathForExtractorMetadata,\n makeBinLinksAsync\n} from './Utils';\nimport {\n CREATE_LINKS_SCRIPT_FILENAME,\n EXTRACTOR_METADATA_FILENAME,\n SCRIPTS_FOLDER_PATH\n} from './PathConstants';\nimport { MAX_CONCURRENCY } from './scripts/createLinks/utilities/constants';\n\n// (@types/npm-packlist is missing this API)\ndeclare module 'npm-packlist' {\n export class Walker {\n public readonly result: string[];\n public constructor(opts: { path: string });\n public on(event: 'done', callback: (result: string[]) => void): Walker;\n public on(event: 'error', callback: (error: Error) => void): Walker;\n public start(): void;\n }\n}\n\nexport const TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING: '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}' =\n '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';\n\n/**\n * Part of the extractor-matadata.json file format. Represents an extracted project.\n *\n * @public\n */\nexport interface IProjectInfoJson {\n /**\n * The name of the project as specified in its package.json file.\n */\n projectName: string;\n /**\n * This path is relative to the root of the extractor output folder\n */\n path: string;\n}\n\n/**\n * The extractor-metadata.json file format.\n *\n * @public\n */\nexport interface IExtractorMetadataJson {\n /**\n * The name of the main project the extraction was performed for.\n */\n mainProjectName: string;\n /**\n * A list of all projects that were extracted.\n */\n projects: IProjectInfoJson[];\n /**\n * A list of all links that are part of the extracted project.\n */\n links: ILinkInfo[];\n /**\n * A list of all files that are part of the extracted project.\n */\n files: string[];\n}\n\n/**\n * The extractor subspace configurations\n *\n * @public\n */\nexport interface IExtractorSubspace {\n /**\n * The subspace name\n */\n subspaceName: string;\n /**\n * The folder where the PNPM \"node_modules\" folder is located. This is used to resolve packages linked\n * to the PNPM virtual store.\n */\n pnpmInstallFolder?: string;\n /**\n * The pnpmfile configuration if using PNPM, otherwise undefined. The configuration will be used to\n * transform the package.json prior to extraction.\n */\n transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;\n}\n\ninterface IExtractorState {\n foldersToCopy: Set<string>;\n packageJsonByPath: Map<string, IPackageJson>;\n projectConfigurationsByPath: Map<string, IExtractorProjectConfiguration>;\n projectConfigurationsByName: Map<string, IExtractorProjectConfiguration>;\n dependencyConfigurationsByName: Map<string, IExtractorDependencyConfiguration[]>;\n symlinkAnalyzer: SymlinkAnalyzer;\n assetHandler: AssetHandler;\n}\n\n/**\n * The extractor configuration for individual projects.\n *\n * @public\n */\nexport interface IExtractorProjectConfiguration {\n /**\n * The name of the project.\n */\n projectName: string;\n /**\n * The absolute path to the project.\n */\n projectFolder: string;\n /**\n * A list of glob patterns to include when extracting this project. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, all paths will be included.\n */\n patternsToInclude?: string[];\n /**\n * A list of glob patterns to exclude when extracting this project. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, no paths will be excluded.\n */\n patternsToExclude?: string[];\n /**\n * The names of additional projects to include when extracting this project.\n */\n additionalProjectsToInclude?: string[];\n /**\n * The names of additional dependencies to include when extracting this project.\n */\n additionalDependenciesToInclude?: string[];\n /**\n * The names of additional dependencies to exclude when extracting this project.\n */\n dependenciesToExclude?: string[];\n}\n\n/**\n * The extractor configuration for individual dependencies.\n *\n * @public\n */\nexport interface IExtractorDependencyConfiguration {\n /**\n * The name of dependency\n */\n dependencyName: string;\n /**\n * The semver version range of dependency\n */\n dependencyVersionRange: string;\n /**\n * A list of glob patterns to exclude when extracting this dependency. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, no paths will be excluded.\n */\n patternsToExclude?: string[];\n /**\n * A list of glob patterns to include when extracting this dependency. If a path is\n * matched by both \"patternsToInclude\" and \"patternsToExclude\", the path will be\n * excluded. If undefined, all paths will be included.\n */\n patternsToInclude?: string[];\n}\n\n/**\n * The mode to use for link creation.\n *\n * @public\n */\nexport type LinkCreationMode = 'default' | 'script' | 'none';\n\n/**\n * Options that can be provided to the extractor.\n *\n * @public\n */\nexport interface IExtractorOptions {\n /**\n * A terminal to log extraction progress.\n */\n terminal: ITerminal;\n\n /**\n * The main project to include in the extraction operation.\n */\n mainProjectName: string;\n\n /**\n * The source folder that copying originates from. Generally it is the repo root folder.\n */\n sourceRootFolder: string;\n\n /**\n * The target folder for the extraction.\n */\n targetRootFolder: string;\n\n /**\n * Whether to overwrite the target folder if it already exists.\n */\n overwriteExisting: boolean;\n\n /**\n * The desired path to be used when archiving the target folder. Supported file extensions: .zip.\n */\n createArchiveFilePath?: string;\n\n /**\n * Whether to skip copying files to the extraction target directory, and only create an extraction\n * archive. This is only supported when {@link IExtractorOptions.linkCreation} is 'script' or 'none'.\n */\n createArchiveOnly?: boolean;\n\n /**\n * The pnpmfile configuration if using PNPM, otherwise `undefined`. The configuration will be used to\n * transform the package.json prior to extraction.\n *\n * @remarks\n * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure\n * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches\n * cannot be combined.\n */\n transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;\n\n /**\n * If dependencies from the \"devDependencies\" package.json field should be included in the extraction.\n */\n includeDevDependencies?: boolean;\n\n /**\n * If files ignored by the .npmignore file should be included in the extraction.\n */\n includeNpmIgnoreFiles?: boolean;\n\n /**\n * The folder where the PNPM \"node_modules\" folder is located. This is used to resolve packages linked\n * to the PNPM virtual store.\n *\n * @remarks\n * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure\n * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches\n * cannot be combined.\n */\n pnpmInstallFolder?: string;\n\n /**\n * The link creation mode to use.\n * \"default\": Create the links while copying the files; this is the default behavior. Use this setting\n * if your file copy tool can handle links correctly.\n * \"script\": A Node.js script called create-links.js will be written to the target folder. Use this setting\n * to create links on the server machine, after the files have been uploaded.\n * \"none\": Do nothing; some other tool may create the links later, based on the extractor-metadata.json file.\n */\n linkCreation?: LinkCreationMode;\n\n /**\n * The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation}\n * is 'script'.\n */\n linkCreationScriptPath?: string;\n\n /**\n * An additional folder containing files which will be copied into the root of the extraction.\n */\n folderToCopy?: string;\n\n /**\n * Configurations for individual projects, keyed by the project path relative to the sourceRootFolder.\n */\n projectConfigurations: IExtractorProjectConfiguration[];\n\n /**\n * Configurations for individual dependencies.\n */\n dependencyConfigurations?: IExtractorDependencyConfiguration[];\n\n /**\n * When using Rush subspaces, this setting can be used to provide configuration information for each\n * individual subspace.\n *\n * @remarks\n * To avoid confusion, if this setting is used, then the {@link IExtractorOptions.transformPackageJson} and\n * {@link IExtractorOptions.pnpmInstallFolder} settings must not be used.\n */\n subspaces?: IExtractorSubspace[];\n}\n\n/**\n * Manages the business logic for the \"rush deploy\" command.\n *\n * @public\n */\nexport class PackageExtractor {\n /**\n * Get a list of files that would be included in a package created from the provided package root path.\n *\n * @beta\n */\n public static async getPackageIncludedFilesAsync(packageRootPath: string): Promise<string[]> {\n // Use npm-packlist to filter the files. Using the Walker class (instead of the default API) ensures\n // that \"bundledDependencies\" are not included.\n const walkerPromise: Promise<string[]> = new Promise<string[]>(\n (resolve: (result: string[]) => void, reject: (error: Error) => void) => {\n const walker: npmPacklist.Walker = new npmPacklist.Walker({\n path: packageRootPath\n });\n walker.on('done', resolve).on('error', reject).start();\n }\n );\n const npmPackFiles: string[] = await walkerPromise;\n return npmPackFiles;\n }\n\n /**\n * Extract a package using the provided options\n */\n public async extractAsync(options: IExtractorOptions): Promise<void> {\n options = PackageExtractor._normalizeOptions(options);\n const {\n terminal,\n projectConfigurations,\n sourceRootFolder,\n targetRootFolder,\n mainProjectName,\n overwriteExisting,\n dependencyConfigurations,\n linkCreation\n } = options;\n\n terminal.writeLine(Colorize.cyan(`Extracting to target folder: ${targetRootFolder}`));\n terminal.writeLine(Colorize.cyan(`Main project for extraction: ${mainProjectName}`));\n\n await FileSystem.ensureFolderAsync(targetRootFolder);\n const existingExtraction: boolean =\n (await FileSystem.readFolderItemNamesAsync(targetRootFolder)).length > 0;\n if (existingExtraction) {\n if (!overwriteExisting) {\n throw new Error('The extraction target folder is not empty. Overwrite must be explicitly requested');\n }\n terminal.writeLine('Deleting target folder contents...');\n terminal.writeLine('');\n await FileSystem.ensureEmptyFolderAsync(targetRootFolder);\n }\n\n // Create a new state for each run\n const symlinkAnalyzer: SymlinkAnalyzer = new SymlinkAnalyzer({\n requiredSourceParentPath: sourceRootFolder\n });\n const state: IExtractorState = {\n symlinkAnalyzer,\n assetHandler: new AssetHandler({ ...options, symlinkAnalyzer }),\n foldersToCopy: new Set(),\n packageJsonByPath: new Map(),\n projectConfigurationsByName: new Map(projectConfigurations.map((p) => [p.projectName, p])),\n projectConfigurationsByPath: new Map(projectConfigurations.map((p) => [p.projectFolder, p])),\n dependencyConfigurationsByName: new Map()\n };\n\n // set state dependencyConfigurationsByName\n for (const dependencyConfiguration of dependencyConfigurations || []) {\n const { dependencyName } = dependencyConfiguration;\n let existingDependencyConfigurations: IExtractorDependencyConfiguration[] | undefined =\n state.dependencyConfigurationsByName.get(dependencyName);\n if (!existingDependencyConfigurations) {\n existingDependencyConfigurations = [];\n state.dependencyConfigurationsByName.set(dependencyName, existingDependencyConfigurations);\n }\n existingDependencyConfigurations.push(dependencyConfiguration);\n }\n\n await this._performExtractionAsync(options, state);\n await state.assetHandler.finalizeAsync({\n onAfterExtractSymlinksAsync: async () => {\n // We need the symlinks to be created before attempting to create the bin links, since it requires\n // the node_modules folder to be realized. While we're here, we may as well perform some specific\n // link creation tasks and write the extractor-metadata.json file before the asset handler finalizes.\n if (linkCreation === 'default') {\n await this._makeBinLinksAsync(options, state);\n } else if (linkCreation === 'script') {\n await this._writeCreateLinksScriptAsync(options, state);\n }\n\n terminal.writeLine('Creating extractor-metadata.json');\n await this._writeExtractorMetadataAsync(options, state);\n }\n });\n }\n\n private static _normalizeOptions(options: IExtractorOptions): IExtractorOptions {\n if (options.subspaces) {\n if (options.pnpmInstallFolder !== undefined) {\n throw new Error(\n 'IExtractorOptions.pnpmInstallFolder cannot be combined with IExtractorOptions.subspaces'\n );\n }\n if (options.transformPackageJson !== undefined) {\n throw new Error(\n 'IExtractorOptions.transformPackageJson cannot be combined with IExtractorOptions.subspaces'\n );\n }\n return options;\n }\n\n const normalizedOptions: IExtractorOptions = { ...options };\n delete normalizedOptions.pnpmInstallFolder;\n delete normalizedOptions.transformPackageJson;\n\n normalizedOptions.subspaces = [\n {\n subspaceName: 'default',\n pnpmInstallFolder: options.pnpmInstallFolder,\n transformPackageJson: options.transformPackageJson\n }\n ];\n\n return normalizedOptions;\n }\n\n private async _performExtractionAsync(options: IExtractorOptions, state: IExtractorState): Promise<void> {\n const {\n terminal,\n mainProjectName,\n sourceRootFolder,\n targetRootFolder,\n folderToCopy: additionalFolderToCopy,\n createArchiveOnly\n } = options;\n const { projectConfigurationsByName, foldersToCopy } = state;\n\n const mainProjectConfiguration: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByName.get(mainProjectName);\n if (!mainProjectConfiguration) {\n throw new Error(`Main project \"${mainProjectName}\" was not found in the list of projects`);\n }\n\n // Calculate the set with additionalProjectsToInclude\n const includedProjectsSet: Set<IExtractorProjectConfiguration> = new Set([mainProjectConfiguration]);\n for (const { additionalProjectsToInclude } of includedProjectsSet) {\n if (additionalProjectsToInclude) {\n for (const additionalProjectNameToInclude of additionalProjectsToInclude) {\n const additionalProjectToInclude: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByName.get(additionalProjectNameToInclude);\n if (!additionalProjectToInclude) {\n throw new Error(\n `Project \"${additionalProjectNameToInclude}\" was not found in the list of projects.`\n );\n }\n includedProjectsSet.add(additionalProjectToInclude);\n }\n }\n }\n\n for (const { projectName, projectFolder } of includedProjectsSet) {\n terminal.writeLine(Colorize.cyan(`Analyzing project: ${projectName}`));\n await this._collectFoldersAsync(projectFolder, options, state);\n }\n\n if (!createArchiveOnly) {\n terminal.writeLine(`Copying folders to target folder \"${targetRootFolder}\"`);\n }\n await Async.forEachAsync(\n foldersToCopy,\n async (folderToCopy: string) => {\n await this._extractFolderAsync(folderToCopy, options, state);\n },\n {\n concurrency: MAX_CONCURRENCY\n }\n );\n\n if (additionalFolderToCopy) {\n // Copy the additional folder directly into the root of the target folder by setting the sourceRootFolder\n // to the root of the folderToCopy\n const additionalFolderPath: string = path.resolve(sourceRootFolder, additionalFolderToCopy);\n const additionalFolderExtractorOptions: IExtractorOptions = {\n ...options,\n sourceRootFolder: additionalFolderPath,\n targetRootFolder\n };\n await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state);\n }\n }\n\n /**\n * Recursively crawl the node_modules dependencies and collect the result in IExtractorState.foldersToCopy.\n */\n private async _collectFoldersAsync(\n packageJsonFolder: string,\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { terminal, subspaces } = options;\n const { projectConfigurationsByPath } = state;\n\n const packageJsonFolderPathQueue: AsyncQueue<string> = new AsyncQueue([packageJsonFolder]);\n\n await Async.forEachAsync(\n packageJsonFolderPathQueue,\n async ([packageJsonFolderPath, callback]: [string, () => void]) => {\n const packageJsonRealFolderPath: string = await FileSystem.getRealPathAsync(packageJsonFolderPath);\n if (state.foldersToCopy.has(packageJsonRealFolderPath)) {\n // we've already seen this folder\n callback();\n return;\n }\n state.foldersToCopy.add(packageJsonRealFolderPath);\n\n const originalPackageJson: IPackageJson = await JsonFile.loadAsync(\n path.join(packageJsonRealFolderPath, 'package.json')\n );\n\n const targetSubspace: IExtractorSubspace | undefined = subspaces?.find(\n (subspace) =>\n subspace.pnpmInstallFolder && Path.isUnder(packageJsonFolderPath, subspace.pnpmInstallFolder)\n );\n\n // Transform packageJson using the provided transformer, if requested\n const packageJson: IPackageJson =\n targetSubspace?.transformPackageJson?.(originalPackageJson) ?? originalPackageJson;\n\n state.packageJsonByPath.set(packageJsonRealFolderPath, packageJson);\n // Union of keys from regular dependencies, peerDependencies, optionalDependencies\n // (and possibly devDependencies if includeDevDependencies=true)\n const dependencyNamesToProcess: Set<string> = new Set<string>();\n\n // Just the keys from optionalDependencies and peerDependencies\n const optionalDependencyNames: Set<string> = new Set<string>();\n\n for (const name of Object.keys(packageJson.dependencies || {})) {\n dependencyNamesToProcess.add(name);\n }\n for (const name of Object.keys(packageJson.peerDependencies || {})) {\n dependencyNamesToProcess.add(name);\n optionalDependencyNames.add(name); // consider peers optional, since they are so frequently broken\n }\n for (const name of Object.keys(packageJson.optionalDependencies || {})) {\n dependencyNamesToProcess.add(name);\n optionalDependencyNames.add(name);\n }\n\n // Check to see if this is a local project\n const projectConfiguration: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByPath.get(packageJsonRealFolderPath);\n\n if (projectConfiguration) {\n if (options.includeDevDependencies) {\n for (const name of Object.keys(packageJson.devDependencies || {})) {\n dependencyNamesToProcess.add(name);\n }\n }\n\n this._applyDependencyFilters(\n terminal,\n dependencyNamesToProcess,\n projectConfiguration.additionalDependenciesToInclude,\n projectConfiguration.dependenciesToExclude\n );\n }\n\n for (const dependencyPackageName of dependencyNamesToProcess) {\n try {\n const dependencyPackageFolderPath: string = await Import.resolvePackageAsync({\n packageName: dependencyPackageName,\n baseFolderPath: packageJsonRealFolderPath,\n getRealPathAsync: async (filePath: string) => {\n try {\n return (await state.symlinkAnalyzer.analyzePathAsync({ inputPath: filePath })).nodePath;\n } catch (error: unknown) {\n if (FileSystem.isFileDoesNotExistError(error as Error)) {\n return filePath;\n }\n throw error;\n }\n }\n });\n packageJsonFolderPathQueue.push(dependencyPackageFolderPath);\n } catch (resolveErr) {\n if (optionalDependencyNames.has(dependencyPackageName)) {\n // Ignore missing optional dependency\n continue;\n }\n throw resolveErr;\n }\n }\n\n // Replicate the links to the virtual store. Note that if the package has not been hoisted by\n // PNPM, the package will not be resolvable from here.\n // Only apply this logic for packages that were actually installed under the common/temp folder.\n const realPnpmInstallFolder: string | undefined = targetSubspace?.pnpmInstallFolder;\n if (realPnpmInstallFolder && Path.isUnder(packageJsonFolderPath, realPnpmInstallFolder)) {\n try {\n // The PNPM virtual store links are created in this folder. We will resolve the current package\n // from that location and collect any additional links encountered along the way.\n // TODO: This can be configured via NPMRC. We should support that.\n const pnpmDotFolderPath: string = path.join(realPnpmInstallFolder, 'node_modules', '.pnpm');\n\n // TODO: Investigate how package aliases are handled by PNPM in this case. For example:\n //\n // \"dependencies\": {\n // \"alias-name\": \"npm:real-name@^1.2.3\"\n // }\n const dependencyPackageFolderPath: string = await Import.resolvePackageAsync({\n packageName: packageJson.name,\n baseFolderPath: pnpmDotFolderPath,\n getRealPathAsync: async (filePath: string) => {\n try {\n return (await state.symlinkAnalyzer.analyzePathAsync({ inputPath: filePath })).nodePath;\n } catch (error: unknown) {\n if (FileSystem.isFileDoesNotExistError(error as Error)) {\n return filePath;\n }\n throw error;\n }\n }\n });\n packageJsonFolderPathQueue.push(dependencyPackageFolderPath);\n } catch (resolveErr) {\n // The virtual store link isn't guaranteed to exist, so ignore if it's missing\n // NOTE: If you encounter this warning a lot, please report it to the Rush maintainers.\n // eslint-disable-next-line no-console\n console.log('Ignoring missing PNPM virtual store link for ' + packageJsonFolderPath);\n }\n }\n\n callback();\n },\n {\n concurrency: MAX_CONCURRENCY\n }\n );\n }\n\n private _applyDependencyFilters(\n terminal: ITerminal,\n allDependencyNames: Set<string>,\n additionalDependenciesToInclude: string[] = [],\n dependenciesToExclude: string[] = []\n ): Set<string> {\n // Track packages that got added/removed for reporting purposes\n const extraIncludedPackageNames: string[] = [];\n const extraExcludedPackageNames: string[] = [];\n\n for (const patternWithStar of dependenciesToExclude) {\n for (const dependency of allDependencyNames) {\n if (matchesWithStar(patternWithStar, dependency)) {\n if (allDependencyNames.delete(dependency)) {\n extraExcludedPackageNames.push(dependency);\n }\n }\n }\n }\n\n for (const dependencyToInclude of additionalDependenciesToInclude) {\n if (!allDependencyNames.has(dependencyToInclude)) {\n allDependencyNames.add(dependencyToInclude);\n extraIncludedPackageNames.push(dependencyToInclude);\n }\n }\n\n if (extraIncludedPackageNames.length > 0) {\n extraIncludedPackageNames.sort();\n terminal.writeLine(`Extra dependencies included by settings: ${extraIncludedPackageNames.join(', ')}`);\n }\n\n if (extraExcludedPackageNames.length > 0) {\n extraExcludedPackageNames.sort();\n terminal.writeLine(`Extra dependencies excluded by settings: ${extraExcludedPackageNames.join(', ')}`);\n }\n\n return allDependencyNames;\n }\n\n /**\n * Copy one package folder to the extractor target folder.\n */\n private async _extractFolderAsync(\n sourceFolderPath: string,\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { includeNpmIgnoreFiles } = options;\n const { projectConfigurationsByPath, packageJsonByPath, dependencyConfigurationsByName, assetHandler } =\n state;\n let useNpmIgnoreFilter: boolean = false;\n\n const sourceFolderRealPath: string = await FileSystem.getRealPathAsync(sourceFolderPath);\n const sourceProjectConfiguration: IExtractorProjectConfiguration | undefined =\n projectConfigurationsByPath.get(sourceFolderRealPath);\n\n const packagesJson: IPackageJson | undefined = packageJsonByPath.get(sourceFolderRealPath);\n // As this function will be used to copy folder for both project inside monorepo and third party\n // dependencies insides node_modules. Third party dependencies won't have project configurations\n const isLocalProject: boolean = !!sourceProjectConfiguration;\n\n // Function to filter files inside local project or third party dependencies.\n const isFileExcluded = (filePath: string): boolean => {\n // Encapsulate exclude logic into a function, so it can be reused.\n const excludeFileByPatterns = (\n patternsToInclude: string[] | undefined,\n patternsToExclude: string[] | undefined\n ): boolean => {\n let includeFilters: IMinimatch[] | undefined;\n let excludeFilters: IMinimatch[] | undefined;\n if (patternsToInclude?.length) {\n includeFilters = patternsToInclude?.map((p) => new Minimatch(p, { dot: true }));\n }\n if (patternsToExclude?.length) {\n excludeFilters = patternsToExclude?.map((p) => new Minimatch(p, { dot: true }));\n }\n // If there are no filters, then we can't exclude anything.\n if (!includeFilters && !excludeFilters) {\n return false;\n }\n\n const isIncluded: boolean = !includeFilters || includeFilters.some((m) => m.match(filePath));\n\n // If the file is not included, then we don't need to check the excludeFilter. If it is included\n // and there is no exclude filter, then we know that the file is not excluded. If it is included\n // and there is an exclude filter, then we need to check for a match.\n return !isIncluded || !!excludeFilters?.some((m) => m.match(filePath));\n };\n\n if (isLocalProject) {\n return excludeFileByPatterns(\n sourceProjectConfiguration?.patternsToInclude,\n sourceProjectConfiguration?.patternsToExclude\n );\n } else {\n if (!packagesJson) {\n return false;\n }\n const dependenciesConfigurations: IExtractorDependencyConfiguration[] | undefined =\n dependencyConfigurationsByName.get(packagesJson.name);\n if (!dependenciesConfigurations) {\n return false;\n }\n const matchedDependenciesConfigurations: IExtractorDependencyConfiguration[] =\n dependenciesConfigurations.filter((d) =>\n semver.satisfies(packagesJson.version, d.dependencyVersionRange)\n );\n return matchedDependenciesConfigurations.some((d) =>\n excludeFileByPatterns(d.patternsToInclude, d.patternsToExclude)\n );\n }\n };\n\n if (sourceProjectConfiguration && !includeNpmIgnoreFiles) {\n // Only use the npmignore filter if the project configuration explicitly asks for it\n useNpmIgnoreFilter = true;\n }\n\n const targetFolderPath: string = remapSourcePathForTargetFolder({\n ...options,\n sourcePath: sourceFolderPath\n });\n if (useNpmIgnoreFilter) {\n const npmPackFiles: string[] = await PackageExtractor.getPackageIncludedFilesAsync(sourceFolderPath);\n await Async.forEachAsync(\n npmPackFiles,\n async (npmPackFile: string) => {\n // In issue https://github.com/microsoft/rushstack/issues/2121 we found that npm-packlist sometimes returns\n // duplicate file paths, for example:\n //\n // 'dist//index.js'\n // 'dist/index.js'\n //\n\n // Filter out files that are excluded by the project configuration or dependency configuration.\n if (isFileExcluded(npmPackFile)) {\n return;\n }\n\n const sourceFilePath: string = path.resolve(sourceFolderPath, npmPackFile);\n const { kind, linkStats: sourceFileStats } = await state.symlinkAnalyzer.analyzePathAsync({\n inputPath: sourceFilePath\n });\n if (kind === 'file') {\n const targetFilePath: string = path.resolve(targetFolderPath, npmPackFile);\n await assetHandler.includeAssetAsync({\n sourceFilePath,\n sourceFileStats,\n targetFilePath\n });\n }\n },\n {\n concurrency: MAX_CONCURRENCY\n }\n );\n } else {\n // use a simplistic \"ignore\" ruleset to filter the files\n const ignoreFilter: Ignore = ignore();\n ignoreFilter.add([\n // The top-level node_modules folder is always excluded\n '/node_modules',\n // Also exclude well-known folders that can contribute a lot of unnecessary files\n '**/.git',\n '**/.svn',\n '**/.hg',\n '**/.DS_Store'\n ]);\n\n // Do a breadth-first search of the source folder, copying each file to the target folder\n const queue: AsyncQueue<string> = new AsyncQueue([sourceFolderPath]);\n await Async.forEachAsync(\n queue,\n async ([sourcePath, callback]: [string, () => void]) => {\n const relativeSourcePath: string = path.relative(sourceFolderPath, sourcePath);\n if (relativeSourcePath !== '' && ignoreFilter.ignores(relativeSourcePath)) {\n callback();\n return;\n }\n\n const sourcePathNode: PathNode | undefined = await state.symlinkAnalyzer.analyzePathAsync({\n inputPath: sourcePath,\n // Treat all links to external paths as if they are files for this scenario. In the future, we may\n // want to explore the target of the external link to see if all files within the target are\n // excluded, and throw if they are not.\n shouldIgnoreExternalLink: (linkSourcePath: string) => {\n // Ignore the provided linkSourcePath since it may not be the first link in the chain. Instead,\n // we will consider only the relativeSourcePath, since that would be our entrypoint into the\n // link chain.\n return isFileExcluded(relativeSourcePath);\n }\n });\n\n if (sourcePathNode === undefined) {\n // The target was a symlink that is excluded. We don't need to do anything.\n callback();\n return;\n } else if (sourcePathNode.kind === 'file') {\n // Only ignore files and not folders to ensure that we traverse the contents of all folders. This is\n // done so that we can match against subfolder patterns, ex. \"src/subfolder/**/*\"\n if (relativeSourcePath !== '' && isFileExcluded(relativeSourcePath)) {\n callback();\n return;\n }\n\n const targetFilePath: string = path.resolve(targetFolderPath, relativeSourcePath);\n await assetHandler.includeAssetAsync({\n sourceFilePath: sourcePath,\n sourceFileStats: sourcePathNode.linkStats,\n targetFilePath\n });\n } else if (sourcePathNode.kind === 'folder') {\n const children: string[] = await FileSystem.readFolderItemNamesAsync(sourcePath);\n for (const child of children) {\n queue.push(path.join(sourcePath, child));\n }\n }\n\n callback();\n },\n {\n concurrency: MAX_CONCURRENCY\n }\n );\n }\n }\n\n /**\n * Write the common/deploy/deploy-metadata.json file.\n */\n private async _writeExtractorMetadataAsync(\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { mainProjectName, sourceRootFolder, targetRootFolder, linkCreation, linkCreationScriptPath } =\n options;\n const { projectConfigurationsByPath } = state;\n\n const extractorMetadataFolderPath: string =\n linkCreation === 'script' && linkCreationScriptPath\n ? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath))\n : targetRootFolder;\n const extractorMetadataFilePath: string = path.join(\n extractorMetadataFolderPath,\n EXTRACTOR_METADATA_FILENAME\n );\n const extractorMetadataJson: IExtractorMetadataJson = {\n mainProjectName,\n projects: [],\n links: [],\n files: []\n };\n\n for (const { projectFolder, projectName } of projectConfigurationsByPath.values()) {\n if (state.foldersToCopy.has(projectFolder)) {\n extractorMetadataJson.projects.push({\n projectName,\n path: remapPathForExtractorMetadata(sourceRootFolder, projectFolder)\n });\n }\n }\n\n // Remap the links to be relative to target folder\n for (const { kind, linkPath, targetPath } of state.symlinkAnalyzer.reportSymlinks()) {\n extractorMetadataJson.links.push({\n kind,\n linkPath: remapPathForExtractorMetadata(sourceRootFolder, linkPath),\n targetPath: remapPathForExtractorMetadata(sourceRootFolder, targetPath)\n });\n }\n\n for (const assetPath of state.assetHandler.assetPaths) {\n extractorMetadataJson.files.push(remapPathForExtractorMetadata(targetRootFolder, assetPath));\n }\n\n const extractorMetadataFileContent: string = JSON.stringify(extractorMetadataJson, undefined, 0);\n await state.assetHandler.includeAssetAsync({\n sourceFileContent: extractorMetadataFileContent,\n targetFilePath: extractorMetadataFilePath\n });\n }\n\n private async _makeBinLinksAsync(options: IExtractorOptions, state: IExtractorState): Promise<void> {\n const { terminal } = options;\n\n const extractedProjectFolderPaths: string[] = [];\n for (const folderPath of state.projectConfigurationsByPath.keys()) {\n if (state.foldersToCopy.has(folderPath)) {\n extractedProjectFolderPaths.push(\n remapSourcePathForTargetFolder({ ...options, sourcePath: folderPath })\n );\n }\n }\n\n const binFilePaths: string[] = await makeBinLinksAsync(terminal, extractedProjectFolderPaths);\n await Async.forEachAsync(\n binFilePaths,\n (targetFilePath: string) => state.assetHandler.includeAssetAsync({ targetFilePath }),\n {\n concurrency: MAX_CONCURRENCY\n }\n );\n }\n\n private async _writeCreateLinksScriptAsync(\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const { terminal, targetRootFolder, linkCreationScriptPath } = options;\n const { assetHandler } = state;\n\n terminal.writeLine(`Creating ${CREATE_LINKS_SCRIPT_FILENAME}`);\n const createLinksSourceFilePath: string = `${SCRIPTS_FOLDER_PATH}/${CREATE_LINKS_SCRIPT_FILENAME}`;\n const createLinksTargetFilePath: string = path.resolve(\n targetRootFolder,\n linkCreationScriptPath || CREATE_LINKS_SCRIPT_FILENAME\n );\n let createLinksScriptContent: string = await FileSystem.readFileAsync(createLinksSourceFilePath);\n createLinksScriptContent = createLinksScriptContent.replace(\n TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING,\n Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder))\n );\n await assetHandler.includeAssetAsync({\n sourceFileContent: createLinksScriptContent,\n targetFilePath: createLinksTargetFilePath\n });\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
- export declare const createLinksScriptFilename: 'create-links.js';
2
- export declare const scriptsFolderPath: string;
1
+ export declare const CREATE_LINKS_SCRIPT_FILENAME: 'create-links.js';
2
+ export declare const EXTRACTOR_METADATA_FILENAME: 'extractor-metadata.json';
3
+ export declare const SCRIPTS_FOLDER_PATH: string;
3
4
  //# sourceMappingURL=PathConstants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PathConstants.d.ts","sourceRoot":"","sources":["../src/PathConstants.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,yBAAyB,EAAE,iBAAqC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,EAAE,MAAyD,CAAC"}
1
+ {"version":3,"file":"PathConstants.d.ts","sourceRoot":"","sources":["../src/PathConstants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,EAAE,iBAAqC,CAAC;AAEjF,eAAO,MAAM,2BAA2B,EAAE,yBAAqD,CAAC;AAGhG,eAAO,MAAM,mBAAmB,EAAE,MAAyD,CAAC"}
@@ -2,9 +2,10 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.scriptsFolderPath = exports.createLinksScriptFilename = void 0;
5
+ exports.SCRIPTS_FOLDER_PATH = exports.EXTRACTOR_METADATA_FILENAME = exports.CREATE_LINKS_SCRIPT_FILENAME = void 0;
6
6
  const node_core_library_1 = require("@rushstack/node-core-library");
7
+ exports.CREATE_LINKS_SCRIPT_FILENAME = 'create-links.js';
8
+ exports.EXTRACTOR_METADATA_FILENAME = 'extractor-metadata.json';
7
9
  const packageExtractorFolderRootPath = node_core_library_1.PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname);
8
- exports.createLinksScriptFilename = 'create-links.js';
9
- exports.scriptsFolderPath = `${packageExtractorFolderRootPath}/dist/scripts`;
10
+ exports.SCRIPTS_FOLDER_PATH = `${packageExtractorFolderRootPath}/dist/scripts`;
10
11
  //# sourceMappingURL=PathConstants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PathConstants.js","sourceRoot":"","sources":["../src/PathConstants.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAiE;AAEjE,MAAM,8BAA8B,GAAW,qCAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAE,CAAC;AAChG,QAAA,yBAAyB,GAAsB,iBAAiB,CAAC;AACjE,QAAA,iBAAiB,GAAW,GAAG,8BAA8B,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { PackageJsonLookup } from '@rushstack/node-core-library';\n\nconst packageExtractorFolderRootPath: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;\nexport const createLinksScriptFilename: 'create-links.js' = 'create-links.js';\nexport const scriptsFolderPath: string = `${packageExtractorFolderRootPath}/dist/scripts`;\n"]}
1
+ {"version":3,"file":"PathConstants.js","sourceRoot":"","sources":["../src/PathConstants.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAiE;AAEpD,QAAA,4BAA4B,GAAsB,iBAAiB,CAAC;AAEpE,QAAA,2BAA2B,GAA8B,yBAAyB,CAAC;AAEhG,MAAM,8BAA8B,GAAW,qCAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAE,CAAC;AAChG,QAAA,mBAAmB,GAAW,GAAG,8BAA8B,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { PackageJsonLookup } from '@rushstack/node-core-library';\n\nexport const CREATE_LINKS_SCRIPT_FILENAME: 'create-links.js' = 'create-links.js';\n\nexport const EXTRACTOR_METADATA_FILENAME: 'extractor-metadata.json' = 'extractor-metadata.json';\n\nconst packageExtractorFolderRootPath: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;\nexport const SCRIPTS_FOLDER_PATH: string = `${packageExtractorFolderRootPath}/dist/scripts`;\n"]}
package/lib/Utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type ITerminal } from '@rushstack/terminal';
1
2
  export declare function matchesWithStar(patternWithStar: string, input: string): boolean;
2
3
  export interface IRemapPathForTargetFolder {
3
4
  sourcePath: string;
@@ -19,4 +20,11 @@ export declare function remapSourcePathForTargetFolder(options: IRemapPathForTar
19
20
  * Example output: "common/deploy/libraries/my-lib"
20
21
  */
21
22
  export declare function remapPathForExtractorMetadata(folderPath: string, filePath: string): string;
23
+ /**
24
+ * Creates the .bin files for the extracted projects and returns the paths to the created .bin files.
25
+ *
26
+ * @param terminal - The terminal to write to
27
+ * @param extractedProjectFolderPaths - The paths to the extracted projects
28
+ */
29
+ export declare function makeBinLinksAsync(terminal: ITerminal, extractedProjectFolderPaths: string[]): Promise<string[]>;
22
30
  //# sourceMappingURL=Utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAY/E;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAQzF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM1F"}
1
+ {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG/D,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAY/E;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAQzF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM1F;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,SAAS,EACnB,2BAA2B,EAAE,MAAM,EAAE,GACpC,OAAO,CAAC,MAAM,EAAE,CAAC,CAiCnB"}
package/lib/Utils.js CHANGED
@@ -5,9 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.remapPathForExtractorMetadata = exports.remapSourcePathForTargetFolder = exports.matchesWithStar = void 0;
8
+ exports.makeBinLinksAsync = exports.remapPathForExtractorMetadata = exports.remapSourcePathForTargetFolder = exports.matchesWithStar = void 0;
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
+ const link_bins_1 = __importDefault(require("@pnpm/link-bins"));
10
11
  const node_core_library_1 = require("@rushstack/node-core-library");
12
+ const terminal_1 = require("@rushstack/terminal");
13
+ const constants_1 = require("./scripts/createLinks/utilities/constants");
11
14
  function matchesWithStar(patternWithStar, input) {
12
15
  // Map "@types/*" --> "^\@types\/.*$"
13
16
  const pattern = '^' +
@@ -52,4 +55,32 @@ function remapPathForExtractorMetadata(folderPath, filePath) {
52
55
  return node_core_library_1.Path.convertToSlashes(relativePath);
53
56
  }
54
57
  exports.remapPathForExtractorMetadata = remapPathForExtractorMetadata;
58
+ /**
59
+ * Creates the .bin files for the extracted projects and returns the paths to the created .bin files.
60
+ *
61
+ * @param terminal - The terminal to write to
62
+ * @param extractedProjectFolderPaths - The paths to the extracted projects
63
+ */
64
+ async function makeBinLinksAsync(terminal, extractedProjectFolderPaths) {
65
+ const binFilePaths = [];
66
+ await node_core_library_1.Async.forEachAsync(extractedProjectFolderPaths, async (extractedProjectFolderPath) => {
67
+ const extractedProjectNodeModulesFolderPath = `${extractedProjectFolderPath}/node_modules`;
68
+ const extractedProjectBinFolderPath = `${extractedProjectNodeModulesFolderPath}/.bin`;
69
+ const linkedBinPackageNames = await (0, link_bins_1.default)(extractedProjectNodeModulesFolderPath, extractedProjectBinFolderPath, {
70
+ warn: (msg) => terminal.writeLine(terminal_1.Colorize.yellow(msg))
71
+ });
72
+ if (linkedBinPackageNames.length) {
73
+ const binFolderItems = await node_core_library_1.FileSystem.readFolderItemNamesAsync(extractedProjectBinFolderPath);
74
+ for (const binFolderItem of binFolderItems) {
75
+ const binFilePath = `${extractedProjectBinFolderPath}/${binFolderItem}`;
76
+ terminal.writeVerboseLine(`Created .bin file: ${binFilePath}`);
77
+ binFilePaths.push(binFilePath);
78
+ }
79
+ }
80
+ }, {
81
+ concurrency: constants_1.MAX_CONCURRENCY
82
+ });
83
+ return binFilePaths;
84
+ }
85
+ exports.makeBinLinksAsync = makeBinLinksAsync;
55
86
  //# sourceMappingURL=Utils.js.map
package/lib/Utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,0DAA6B;AAC7B,oEAA0D;AAE1D,SAAgB,eAAe,CAAC,eAAuB,EAAE,KAAa;IACpE,qCAAqC;IACrC,MAAM,OAAO,GACX,GAAG;QACH,eAAe;aACZ,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,wBAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAChC,IAAI,CAAC,IAAI,CAAC;QACb,GAAG,CAAC;IACN,gEAAgE;IAChE,MAAM,MAAM,GAAW,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAZD,0CAYC;AAQD;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAAC,OAAkC;IAC/E,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IACnE,MAAM,YAAY,GAAW,mBAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACzE,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,gBAAgB,UAAU,mBAAmB,gBAAgB,GAAG,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,0BAA0B,GAAW,mBAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IACrF,OAAO,0BAA0B,CAAC;AACpC,CAAC;AARD,wEAQC;AAED;;;;;GAKG;AACH,SAAgB,6BAA6B,CAAC,UAAkB,EAAE,QAAgB;IAChF,MAAM,YAAY,GAAW,mBAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACjE,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,SAAS,QAAQ,mBAAmB,UAAU,GAAG,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,wBAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAND,sEAMC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport path from 'node:path';\nimport { Path, Text } from '@rushstack/node-core-library';\n\nexport function matchesWithStar(patternWithStar: string, input: string): boolean {\n // Map \"@types/*\" --> \"^\\@types\\/.*$\"\n const pattern: string =\n '^' +\n patternWithStar\n .split('*')\n .map((x) => Text.escapeRegExp(x))\n .join('.*') +\n '$';\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp\n const regExp: RegExp = new RegExp(pattern);\n return regExp.test(input);\n}\n\nexport interface IRemapPathForTargetFolder {\n sourcePath: string;\n sourceRootFolder: string;\n targetRootFolder: string;\n}\n\n/**\n * Maps a file path under the provided {@link IRemapPathForTargetFolder.sourceRootFolder} to the provided\n * {@link IExtractorOptions.targetRootFolder}.\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"C:\\\\MyRepo\\\\common\\\\deploy\\\\libraries\\\\my-lib\"\n */\nexport function remapSourcePathForTargetFolder(options: IRemapPathForTargetFolder): string {\n const { sourcePath, sourceRootFolder, targetRootFolder } = options;\n const relativePath: string = path.relative(sourceRootFolder, sourcePath);\n if (relativePath.startsWith('..')) {\n throw new Error(`Source path \"${sourcePath}\" is not under \"${sourceRootFolder}\"`);\n }\n const absolutePathInTargetFolder: string = path.join(targetRootFolder, relativePath);\n return absolutePathInTargetFolder;\n}\n\n/**\n * Maps a file path under the provided folder path to the expected path format for the extractor metadata.\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"common/deploy/libraries/my-lib\"\n */\nexport function remapPathForExtractorMetadata(folderPath: string, filePath: string): string {\n const relativePath: string = path.relative(folderPath, filePath);\n if (relativePath.startsWith('..')) {\n throw new Error(`Path \"${filePath}\" is not under \"${folderPath}\"`);\n }\n return Path.convertToSlashes(relativePath);\n}\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,0DAA6B;AAC7B,gEAA2C;AAC3C,oEAA6E;AAC7E,kDAA+D;AAC/D,yEAA4E;AAE5E,SAAgB,eAAe,CAAC,eAAuB,EAAE,KAAa;IACpE,qCAAqC;IACrC,MAAM,OAAO,GACX,GAAG;QACH,eAAe;aACZ,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,wBAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAChC,IAAI,CAAC,IAAI,CAAC;QACb,GAAG,CAAC;IACN,gEAAgE;IAChE,MAAM,MAAM,GAAW,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAZD,0CAYC;AAQD;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAA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,GAAW,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAChE,CACF,CAAC;QAEF,IAAI,qBAAqB,CAAC,MAAM,EAAE,CAAC;YACjC,MAAM,cAAc,GAAa,MAAM,8BAAU,CAAC,wBAAwB,CACxE,6BAA6B,CAC9B,CAAC;YACF,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;gBAC3C,MAAM,WAAW,GAAW,GAAG,6BAA6B,IAAI,aAAa,EAAE,CAAC;gBAChF,QAAQ,CAAC,gBAAgB,CAAC,sBAAsB,WAAW,EAAE,CAAC,CAAC;gBAC/D,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC,EACD;QACE,WAAW,EAAE,2BAAe;KAC7B,CACF,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC;AApCD,8CAoCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport path from 'node:path';\nimport pnpmLinkBins from '@pnpm/link-bins';\nimport { Async, FileSystem, Path, Text } from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\nimport { MAX_CONCURRENCY } from './scripts/createLinks/utilities/constants';\n\nexport function matchesWithStar(patternWithStar: string, input: string): boolean {\n // Map \"@types/*\" --> \"^\\@types\\/.*$\"\n const pattern: string =\n '^' +\n patternWithStar\n .split('*')\n .map((x) => Text.escapeRegExp(x))\n .join('.*') +\n '$';\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp\n const regExp: RegExp = new RegExp(pattern);\n return regExp.test(input);\n}\n\nexport interface IRemapPathForTargetFolder {\n sourcePath: string;\n sourceRootFolder: string;\n targetRootFolder: string;\n}\n\n/**\n * Maps a file path under the provided {@link IRemapPathForTargetFolder.sourceRootFolder} to the provided\n * {@link IExtractorOptions.targetRootFolder}.\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"C:\\\\MyRepo\\\\common\\\\deploy\\\\libraries\\\\my-lib\"\n */\nexport function remapSourcePathForTargetFolder(options: IRemapPathForTargetFolder): string {\n const { sourcePath, sourceRootFolder, targetRootFolder } = options;\n const relativePath: string = path.relative(sourceRootFolder, sourcePath);\n if (relativePath.startsWith('..')) {\n throw new Error(`Source path \"${sourcePath}\" is not under \"${sourceRootFolder}\"`);\n }\n const absolutePathInTargetFolder: string = path.join(targetRootFolder, relativePath);\n return absolutePathInTargetFolder;\n}\n\n/**\n * Maps a file path under the provided folder path to the expected path format for the extractor metadata.\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"common/deploy/libraries/my-lib\"\n */\nexport function remapPathForExtractorMetadata(folderPath: string, filePath: string): string {\n const relativePath: string = path.relative(folderPath, filePath);\n if (relativePath.startsWith('..')) {\n throw new Error(`Path \"${filePath}\" is not under \"${folderPath}\"`);\n }\n return Path.convertToSlashes(relativePath);\n}\n\n/**\n * Creates the .bin files for the extracted projects and returns the paths to the created .bin files.\n *\n * @param terminal - The terminal to write to\n * @param extractedProjectFolderPaths - The paths to the extracted projects\n */\nexport async function makeBinLinksAsync(\n terminal: ITerminal,\n extractedProjectFolderPaths: string[]\n): Promise<string[]> {\n const binFilePaths: string[] = [];\n await Async.forEachAsync(\n extractedProjectFolderPaths,\n async (extractedProjectFolderPath: string) => {\n const extractedProjectNodeModulesFolderPath: string = `${extractedProjectFolderPath}/node_modules`;\n const extractedProjectBinFolderPath: string = `${extractedProjectNodeModulesFolderPath}/.bin`;\n\n const linkedBinPackageNames: string[] = await pnpmLinkBins(\n extractedProjectNodeModulesFolderPath,\n extractedProjectBinFolderPath,\n {\n warn: (msg: string) => terminal.writeLine(Colorize.yellow(msg))\n }\n );\n\n if (linkedBinPackageNames.length) {\n const binFolderItems: string[] = await FileSystem.readFolderItemNamesAsync(\n extractedProjectBinFolderPath\n );\n for (const binFolderItem of binFolderItems) {\n const binFilePath: string = `${extractedProjectBinFolderPath}/${binFolderItem}`;\n terminal.writeVerboseLine(`Created .bin file: ${binFilePath}`);\n binFilePaths.push(binFilePath);\n }\n }\n },\n {\n concurrency: MAX_CONCURRENCY\n }\n );\n\n return binFilePaths;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { CommandLineParser } from '@rushstack/ts-command-line';
2
+ import type { ITerminal } from '@rushstack/terminal';
3
+ export declare class CreateLinksCommandLineParser extends CommandLineParser {
4
+ private readonly _terminal;
5
+ constructor(terminal: ITerminal);
6
+ protected onExecute(): Promise<void>;
7
+ }
8
+ //# sourceMappingURL=CreateLinksCommandLineParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateLinksCommandLineParser.d.ts","sourceRoot":"","sources":["../../../../src/scripts/createLinks/cli/CreateLinksCommandLineParser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,qBAAa,4BAA6B,SAAQ,iBAAiB;IACjE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAEnB,QAAQ,EAAE,SAAS;cAYtB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAc3C"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.CreateLinksCommandLineParser = void 0;
6
+ const ts_command_line_1 = require("@rushstack/ts-command-line");
7
+ const node_core_library_1 = require("@rushstack/node-core-library");
8
+ const CreateLinksAction_1 = require("./actions/CreateLinksAction");
9
+ const RemoveLinksAction_1 = require("./actions/RemoveLinksAction");
10
+ class CreateLinksCommandLineParser extends ts_command_line_1.CommandLineParser {
11
+ constructor(terminal) {
12
+ super({
13
+ toolFilename: 'create-links',
14
+ toolDescription: 'Create or remove symlinks for the extracted packages'
15
+ });
16
+ this._terminal = terminal;
17
+ this.addAction(new CreateLinksAction_1.CreateLinksAction(this._terminal));
18
+ this.addAction(new RemoveLinksAction_1.RemoveLinksAction(this._terminal));
19
+ }
20
+ async onExecute() {
21
+ // override
22
+ process.exitCode = 1;
23
+ try {
24
+ await super.onExecute();
25
+ process.exitCode = 0;
26
+ }
27
+ catch (error) {
28
+ if (!(error instanceof node_core_library_1.AlreadyReportedError)) {
29
+ this._terminal.writeErrorLine();
30
+ this._terminal.writeErrorLine('ERROR: ' + error.message.trim());
31
+ }
32
+ }
33
+ }
34
+ }
35
+ exports.CreateLinksCommandLineParser = CreateLinksCommandLineParser;
36
+ //# sourceMappingURL=CreateLinksCommandLineParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateLinksCommandLineParser.js","sourceRoot":"","sources":["../../../../src/scripts/createLinks/cli/CreateLinksCommandLineParser.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAA+D;AAC/D,oEAAoE;AAGpE,mEAAgE;AAChE,mEAAgE;AAEhE,MAAa,4BAA6B,SAAQ,mCAAiB;IAGjE,YAAmB,QAAmB;QACpC,KAAK,CAAC;YACJ,YAAY,EAAE,cAAc;YAC5B,eAAe,EAAE,sDAAsD;SACxE,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,SAAS,CAAC,IAAI,qCAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,CAAC,IAAI,qCAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QAErB,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC;YACxB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,KAAK,YAAY,wCAAoB,CAAC,EAAE,CAAC;gBAC7C,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;gBAChC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA7BD,oEA6BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { CommandLineParser } from '@rushstack/ts-command-line';\nimport { AlreadyReportedError } from '@rushstack/node-core-library';\nimport type { ITerminal } from '@rushstack/terminal';\n\nimport { CreateLinksAction } from './actions/CreateLinksAction';\nimport { RemoveLinksAction } from './actions/RemoveLinksAction';\n\nexport class CreateLinksCommandLineParser extends CommandLineParser {\n private readonly _terminal: ITerminal;\n\n public constructor(terminal: ITerminal) {\n super({\n toolFilename: 'create-links',\n toolDescription: 'Create or remove symlinks for the extracted packages'\n });\n\n this._terminal = terminal;\n\n this.addAction(new CreateLinksAction(this._terminal));\n this.addAction(new RemoveLinksAction(this._terminal));\n }\n\n protected async onExecute(): Promise<void> {\n // override\n process.exitCode = 1;\n\n try {\n await super.onExecute();\n process.exitCode = 0;\n } catch (error) {\n if (!(error instanceof AlreadyReportedError)) {\n this._terminal.writeErrorLine();\n this._terminal.writeErrorLine('ERROR: ' + error.message.trim());\n }\n }\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { ITerminal } from '@rushstack/terminal';
2
+ import { CommandLineAction } from '@rushstack/ts-command-line';
3
+ export declare class CreateLinksAction extends CommandLineAction {
4
+ private _terminal;
5
+ private _realizeFilesParameter;
6
+ private _linkBinsParameter;
7
+ constructor(terminal: ITerminal);
8
+ protected onExecute(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=CreateLinksAction.d.ts.map