@rushstack/package-extractor 0.12.15 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"PackageExtractor.js","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAE7C,OAAO,EACL,KAAK,EACL,UAAU,EACV,IAAI,EACJ,UAAU,EACV,MAAM,EACN,QAAQ,EAET,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAiC,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,6BAA6B,EAC7B,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAa5E,MAAM,CAAC,MAAM,gDAAgD,GAC3D,oCAAoC,CAAC;AAyQvC;;;;GAIG;AACH,MAAM,OAAO,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,IA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BAAiB,CAAC,EAAE,cAAc,EAAE,CAAC,EACpF;YACE,WAAW,EAAE,eAAe;SAC7B,CACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,4BAA4B,CACxC,OAA0B,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,4BAA4B,EAAE,CAAC,CAAC;QAC/D,MAAM,yBAAyB,GAAW,GAAG,mBAAmB,IAAI,4BAA4B,EAAE,CAAC;QACnG,MAAM,yBAAyB,GAAW,IAAI,CAAC,OAAO,CACpD,gBAAgB,EAChB,sBAAsB,IAAI,4BAA4B,CACvD,CAAC;QACF,IAAI,wBAAwB,GAAW,MAAM,UAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACjG,wBAAwB,GAAG,wBAAwB,CAAC,OAAO,CACzD,gDAAgD,EAChD,IAAI,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","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 'node:path';\n\nimport { Minimatch } from 'minimatch';\nimport semver from 'semver';\nimport npmPacklist from 'npm-packlist';\nimport ignore, { type Ignore } from 'ignore';\n\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\n // npm-packlist@v5 (uses glob@v8) returns \"./dist/index.js\" for pattern: \"./dist/index.js\",\n // whereas npm-packlist@v2 (uses glob@v7) returns an empty array.\n // This may cause duplicate files in the result list, leading to copying conflicts\n // in the AssetHandler.ts includeAssetAsync method.\n //\n // Temporary fix: normalize the file paths to be relative to the package root, and remove duplicates.\n //\n // TODO: A better long-term fix is to replace \"npm-packlist\" with \"@pnpm/fs.packlist\", notes here:\n // https://github.com/microsoft/rushstack/pull/5720/changes#r2984873283\n const normalizedFiles: string[] = Array.from(\n new Set(npmPackFiles.map((file) => path.posix.normalize(file)))\n );\n return normalizedFiles;\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: Minimatch[] | undefined;\n let excludeFilters: Minimatch[] | 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
+ {"version":3,"file":"PackageExtractor.js","sourceRoot":"","sources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,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,cAAc,EAAE,CAAC,EACpF;YACE,WAAW,EAAE,eAAe;SAC7B,CACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,4BAA4B,CACxC,OAA0B,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,4BAA4B,EAAE,CAAC,CAAC;QAC/D,MAAM,yBAAyB,GAAW,GAAG,mBAAmB,IAAI,4BAA4B,EAAE,CAAC;QACnG,MAAM,yBAAyB,GAAW,IAAI,CAAC,OAAO,CACpD,gBAAgB,EAChB,sBAAsB,IAAI,4BAA4B,CACvD,CAAC;QACF,IAAI,wBAAwB,GAAW,MAAM,UAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACjG,wBAAwB,GAAG,wBAAwB,CAAC,OAAO,CACzD,gDAAgD,EAChD,IAAI,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","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 'node:path';\n\nimport { Minimatch } from 'minimatch';\nimport semver from 'semver';\nimport npmPacklist from 'npm-packlist';\nimport ignore, { type Ignore } from 'ignore';\n\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 * Whether PNPM hoisting is enabled for this subspace. When set to `false`,\n * the extractor will skip looking for hoisted packages in the PNPM virtual store, since no\n * hoisting symlinks will exist. Default is `true`.\n */\n pnpmNodeModulesHoistingEnabled?: boolean;\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\n // npm-packlist@v5 (uses glob@v8) returns \"./dist/index.js\" for pattern: \"./dist/index.js\",\n // whereas npm-packlist@v2 (uses glob@v7) returns an empty array.\n // This may cause duplicate files in the result list, leading to copying conflicts\n // in the AssetHandler.ts includeAssetAsync method.\n //\n // Temporary fix: normalize the file paths to be relative to the package root, and remove duplicates.\n //\n // TODO: A better long-term fix is to replace \"npm-packlist\" with \"@pnpm/fs.packlist\", notes here:\n // https://github.com/microsoft/rushstack/pull/5720/changes#r2984873283\n const normalizedFiles: string[] = Array.from(\n new Set(npmPackFiles.map((file) => path.posix.normalize(file)))\n );\n return normalizedFiles;\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 const startingFolders: string[] = [];\n for (const { projectName, projectFolder } of includedProjectsSet) {\n terminal.writeLine(Colorize.cyan(`Analyzing project: ${projectName}`));\n startingFolders.push(projectFolder);\n }\n await this._collectFoldersAsync(startingFolders, options, state);\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 packageJsonFolders: 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(packageJsonFolders);\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 // and only when hoisting is enabled for the subspace.\n const realPnpmInstallFolder: string | undefined = targetSubspace?.pnpmInstallFolder;\n const hoistingEnabled: boolean = targetSubspace?.pnpmNodeModulesHoistingEnabled !== false;\n if (\n hoistingEnabled &&\n realPnpmInstallFolder &&\n Path.isUnder(packageJsonFolderPath, realPnpmInstallFolder)\n ) {\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: Minimatch[] | undefined;\n let excludeFilters: Minimatch[] | 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/package-extractor",
3
- "version": "0.12.15",
3
+ "version": "0.13.1",
4
4
  "description": "A library for bundling selected files and dependencies into a deployable package.",
5
5
  "main": "./lib-commonjs/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -40,9 +40,9 @@
40
40
  "minimatch": "10.2.3",
41
41
  "npm-packlist": "~5.1.3",
42
42
  "semver": "~7.5.4",
43
- "@rushstack/ts-command-line": "5.3.5",
44
- "@rushstack/node-core-library": "5.22.0",
45
- "@rushstack/terminal": "0.22.5"
43
+ "@rushstack/node-core-library": "5.23.0",
44
+ "@rushstack/terminal": "0.22.6",
45
+ "@rushstack/ts-command-line": "5.3.6"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/glob": "7.1.1",
@@ -50,10 +50,10 @@
50
50
  "eslint": "~9.37.0",
51
51
  "webpack": "~5.105.2",
52
52
  "@types/semver": "7.5.0",
53
- "@rushstack/heft-webpack5-plugin": "1.3.13",
54
53
  "local-node-rig": "1.0.0",
55
- "@rushstack/heft": "1.2.12",
56
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.12.13"
54
+ "@rushstack/heft-webpack5-plugin": "1.3.14",
55
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.12.14",
56
+ "@rushstack/heft": "1.2.13"
57
57
  },
58
58
  "sideEffects": false,
59
59
  "scripts": {