@rushstack/package-extractor 0.6.43 → 0.7.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.
@@ -85,10 +85,15 @@ export declare interface IExtractorOptions {
85
85
  */
86
86
  createArchiveOnly?: boolean;
87
87
  /**
88
- * The pnpmfile configuration if using PNPM, otherwise undefined. The configuration will be used to
88
+ * The pnpmfile configuration if using PNPM, otherwise `undefined`. The configuration will be used to
89
89
  * transform the package.json prior to extraction.
90
+ *
91
+ * @remarks
92
+ * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure
93
+ * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches
94
+ * cannot be combined.
90
95
  */
91
- transformPackageJson?: (packageJson: IPackageJson) => IPackageJson | undefined;
96
+ transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;
92
97
  /**
93
98
  * If dependencies from the "devDependencies" package.json field should be included in the extraction.
94
99
  */
@@ -100,6 +105,11 @@ export declare interface IExtractorOptions {
100
105
  /**
101
106
  * The folder where the PNPM "node_modules" folder is located. This is used to resolve packages linked
102
107
  * to the PNPM virtual store.
108
+ *
109
+ * @remarks
110
+ * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure
111
+ * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches
112
+ * cannot be combined.
103
113
  */
104
114
  pnpmInstallFolder?: string;
105
115
  /**
@@ -123,6 +133,15 @@ export declare interface IExtractorOptions {
123
133
  * Configurations for individual dependencies.
124
134
  */
125
135
  dependencyConfigurations?: IExtractorDependencyConfiguration[];
136
+ /**
137
+ * When using Rush subspaces, this setting can be used to provide configuration information for each
138
+ * individual subspace.
139
+ *
140
+ * @remarks
141
+ * To avoid confusion, if this setting is used, then the {@link IExtractorOptions.transformPackageJson} and
142
+ * {@link IExtractorOptions.pnpmInstallFolder} settings must not be used.
143
+ */
144
+ subspaces?: IExtractorSubspace[];
126
145
  }
127
146
 
128
147
  /**
@@ -165,6 +184,28 @@ export declare interface IExtractorProjectConfiguration {
165
184
  dependenciesToExclude?: string[];
166
185
  }
167
186
 
187
+ /**
188
+ * The extractor subspace configurations
189
+ *
190
+ * @public
191
+ */
192
+ export declare interface IExtractorSubspace {
193
+ /**
194
+ * The subspace name
195
+ */
196
+ subspaceName: string;
197
+ /**
198
+ * The folder where the PNPM "node_modules" folder is located. This is used to resolve packages linked
199
+ * to the PNPM virtual store.
200
+ */
201
+ pnpmInstallFolder?: string;
202
+ /**
203
+ * The pnpmfile configuration if using PNPM, otherwise undefined. The configuration will be used to
204
+ * transform the package.json prior to extraction.
205
+ */
206
+ transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;
207
+ }
208
+
168
209
  /**
169
210
  * Represents a symbolic link.
170
211
  *
@@ -217,6 +258,7 @@ export declare class PackageExtractor {
217
258
  * Extract a package using the provided options
218
259
  */
219
260
  extractAsync(options: IExtractorOptions): Promise<void>;
261
+ private static _normalizeOptions;
220
262
  private _performExtractionAsync;
221
263
  /**
222
264
  * Recursively crawl the node_modules dependencies and collect the result in IExtractorState.foldersToCopy.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.43.0"
8
+ "packageVersion": "7.43.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -46,6 +46,27 @@ export interface IExtractorMetadataJson {
46
46
  */
47
47
  links: ILinkInfo[];
48
48
  }
49
+ /**
50
+ * The extractor subspace configurations
51
+ *
52
+ * @public
53
+ */
54
+ export interface IExtractorSubspace {
55
+ /**
56
+ * The subspace name
57
+ */
58
+ subspaceName: string;
59
+ /**
60
+ * The folder where the PNPM "node_modules" folder is located. This is used to resolve packages linked
61
+ * to the PNPM virtual store.
62
+ */
63
+ pnpmInstallFolder?: string;
64
+ /**
65
+ * The pnpmfile configuration if using PNPM, otherwise undefined. The configuration will be used to
66
+ * transform the package.json prior to extraction.
67
+ */
68
+ transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;
69
+ }
49
70
  /**
50
71
  * The extractor configuration for individual projects.
51
72
  *
@@ -148,10 +169,15 @@ export interface IExtractorOptions {
148
169
  */
149
170
  createArchiveOnly?: boolean;
150
171
  /**
151
- * The pnpmfile configuration if using PNPM, otherwise undefined. The configuration will be used to
172
+ * The pnpmfile configuration if using PNPM, otherwise `undefined`. The configuration will be used to
152
173
  * transform the package.json prior to extraction.
174
+ *
175
+ * @remarks
176
+ * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure
177
+ * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches
178
+ * cannot be combined.
153
179
  */
154
- transformPackageJson?: (packageJson: IPackageJson) => IPackageJson | undefined;
180
+ transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;
155
181
  /**
156
182
  * If dependencies from the "devDependencies" package.json field should be included in the extraction.
157
183
  */
@@ -163,6 +189,11 @@ export interface IExtractorOptions {
163
189
  /**
164
190
  * The folder where the PNPM "node_modules" folder is located. This is used to resolve packages linked
165
191
  * to the PNPM virtual store.
192
+ *
193
+ * @remarks
194
+ * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure
195
+ * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches
196
+ * cannot be combined.
166
197
  */
167
198
  pnpmInstallFolder?: string;
168
199
  /**
@@ -186,6 +217,15 @@ export interface IExtractorOptions {
186
217
  * Configurations for individual dependencies.
187
218
  */
188
219
  dependencyConfigurations?: IExtractorDependencyConfiguration[];
220
+ /**
221
+ * When using Rush subspaces, this setting can be used to provide configuration information for each
222
+ * individual subspace.
223
+ *
224
+ * @remarks
225
+ * To avoid confusion, if this setting is used, then the {@link IExtractorOptions.transformPackageJson} and
226
+ * {@link IExtractorOptions.pnpmInstallFolder} settings must not be used.
227
+ */
228
+ subspaces?: IExtractorSubspace[];
189
229
  }
190
230
  /**
191
231
  * Manages the business logic for the "rush deploy" command.
@@ -203,6 +243,7 @@ export declare class PackageExtractor {
203
243
  * Extract a package using the provided options
204
244
  */
205
245
  extractAsync(options: IExtractorOptions): Promise<void>;
246
+ private static _normalizeOptions;
206
247
  private _performExtractionAsync;
207
248
  /**
208
249
  * Recursively crawl the node_modules dependencies and collect the result in IExtractorState.foldersToCopy.
@@ -1 +1 @@
1
- {"version":3,"file":"PackageExtractor.d.ts","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":"AAUA,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAmB,KAAK,SAAS,EAAiB,MAAM,mBAAmB,CAAC;AAKnF,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;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAYD;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IAC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AI,CAAC;IAwFpE,OAAO,CAAC,MAAM,CAAC,iBAAiB;YA8BlB,uBAAuB;IAmGrC;;OAEG;YACW,oBAAoB;IAkJlC,OAAO,CAAC,uBAAuB;IAwC/B;;;;;OAKG;IACH,OAAO,CAAC,4BAA4B;IAapC;;;;;OAKG;IACH,OAAO,CAAC,8BAA8B;IAYtC;;OAEG;YACW,mBAAmB;IAuNjC;;OAEG;YACW,oBAAoB;IAiDlC;;OAEG;YACW,4BAA4B;YA4C5B,kBAAkB;CAwCjC"}
@@ -69,6 +69,7 @@ class PackageExtractor {
69
69
  * Extract a package using the provided options
70
70
  */
71
71
  async extractAsync(options) {
72
+ options = PackageExtractor._normalizeOptions(options);
72
73
  const { terminal, projectConfigurations, sourceRootFolder, targetRootFolder, mainProjectName, overwriteExisting, createArchiveFilePath, createArchiveOnly, dependencyConfigurations } = options;
73
74
  if (createArchiveOnly) {
74
75
  if (options.linkCreation !== 'script' && options.linkCreation !== 'none') {
@@ -134,6 +135,28 @@ class PackageExtractor {
134
135
  await archiver.createArchiveAsync(archiveFilePath);
135
136
  }
136
137
  }
138
+ static _normalizeOptions(options) {
139
+ if (options.subspaces) {
140
+ if (options.pnpmInstallFolder !== undefined) {
141
+ throw new Error('IExtractorOptions.pnpmInstallFolder cannot be combined with IExtractorOptions.subspaces');
142
+ }
143
+ if (options.transformPackageJson !== undefined) {
144
+ throw new Error('IExtractorOptions.transformPackageJson cannot be combined with IExtractorOptions.subspaces');
145
+ }
146
+ return options;
147
+ }
148
+ const normalizedOptions = Object.assign({}, options);
149
+ delete normalizedOptions.pnpmInstallFolder;
150
+ delete normalizedOptions.transformPackageJson;
151
+ normalizedOptions.subspaces = [
152
+ {
153
+ subspaceName: 'default',
154
+ pnpmInstallFolder: options.pnpmInstallFolder,
155
+ transformPackageJson: options.transformPackageJson
156
+ }
157
+ ];
158
+ return normalizedOptions;
159
+ }
137
160
  async _performExtractionAsync(options, state) {
138
161
  var _a;
139
162
  const { terminal, mainProjectName, sourceRootFolder, targetRootFolder, folderToCopy: additionalFolderToCopy, linkCreation } = options;
@@ -211,11 +234,11 @@ class PackageExtractor {
211
234
  * Recursively crawl the node_modules dependencies and collect the result in IExtractorState.foldersToCopy.
212
235
  */
213
236
  async _collectFoldersAsync(packageJsonFolder, options, state) {
214
- const { terminal, pnpmInstallFolder, transformPackageJson } = options;
237
+ const { terminal, subspaces } = options;
215
238
  const { projectConfigurationsByPath } = state;
216
239
  const packageJsonFolderPathQueue = new node_core_library_1.AsyncQueue([packageJsonFolder]);
217
240
  await node_core_library_1.Async.forEachAsync(packageJsonFolderPathQueue, async ([packageJsonFolderPath, callback]) => {
218
- var _a;
241
+ var _a, _b;
219
242
  const packageJsonRealFolderPath = await node_core_library_1.FileSystem.getRealPathAsync(packageJsonFolderPath);
220
243
  if (state.foldersToCopy.has(packageJsonRealFolderPath)) {
221
244
  // we've already seen this folder
@@ -224,8 +247,9 @@ class PackageExtractor {
224
247
  }
225
248
  state.foldersToCopy.add(packageJsonRealFolderPath);
226
249
  const originalPackageJson = await node_core_library_1.JsonFile.loadAsync(path.join(packageJsonRealFolderPath, 'package.json'));
250
+ const targetSubspace = subspaces === null || subspaces === void 0 ? void 0 : subspaces.find((subspace) => subspace.pnpmInstallFolder && node_core_library_1.Path.isUnder(packageJsonFolderPath, subspace.pnpmInstallFolder));
227
251
  // Transform packageJson using the provided transformer, if requested
228
- const packageJson = (_a = transformPackageJson === null || transformPackageJson === void 0 ? void 0 : transformPackageJson(originalPackageJson)) !== null && _a !== void 0 ? _a : originalPackageJson;
252
+ const packageJson = (_b = (_a = targetSubspace === null || targetSubspace === void 0 ? void 0 : targetSubspace.transformPackageJson) === null || _a === void 0 ? void 0 : _a.call(targetSubspace, originalPackageJson)) !== null && _b !== void 0 ? _b : originalPackageJson;
229
253
  state.packageJsonByPath.set(packageJsonRealFolderPath, packageJson);
230
254
  // Union of keys from regular dependencies, peerDependencies, optionalDependencies
231
255
  // (and possibly devDependencies if includeDevDependencies=true)
@@ -283,12 +307,13 @@ class PackageExtractor {
283
307
  // Replicate the links to the virtual store. Note that if the package has not been hoisted by
284
308
  // PNPM, the package will not be resolvable from here.
285
309
  // Only apply this logic for packages that were actually installed under the common/temp folder.
286
- if (pnpmInstallFolder && node_core_library_1.Path.isUnder(packageJsonFolderPath, pnpmInstallFolder)) {
310
+ const realPnpmInstallFolder = targetSubspace === null || targetSubspace === void 0 ? void 0 : targetSubspace.pnpmInstallFolder;
311
+ if (realPnpmInstallFolder && node_core_library_1.Path.isUnder(packageJsonFolderPath, realPnpmInstallFolder)) {
287
312
  try {
288
313
  // The PNPM virtual store links are created in this folder. We will resolve the current package
289
314
  // from that location and collect any additional links encountered along the way.
290
315
  // TODO: This can be configured via NPMRC. We should support that.
291
- const pnpmDotFolderPath = path.join(pnpmInstallFolder, 'node_modules', '.pnpm');
316
+ const pnpmDotFolderPath = path.join(realPnpmInstallFolder, 'node_modules', '.pnpm');
292
317
  // TODO: Investigate how package aliases are handled by PNPM in this case. For example:
293
318
  //
294
319
  // "dependencies": {
@@ -1 +1 @@
1
- {"version":3,"file":"PackageExtractor.js","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,uCAAyB;AACzB,yCAAuD;AACvD,oDAA4B;AAC5B,gEAAuC;AACvC,gEAA2C;AAC3C,oDAA6C;AAC7C,oEASsC;AACtC,kDAA+D;AAE/D,qDAAkD;AAClD,uDAAmF;AACnF,mCAA0C;AAC1C,mDAA+E;AAyN/E;;;;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,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CAAC,CAAC;YACpG,MAAM,yBAAyB,GAAW,IAAI,CAAC,IAAI,CAAC,iCAAiC,EAAE,MAAM,CAAC,CAAC;YAE/F,MAAM,qBAAqB,GAAa,MAAM,IAAA,mBAAY,EACxD,iCAAiC,EACjC,yBAAyB,EACzB;gBACE,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAChE,CACF,CAAC;YAEF,IAAI,qBAAqB,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,cAAc,GAAa,MAAM,8BAAU,CAAC,wBAAwB,CACxE,yBAAyB,CAC1B,CAAC;gBACF,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;oBAC3C,MAAM,WAAW,GAAW,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;oBAChF,MAAM,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC;wBACrC,QAAQ,EAAE,WAAW;wBACrB,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,WAAW,CAAC;qBAClE,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,EACD;YACE,WAAW,EAAE,EAAE;SAChB,CACF,CAAC;IACJ,CAAC;CACF;AAlxBD,4CAkxBC","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 * as fs from 'fs';\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 AlreadyExistsBehavior,\n type IPackageJson\n} from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\n\nimport { ArchiveManager } from './ArchiveManager';\nimport { SymlinkAnalyzer, type ILinkInfo, type PathNode } from './SymlinkAnalyzer';\nimport { matchesWithStar } 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\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\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 archiver?: ArchiveManager;\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 * 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 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 transformPackageJson?: (packageJson: IPackageJson) => IPackageJson | undefined;\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 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?: 'default' | 'script' | 'none';\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/**\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 const {\n terminal,\n projectConfigurations,\n sourceRootFolder,\n targetRootFolder,\n mainProjectName,\n overwriteExisting,\n createArchiveFilePath,\n createArchiveOnly,\n dependencyConfigurations\n } = options;\n\n if (createArchiveOnly) {\n if (options.linkCreation !== 'script' && options.linkCreation !== 'none') {\n throw new Error('createArchiveOnly is only supported when linkCreation is \"script\" or \"none\"');\n }\n if (!createArchiveFilePath) {\n throw new Error('createArchiveOnly is only supported when createArchiveFilePath is specified');\n }\n }\n\n let archiver: ArchiveManager | undefined;\n let archiveFilePath: string | undefined;\n if (createArchiveFilePath) {\n if (path.extname(createArchiveFilePath) !== '.zip') {\n throw new Error('Only archives with the .zip file extension are currently supported.');\n }\n\n archiveFilePath = path.resolve(targetRootFolder, createArchiveFilePath);\n archiver = new ArchiveManager();\n }\n\n await FileSystem.ensureFolderAsync(targetRootFolder);\n\n terminal.writeLine(Colorize.cyan(`Extracting to target folder: ${targetRootFolder}`));\n terminal.writeLine(Colorize.cyan(`Main project for extraction: ${mainProjectName}`));\n\n try {\n const existingExtraction: boolean =\n (await FileSystem.readFolderItemNamesAsync(targetRootFolder)).length > 0;\n if (existingExtraction) {\n if (!overwriteExisting) {\n throw new Error(\n 'The extraction target folder is not empty. Overwrite must be explicitly requested'\n );\n } else {\n terminal.writeLine('Deleting target folder contents...');\n terminal.writeLine('');\n await FileSystem.ensureEmptyFolderAsync(targetRootFolder);\n }\n }\n } catch (error: unknown) {\n if (!FileSystem.isFolderDoesNotExistError(error as Error)) {\n throw error;\n }\n }\n\n // Create a new state for each run\n const state: IExtractorState = {\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 symlinkAnalyzer: new SymlinkAnalyzer({ requiredSourceParentPath: sourceRootFolder }),\n archiver\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 if (archiver && archiveFilePath) {\n terminal.writeLine(`Creating archive at \"${archiveFilePath}\"`);\n await archiver.createArchiveAsync(archiveFilePath);\n }\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 linkCreation\n } = options;\n const { projectConfigurationsByName, foldersToCopy, symlinkAnalyzer } = 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 (!options.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: options.targetRootFolder\n };\n await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state);\n }\n\n switch (linkCreation) {\n case 'script': {\n const sourceFilePath: string = path.join(scriptsFolderPath, createLinksScriptFilename);\n if (!options.createArchiveOnly) {\n terminal.writeLine(`Creating ${createLinksScriptFilename}`);\n await FileSystem.copyFileAsync({\n sourcePath: sourceFilePath,\n destinationPath: path.join(targetRootFolder, createLinksScriptFilename),\n alreadyExistsBehavior: AlreadyExistsBehavior.Error\n });\n }\n await state.archiver?.addToArchiveAsync({\n filePath: sourceFilePath,\n archivePath: createLinksScriptFilename\n });\n break;\n }\n case 'default': {\n terminal.writeLine('Creating symlinks');\n const linksToCopy: ILinkInfo[] = symlinkAnalyzer.reportSymlinks();\n await Async.forEachAsync(linksToCopy, async (linkToCopy: ILinkInfo) => {\n await this._extractSymlinkAsync(linkToCopy, options, state);\n });\n await this._makeBinLinksAsync(options, state);\n break;\n }\n default: {\n break;\n }\n }\n\n terminal.writeLine('Creating extractor-metadata.json');\n await this._writeExtractorMetadataAsync(options, state);\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, pnpmInstallFolder, transformPackageJson } = 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 // Transform packageJson using the provided transformer, if requested\n const packageJson: IPackageJson = 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 if (pnpmInstallFolder && Path.isUnder(packageJsonFolderPath, pnpmInstallFolder)) {\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(pnpmInstallFolder, '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 * Maps a file path from IExtractorOptions.sourceRootFolder to IExtractorOptions.targetRootFolder\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"C:\\\\MyRepo\\\\common\\\\deploy\\\\libraries\\\\my-lib\"\n */\n private _remapPathForExtractorFolder(\n absolutePathInSourceFolder: string,\n options: IExtractorOptions\n ): string {\n const { sourceRootFolder, targetRootFolder } = options;\n const relativePath: string = path.relative(sourceRootFolder, absolutePathInSourceFolder);\n if (relativePath.startsWith('..')) {\n throw new Error(`Source path \"${absolutePathInSourceFolder}\" is not under \"${sourceRootFolder}\"`);\n }\n const absolutePathInTargetFolder: string = path.join(targetRootFolder, relativePath);\n return absolutePathInTargetFolder;\n }\n\n /**\n * Maps a file path from IExtractorOptions.sourceRootFolder to relative path\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"libraries/my-lib\"\n */\n private _remapPathForExtractorMetadata(\n absolutePathInSourceFolder: string,\n options: IExtractorOptions\n ): string {\n const { sourceRootFolder } = options;\n const relativePath: string = path.relative(sourceRootFolder, absolutePathInSourceFolder);\n if (relativePath.startsWith('..')) {\n throw new Error(`Source path \"${absolutePathInSourceFolder}\" is not under \"${sourceRootFolder}\"`);\n }\n return Path.convertToSlashes(relativePath);\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, targetRootFolder } = options;\n const { projectConfigurationsByPath, packageJsonByPath, dependencyConfigurationsByName, archiver } =\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 dependencies insides node_modules\n // 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 = this._remapPathForExtractorFolder(sourceFolderPath, options);\n\n if (useNpmIgnoreFilter) {\n const npmPackFiles: string[] = await PackageExtractor.getPackageIncludedFilesAsync(sourceFolderPath);\n\n const alreadyCopiedSourcePaths: Set<string> = new Set();\n\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 // We can detect the duplicates by comparing the path.resolve() result.\n const copySourcePath: string = path.resolve(sourceFolderPath, npmPackFile);\n\n if (alreadyCopiedSourcePaths.has(copySourcePath)) {\n return;\n }\n alreadyCopiedSourcePaths.add(copySourcePath);\n\n const copyDestinationPath: string = path.join(targetFolderPath, npmPackFile);\n\n const copySourcePathNode: PathNode = await state.symlinkAnalyzer.analyzePathAsync({\n inputPath: copySourcePath\n });\n if (copySourcePathNode.kind !== 'link') {\n if (!options.createArchiveOnly) {\n await FileSystem.ensureFolderAsync(path.dirname(copyDestinationPath));\n // Use the fs.copyFile API instead of FileSystem.copyFileAsync() since copyFileAsync performs\n // a needless stat() call to determine if it's a file or folder, and we already know it's a file.\n await fs.promises.copyFile(copySourcePath, copyDestinationPath, fs.constants.COPYFILE_EXCL);\n }\n\n if (archiver) {\n const archivePath: string = path.relative(targetRootFolder, copyDestinationPath);\n await archiver.addToArchiveAsync({\n filePath: copySourcePath,\n archivePath,\n stats: copySourcePathNode.linkStats\n });\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 targetPath: string = path.join(targetFolderPath, relativeSourcePath);\n if (!options.createArchiveOnly) {\n // Manually call fs.copyFile to avoid unnecessary stat calls.\n const targetParentPath: string = path.dirname(targetPath);\n await FileSystem.ensureFolderAsync(targetParentPath);\n await fs.promises.copyFile(sourcePath, targetPath, fs.constants.COPYFILE_EXCL);\n }\n\n // Add the file to the archive. Only need to add files since directories will be auto-created\n if (archiver) {\n const archivePath: string = path.relative(targetRootFolder, targetPath);\n await archiver.addToArchiveAsync({\n filePath: sourcePath,\n archivePath: archivePath,\n stats: sourcePathNode.linkStats\n });\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 * Create a symlink as described by the ILinkInfo object.\n */\n private async _extractSymlinkAsync(\n originalLinkInfo: ILinkInfo,\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const linkInfo: ILinkInfo = {\n kind: originalLinkInfo.kind,\n linkPath: this._remapPathForExtractorFolder(originalLinkInfo.linkPath, options),\n targetPath: this._remapPathForExtractorFolder(originalLinkInfo.targetPath, options)\n };\n\n const newLinkFolder: string = path.dirname(linkInfo.linkPath);\n await FileSystem.ensureFolderAsync(newLinkFolder);\n\n // Link to the relative path for symlinks\n const relativeTargetPath: string = path.relative(newLinkFolder, linkInfo.targetPath);\n\n // NOTE: This logic is based on NpmLinkManager._createSymlink()\n if (linkInfo.kind === 'fileLink') {\n // For files, we use a Windows \"hard link\", because creating a symbolic link requires\n // administrator permission. However hard links seem to cause build failures on Mac,\n // so for all other operating systems we use symbolic links for this case.\n if (process.platform === 'win32') {\n await FileSystem.createHardLinkAsync({\n linkTargetPath: relativeTargetPath,\n newLinkPath: linkInfo.linkPath\n });\n } else {\n await FileSystem.createSymbolicLinkFileAsync({\n linkTargetPath: relativeTargetPath,\n newLinkPath: linkInfo.linkPath\n });\n }\n } else {\n // Junctions are only supported on Windows. This will create a symbolic link on other platforms.\n await FileSystem.createSymbolicLinkJunctionAsync({\n linkTargetPath: relativeTargetPath,\n newLinkPath: linkInfo.linkPath\n });\n }\n\n // Since the created symlinks have the required relative paths, they can be added directly to\n // the archive.\n await state.archiver?.addToArchiveAsync({\n filePath: linkInfo.linkPath,\n archivePath: path.relative(options.targetRootFolder, linkInfo.linkPath)\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, targetRootFolder } = options;\n const { projectConfigurationsByPath } = state;\n\n const extractorMetadataFileName: string = 'extractor-metadata.json';\n const extractorMetadataFilePath: string = path.join(targetRootFolder, extractorMetadataFileName);\n const extractorMetadataJson: IExtractorMetadataJson = {\n mainProjectName,\n projects: [],\n links: []\n };\n\n for (const { projectFolder, projectName } of projectConfigurationsByPath.values()) {\n if (state.foldersToCopy.has(projectFolder)) {\n extractorMetadataJson.projects.push({\n projectName,\n path: this._remapPathForExtractorMetadata(projectFolder, options)\n });\n }\n }\n\n // Remap the links to be relative to target folder\n for (const absoluteLinkInfo of state.symlinkAnalyzer.reportSymlinks()) {\n const relativeInfo: ILinkInfo = {\n kind: absoluteLinkInfo.kind,\n linkPath: this._remapPathForExtractorMetadata(absoluteLinkInfo.linkPath, options),\n targetPath: this._remapPathForExtractorMetadata(absoluteLinkInfo.targetPath, options)\n };\n extractorMetadataJson.links.push(relativeInfo);\n }\n\n const extractorMetadataFileContent: string = JSON.stringify(extractorMetadataJson, undefined, 0);\n if (!options.createArchiveOnly) {\n await FileSystem.writeFileAsync(extractorMetadataFilePath, extractorMetadataFileContent);\n }\n await state.archiver?.addToArchiveAsync({\n fileData: extractorMetadataFileContent,\n archivePath: extractorMetadataFileName\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 = this._remapPathForExtractorFolder(projectFolder, options);\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 && state.archiver) {\n const binFolderItems: string[] = await FileSystem.readFolderItemNamesAsync(\n extractedProjectBinFolder\n );\n for (const binFolderItem of binFolderItems) {\n const binFilePath: string = path.join(extractedProjectBinFolder, binFolderItem);\n await state.archiver.addToArchiveAsync({\n filePath: binFilePath,\n archivePath: path.relative(options.targetRootFolder, binFilePath)\n });\n }\n }\n },\n {\n concurrency: 10\n }\n );\n }\n}\n"]}
1
+ {"version":3,"file":"PackageExtractor.js","sourceRoot":"","sources":["../src/PackageExtractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,uCAAyB;AACzB,yCAAuD;AACvD,oDAA4B;AAC5B,gEAAuC;AACvC,gEAA2C;AAC3C,oDAA6C;AAC7C,oEASsC;AACtC,kDAA+D;AAE/D,qDAAkD;AAClD,uDAAmF;AACnF,mCAA0C;AAC1C,mDAA+E;AAmQ/E;;;;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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ACjC,yBAAyB,EACzB;gBACE,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAChE,CACF,CAAC;YAEF,IAAI,qBAAqB,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,cAAc,GAAa,MAAM,8BAAU,CAAC,wBAAwB,CACxE,yBAAyB,CAC1B,CAAC;gBACF,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;oBAC3C,MAAM,WAAW,GAAW,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;oBAChF,MAAM,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC;wBACrC,QAAQ,EAAE,WAAW;wBACrB,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,WAAW,CAAC;qBAClE,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,EACD;YACE,WAAW,EAAE,EAAE;SAChB,CACF,CAAC;IACJ,CAAC;CACF;AAxzBD,4CAwzBC","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 * as fs from 'fs';\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 AlreadyExistsBehavior,\n type IPackageJson\n} from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\n\nimport { ArchiveManager } from './ArchiveManager';\nimport { SymlinkAnalyzer, type ILinkInfo, type PathNode } from './SymlinkAnalyzer';\nimport { matchesWithStar } 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\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\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 archiver?: ArchiveManager;\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 * 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 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?: 'default' | 'script' | 'none';\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 createArchiveFilePath,\n createArchiveOnly,\n dependencyConfigurations\n } = options;\n\n if (createArchiveOnly) {\n if (options.linkCreation !== 'script' && options.linkCreation !== 'none') {\n throw new Error('createArchiveOnly is only supported when linkCreation is \"script\" or \"none\"');\n }\n if (!createArchiveFilePath) {\n throw new Error('createArchiveOnly is only supported when createArchiveFilePath is specified');\n }\n }\n\n let archiver: ArchiveManager | undefined;\n let archiveFilePath: string | undefined;\n if (createArchiveFilePath) {\n if (path.extname(createArchiveFilePath) !== '.zip') {\n throw new Error('Only archives with the .zip file extension are currently supported.');\n }\n\n archiveFilePath = path.resolve(targetRootFolder, createArchiveFilePath);\n archiver = new ArchiveManager();\n }\n\n await FileSystem.ensureFolderAsync(targetRootFolder);\n\n terminal.writeLine(Colorize.cyan(`Extracting to target folder: ${targetRootFolder}`));\n terminal.writeLine(Colorize.cyan(`Main project for extraction: ${mainProjectName}`));\n\n try {\n const existingExtraction: boolean =\n (await FileSystem.readFolderItemNamesAsync(targetRootFolder)).length > 0;\n if (existingExtraction) {\n if (!overwriteExisting) {\n throw new Error(\n 'The extraction target folder is not empty. Overwrite must be explicitly requested'\n );\n } else {\n terminal.writeLine('Deleting target folder contents...');\n terminal.writeLine('');\n await FileSystem.ensureEmptyFolderAsync(targetRootFolder);\n }\n }\n } catch (error: unknown) {\n if (!FileSystem.isFolderDoesNotExistError(error as Error)) {\n throw error;\n }\n }\n\n // Create a new state for each run\n const state: IExtractorState = {\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 symlinkAnalyzer: new SymlinkAnalyzer({ requiredSourceParentPath: sourceRootFolder }),\n archiver\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 if (archiver && archiveFilePath) {\n terminal.writeLine(`Creating archive at \"${archiveFilePath}\"`);\n await archiver.createArchiveAsync(archiveFilePath);\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 linkCreation\n } = options;\n const { projectConfigurationsByName, foldersToCopy, symlinkAnalyzer } = 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 (!options.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: options.targetRootFolder\n };\n await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state);\n }\n\n switch (linkCreation) {\n case 'script': {\n const sourceFilePath: string = path.join(scriptsFolderPath, createLinksScriptFilename);\n if (!options.createArchiveOnly) {\n terminal.writeLine(`Creating ${createLinksScriptFilename}`);\n await FileSystem.copyFileAsync({\n sourcePath: sourceFilePath,\n destinationPath: path.join(targetRootFolder, createLinksScriptFilename),\n alreadyExistsBehavior: AlreadyExistsBehavior.Error\n });\n }\n await state.archiver?.addToArchiveAsync({\n filePath: sourceFilePath,\n archivePath: createLinksScriptFilename\n });\n break;\n }\n case 'default': {\n terminal.writeLine('Creating symlinks');\n const linksToCopy: ILinkInfo[] = symlinkAnalyzer.reportSymlinks();\n await Async.forEachAsync(linksToCopy, async (linkToCopy: ILinkInfo) => {\n await this._extractSymlinkAsync(linkToCopy, options, state);\n });\n await this._makeBinLinksAsync(options, state);\n break;\n }\n default: {\n break;\n }\n }\n\n terminal.writeLine('Creating extractor-metadata.json');\n await this._writeExtractorMetadataAsync(options, state);\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 * Maps a file path from IExtractorOptions.sourceRootFolder to IExtractorOptions.targetRootFolder\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"C:\\\\MyRepo\\\\common\\\\deploy\\\\libraries\\\\my-lib\"\n */\n private _remapPathForExtractorFolder(\n absolutePathInSourceFolder: string,\n options: IExtractorOptions\n ): string {\n const { sourceRootFolder, targetRootFolder } = options;\n const relativePath: string = path.relative(sourceRootFolder, absolutePathInSourceFolder);\n if (relativePath.startsWith('..')) {\n throw new Error(`Source path \"${absolutePathInSourceFolder}\" is not under \"${sourceRootFolder}\"`);\n }\n const absolutePathInTargetFolder: string = path.join(targetRootFolder, relativePath);\n return absolutePathInTargetFolder;\n }\n\n /**\n * Maps a file path from IExtractorOptions.sourceRootFolder to relative path\n *\n * Example input: \"C:\\\\MyRepo\\\\libraries\\\\my-lib\"\n * Example output: \"libraries/my-lib\"\n */\n private _remapPathForExtractorMetadata(\n absolutePathInSourceFolder: string,\n options: IExtractorOptions\n ): string {\n const { sourceRootFolder } = options;\n const relativePath: string = path.relative(sourceRootFolder, absolutePathInSourceFolder);\n if (relativePath.startsWith('..')) {\n throw new Error(`Source path \"${absolutePathInSourceFolder}\" is not under \"${sourceRootFolder}\"`);\n }\n return Path.convertToSlashes(relativePath);\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, targetRootFolder } = options;\n const { projectConfigurationsByPath, packageJsonByPath, dependencyConfigurationsByName, archiver } =\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 dependencies insides node_modules\n // 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 = this._remapPathForExtractorFolder(sourceFolderPath, options);\n\n if (useNpmIgnoreFilter) {\n const npmPackFiles: string[] = await PackageExtractor.getPackageIncludedFilesAsync(sourceFolderPath);\n\n const alreadyCopiedSourcePaths: Set<string> = new Set();\n\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 // We can detect the duplicates by comparing the path.resolve() result.\n const copySourcePath: string = path.resolve(sourceFolderPath, npmPackFile);\n\n if (alreadyCopiedSourcePaths.has(copySourcePath)) {\n return;\n }\n alreadyCopiedSourcePaths.add(copySourcePath);\n\n const copyDestinationPath: string = path.join(targetFolderPath, npmPackFile);\n\n const copySourcePathNode: PathNode = await state.symlinkAnalyzer.analyzePathAsync({\n inputPath: copySourcePath\n });\n if (copySourcePathNode.kind !== 'link') {\n if (!options.createArchiveOnly) {\n await FileSystem.ensureFolderAsync(path.dirname(copyDestinationPath));\n // Use the fs.copyFile API instead of FileSystem.copyFileAsync() since copyFileAsync performs\n // a needless stat() call to determine if it's a file or folder, and we already know it's a file.\n await fs.promises.copyFile(copySourcePath, copyDestinationPath, fs.constants.COPYFILE_EXCL);\n }\n\n if (archiver) {\n const archivePath: string = path.relative(targetRootFolder, copyDestinationPath);\n await archiver.addToArchiveAsync({\n filePath: copySourcePath,\n archivePath,\n stats: copySourcePathNode.linkStats\n });\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 targetPath: string = path.join(targetFolderPath, relativeSourcePath);\n if (!options.createArchiveOnly) {\n // Manually call fs.copyFile to avoid unnecessary stat calls.\n const targetParentPath: string = path.dirname(targetPath);\n await FileSystem.ensureFolderAsync(targetParentPath);\n await fs.promises.copyFile(sourcePath, targetPath, fs.constants.COPYFILE_EXCL);\n }\n\n // Add the file to the archive. Only need to add files since directories will be auto-created\n if (archiver) {\n const archivePath: string = path.relative(targetRootFolder, targetPath);\n await archiver.addToArchiveAsync({\n filePath: sourcePath,\n archivePath: archivePath,\n stats: sourcePathNode.linkStats\n });\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 * Create a symlink as described by the ILinkInfo object.\n */\n private async _extractSymlinkAsync(\n originalLinkInfo: ILinkInfo,\n options: IExtractorOptions,\n state: IExtractorState\n ): Promise<void> {\n const linkInfo: ILinkInfo = {\n kind: originalLinkInfo.kind,\n linkPath: this._remapPathForExtractorFolder(originalLinkInfo.linkPath, options),\n targetPath: this._remapPathForExtractorFolder(originalLinkInfo.targetPath, options)\n };\n\n const newLinkFolder: string = path.dirname(linkInfo.linkPath);\n await FileSystem.ensureFolderAsync(newLinkFolder);\n\n // Link to the relative path for symlinks\n const relativeTargetPath: string = path.relative(newLinkFolder, linkInfo.targetPath);\n\n // NOTE: This logic is based on NpmLinkManager._createSymlink()\n if (linkInfo.kind === 'fileLink') {\n // For files, we use a Windows \"hard link\", because creating a symbolic link requires\n // administrator permission. However hard links seem to cause build failures on Mac,\n // so for all other operating systems we use symbolic links for this case.\n if (process.platform === 'win32') {\n await FileSystem.createHardLinkAsync({\n linkTargetPath: relativeTargetPath,\n newLinkPath: linkInfo.linkPath\n });\n } else {\n await FileSystem.createSymbolicLinkFileAsync({\n linkTargetPath: relativeTargetPath,\n newLinkPath: linkInfo.linkPath\n });\n }\n } else {\n // Junctions are only supported on Windows. This will create a symbolic link on other platforms.\n await FileSystem.createSymbolicLinkJunctionAsync({\n linkTargetPath: relativeTargetPath,\n newLinkPath: linkInfo.linkPath\n });\n }\n\n // Since the created symlinks have the required relative paths, they can be added directly to\n // the archive.\n await state.archiver?.addToArchiveAsync({\n filePath: linkInfo.linkPath,\n archivePath: path.relative(options.targetRootFolder, linkInfo.linkPath)\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, targetRootFolder } = options;\n const { projectConfigurationsByPath } = state;\n\n const extractorMetadataFileName: string = 'extractor-metadata.json';\n const extractorMetadataFilePath: string = path.join(targetRootFolder, extractorMetadataFileName);\n const extractorMetadataJson: IExtractorMetadataJson = {\n mainProjectName,\n projects: [],\n links: []\n };\n\n for (const { projectFolder, projectName } of projectConfigurationsByPath.values()) {\n if (state.foldersToCopy.has(projectFolder)) {\n extractorMetadataJson.projects.push({\n projectName,\n path: this._remapPathForExtractorMetadata(projectFolder, options)\n });\n }\n }\n\n // Remap the links to be relative to target folder\n for (const absoluteLinkInfo of state.symlinkAnalyzer.reportSymlinks()) {\n const relativeInfo: ILinkInfo = {\n kind: absoluteLinkInfo.kind,\n linkPath: this._remapPathForExtractorMetadata(absoluteLinkInfo.linkPath, options),\n targetPath: this._remapPathForExtractorMetadata(absoluteLinkInfo.targetPath, options)\n };\n extractorMetadataJson.links.push(relativeInfo);\n }\n\n const extractorMetadataFileContent: string = JSON.stringify(extractorMetadataJson, undefined, 0);\n if (!options.createArchiveOnly) {\n await FileSystem.writeFileAsync(extractorMetadataFilePath, extractorMetadataFileContent);\n }\n await state.archiver?.addToArchiveAsync({\n fileData: extractorMetadataFileContent,\n archivePath: extractorMetadataFileName\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 = this._remapPathForExtractorFolder(projectFolder, options);\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 && state.archiver) {\n const binFolderItems: string[] = await FileSystem.readFolderItemNamesAsync(\n extractedProjectBinFolder\n );\n for (const binFolderItem of binFolderItems) {\n const binFilePath: string = path.join(extractedProjectBinFolder, binFolderItem);\n await state.archiver.addToArchiveAsync({\n filePath: binFilePath,\n archivePath: path.relative(options.targetRootFolder, binFilePath)\n });\n }\n }\n },\n {\n concurrency: 10\n }\n );\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { PackageExtractor, type IExtractorOptions, type IExtractorProjectConfiguration, type IExtractorDependencyConfiguration, type IExtractorMetadataJson, type IProjectInfoJson } from './PackageExtractor';
1
+ export { PackageExtractor, type IExtractorOptions, type IExtractorProjectConfiguration, type IExtractorDependencyConfiguration, type IExtractorMetadataJson, type IProjectInfoJson, type IExtractorSubspace } from './PackageExtractor';
2
2
  export type { ILinkInfo } from './SymlinkAnalyzer';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,uDAO4B;AAN1B,oHAAA,gBAAgB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport {\n PackageExtractor,\n type IExtractorOptions,\n type IExtractorProjectConfiguration,\n type IExtractorDependencyConfiguration,\n type IExtractorMetadataJson,\n type IProjectInfoJson\n} from './PackageExtractor';\n\nexport type { ILinkInfo } from './SymlinkAnalyzer';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,uDAQ4B;AAP1B,oHAAA,gBAAgB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport {\n PackageExtractor,\n type IExtractorOptions,\n type IExtractorProjectConfiguration,\n type IExtractorDependencyConfiguration,\n type IExtractorMetadataJson,\n type IProjectInfoJson,\n type IExtractorSubspace\n} from './PackageExtractor';\n\nexport type { ILinkInfo } from './SymlinkAnalyzer';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/package-extractor",
3
- "version": "0.6.43",
3
+ "version": "0.7.0",
4
4
  "description": "A library for bundling selected files and dependencies into a deployable package.",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/package-extractor.d.ts",
@@ -24,13 +24,13 @@
24
24
  "@types/glob": "7.1.1",
25
25
  "@types/minimatch": "3.0.5",
26
26
  "@types/npm-packlist": "~1.1.1",
27
- "eslint": "~8.7.0",
27
+ "eslint": "~8.57.0",
28
28
  "webpack": "~5.82.1",
29
29
  "@types/semver": "7.5.0",
30
- "local-node-rig": "1.0.0",
31
30
  "@rushstack/heft-webpack5-plugin": "0.9.40",
31
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.40",
32
32
  "@rushstack/heft": "0.66.3",
33
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.40"
33
+ "local-node-rig": "1.0.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "heft build --clean",