@rushstack/package-extractor 0.7.25 → 0.8.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.
package/CHANGELOG.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@rushstack/package-extractor",
3
3
  "entries": [
4
+ {
5
+ "version": "0.8.0",
6
+ "tag": "@rushstack/package-extractor_v0.8.0",
7
+ "date": "Wed, 11 Sep 2024 19:54:47 GMT",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "comment": "Add the ability to change where the \"create-links.js\" file and the associated metadata file are generated when running in the \"script\" linkCreation mode"
12
+ }
13
+ ]
14
+ }
15
+ },
16
+ {
17
+ "version": "0.7.26",
18
+ "tag": "@rushstack/package-extractor_v0.7.26",
19
+ "date": "Tue, 10 Sep 2024 20:08:11 GMT",
20
+ "comments": {
21
+ "dependency": [
22
+ {
23
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.8.0`"
24
+ },
25
+ {
26
+ "comment": "Updating dependency \"@rushstack/terminal\" to `0.14.1`"
27
+ },
28
+ {
29
+ "comment": "Updating dependency \"@rushstack/heft-webpack5-plugin\" to `0.10.10`"
30
+ },
31
+ {
32
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.67.1`"
33
+ },
34
+ {
35
+ "comment": "Updating dependency \"@rushstack/webpack-preserve-dynamic-require-plugin\" to `0.11.65`"
36
+ }
37
+ ]
38
+ }
39
+ },
4
40
  {
5
41
  "version": "0.7.25",
6
42
  "tag": "@rushstack/package-extractor_v0.7.25",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Change Log - @rushstack/package-extractor
2
2
 
3
- This log was last generated on Wed, 21 Aug 2024 05:43:04 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 11 Sep 2024 19:54:47 GMT and should not be manually modified.
4
+
5
+ ## 0.8.0
6
+ Wed, 11 Sep 2024 19:54:47 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Add the ability to change where the "create-links.js" file and the associated metadata file are generated when running in the "script" linkCreation mode
11
+
12
+ ## 0.7.26
13
+ Tue, 10 Sep 2024 20:08:11 GMT
14
+
15
+ _Version update only_
4
16
 
5
17
  ## 0.7.25
6
18
  Wed, 21 Aug 2024 05:43:04 GMT
@@ -81,7 +81,7 @@ export declare interface IExtractorOptions {
81
81
  createArchiveFilePath?: string;
82
82
  /**
83
83
  * Whether to skip copying files to the extraction target directory, and only create an extraction
84
- * archive. This is only supported when linkCreation is 'script' or 'none'.
84
+ * archive. This is only supported when {@link IExtractorOptions.linkCreation} is 'script' or 'none'.
85
85
  */
86
86
  createArchiveOnly?: boolean;
87
87
  /**
@@ -121,6 +121,11 @@ export declare interface IExtractorOptions {
121
121
  * "none": Do nothing; some other tool may create the links later, based on the extractor-metadata.json file.
122
122
  */
123
123
  linkCreation?: 'default' | 'script' | 'none';
124
+ /**
125
+ * The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation}
126
+ * is 'script'.
127
+ */
128
+ linkCreationScriptPath?: string;
124
129
  /**
125
130
  * An additional folder containing files which will be copied into the root of the extraction.
126
131
  */
@@ -107,6 +107,8 @@ __webpack_require__.r(__webpack_exports__);
107
107
  /* eslint-disable no-console */
108
108
 
109
109
 
110
+ const TARGET_ROOT_SCRIPT_RELATIVE_PATH = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';
111
+ const TARGET_ROOT_FOLDER = path__WEBPACK_IMPORTED_MODULE_1__.resolve(__dirname, TARGET_ROOT_SCRIPT_RELATIVE_PATH);
110
112
  // API borrowed from @rushstack/node-core-library, since this script avoids using any
111
113
  // NPM dependencies.
112
114
  class FileSystem {
@@ -191,21 +193,20 @@ function main() {
191
193
  showUsage();
192
194
  return false;
193
195
  }
194
- const targetRootFolder = __dirname;
195
- const extractorMetadataPath = path__WEBPACK_IMPORTED_MODULE_1__.join(targetRootFolder, 'extractor-metadata.json');
196
+ const extractorMetadataPath = `${__dirname}/extractor-metadata.json`;
196
197
  if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(extractorMetadataPath)) {
197
198
  throw new Error('Input file not found: ' + extractorMetadataPath);
198
199
  }
199
200
  const extractorMetadataJson = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(extractorMetadataPath).toString();
200
201
  const extractorMetadataObject = JSON.parse(extractorMetadataJson);
201
202
  if (args[0] === 'create') {
202
- console.log(`\nCreating links for extraction at path "${targetRootFolder}"`);
203
- removeLinks(targetRootFolder, extractorMetadataObject);
204
- createLinks(targetRootFolder, extractorMetadataObject);
203
+ console.log(`\nCreating links for extraction at path "${TARGET_ROOT_FOLDER}"`);
204
+ removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);
205
+ createLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);
205
206
  }
206
207
  else {
207
- console.log(`\nRemoving links for extraction at path "${targetRootFolder}"`);
208
- removeLinks(targetRootFolder, extractorMetadataObject);
208
+ console.log(`\nRemoving links for extraction at path "${TARGET_ROOT_FOLDER}"`);
209
+ removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);
209
210
  }
210
211
  console.log('The operation completed successfully.');
211
212
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"create-links.js","mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACyB;AACI;AAC7B;AACA;AACA;AACA;AACA,QAAQ,2CAAc;AACtB;AACA;AACA,QAAQ,2CAAc;AACtB;AACA;AACA,QAAQ,2CAAc;AACtB;AACA;AACA,QAAQ,wCAAW;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,0CAAa;AACrB;AACA;AACA,uBAAuB,yCAAY;AACnC;AACA;AACA;AACA,IAAI,yCAAY;AAChB;AACA;AACA;AACA;AACA,4BAA4B,sCAAS;AACrC,YAAY,0CAAa;AACzB,YAAY,0CAAa;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sCAAS;AACrC,+BAA+B,sCAAS;AACxC;AACA,qBAAqB,yCAAY;AACjC;AACA;AACA;AACA;AACA,wDAAwD,6BAA6B;AACrF;AACA;AACA;AACA;AACA;AACA,4CAA4C,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,6BAA6B;AACnF;AACA;AACA,oDAAoD,6BAA6B;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,sCAAS;AAC3C,SAAS,0CAAa;AACtB;AACA;AACA,kCAAkC,4CAAe;AACjD;AACA;AACA,gEAAgE,iBAAiB;AACjF;AACA;AACA;AACA;AACA,gEAAgE,iBAAiB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wC","sources":["webpack://@rushstack/package-extractor/external node-commonjs \"fs\"","webpack://@rushstack/package-extractor/external node-commonjs \"path\"","webpack://@rushstack/package-extractor/webpack/bootstrap","webpack://@rushstack/package-extractor/webpack/runtime/compat get default export","webpack://@rushstack/package-extractor/webpack/runtime/define property getters","webpack://@rushstack/package-extractor/webpack/runtime/hasOwnProperty shorthand","webpack://@rushstack/package-extractor/webpack/runtime/make namespace object","webpack://@rushstack/package-extractor/./lib-esnext/scripts/create-links.js"],"sourcesContent":["module.exports = require(\"fs\");","module.exports = require(\"path\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n// THIS SCRIPT IS GENERATED BY THE \"rush deploy\" COMMAND.\n/* eslint-disable no-console */\nimport * as fs from 'fs';\nimport * as path from 'path';\n// API borrowed from @rushstack/node-core-library, since this script avoids using any\n// NPM dependencies.\nclass FileSystem {\n static createSymbolicLinkJunction(options) {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'junction');\n }\n static createSymbolicLinkFile(options) {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'file');\n }\n static createSymbolicLinkFolder(options) {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'dir');\n }\n static createHardLink(options) {\n fs.linkSync(options.linkTargetPath, options.newLinkPath);\n }\n}\nfunction ensureFolder(folderPath) {\n if (!folderPath) {\n return;\n }\n if (fs.existsSync(folderPath)) {\n return;\n }\n const parentPath = path.dirname(folderPath);\n if (parentPath && parentPath !== folderPath) {\n ensureFolder(parentPath);\n }\n fs.mkdirSync(folderPath);\n}\nfunction removeLinks(targetRootFolder, extractorMetadataObject) {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath = path.join(targetRootFolder, linkInfo.linkPath);\n if (fs.existsSync(newLinkPath)) {\n fs.unlinkSync(newLinkPath);\n }\n }\n}\nfunction createLinks(targetRootFolder, extractorMetadataObject) {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath = path.join(targetRootFolder, linkInfo.linkPath);\n const linkTargetPath = path.join(targetRootFolder, linkInfo.targetPath);\n // Make sure the containing folder exists\n ensureFolder(path.dirname(newLinkPath));\n // NOTE: This logic is based on NpmLinkManager._createSymlink()\n if (process.platform === 'win32') {\n if (linkInfo.kind === 'folderLink') {\n // For directories, we use a Windows \"junction\". On Unix, this produces a regular symlink.\n FileSystem.createSymbolicLinkJunction({ newLinkPath, linkTargetPath });\n }\n else {\n // For files, we use a Windows \"hard link\", because creating a symbolic link requires\n // administrator permission.\n // NOTE: We cannot use the relative path for hard links\n FileSystem.createHardLink({ newLinkPath, linkTargetPath });\n }\n }\n else {\n // However hard links seem to cause build failures on Mac, so for all other operating systems\n // we use symbolic links for this case.\n if (linkInfo.kind === 'folderLink') {\n FileSystem.createSymbolicLinkFolder({ newLinkPath, linkTargetPath });\n }\n else {\n FileSystem.createSymbolicLinkFile({ newLinkPath, linkTargetPath });\n }\n }\n }\n}\nfunction showUsage() {\n console.log('Usage:');\n console.log(' node create-links.js create');\n console.log(' node create-links.js remove');\n console.log('\\nCreates or removes the symlinks for the output folder created by \"rush deploy\".');\n console.log('The link information is read from \"extractor-metadata.json\" in the same folder.');\n}\nfunction main() {\n // Example: [ \"node.exe\", \"create-links.js\", \"\"create\" ]\n const args = process.argv.slice(2);\n if (args.length !== 1 || (args[0] !== 'create' && args[0] !== 'remove')) {\n showUsage();\n return false;\n }\n const targetRootFolder = __dirname;\n const extractorMetadataPath = path.join(targetRootFolder, 'extractor-metadata.json');\n if (!fs.existsSync(extractorMetadataPath)) {\n throw new Error('Input file not found: ' + extractorMetadataPath);\n }\n const extractorMetadataJson = fs.readFileSync(extractorMetadataPath).toString();\n const extractorMetadataObject = JSON.parse(extractorMetadataJson);\n if (args[0] === 'create') {\n console.log(`\\nCreating links for extraction at path \"${targetRootFolder}\"`);\n removeLinks(targetRootFolder, extractorMetadataObject);\n createLinks(targetRootFolder, extractorMetadataObject);\n }\n else {\n console.log(`\\nRemoving links for extraction at path \"${targetRootFolder}\"`);\n removeLinks(targetRootFolder, extractorMetadataObject);\n }\n console.log('The operation completed successfully.');\n return true;\n}\ntry {\n process.exitCode = 1;\n if (main()) {\n process.exitCode = 0;\n }\n}\ncatch (error) {\n console.log('ERROR: ' + error);\n}\n//# sourceMappingURL=create-links.js.map"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"create-links.js","mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACyB;AACI;AAC7B,2CAA2C,iCAAiC;AAC5E,2BAA2B,yCAAY;AACvC;AACA;AACA;AACA;AACA,QAAQ,2CAAc;AACtB;AACA;AACA,QAAQ,2CAAc;AACtB;AACA;AACA,QAAQ,2CAAc;AACtB;AACA;AACA,QAAQ,wCAAW;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,0CAAa;AACrB;AACA;AACA,uBAAuB,yCAAY;AACnC;AACA;AACA;AACA,IAAI,yCAAY;AAChB;AACA;AACA;AACA;AACA,4BAA4B,sCAAS;AACrC,YAAY,0CAAa;AACzB,YAAY,0CAAa;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sCAAS;AACrC,+BAA+B,sCAAS;AACxC;AACA,qBAAqB,yCAAY;AACjC;AACA;AACA;AACA;AACA,wDAAwD,6BAA6B;AACrF;AACA;AACA;AACA;AACA;AACA,4CAA4C,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,6BAA6B;AACnF;AACA;AACA,oDAAoD,6BAA6B;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,UAAU;AAC/C,SAAS,0CAAa;AACtB;AACA;AACA,kCAAkC,4CAAe;AACjD;AACA;AACA,gEAAgE,mBAAmB;AACnF;AACA;AACA;AACA;AACA,gEAAgE,mBAAmB;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wC","sources":["webpack://@rushstack/package-extractor/external node-commonjs \"fs\"","webpack://@rushstack/package-extractor/external node-commonjs \"path\"","webpack://@rushstack/package-extractor/webpack/bootstrap","webpack://@rushstack/package-extractor/webpack/runtime/compat get default export","webpack://@rushstack/package-extractor/webpack/runtime/define property getters","webpack://@rushstack/package-extractor/webpack/runtime/hasOwnProperty shorthand","webpack://@rushstack/package-extractor/webpack/runtime/make namespace object","webpack://@rushstack/package-extractor/./lib-esnext/scripts/create-links.js"],"sourcesContent":["module.exports = require(\"fs\");","module.exports = require(\"path\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n// THIS SCRIPT IS GENERATED BY THE \"rush deploy\" COMMAND.\n/* eslint-disable no-console */\nimport * as fs from 'fs';\nimport * as path from 'path';\nconst TARGET_ROOT_SCRIPT_RELATIVE_PATH = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';\nconst TARGET_ROOT_FOLDER = path.resolve(__dirname, TARGET_ROOT_SCRIPT_RELATIVE_PATH);\n// API borrowed from @rushstack/node-core-library, since this script avoids using any\n// NPM dependencies.\nclass FileSystem {\n static createSymbolicLinkJunction(options) {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'junction');\n }\n static createSymbolicLinkFile(options) {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'file');\n }\n static createSymbolicLinkFolder(options) {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'dir');\n }\n static createHardLink(options) {\n fs.linkSync(options.linkTargetPath, options.newLinkPath);\n }\n}\nfunction ensureFolder(folderPath) {\n if (!folderPath) {\n return;\n }\n if (fs.existsSync(folderPath)) {\n return;\n }\n const parentPath = path.dirname(folderPath);\n if (parentPath && parentPath !== folderPath) {\n ensureFolder(parentPath);\n }\n fs.mkdirSync(folderPath);\n}\nfunction removeLinks(targetRootFolder, extractorMetadataObject) {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath = path.join(targetRootFolder, linkInfo.linkPath);\n if (fs.existsSync(newLinkPath)) {\n fs.unlinkSync(newLinkPath);\n }\n }\n}\nfunction createLinks(targetRootFolder, extractorMetadataObject) {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath = path.join(targetRootFolder, linkInfo.linkPath);\n const linkTargetPath = path.join(targetRootFolder, linkInfo.targetPath);\n // Make sure the containing folder exists\n ensureFolder(path.dirname(newLinkPath));\n // NOTE: This logic is based on NpmLinkManager._createSymlink()\n if (process.platform === 'win32') {\n if (linkInfo.kind === 'folderLink') {\n // For directories, we use a Windows \"junction\". On Unix, this produces a regular symlink.\n FileSystem.createSymbolicLinkJunction({ newLinkPath, linkTargetPath });\n }\n else {\n // For files, we use a Windows \"hard link\", because creating a symbolic link requires\n // administrator permission.\n // NOTE: We cannot use the relative path for hard links\n FileSystem.createHardLink({ newLinkPath, linkTargetPath });\n }\n }\n else {\n // However hard links seem to cause build failures on Mac, so for all other operating systems\n // we use symbolic links for this case.\n if (linkInfo.kind === 'folderLink') {\n FileSystem.createSymbolicLinkFolder({ newLinkPath, linkTargetPath });\n }\n else {\n FileSystem.createSymbolicLinkFile({ newLinkPath, linkTargetPath });\n }\n }\n }\n}\nfunction showUsage() {\n console.log('Usage:');\n console.log(' node create-links.js create');\n console.log(' node create-links.js remove');\n console.log('\\nCreates or removes the symlinks for the output folder created by \"rush deploy\".');\n console.log('The link information is read from \"extractor-metadata.json\" in the same folder.');\n}\nfunction main() {\n // Example: [ \"node.exe\", \"create-links.js\", \"\"create\" ]\n const args = process.argv.slice(2);\n if (args.length !== 1 || (args[0] !== 'create' && args[0] !== 'remove')) {\n showUsage();\n return false;\n }\n const extractorMetadataPath = `${__dirname}/extractor-metadata.json`;\n if (!fs.existsSync(extractorMetadataPath)) {\n throw new Error('Input file not found: ' + extractorMetadataPath);\n }\n const extractorMetadataJson = fs.readFileSync(extractorMetadataPath).toString();\n const extractorMetadataObject = JSON.parse(extractorMetadataJson);\n if (args[0] === 'create') {\n console.log(`\\nCreating links for extraction at path \"${TARGET_ROOT_FOLDER}\"`);\n removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);\n createLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);\n }\n else {\n console.log(`\\nRemoving links for extraction at path \"${TARGET_ROOT_FOLDER}\"`);\n removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);\n }\n console.log('The operation completed successfully.');\n return true;\n}\ntry {\n process.exitCode = 1;\n if (main()) {\n process.exitCode = 0;\n }\n}\ncatch (error) {\n console.log('ERROR: ' + error);\n}\n//# sourceMappingURL=create-links.js.map"],"names":[],"sourceRoot":""}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.6"
8
+ "packageVersion": "7.47.8"
9
9
  }
10
10
  ]
11
11
  }
@@ -12,6 +12,7 @@ declare module 'npm-packlist' {
12
12
  start(): void;
13
13
  }
14
14
  }
15
+ export declare const TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING: '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';
15
16
  /**
16
17
  * Part of the extractor-matadata.json file format. Represents an extracted project.
17
18
  *
@@ -165,7 +166,7 @@ export interface IExtractorOptions {
165
166
  createArchiveFilePath?: string;
166
167
  /**
167
168
  * Whether to skip copying files to the extraction target directory, and only create an extraction
168
- * archive. This is only supported when linkCreation is 'script' or 'none'.
169
+ * archive. This is only supported when {@link IExtractorOptions.linkCreation} is 'script' or 'none'.
169
170
  */
170
171
  createArchiveOnly?: boolean;
171
172
  /**
@@ -205,6 +206,11 @@ export interface IExtractorOptions {
205
206
  * "none": Do nothing; some other tool may create the links later, based on the extractor-metadata.json file.
206
207
  */
207
208
  linkCreation?: 'default' | 'script' | 'none';
209
+ /**
210
+ * The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation}
211
+ * is 'script'.
212
+ */
213
+ linkCreationScriptPath?: string;
208
214
  /**
209
215
  * An additional folder containing files which will be copied into the root of the extraction.
210
216
  */
@@ -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,CAA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kBAAkB;CAuCjC"}
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  return (mod && mod.__esModule) ? mod : { "default": mod };
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.PackageExtractor = void 0;
31
+ exports.PackageExtractor = exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING = void 0;
32
32
  const path = __importStar(require("path"));
33
33
  const fs = __importStar(require("fs"));
34
34
  const minimatch_1 = require("minimatch");
@@ -42,6 +42,7 @@ const ArchiveManager_1 = require("./ArchiveManager");
42
42
  const SymlinkAnalyzer_1 = require("./SymlinkAnalyzer");
43
43
  const Utils_1 = require("./Utils");
44
44
  const PathConstants_1 = require("./PathConstants");
45
+ exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';
45
46
  /**
46
47
  * Manages the business logic for the "rush deploy" command.
47
48
  *
@@ -159,7 +160,7 @@ class PackageExtractor {
159
160
  }
160
161
  async _performExtractionAsync(options, state) {
161
162
  var _a;
162
- const { terminal, mainProjectName, sourceRootFolder, targetRootFolder, folderToCopy: additionalFolderToCopy, linkCreation } = options;
163
+ const { terminal, mainProjectName, sourceRootFolder, targetRootFolder, folderToCopy: additionalFolderToCopy, linkCreation, linkCreationScriptPath, createArchiveOnly } = options;
163
164
  const { projectConfigurationsByName, foldersToCopy, symlinkAnalyzer } = state;
164
165
  const mainProjectConfiguration = projectConfigurationsByName.get(mainProjectName);
165
166
  if (!mainProjectConfiguration) {
@@ -182,7 +183,7 @@ class PackageExtractor {
182
183
  terminal.writeLine(terminal_1.Colorize.cyan(`Analyzing project: ${projectName}`));
183
184
  await this._collectFoldersAsync(projectFolder, options, state);
184
185
  }
185
- if (!options.createArchiveOnly) {
186
+ if (!createArchiveOnly) {
186
187
  terminal.writeLine(`Copying folders to target folder "${targetRootFolder}"`);
187
188
  }
188
189
  await node_core_library_1.Async.forEachAsync(foldersToCopy, async (folderToCopy) => {
@@ -194,23 +195,26 @@ class PackageExtractor {
194
195
  // Copy the additional folder directly into the root of the target folder by setting the sourceRootFolder
195
196
  // to the root of the folderToCopy
196
197
  const additionalFolderPath = path.resolve(sourceRootFolder, additionalFolderToCopy);
197
- const additionalFolderExtractorOptions = Object.assign(Object.assign({}, options), { sourceRootFolder: additionalFolderPath, targetRootFolder: options.targetRootFolder });
198
+ const additionalFolderExtractorOptions = Object.assign(Object.assign({}, options), { sourceRootFolder: additionalFolderPath, targetRootFolder });
198
199
  await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state);
199
200
  }
200
201
  switch (linkCreation) {
201
202
  case 'script': {
202
- const sourceFilePath = path.join(PathConstants_1.scriptsFolderPath, PathConstants_1.createLinksScriptFilename);
203
- if (!options.createArchiveOnly) {
204
- terminal.writeLine(`Creating ${PathConstants_1.createLinksScriptFilename}`);
205
- await node_core_library_1.FileSystem.copyFileAsync({
206
- sourcePath: sourceFilePath,
207
- destinationPath: path.join(targetRootFolder, PathConstants_1.createLinksScriptFilename),
208
- alreadyExistsBehavior: node_core_library_1.AlreadyExistsBehavior.Error
203
+ terminal.writeLine(`Creating ${PathConstants_1.createLinksScriptFilename}`);
204
+ const createLinksSourceFilePath = `${PathConstants_1.scriptsFolderPath}/${PathConstants_1.createLinksScriptFilename}`;
205
+ const createLinksTargetFilePath = linkCreationScriptPath
206
+ ? path.resolve(targetRootFolder, linkCreationScriptPath)
207
+ : `${targetRootFolder}/${PathConstants_1.createLinksScriptFilename}`;
208
+ let createLinksScriptContent = await node_core_library_1.FileSystem.readFileAsync(createLinksSourceFilePath);
209
+ createLinksScriptContent = createLinksScriptContent.replace(exports.TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING, node_core_library_1.Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder)));
210
+ if (!createArchiveOnly) {
211
+ await node_core_library_1.FileSystem.writeFileAsync(createLinksTargetFilePath, createLinksScriptContent, {
212
+ ensureFolderExists: true
209
213
  });
210
214
  }
211
215
  await ((_a = state.archiver) === null || _a === void 0 ? void 0 : _a.addToArchiveAsync({
212
- filePath: sourceFilePath,
213
- archivePath: PathConstants_1.createLinksScriptFilename
216
+ fileData: createLinksScriptContent,
217
+ archivePath: path.relative(targetRootFolder, createLinksTargetFilePath)
214
218
  }));
215
219
  break;
216
220
  }
@@ -629,10 +633,13 @@ class PackageExtractor {
629
633
  */
630
634
  async _writeExtractorMetadataAsync(options, state) {
631
635
  var _a;
632
- const { mainProjectName, targetRootFolder } = options;
636
+ const { mainProjectName, targetRootFolder, linkCreation, linkCreationScriptPath } = options;
633
637
  const { projectConfigurationsByPath } = state;
634
638
  const extractorMetadataFileName = 'extractor-metadata.json';
635
- const extractorMetadataFilePath = path.join(targetRootFolder, extractorMetadataFileName);
639
+ const extractorMetadataFolderPath = linkCreation === 'script' && linkCreationScriptPath
640
+ ? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath))
641
+ : targetRootFolder;
642
+ const extractorMetadataFilePath = path.join(extractorMetadataFolderPath, extractorMetadataFileName);
636
643
  const extractorMetadataJson = {
637
644
  mainProjectName,
638
645
  projects: [],
@@ -657,12 +664,12 @@ class PackageExtractor {
657
664
  }
658
665
  const extractorMetadataFileContent = JSON.stringify(extractorMetadataJson, undefined, 0);
659
666
  if (!options.createArchiveOnly) {
660
- await node_core_library_1.FileSystem.writeFileAsync(extractorMetadataFilePath, extractorMetadataFileContent);
667
+ await node_core_library_1.FileSystem.writeFileAsync(extractorMetadataFilePath, extractorMetadataFileContent, {
668
+ ensureFolderExists: true
669
+ });
661
670
  }
662
- await ((_a = state.archiver) === null || _a === void 0 ? void 0 : _a.addToArchiveAsync({
663
- fileData: extractorMetadataFileContent,
664
- archivePath: extractorMetadataFileName
665
- }));
671
+ const archivePath = path.relative(targetRootFolder, extractorMetadataFilePath);
672
+ await ((_a = state.archiver) === null || _a === void 0 ? void 0 : _a.addToArchiveAsync({ archivePath, fileData: extractorMetadataFileContent }));
666
673
  }
667
674
  async _makeBinLinksAsync(options, state) {
668
675
  const { terminal } = options;
@@ -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;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;YACtE,MAAM,MAAM,GAAuB,IAAI,sBAAW,CAAC,MAAM,CAAC;gBACxD,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QACzD,CAAC,CACF,CAAC;QACF,MAAM,YAAY,GAAa,MAAM,aAAa,CAAC;QACnD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAY,CAAC,OAA0B;QAClD,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,EACJ,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACzB,G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gB,EAAE,WAAW,CAAC;qBAClE,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,EACD;YACE,WAAW,EAAE,EAAE;SAChB,CACF,CAAC;IACJ,CAAC;CACF;AAvzBD,4CAuzBC","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[] =\n await FileSystem.readFolderItemNamesAsync(extractedProjectBinFolder);\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,oEAQsC;AACtC,kDAA+D;AAE/D,qDAAkD;AAClD,uDAAmF;AACnF,mCAA0C;AAC1C,mDAA+E;AAalE,QAAA,gDAAgD,GAC3D,oCAAoC,CAAC;AA8PvC;;;;GAIG;AACH,MAAa,gBAAgB;IAC3B;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,eAAuB;QACtE,qGAAqG;QACrG,+CAA+C;QAC/C,MAAM,aAAa,GAAsB,IAAI,OAAO,CAClD,CAAC,OAAmC,EAAE,MAA8B,EAAE,EAAE;YACtE,MAAM,MAAM,GAAuB,IAAI,sBAAW,CAAC,MAAM,CAAC;gBACxD,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QACzD,CAAC,CACF,CAAC;QACF,MAAM,YAAY,GAAa,MAAM,aAAa,CAAC;QACnD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAY,CAAC,OAA0B;QAClD,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,EACJ,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACzB,GAAG,OAAO,CAAC;QAEZ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C,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,GAClB,MAAM,8BAAU,CAAC,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;gBACvE,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;AAv0BD,4CAu0BC","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 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\nexport const TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING: '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}' =\n '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';\n\n/**\n * Part of the extractor-matadata.json file format. Represents an extracted project.\n *\n * @public\n */\nexport interface IProjectInfoJson {\n /**\n * The name of the project as specified in its package.json file.\n */\n projectName: string;\n /**\n * This path is relative to the root of the extractor output folder\n */\n path: string;\n}\n\n/**\n * The extractor-metadata.json file format.\n *\n * @public\n */\nexport interface IExtractorMetadataJson {\n /**\n * The name of the main project the extraction was performed for.\n */\n mainProjectName: string;\n /**\n * A list of all projects that were extracted.\n */\n projects: IProjectInfoJson[];\n /**\n * A list of all links that are part of the extracted project.\n */\n links: ILinkInfo[];\n}\n\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 {@link IExtractorOptions.linkCreation} is 'script' or 'none'.\n */\n createArchiveOnly?: boolean;\n\n /**\n * The pnpmfile configuration if using PNPM, otherwise `undefined`. The configuration will be used to\n * transform the package.json prior to extraction.\n *\n * @remarks\n * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure\n * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches\n * cannot be combined.\n */\n transformPackageJson?: (packageJson: IPackageJson) => IPackageJson;\n\n /**\n * If dependencies from the \"devDependencies\" package.json field should be included in the extraction.\n */\n includeDevDependencies?: boolean;\n\n /**\n * If files ignored by the .npmignore file should be included in the extraction.\n */\n includeNpmIgnoreFiles?: boolean;\n\n /**\n * The folder where the PNPM \"node_modules\" folder is located. This is used to resolve packages linked\n * to the PNPM virtual store.\n *\n * @remarks\n * When Rush subspaces are enabled, this setting applies to `default` subspace only. To configure\n * each subspace, use the {@link IExtractorOptions.subspaces} array instead. The two approaches\n * cannot be combined.\n */\n pnpmInstallFolder?: string;\n\n /**\n * The link creation mode to use.\n * \"default\": Create the links while copying the files; this is the default behavior. Use this setting\n * if your file copy tool can handle links correctly.\n * \"script\": A Node.js script called create-links.js will be written to the target folder. Use this setting\n * to create links on the server machine, after the files have been uploaded.\n * \"none\": Do nothing; some other tool may create the links later, based on the extractor-metadata.json file.\n */\n linkCreation?: 'default' | 'script' | 'none';\n\n /**\n * The path to the generated link creation script. This is only used when {@link IExtractorOptions.linkCreation}\n * is 'script'.\n */\n linkCreationScriptPath?: string;\n\n /**\n * An additional folder containing files which will be copied into the root of the extraction.\n */\n folderToCopy?: string;\n\n /**\n * Configurations for individual projects, keyed by the project path relative to the sourceRootFolder.\n */\n projectConfigurations: IExtractorProjectConfiguration[];\n\n /**\n * Configurations for individual dependencies.\n */\n dependencyConfigurations?: IExtractorDependencyConfiguration[];\n\n /**\n * When using Rush subspaces, this setting can be used to provide configuration information for each\n * individual subspace.\n *\n * @remarks\n * To avoid confusion, if this setting is used, then the {@link IExtractorOptions.transformPackageJson} and\n * {@link IExtractorOptions.pnpmInstallFolder} settings must not be used.\n */\n subspaces?: IExtractorSubspace[];\n}\n\n/**\n * Manages the business logic for the \"rush deploy\" command.\n *\n * @public\n */\nexport class PackageExtractor {\n /**\n * Get a list of files that would be included in a package created from the provided package root path.\n *\n * @beta\n */\n public static async getPackageIncludedFilesAsync(packageRootPath: string): Promise<string[]> {\n // Use npm-packlist to filter the files. Using the Walker class (instead of the default API) ensures\n // that \"bundledDependencies\" are not included.\n const walkerPromise: Promise<string[]> = new Promise<string[]>(\n (resolve: (result: string[]) => void, reject: (error: Error) => void) => {\n const walker: npmPacklist.Walker = new npmPacklist.Walker({\n path: packageRootPath\n });\n walker.on('done', resolve).on('error', reject).start();\n }\n );\n const npmPackFiles: string[] = await walkerPromise;\n return npmPackFiles;\n }\n\n /**\n * Extract a package using the provided options\n */\n public async extractAsync(options: IExtractorOptions): Promise<void> {\n options = PackageExtractor._normalizeOptions(options);\n const {\n terminal,\n projectConfigurations,\n sourceRootFolder,\n targetRootFolder,\n mainProjectName,\n overwriteExisting,\n 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 linkCreationScriptPath,\n createArchiveOnly\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 (!createArchiveOnly) {\n terminal.writeLine(`Copying folders to target folder \"${targetRootFolder}\"`);\n }\n await Async.forEachAsync(\n foldersToCopy,\n async (folderToCopy: string) => {\n await this._extractFolderAsync(folderToCopy, options, state);\n },\n {\n concurrency: 10\n }\n );\n\n if (additionalFolderToCopy) {\n // Copy the additional folder directly into the root of the target folder by setting the sourceRootFolder\n // to the root of the folderToCopy\n const additionalFolderPath: string = path.resolve(sourceRootFolder, additionalFolderToCopy);\n const additionalFolderExtractorOptions: IExtractorOptions = {\n ...options,\n sourceRootFolder: additionalFolderPath,\n targetRootFolder\n };\n await this._extractFolderAsync(additionalFolderPath, additionalFolderExtractorOptions, state);\n }\n\n switch (linkCreation) {\n case 'script': {\n terminal.writeLine(`Creating ${createLinksScriptFilename}`);\n const createLinksSourceFilePath: string = `${scriptsFolderPath}/${createLinksScriptFilename}`;\n const createLinksTargetFilePath: string = linkCreationScriptPath\n ? path.resolve(targetRootFolder, linkCreationScriptPath)\n : `${targetRootFolder}/${createLinksScriptFilename}`;\n let createLinksScriptContent: string = await FileSystem.readFileAsync(createLinksSourceFilePath);\n createLinksScriptContent = createLinksScriptContent.replace(\n TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING,\n Path.convertToSlashes(path.relative(path.dirname(createLinksTargetFilePath), targetRootFolder))\n );\n if (!createArchiveOnly) {\n await FileSystem.writeFileAsync(createLinksTargetFilePath, createLinksScriptContent, {\n ensureFolderExists: true\n });\n }\n await state.archiver?.addToArchiveAsync({\n fileData: createLinksScriptContent,\n archivePath: path.relative(targetRootFolder, createLinksTargetFilePath)\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, linkCreation, linkCreationScriptPath } = options;\n const { projectConfigurationsByPath } = state;\n\n const extractorMetadataFileName: string = 'extractor-metadata.json';\n const extractorMetadataFolderPath: string =\n linkCreation === 'script' && linkCreationScriptPath\n ? path.dirname(path.resolve(targetRootFolder, linkCreationScriptPath))\n : targetRootFolder;\n const extractorMetadataFilePath: string = path.join(\n extractorMetadataFolderPath,\n extractorMetadataFileName\n );\n const extractorMetadataJson: IExtractorMetadataJson = {\n mainProjectName,\n projects: [],\n links: []\n };\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 ensureFolderExists: true\n });\n }\n\n const archivePath: string = path.relative(targetRootFolder, extractorMetadataFilePath);\n await state.archiver?.addToArchiveAsync({ archivePath, fileData: extractorMetadataFileContent });\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[] =\n await FileSystem.readFolderItemNamesAsync(extractedProjectBinFolder);\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"]}
@@ -29,6 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  /* eslint-disable no-console */
30
30
  const fs = __importStar(require("fs"));
31
31
  const path = __importStar(require("path"));
32
+ const TARGET_ROOT_SCRIPT_RELATIVE_PATH = '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';
33
+ const TARGET_ROOT_FOLDER = path.resolve(__dirname, TARGET_ROOT_SCRIPT_RELATIVE_PATH);
32
34
  // API borrowed from @rushstack/node-core-library, since this script avoids using any
33
35
  // NPM dependencies.
34
36
  class FileSystem {
@@ -113,21 +115,20 @@ function main() {
113
115
  showUsage();
114
116
  return false;
115
117
  }
116
- const targetRootFolder = __dirname;
117
- const extractorMetadataPath = path.join(targetRootFolder, 'extractor-metadata.json');
118
+ const extractorMetadataPath = `${__dirname}/extractor-metadata.json`;
118
119
  if (!fs.existsSync(extractorMetadataPath)) {
119
120
  throw new Error('Input file not found: ' + extractorMetadataPath);
120
121
  }
121
122
  const extractorMetadataJson = fs.readFileSync(extractorMetadataPath).toString();
122
123
  const extractorMetadataObject = JSON.parse(extractorMetadataJson);
123
124
  if (args[0] === 'create') {
124
- console.log(`\nCreating links for extraction at path "${targetRootFolder}"`);
125
- removeLinks(targetRootFolder, extractorMetadataObject);
126
- createLinks(targetRootFolder, extractorMetadataObject);
125
+ console.log(`\nCreating links for extraction at path "${TARGET_ROOT_FOLDER}"`);
126
+ removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);
127
+ createLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);
127
128
  }
128
129
  else {
129
- console.log(`\nRemoving links for extraction at path "${targetRootFolder}"`);
130
- removeLinks(targetRootFolder, extractorMetadataObject);
130
+ console.log(`\nRemoving links for extraction at path "${TARGET_ROOT_FOLDER}"`);
131
+ removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);
131
132
  }
132
133
  console.log('The operation completed successfully.');
133
134
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"create-links.js","sourceRoot":"","sources":["../../src/scripts/create-links.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,yDAAyD;AAEzD,+BAA+B;AAE/B,uCAAyB;AACzB,2CAA6B;AAI7B,qFAAqF;AACrF,oBAAoB;AACpB,MAAM,UAAU;IACP,MAAM,CAAC,0BAA0B,CAAC,OAAqC;QAC5E,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;IAEM,MAAM,CAAC,sBAAsB,CAAC,OAAqC;QACxE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAEM,MAAM,CAAC,wBAAwB,CAAC,OAAqC;QAC1E,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,OAAqC;QAChE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,SAAS,YAAY,CAAC,UAAkB;IACtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;IACT,CAAC;IACD,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,MAAM,UAAU,GAAW,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,IAAI,UAAU,IAAI,UAAU,KAAK,UAAU,E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;IAED,MAAM,qBAAqB,GAAW,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAAC;IACxF,MAAM,uBAAuB,GAA2B,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAE1F,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,4CAA4C,gBAAgB,GAAG,CAAC,CAAC;QAC7E,WAAW,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;QACvD,WAAW,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,4CAA4C,gBAAgB,GAAG,CAAC,CAAC;QAC7E,WAAW,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,IAAI,CAAC;IACH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACrB,IAAI,IAAI,EAAE,EAAE,CAAC;QACX,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// THIS SCRIPT IS GENERATED BY THE \"rush deploy\" COMMAND.\n\n/* eslint-disable no-console */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { IExtractorMetadataJson } from '../PackageExtractor';\nimport type { IFileSystemCreateLinkOptions } from '@rushstack/node-core-library';\n\n// API borrowed from @rushstack/node-core-library, since this script avoids using any\n// NPM dependencies.\nclass FileSystem {\n public static createSymbolicLinkJunction(options: IFileSystemCreateLinkOptions): void {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'junction');\n }\n\n public static createSymbolicLinkFile(options: IFileSystemCreateLinkOptions): void {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'file');\n }\n\n public static createSymbolicLinkFolder(options: IFileSystemCreateLinkOptions): void {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'dir');\n }\n\n public static createHardLink(options: IFileSystemCreateLinkOptions): void {\n fs.linkSync(options.linkTargetPath, options.newLinkPath);\n }\n}\n\nfunction ensureFolder(folderPath: string): void {\n if (!folderPath) {\n return;\n }\n if (fs.existsSync(folderPath)) {\n return;\n }\n const parentPath: string = path.dirname(folderPath);\n if (parentPath && parentPath !== folderPath) {\n ensureFolder(parentPath);\n }\n fs.mkdirSync(folderPath);\n}\n\nfunction removeLinks(targetRootFolder: string, extractorMetadataObject: IExtractorMetadataJson): void {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath: string = path.join(targetRootFolder, linkInfo.linkPath);\n if (fs.existsSync(newLinkPath)) {\n fs.unlinkSync(newLinkPath);\n }\n }\n}\n\nfunction createLinks(targetRootFolder: string, extractorMetadataObject: IExtractorMetadataJson): void {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath: string = path.join(targetRootFolder, linkInfo.linkPath);\n const linkTargetPath: string = path.join(targetRootFolder, linkInfo.targetPath);\n\n // Make sure the containing folder exists\n ensureFolder(path.dirname(newLinkPath));\n\n // NOTE: This logic is based on NpmLinkManager._createSymlink()\n if (process.platform === 'win32') {\n if (linkInfo.kind === 'folderLink') {\n // For directories, we use a Windows \"junction\". On Unix, this produces a regular symlink.\n FileSystem.createSymbolicLinkJunction({ newLinkPath, linkTargetPath });\n } else {\n // For files, we use a Windows \"hard link\", because creating a symbolic link requires\n // administrator permission.\n\n // NOTE: We cannot use the relative path for hard links\n FileSystem.createHardLink({ newLinkPath, linkTargetPath });\n }\n } else {\n // However hard links seem to cause build failures on Mac, so for all other operating systems\n // we use symbolic links for this case.\n if (linkInfo.kind === 'folderLink') {\n FileSystem.createSymbolicLinkFolder({ newLinkPath, linkTargetPath });\n } else {\n FileSystem.createSymbolicLinkFile({ newLinkPath, linkTargetPath });\n }\n }\n }\n}\n\nfunction showUsage(): void {\n console.log('Usage:');\n console.log(' node create-links.js create');\n console.log(' node create-links.js remove');\n\n console.log('\\nCreates or removes the symlinks for the output folder created by \"rush deploy\".');\n console.log('The link information is read from \"extractor-metadata.json\" in the same folder.');\n}\n\nfunction main(): boolean {\n // Example: [ \"node.exe\", \"create-links.js\", \"\"create\" ]\n const args: string[] = process.argv.slice(2);\n\n if (args.length !== 1 || (args[0] !== 'create' && args[0] !== 'remove')) {\n showUsage();\n return false;\n }\n\n const targetRootFolder: string = __dirname;\n const extractorMetadataPath: string = path.join(targetRootFolder, 'extractor-metadata.json');\n\n if (!fs.existsSync(extractorMetadataPath)) {\n throw new Error('Input file not found: ' + extractorMetadataPath);\n }\n\n const extractorMetadataJson: string = fs.readFileSync(extractorMetadataPath).toString();\n const extractorMetadataObject: IExtractorMetadataJson = JSON.parse(extractorMetadataJson);\n\n if (args[0] === 'create') {\n console.log(`\\nCreating links for extraction at path \"${targetRootFolder}\"`);\n removeLinks(targetRootFolder, extractorMetadataObject);\n createLinks(targetRootFolder, extractorMetadataObject);\n } else {\n console.log(`\\nRemoving links for extraction at path \"${targetRootFolder}\"`);\n removeLinks(targetRootFolder, extractorMetadataObject);\n }\n\n console.log('The operation completed successfully.');\n return true;\n}\n\ntry {\n process.exitCode = 1;\n if (main()) {\n process.exitCode = 0;\n }\n} catch (error) {\n console.log('ERROR: ' + error);\n}\n"]}
1
+ {"version":3,"file":"create-links.js","sourceRoot":"","sources":["../../src/scripts/create-links.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,yDAAyD;AAEzD,+BAA+B;AAE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CAAC,GAAG,CAAC,4CAA4C,kBAAkB,GAAG,CAAC,CAAC;QAC/E,WAAW,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;QACzD,WAAW,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,4CAA4C,kBAAkB,GAAG,CAAC,CAAC;QAC/E,WAAW,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,IAAI,CAAC;IACH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACrB,IAAI,IAAI,EAAE,EAAE,CAAC;QACX,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// THIS SCRIPT IS GENERATED BY THE \"rush deploy\" COMMAND.\n\n/* eslint-disable no-console */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { IFileSystemCreateLinkOptions } from '@rushstack/node-core-library';\nimport type {\n TARGET_ROOT_SCRIPT_RELATIVE_PATH_TEMPLATE_STRING as TargetRootScriptRelativePathTemplateString,\n IExtractorMetadataJson\n} from '../PackageExtractor';\n\nconst TARGET_ROOT_SCRIPT_RELATIVE_PATH: typeof TargetRootScriptRelativePathTemplateString =\n '{TARGET_ROOT_SCRIPT_RELATIVE_PATH}';\nconst TARGET_ROOT_FOLDER: string = path.resolve(__dirname, TARGET_ROOT_SCRIPT_RELATIVE_PATH);\n\n// API borrowed from @rushstack/node-core-library, since this script avoids using any\n// NPM dependencies.\nclass FileSystem {\n public static createSymbolicLinkJunction(options: IFileSystemCreateLinkOptions): void {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'junction');\n }\n\n public static createSymbolicLinkFile(options: IFileSystemCreateLinkOptions): void {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'file');\n }\n\n public static createSymbolicLinkFolder(options: IFileSystemCreateLinkOptions): void {\n fs.symlinkSync(options.linkTargetPath, options.newLinkPath, 'dir');\n }\n\n public static createHardLink(options: IFileSystemCreateLinkOptions): void {\n fs.linkSync(options.linkTargetPath, options.newLinkPath);\n }\n}\n\nfunction ensureFolder(folderPath: string): void {\n if (!folderPath) {\n return;\n }\n if (fs.existsSync(folderPath)) {\n return;\n }\n const parentPath: string = path.dirname(folderPath);\n if (parentPath && parentPath !== folderPath) {\n ensureFolder(parentPath);\n }\n fs.mkdirSync(folderPath);\n}\n\nfunction removeLinks(targetRootFolder: string, extractorMetadataObject: IExtractorMetadataJson): void {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath: string = path.join(targetRootFolder, linkInfo.linkPath);\n if (fs.existsSync(newLinkPath)) {\n fs.unlinkSync(newLinkPath);\n }\n }\n}\n\nfunction createLinks(targetRootFolder: string, extractorMetadataObject: IExtractorMetadataJson): void {\n for (const linkInfo of extractorMetadataObject.links) {\n // Link to the relative path for symlinks\n const newLinkPath: string = path.join(targetRootFolder, linkInfo.linkPath);\n const linkTargetPath: string = path.join(targetRootFolder, linkInfo.targetPath);\n\n // Make sure the containing folder exists\n ensureFolder(path.dirname(newLinkPath));\n\n // NOTE: This logic is based on NpmLinkManager._createSymlink()\n if (process.platform === 'win32') {\n if (linkInfo.kind === 'folderLink') {\n // For directories, we use a Windows \"junction\". On Unix, this produces a regular symlink.\n FileSystem.createSymbolicLinkJunction({ newLinkPath, linkTargetPath });\n } else {\n // For files, we use a Windows \"hard link\", because creating a symbolic link requires\n // administrator permission.\n\n // NOTE: We cannot use the relative path for hard links\n FileSystem.createHardLink({ newLinkPath, linkTargetPath });\n }\n } else {\n // However hard links seem to cause build failures on Mac, so for all other operating systems\n // we use symbolic links for this case.\n if (linkInfo.kind === 'folderLink') {\n FileSystem.createSymbolicLinkFolder({ newLinkPath, linkTargetPath });\n } else {\n FileSystem.createSymbolicLinkFile({ newLinkPath, linkTargetPath });\n }\n }\n }\n}\n\nfunction showUsage(): void {\n console.log('Usage:');\n console.log(' node create-links.js create');\n console.log(' node create-links.js remove');\n\n console.log('\\nCreates or removes the symlinks for the output folder created by \"rush deploy\".');\n console.log('The link information is read from \"extractor-metadata.json\" in the same folder.');\n}\n\nfunction main(): boolean {\n // Example: [ \"node.exe\", \"create-links.js\", \"\"create\" ]\n const args: string[] = process.argv.slice(2);\n\n if (args.length !== 1 || (args[0] !== 'create' && args[0] !== 'remove')) {\n showUsage();\n return false;\n }\n\n const extractorMetadataPath: string = `${__dirname}/extractor-metadata.json`;\n if (!fs.existsSync(extractorMetadataPath)) {\n throw new Error('Input file not found: ' + extractorMetadataPath);\n }\n\n const extractorMetadataJson: string = fs.readFileSync(extractorMetadataPath).toString();\n const extractorMetadataObject: IExtractorMetadataJson = JSON.parse(extractorMetadataJson);\n\n if (args[0] === 'create') {\n console.log(`\\nCreating links for extraction at path \"${TARGET_ROOT_FOLDER}\"`);\n removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);\n createLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);\n } else {\n console.log(`\\nRemoving links for extraction at path \"${TARGET_ROOT_FOLDER}\"`);\n removeLinks(TARGET_ROOT_FOLDER, extractorMetadataObject);\n }\n\n console.log('The operation completed successfully.');\n return true;\n}\n\ntry {\n process.exitCode = 1;\n if (main()) {\n process.exitCode = 0;\n }\n} catch (error) {\n console.log('ERROR: ' + error);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/package-extractor",
3
- "version": "0.7.25",
3
+ "version": "0.8.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",
@@ -17,8 +17,8 @@
17
17
  "minimatch": "~3.0.3",
18
18
  "npm-packlist": "~2.1.2",
19
19
  "semver": "~7.5.4",
20
- "@rushstack/node-core-library": "5.7.0",
21
- "@rushstack/terminal": "0.14.0"
20
+ "@rushstack/node-core-library": "5.8.0",
21
+ "@rushstack/terminal": "0.14.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/glob": "7.1.1",
@@ -28,9 +28,9 @@
28
28
  "webpack": "~5.82.1",
29
29
  "@types/semver": "7.5.0",
30
30
  "local-node-rig": "1.0.0",
31
- "@rushstack/heft-webpack5-plugin": "0.10.9",
32
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.64",
33
- "@rushstack/heft": "0.67.0"
31
+ "@rushstack/heft-webpack5-plugin": "0.10.10",
32
+ "@rushstack/heft": "0.67.1",
33
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.65"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "heft build --clean",