@rushstack/rush-resolver-cache-plugin 5.133.0 → 5.133.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/afterInstallAsync.d.ts.map +1 -1
- package/lib/afterInstallAsync.js +5 -2
- package/lib/afterInstallAsync.js.map +1 -1
- package/lib/computeResolverCacheFromLockfileAsync.d.ts.map +1 -1
- package/lib/computeResolverCacheFromLockfileAsync.js +55 -2
- package/lib/computeResolverCacheFromLockfileAsync.js.map +1 -1
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +9 -5
- package/lib/helpers.js.map +1 -1
- package/lib/types.d.ts +2 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -4,4 +4,4 @@ A Rush plugin that runs after successful dependency installation and generates a
|
|
|
4
4
|
|
|
5
5
|
When this plugin is installed, it will produce a file called `resolver-cache.json` in the temp directory of the default subspace, e.g. `<repo>/common/temp/default/resolver-cache.json`
|
|
6
6
|
|
|
7
|
-
To use this file, load it, call JSON.parse, and pass the result as the `cacheData` property to the `WorkspaceLayoutCache` constructor from `@rushstack/webpack-workspace-resolve-plugin`.
|
|
7
|
+
To use this file, load it, call JSON.parse, and pass the result as the `cacheData` property to the `WorkspaceLayoutCache` constructor from `@rushstack/webpack-workspace-resolve-plugin`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afterInstallAsync.d.ts","sourceRoot":"","sources":["../src/afterInstallAsync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAEjB,OAAO,EAEP,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAgC7B;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"afterInstallAsync.d.ts","sourceRoot":"","sources":["../src/afterInstallAsync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAEjB,OAAO,EAEP,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAgC7B;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CA2Gf"}
|
package/lib/afterInstallAsync.js
CHANGED
|
@@ -76,8 +76,11 @@ async function afterInstallAsync(rushSession, rushConfiguration, subspace, logge
|
|
|
76
76
|
const { files } = JSON.parse(indexContent);
|
|
77
77
|
const filteredFiles = Object.keys(files).filter((file) => file.endsWith('/package.json'));
|
|
78
78
|
if (filteredFiles.length > 0) {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const nestedPackageDirs = filteredFiles.map((x) => x.slice(0, /* -'/package.json'.length */ -13));
|
|
80
|
+
if (nestedPackageDirs.length > 0) {
|
|
81
|
+
// eslint-disable-next-line require-atomic-updates
|
|
82
|
+
context.nestedPackageDirs = nestedPackageDirs;
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afterInstallAsync.js","sourceRoot":"","sources":["../src/afterInstallAsync.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAY3D,2CAAoE;AACpE,mGAGiD;AAGjD;;;GAGG;AACH,SAAS,eAAe;;IACtB,6EAA6E;IAC7E,qDAAqD;IACrD,MAAM,EACJ,QAAQ,EAAE,EAAE,EACZ,IAAI,EAAE,GAAG,EACT,mBAAmB;IACnB,8DAA8D;MAC/D,GAAG,MAAA,MAAC,MAAA,O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,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;oBACtB,MAAM,IAAI,KAAK,CACb,kCAAkC,OAAO,CAAC,mBAAmB,MAAM,mBAAmB,GAAG,CAC1F,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,SAAS,CAAC,4CAA4C,mBAAmB,EAAE,CAAC,CAAC;oBACtF,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;oBACrC,2BAA2B,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;gBACvD,CAAC;YACH,CAAC;QACH,CAAC;QAED,2EAA2E;QAC3E,0FAA0F;QAC1F,gFAAgF;QAChF,MAAM,iBAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,qCAAqC,EAAE;YACjF,WAAW,EAAE,EAAE;SAChB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,SAAS,GAAuB,MAAM,IAAA,6EAAqC,EAAC;QAChF,aAAa;QACb,kBAAkB,EAAE,QAAQ;QAC5B,YAAY,EAAE,eAAe,EAAE;QAC/B,qBAAqB;QACrB,QAAQ,EAAE,QAAQ;QAClB,0BAA0B;KAC3B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAW,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAErD,MAAM,sBAAU,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAE;QACzD,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAC;AACL,CAAC;AA5GD,8CA4GC","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 type {\n RushSession,\n RushConfiguration,\n RushConfigurationProject,\n ILogger,\n LookupByPath,\n Subspace\n} from '@rushstack/rush-sdk';\nimport type { IResolverCacheFile } from '@rushstack/webpack-workspace-resolve-plugin';\n\nimport { Async, FileSystem, PnpmShrinkwrapFile } from './externals';\nimport {\n computeResolverCacheFromLockfileAsync,\n type IPlatformInfo\n} from './computeResolverCacheFromLockfileAsync';\nimport type { IResolverContext } from './types';\n\n/**\n * Gets information used to determine compatibility of optional dependencies.\n * @returns Information about the platform Rush is running on\n */\nfunction getPlatformInfo(): IPlatformInfo {\n // Acquiring the libc version is a bit more obnoxious than platform and arch,\n // but all of them are ultimately on the same object.\n const {\n platform: os,\n arch: cpu,\n glibcVersionRuntime\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } = (process.report?.getReport() as any)?.header ?? process;\n const libc: 'glibc' | 'musl' = glibcVersionRuntime ? 'glibc' : 'musl';\n\n return {\n os,\n cpu,\n libc\n };\n}\n\n/**\n * Plugin entry point for after install.\n * @param rushSession - The Rush Session\n * @param rushConfiguration - The Rush Configuration\n * @param subspace - The subspace that was just installed\n * @param logger - The initialized logger\n */\nexport async function afterInstallAsync(\n rushSession: RushSession,\n rushConfiguration: RushConfiguration,\n subspace: Subspace,\n logger: ILogger\n): Promise<void> {\n const { terminal } = logger;\n const rushRoot: string = `${rushConfiguration.rushJsonFolder}/`;\n\n const lockFilePath: string = subspace.getCommittedShrinkwrapFilename();\n const workspaceRoot: string = subspace.getSubspaceTempFolderPath();\n\n const projectByImporterPath: LookupByPath<RushConfigurationProject> =\n rushConfiguration.getProjectLookupForRoot(workspaceRoot);\n\n const pnpmStoreDir: string = `${rushConfiguration.pnpmOptions.pnpmStorePath}/v3/files/`;\n\n terminal.writeLine(`Using pnpm-lock from: ${lockFilePath}`);\n terminal.writeLine(`Using pnpm store folder: ${pnpmStoreDir}`);\n\n const lockFile: PnpmShrinkwrapFile | undefined = PnpmShrinkwrapFile.loadFromFile(lockFilePath, {\n withCaching: true\n });\n if (!lockFile) {\n throw new Error(`Failed to load shrinkwrap file: ${lockFilePath}`);\n }\n\n const cacheFilePath: string = `${workspaceRoot}/resolver-cache.json`;\n\n terminal.writeLine(`Resolver cache will be written at ${cacheFilePath}`);\n\n async function afterExternalPackagesAsync(\n contexts: Map<string, IResolverContext>,\n missingOptionalDependencies: Set<string>\n ): Promise<void> {\n /**\n * Loads the index file from the pnpm store to discover nested package.json files in an external package\n * For internal packages, assumes there are no nested package.json files.\n * @param context - The context to find nested package.json files for\n * @returns A promise that resolves when the nested package.json files are found, if applicable\n */\n async function findNestedPackageJsonsForContextAsync(context: IResolverContext): Promise<void> {\n const { descriptionFileRoot, descriptionFileHash } = context;\n\n if (descriptionFileHash === undefined) {\n // Assume this package has no nested package json files for now.\n terminal.writeDebugLine(\n `Package at ${descriptionFileRoot} does not having a file list. Assuming no nested \"package.json\" files.`\n );\n return;\n }\n\n // Convert an integrity hash like\n // sha512-C6uiGQJ+Gt4RyHXXYt+v9f+SN1v83x68URwgxNQ98cvH8kxiuywWGP4XeNZ1paOzZ63aY3cTciCEQJNFUljlLw==\n // To its hex representation, e.g.\n // 0baba219027e1ade11c875d762dfaff5ff92375bfcdf1ebc511c20c4d43df1cbc7f24c62bb2c1618fe1778d675a5a3b367adda6377137220844093455258e52f\n const prefixIndex: number = descriptionFileHash.indexOf('-');\n const hash: string = Buffer.from(descriptionFileHash.slice(prefixIndex + 1), 'base64').toString('hex');\n\n // The pnpm store directory has index files of package contents at paths:\n // <store>/v3/files/<hash (0-2)>/<hash (2-)>-index.json\n // See https://github.com/pnpm/pnpm/blob/f394cfccda7bc519ceee8c33fc9b68a0f4235532/store/cafs/src/getFilePathInCafs.ts#L33\n const indexPath: string = `${pnpmStoreDir}${hash.slice(0, 2)}/${hash.slice(2)}-index.json`;\n\n try {\n const indexContent: string = await FileSystem.readFileAsync(indexPath);\n const { files } = JSON.parse(indexContent);\n\n const filteredFiles: string[] = Object.keys(files).filter((file) => file.endsWith('/package.json'));\n if (filteredFiles.length > 0) {\n // eslint-disable-next-line require-atomic-updates\n context.files = filteredFiles.map((x) => x.slice(0, -13));\n }\n } catch (error) {\n if (!context.optional) {\n throw new Error(\n `Error reading index file for: \"${context.descriptionFileRoot}\" (${descriptionFileHash})`\n );\n } else {\n terminal.writeLine(`Trimming missing optional dependency at: ${descriptionFileRoot}`);\n contexts.delete(descriptionFileRoot);\n missingOptionalDependencies.add(descriptionFileRoot);\n }\n }\n }\n\n // For external packages, update the contexts with data from the pnpm store\n // This gives us the list of nested package.json files, as well as the actual package name\n // We could also cache package.json contents, but that proves to be inefficient.\n await Async.forEachAsync(contexts.values(), findNestedPackageJsonsForContextAsync, {\n concurrency: 20\n });\n }\n\n const cacheFile: IResolverCacheFile = await computeResolverCacheFromLockfileAsync({\n workspaceRoot,\n commonPrefixToTrim: rushRoot,\n platformInfo: getPlatformInfo(),\n projectByImporterPath,\n lockfile: lockFile,\n afterExternalPackagesAsync\n });\n\n const serialized: string = JSON.stringify(cacheFile);\n\n await FileSystem.writeFileAsync(cacheFilePath, serialized, {\n ensureFolderExists: true\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"afterInstallAsync.js","sourceRoot":"","sources":["../src/afterInstallAsync.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAY3D,2CAAoE;AACpE,mGAGiD;AAGjD;;;GAGG;AACH,SAAS,eAAe;;IACtB,6EAA6E;IAC7E,qDAAqD;IACrD,MAAM,EACJ,QAAQ,EAAE,EAAE,EACZ,IAAI,EAAE,GAAG,EACT,mBAAmB;IACnB,8DAA8D;MAC/D,GAAG,MAAA,MAAC,MAAA,OAAO,CAAC,MAAM,0CAAE,SAAS,EAAU,0CAAE,MAAM,mCAAI,OAAO,CAAC;IAC5D,MAAM,IAAI,GAAqB,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAEtE,OAAO;QACL,EAAE;QACF,GAAG;QACH,IAAI;KACL,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,WAAwB,EACxB,iBAAoC,EACp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M,IAAI,KAAK,CACb,kCAAkC,OAAO,CAAC,mBAAmB,MAAM,mBAAmB,GAAG,CAC1F,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,SAAS,CAAC,4CAA4C,mBAAmB,EAAE,CAAC,CAAC;oBACtF,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;oBACrC,2BAA2B,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;gBACvD,CAAC;YACH,CAAC;QACH,CAAC;QAED,2EAA2E;QAC3E,0FAA0F;QAC1F,gFAAgF;QAChF,MAAM,iBAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,qCAAqC,EAAE;YACjF,WAAW,EAAE,EAAE;SAChB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,SAAS,GAAuB,MAAM,IAAA,6EAAqC,EAAC;QAChF,aAAa;QACb,kBAAkB,EAAE,QAAQ;QAC5B,YAAY,EAAE,eAAe,EAAE;QAC/B,qBAAqB;QACrB,QAAQ,EAAE,QAAQ;QAClB,0BAA0B;KAC3B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAW,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAErD,MAAM,sBAAU,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAE;QACzD,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAC;AACL,CAAC;AAhHD,8CAgHC","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 type {\n RushSession,\n RushConfiguration,\n RushConfigurationProject,\n ILogger,\n LookupByPath,\n Subspace\n} from '@rushstack/rush-sdk';\nimport type { IResolverCacheFile } from '@rushstack/webpack-workspace-resolve-plugin';\n\nimport { Async, FileSystem, PnpmShrinkwrapFile } from './externals';\nimport {\n computeResolverCacheFromLockfileAsync,\n type IPlatformInfo\n} from './computeResolverCacheFromLockfileAsync';\nimport type { IResolverContext } from './types';\n\n/**\n * Gets information used to determine compatibility of optional dependencies.\n * @returns Information about the platform Rush is running on\n */\nfunction getPlatformInfo(): IPlatformInfo {\n // Acquiring the libc version is a bit more obnoxious than platform and arch,\n // but all of them are ultimately on the same object.\n const {\n platform: os,\n arch: cpu,\n glibcVersionRuntime\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } = (process.report?.getReport() as any)?.header ?? process;\n const libc: 'glibc' | 'musl' = glibcVersionRuntime ? 'glibc' : 'musl';\n\n return {\n os,\n cpu,\n libc\n };\n}\n\n/**\n * Plugin entry point for after install.\n * @param rushSession - The Rush Session\n * @param rushConfiguration - The Rush Configuration\n * @param subspace - The subspace that was just installed\n * @param logger - The initialized logger\n */\nexport async function afterInstallAsync(\n rushSession: RushSession,\n rushConfiguration: RushConfiguration,\n subspace: Subspace,\n logger: ILogger\n): Promise<void> {\n const { terminal } = logger;\n const rushRoot: string = `${rushConfiguration.rushJsonFolder}/`;\n\n const lockFilePath: string = subspace.getCommittedShrinkwrapFilename();\n const workspaceRoot: string = subspace.getSubspaceTempFolderPath();\n\n const projectByImporterPath: LookupByPath<RushConfigurationProject> =\n rushConfiguration.getProjectLookupForRoot(workspaceRoot);\n\n const pnpmStoreDir: string = `${rushConfiguration.pnpmOptions.pnpmStorePath}/v3/files/`;\n\n terminal.writeLine(`Using pnpm-lock from: ${lockFilePath}`);\n terminal.writeLine(`Using pnpm store folder: ${pnpmStoreDir}`);\n\n const lockFile: PnpmShrinkwrapFile | undefined = PnpmShrinkwrapFile.loadFromFile(lockFilePath, {\n withCaching: true\n });\n if (!lockFile) {\n throw new Error(`Failed to load shrinkwrap file: ${lockFilePath}`);\n }\n\n const cacheFilePath: string = `${workspaceRoot}/resolver-cache.json`;\n\n terminal.writeLine(`Resolver cache will be written at ${cacheFilePath}`);\n\n async function afterExternalPackagesAsync(\n contexts: Map<string, IResolverContext>,\n missingOptionalDependencies: Set<string>\n ): Promise<void> {\n /**\n * Loads the index file from the pnpm store to discover nested package.json files in an external package\n * For internal packages, assumes there are no nested package.json files.\n * @param context - The context to find nested package.json files for\n * @returns A promise that resolves when the nested package.json files are found, if applicable\n */\n async function findNestedPackageJsonsForContextAsync(context: IResolverContext): Promise<void> {\n const { descriptionFileRoot, descriptionFileHash } = context;\n\n if (descriptionFileHash === undefined) {\n // Assume this package has no nested package json files for now.\n terminal.writeDebugLine(\n `Package at ${descriptionFileRoot} does not having a file list. Assuming no nested \"package.json\" files.`\n );\n return;\n }\n\n // Convert an integrity hash like\n // sha512-C6uiGQJ+Gt4RyHXXYt+v9f+SN1v83x68URwgxNQ98cvH8kxiuywWGP4XeNZ1paOzZ63aY3cTciCEQJNFUljlLw==\n // To its hex representation, e.g.\n // 0baba219027e1ade11c875d762dfaff5ff92375bfcdf1ebc511c20c4d43df1cbc7f24c62bb2c1618fe1778d675a5a3b367adda6377137220844093455258e52f\n const prefixIndex: number = descriptionFileHash.indexOf('-');\n const hash: string = Buffer.from(descriptionFileHash.slice(prefixIndex + 1), 'base64').toString('hex');\n\n // The pnpm store directory has index files of package contents at paths:\n // <store>/v3/files/<hash (0-2)>/<hash (2-)>-index.json\n // See https://github.com/pnpm/pnpm/blob/f394cfccda7bc519ceee8c33fc9b68a0f4235532/store/cafs/src/getFilePathInCafs.ts#L33\n const indexPath: string = `${pnpmStoreDir}${hash.slice(0, 2)}/${hash.slice(2)}-index.json`;\n\n try {\n const indexContent: string = await FileSystem.readFileAsync(indexPath);\n const { files } = JSON.parse(indexContent);\n\n const filteredFiles: string[] = Object.keys(files).filter((file) => file.endsWith('/package.json'));\n if (filteredFiles.length > 0) {\n const nestedPackageDirs: string[] = filteredFiles.map((x) => x.slice(0, /* -'/package.json'.length */ -13));\n\n if (nestedPackageDirs.length > 0) {\n // eslint-disable-next-line require-atomic-updates\n context.nestedPackageDirs = nestedPackageDirs;\n }\n }\n } catch (error) {\n if (!context.optional) {\n throw new Error(\n `Error reading index file for: \"${context.descriptionFileRoot}\" (${descriptionFileHash})`\n );\n } else {\n terminal.writeLine(`Trimming missing optional dependency at: ${descriptionFileRoot}`);\n contexts.delete(descriptionFileRoot);\n missingOptionalDependencies.add(descriptionFileRoot);\n }\n }\n }\n\n // For external packages, update the contexts with data from the pnpm store\n // This gives us the list of nested package.json files, as well as the actual package name\n // We could also cache package.json contents, but that proves to be inefficient.\n await Async.forEachAsync(contexts.values(), findNestedPackageJsonsForContextAsync, {\n concurrency: 20\n });\n }\n\n const cacheFile: IResolverCacheFile = await computeResolverCacheFromLockfileAsync({\n workspaceRoot,\n commonPrefixToTrim: rushRoot,\n platformInfo: getPlatformInfo(),\n projectByImporterPath,\n lockfile: lockFile,\n afterExternalPackagesAsync\n });\n\n const serialized: string = JSON.stringify(cacheFile);\n\n await FileSystem.writeFileAsync(cacheFilePath, serialized, {\n ensureFolderExists: true\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeResolverCacheFromLockfileAsync.d.ts","sourceRoot":"","sources":["../src/computeResolverCacheFromLockfileAsync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC;IAC5B,GAAG,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IACzB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"computeResolverCacheFromLockfileAsync.d.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PackageCompatible(pack, platformInfo) {
|
|
|
17
17
|
}
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
|
+
function extractBundledDependencies(contexts, context) {
|
|
21
|
+
var _a;
|
|
22
|
+
const { nestedPackageDirs } = context;
|
|
23
|
+
if (!nestedPackageDirs) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (let i = nestedPackageDirs.length - 1; i >= 0; i--) {
|
|
27
|
+
const nestedDir = nestedPackageDirs[i];
|
|
28
|
+
if (!nestedDir.startsWith('node_modules/')) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const isScoped = nestedDir.charAt(/* 'node_modules/'.length */ 13) === '@';
|
|
32
|
+
let index = nestedDir.indexOf('/', 13);
|
|
33
|
+
if (isScoped) {
|
|
34
|
+
index = nestedDir.indexOf('/', index + 1);
|
|
35
|
+
}
|
|
36
|
+
const name = index === -1 ? nestedDir.slice(13) : nestedDir.slice(13, index);
|
|
37
|
+
if (name.startsWith('.')) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
// Remove this nested package from the list
|
|
41
|
+
nestedPackageDirs.splice(i, 1);
|
|
42
|
+
const remainder = index === -1 ? '' : nestedDir.slice(index + 1);
|
|
43
|
+
const nestedRoot = `${context.descriptionFileRoot}/node_modules/${name}`;
|
|
44
|
+
let nestedContext = contexts.get(nestedRoot);
|
|
45
|
+
if (!nestedContext) {
|
|
46
|
+
nestedContext = {
|
|
47
|
+
descriptionFileRoot: nestedRoot,
|
|
48
|
+
descriptionFileHash: undefined,
|
|
49
|
+
isProject: false,
|
|
50
|
+
name,
|
|
51
|
+
deps: new Map(),
|
|
52
|
+
ordinal: -1
|
|
53
|
+
};
|
|
54
|
+
contexts.set(nestedRoot, nestedContext);
|
|
55
|
+
}
|
|
56
|
+
context.deps.set(name, nestedRoot);
|
|
57
|
+
if (remainder) {
|
|
58
|
+
(_a = nestedContext.nestedPackageDirs) !== null && _a !== void 0 ? _a : (nestedContext.nestedPackageDirs = []);
|
|
59
|
+
nestedContext.nestedPackageDirs.push(remainder);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
20
63
|
/**
|
|
21
64
|
* Given a lockfile and information about the workspace and platform, computes the resolver cache file.
|
|
22
65
|
* @param params - The options for computing the resolver cache
|
|
@@ -50,7 +93,7 @@ async function computeResolverCacheFromLockfileAsync(params) {
|
|
|
50
93
|
isProject: false,
|
|
51
94
|
name,
|
|
52
95
|
deps: new Map(),
|
|
53
|
-
ordinal:
|
|
96
|
+
ordinal: -1,
|
|
54
97
|
optional: pack.optional
|
|
55
98
|
};
|
|
56
99
|
contexts.set(descriptionFileRoot, context);
|
|
@@ -64,6 +107,11 @@ async function computeResolverCacheFromLockfileAsync(params) {
|
|
|
64
107
|
if (afterExternalPackagesAsync) {
|
|
65
108
|
await afterExternalPackagesAsync(contexts, missingOptionalDependencies);
|
|
66
109
|
}
|
|
110
|
+
for (const context of contexts.values()) {
|
|
111
|
+
if (context.nestedPackageDirs) {
|
|
112
|
+
extractBundledDependencies(contexts, context);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
67
115
|
// Add the data for workspace projects
|
|
68
116
|
for (const [importerPath, importer] of lockfile.importers) {
|
|
69
117
|
// Ignore the root project. This plugin assumes you don't have one.
|
|
@@ -81,7 +129,7 @@ async function computeResolverCacheFromLockfileAsync(params) {
|
|
|
81
129
|
name: project.packageJson.name,
|
|
82
130
|
isProject: true,
|
|
83
131
|
deps: new Map(),
|
|
84
|
-
ordinal:
|
|
132
|
+
ordinal: -1
|
|
85
133
|
};
|
|
86
134
|
contexts.set(project.projectFolder, context);
|
|
87
135
|
if (importer.dependencies) {
|
|
@@ -94,9 +142,14 @@ async function computeResolverCacheFromLockfileAsync(params) {
|
|
|
94
142
|
(0, helpers_1.resolveDependencies)(workspaceRoot, importer.optionalDependencies, context);
|
|
95
143
|
}
|
|
96
144
|
}
|
|
145
|
+
let ordinal = 0;
|
|
146
|
+
for (const context of contexts.values()) {
|
|
147
|
+
context.ordinal = ordinal++;
|
|
148
|
+
}
|
|
97
149
|
// Convert the intermediate representation to the final cache file
|
|
98
150
|
const serializedContexts = Array.from(contexts, (0, helpers_1.createContextSerializer)(missingOptionalDependencies, contexts, commonPrefixToTrim));
|
|
99
151
|
const cacheFile = {
|
|
152
|
+
basePath: commonPrefixToTrim,
|
|
100
153
|
contexts: serializedContexts
|
|
101
154
|
};
|
|
102
155
|
return cacheFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeResolverCacheFromLockfileAsync.js","sourceRoot":"","sources":["../src/computeResolverCacheFromLockfileAsync.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAU3D,uCAAwG;AAoBxG,SAAS,mBAAmB,CAC1B,IAAgE,EAChE,YAA2B;;IAE3B,IAAI,MAAA,IAAI,CAAC,EAAE,0CAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;QACvE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAA,IAAI,CAAC,GAAG,0CAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAwCD;;;;GAIG;AACI,KAAK,UAAU,qCAAqC,CACzD,MAAgD;;IAEhD,MAAM,EACJ,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,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AE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;YAC7B,IAAA,6BAAmB,EAAC,aAAa,EAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YAClC,IAAA,6BAAmB,EAAC,aAAa,EAAE,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED,kEAAkE;IAClE,MAAM,kBAAkB,GAAgC,KAAK,CAAC,IAAI,CAChE,QAAQ,EACR,IAAA,iCAAuB,EAAC,2BAA2B,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CACnF,CAAC;IAEF,MAAM,SAAS,GAAuB;QACpC,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC;AA1GD,sFA0GC","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 type { LookupByPath } from '@rushstack/rush-sdk';\nimport type { IPnpmShrinkwrapDependencyYaml } from '@rushstack/rush-sdk/lib/logic/pnpm/PnpmShrinkwrapFile';\nimport type {\n ISerializedResolveContext,\n IResolverCacheFile\n} from '@rushstack/webpack-workspace-resolve-plugin';\n\nimport type { PnpmShrinkwrapFile } from './externals';\nimport { getDescriptionFileRootFromKey, resolveDependencies, createContextSerializer } from './helpers';\nimport type { IResolverContext } from './types';\n\n/**\n * The only parts of a RushConfigurationProject needed by this tool.\n * Reduced for unit test typings.\n */\nexport interface IPartialRushProject {\n projectFolder: string;\n packageJson: {\n name: string;\n };\n}\n\nexport interface IPlatformInfo {\n os: typeof process.platform;\n cpu: typeof process.arch;\n libc: 'glibc' | 'musl';\n}\n\nfunction isPackageCompatible(\n pack: Pick<IPnpmShrinkwrapDependencyYaml, 'os' | 'cpu' | 'libc'>,\n platformInfo: IPlatformInfo\n): boolean {\n if (pack.os?.every((value) => value.toLowerCase() !== platformInfo.os)) {\n return false;\n }\n if (pack.cpu?.every((value) => value.toLowerCase() !== platformInfo.cpu)) {\n return false;\n }\n if (pack.libc?.every((value) => value.toLowerCase() !== platformInfo.libc)) {\n return false;\n }\n return true;\n}\n\n/**\n * Options for computing the resolver cache from a lockfile.\n */\nexport interface IComputeResolverCacheFromLockfileOptions {\n /**\n * The root folder of the workspace being installed\n */\n workspaceRoot: string;\n /**\n * The common root path to trim from the description file roots for brevity\n */\n commonPrefixToTrim: string;\n /**\n * Information about the platform Rush is running on\n */\n platformInfo: IPlatformInfo;\n /**\n * A lookup of projects by their importer path\n */\n projectByImporterPath: Pick<LookupByPath<IPartialRushProject>, 'findChildPath'>;\n /**\n * The lockfile to compute the cache from\n */\n lockfile: PnpmShrinkwrapFile;\n /**\n * A callback to process external packages after they have been enumerated.\n * Broken out as a separate function to facilitate testing without hitting the disk.\n * @remarks This is useful for fetching additional data from the pnpm store\n * @param contexts - The current context information per description file root\n * @param missingOptionalDependencies - The set of optional dependencies that were not installed\n * @returns A promise that resolves when the external packages have been processed\n */\n afterExternalPackagesAsync?: (\n contexts: Map<string, IResolverContext>,\n missingOptionalDependencies: Set<string>\n ) => Promise<void>;\n}\n\n/**\n * Given a lockfile and information about the workspace and platform, computes the resolver cache file.\n * @param params - The options for computing the resolver cache\n * @returns A promise that resolves with the resolver cache file\n */\nexport async function computeResolverCacheFromLockfileAsync(\n params: IComputeResolverCacheFromLockfileOptions\n): Promise<IResolverCacheFile> {\n const {\n workspaceRoot,\n commonPrefixToTrim,\n platformInfo,\n projectByImporterPath,\n lockfile,\n afterExternalPackagesAsync\n } = params;\n const contexts: Map<string, IResolverContext> = new Map();\n const missingOptionalDependencies: Set<string> = new Set();\n\n // Enumerate external dependencies first, to simplify looping over them for store data\n for (const [key, pack] of lockfile.packages) {\n let name: string | undefined = pack.name;\n const descriptionFileRoot: string = getDescriptionFileRootFromKey(workspaceRoot, key, name);\n\n // Skip optional dependencies that are incompatible with the current environment\n if (pack.optional && !isPackageCompatible(pack, platformInfo)) {\n missingOptionalDependencies.add(descriptionFileRoot);\n continue;\n }\n\n const integrity: string | undefined = pack.resolution?.integrity;\n\n if (!name && key.startsWith('/')) {\n const versionIndex: number = key.indexOf('@', 2);\n name = key.slice(1, versionIndex);\n }\n\n if (!name) {\n throw new Error(`Missing name for ${key}`);\n }\n\n const context: IResolverContext = {\n descriptionFileRoot,\n descriptionFileHash: integrity,\n isProject: false,\n name,\n deps: new Map(),\n ordinal: contexts.size,\n optional: pack.optional\n };\n\n contexts.set(descriptionFileRoot, context);\n\n if (pack.dependencies) {\n resolveDependencies(workspaceRoot, pack.dependencies, context);\n }\n if (pack.optionalDependencies) {\n resolveDependencies(workspaceRoot, pack.optionalDependencies, context);\n }\n }\n\n if (afterExternalPackagesAsync) {\n await afterExternalPackagesAsync(contexts, missingOptionalDependencies);\n }\n\n // Add the data for workspace projects\n for (const [importerPath, importer] of lockfile.importers) {\n // Ignore the root project. This plugin assumes you don't have one.\n // A non-empty root project results in global dependency hoisting, and that's bad for strictness.\n if (importerPath === '.') {\n continue;\n }\n\n const project: IPartialRushProject | undefined = projectByImporterPath.findChildPath(importerPath);\n if (!project) {\n throw new Error(`Missing project for importer ${importerPath}`);\n }\n\n const context: IResolverContext = {\n descriptionFileRoot: project.projectFolder,\n descriptionFileHash: undefined, // Not needed anymore\n name: project.packageJson.name,\n isProject: true,\n deps: new Map(),\n ordinal: contexts.size\n };\n\n contexts.set(project.projectFolder, context);\n\n if (importer.dependencies) {\n resolveDependencies(workspaceRoot, importer.dependencies, context);\n }\n if (importer.devDependencies) {\n resolveDependencies(workspaceRoot, importer.devDependencies, context);\n }\n if (importer.optionalDependencies) {\n resolveDependencies(workspaceRoot, importer.optionalDependencies, context);\n }\n }\n\n // Convert the intermediate representation to the final cache file\n const serializedContexts: ISerializedResolveContext[] = Array.from(\n contexts,\n createContextSerializer(missingOptionalDependencies, contexts, commonPrefixToTrim)\n );\n\n const cacheFile: IResolverCacheFile = {\n contexts: serializedContexts\n };\n\n return cacheFile;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"computeResolverCacheFromLockfileAsync.js","sourceRoot":"","sources":["../src/computeResolverCacheFromLockfileAsync.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAU3D,uCAAwG;AAoBxG,SAAS,mBAAmB,CAC1B,IAAgE,EAChE,YAA2B;;IAE3B,IAAI,MAAA,IAAI,CAAC,EAAE,0CAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;QACvE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAA,IAAI,CAAC,GAAG,0CAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,0BAA0B,CACjC,QAAuC,EACvC,OAAyB;;IAEzB,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,KAAK,IAAI,CAAC,GAAW,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/D,MAAM,SAAS,GAAW,iBAAiB,CAAC,CAAC,CAAC,C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IAAI,CAChE,QAAQ,EACR,IAAA,iCAAuB,EAAC,2BAA2B,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CACnF,CAAC;IAEF,MAAM,SAAS,GAAuB;QACpC,QAAQ,EAAE,kBAAkB;QAC5B,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC;AAtHD,sFAsHC","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 type { LookupByPath } from '@rushstack/rush-sdk';\nimport type { IPnpmShrinkwrapDependencyYaml } from '@rushstack/rush-sdk/lib/logic/pnpm/PnpmShrinkwrapFile';\nimport type {\n ISerializedResolveContext,\n IResolverCacheFile\n} from '@rushstack/webpack-workspace-resolve-plugin';\n\nimport type { PnpmShrinkwrapFile } from './externals';\nimport { getDescriptionFileRootFromKey, resolveDependencies, createContextSerializer } from './helpers';\nimport type { IResolverContext } from './types';\n\n/**\n * The only parts of a RushConfigurationProject needed by this tool.\n * Reduced for unit test typings.\n */\nexport interface IPartialRushProject {\n projectFolder: string;\n packageJson: {\n name: string;\n };\n}\n\nexport interface IPlatformInfo {\n os: typeof process.platform;\n cpu: typeof process.arch;\n libc: 'glibc' | 'musl';\n}\n\nfunction isPackageCompatible(\n pack: Pick<IPnpmShrinkwrapDependencyYaml, 'os' | 'cpu' | 'libc'>,\n platformInfo: IPlatformInfo\n): boolean {\n if (pack.os?.every((value) => value.toLowerCase() !== platformInfo.os)) {\n return false;\n }\n if (pack.cpu?.every((value) => value.toLowerCase() !== platformInfo.cpu)) {\n return false;\n }\n if (pack.libc?.every((value) => value.toLowerCase() !== platformInfo.libc)) {\n return false;\n }\n return true;\n}\n\nfunction extractBundledDependencies(\n contexts: Map<string, IResolverContext>,\n context: IResolverContext\n): void {\n const { nestedPackageDirs } = context;\n if (!nestedPackageDirs) {\n return;\n }\n\n for (let i: number = nestedPackageDirs.length - 1; i >= 0; i--) {\n const nestedDir: string = nestedPackageDirs[i];\n if (!nestedDir.startsWith('node_modules/')) {\n continue;\n }\n\n const isScoped: boolean = nestedDir.charAt(/* 'node_modules/'.length */ 13) === '@';\n let index: number = nestedDir.indexOf('/', 13);\n if (isScoped) {\n index = nestedDir.indexOf('/', index + 1);\n }\n\n const name: string = index === -1 ? nestedDir.slice(13) : nestedDir.slice(13, index);\n if (name.startsWith('.')) {\n continue;\n }\n\n // Remove this nested package from the list\n nestedPackageDirs.splice(i, 1);\n\n const remainder: string = index === -1 ? '' : nestedDir.slice(index + 1);\n const nestedRoot: string = `${context.descriptionFileRoot}/node_modules/${name}`;\n let nestedContext: IResolverContext | undefined = contexts.get(nestedRoot);\n if (!nestedContext) {\n nestedContext = {\n descriptionFileRoot: nestedRoot,\n descriptionFileHash: undefined,\n isProject: false,\n name,\n deps: new Map(),\n ordinal: -1\n };\n contexts.set(nestedRoot, nestedContext);\n }\n\n context.deps.set(name, nestedRoot);\n\n if (remainder) {\n nestedContext.nestedPackageDirs ??= [];\n nestedContext.nestedPackageDirs.push(remainder);\n }\n }\n}\n\n/**\n * Options for computing the resolver cache from a lockfile.\n */\nexport interface IComputeResolverCacheFromLockfileOptions {\n /**\n * The root folder of the workspace being installed\n */\n workspaceRoot: string;\n /**\n * The common root path to trim from the description file roots for brevity\n */\n commonPrefixToTrim: string;\n /**\n * Information about the platform Rush is running on\n */\n platformInfo: IPlatformInfo;\n /**\n * A lookup of projects by their importer path\n */\n projectByImporterPath: Pick<LookupByPath<IPartialRushProject>, 'findChildPath'>;\n /**\n * The lockfile to compute the cache from\n */\n lockfile: PnpmShrinkwrapFile;\n /**\n * A callback to process external packages after they have been enumerated.\n * Broken out as a separate function to facilitate testing without hitting the disk.\n * @remarks This is useful for fetching additional data from the pnpm store\n * @param contexts - The current context information per description file root\n * @param missingOptionalDependencies - The set of optional dependencies that were not installed\n * @returns A promise that resolves when the external packages have been processed\n */\n afterExternalPackagesAsync?: (\n contexts: Map<string, IResolverContext>,\n missingOptionalDependencies: Set<string>\n ) => Promise<void>;\n}\n\n/**\n * Given a lockfile and information about the workspace and platform, computes the resolver cache file.\n * @param params - The options for computing the resolver cache\n * @returns A promise that resolves with the resolver cache file\n */\nexport async function computeResolverCacheFromLockfileAsync(\n params: IComputeResolverCacheFromLockfileOptions\n): Promise<IResolverCacheFile> {\n const {\n workspaceRoot,\n commonPrefixToTrim,\n platformInfo,\n projectByImporterPath,\n lockfile,\n afterExternalPackagesAsync\n } = params;\n const contexts: Map<string, IResolverContext> = new Map();\n const missingOptionalDependencies: Set<string> = new Set();\n\n // Enumerate external dependencies first, to simplify looping over them for store data\n for (const [key, pack] of lockfile.packages) {\n let name: string | undefined = pack.name;\n const descriptionFileRoot: string = getDescriptionFileRootFromKey(workspaceRoot, key, name);\n\n // Skip optional dependencies that are incompatible with the current environment\n if (pack.optional && !isPackageCompatible(pack, platformInfo)) {\n missingOptionalDependencies.add(descriptionFileRoot);\n continue;\n }\n\n const integrity: string | undefined = pack.resolution?.integrity;\n\n if (!name && key.startsWith('/')) {\n const versionIndex: number = key.indexOf('@', 2);\n name = key.slice(1, versionIndex);\n }\n\n if (!name) {\n throw new Error(`Missing name for ${key}`);\n }\n\n const context: IResolverContext = {\n descriptionFileRoot,\n descriptionFileHash: integrity,\n isProject: false,\n name,\n deps: new Map(),\n ordinal: -1,\n optional: pack.optional\n };\n\n contexts.set(descriptionFileRoot, context);\n\n if (pack.dependencies) {\n resolveDependencies(workspaceRoot, pack.dependencies, context);\n }\n if (pack.optionalDependencies) {\n resolveDependencies(workspaceRoot, pack.optionalDependencies, context);\n }\n }\n\n if (afterExternalPackagesAsync) {\n await afterExternalPackagesAsync(contexts, missingOptionalDependencies);\n }\n\n for (const context of contexts.values()) {\n if (context.nestedPackageDirs) {\n extractBundledDependencies(contexts, context);\n }\n }\n\n // Add the data for workspace projects\n for (const [importerPath, importer] of lockfile.importers) {\n // Ignore the root project. This plugin assumes you don't have one.\n // A non-empty root project results in global dependency hoisting, and that's bad for strictness.\n if (importerPath === '.') {\n continue;\n }\n\n const project: IPartialRushProject | undefined = projectByImporterPath.findChildPath(importerPath);\n if (!project) {\n throw new Error(`Missing project for importer ${importerPath}`);\n }\n\n const context: IResolverContext = {\n descriptionFileRoot: project.projectFolder,\n descriptionFileHash: undefined, // Not needed anymore\n name: project.packageJson.name,\n isProject: true,\n deps: new Map(),\n ordinal: -1\n };\n\n contexts.set(project.projectFolder, context);\n\n if (importer.dependencies) {\n resolveDependencies(workspaceRoot, importer.dependencies, context);\n }\n if (importer.devDependencies) {\n resolveDependencies(workspaceRoot, importer.devDependencies, context);\n }\n if (importer.optionalDependencies) {\n resolveDependencies(workspaceRoot, importer.optionalDependencies, context);\n }\n }\n\n let ordinal: number = 0;\n for (const context of contexts.values()) {\n context.ordinal = ordinal++;\n }\n\n // Convert the intermediate representation to the final cache file\n const serializedContexts: ISerializedResolveContext[] = Array.from(\n contexts,\n createContextSerializer(missingOptionalDependencies, contexts, commonPrefixToTrim)\n );\n\n const cacheFile: IResolverCacheFile = {\n basePath: commonPrefixToTrim,\n contexts: serializedContexts\n };\n\n return cacheFile;\n}\n"]}
|
package/lib/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMlE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA4BtD;AAGD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CASzD;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,GACxB,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,MAAM,CAYxG;AAED,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC5C,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQlE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,2BAA2B,EAAE,GAAG,CAAC,MAAM,CAAC,EACxC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACvC,gBAAgB,EAAE,MAAM,GACvB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,yBAAyB,CAgClE"}
|
package/lib/helpers.js
CHANGED
|
@@ -148,8 +148,11 @@ exports.depPathToFilenameUnescaped = depPathToFilenameUnescaped;
|
|
|
148
148
|
*/
|
|
149
149
|
function createContextSerializer(missingOptionalDependencies, contexts, commonPathPrefix) {
|
|
150
150
|
return ([descriptionFileRoot, context]) => {
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
var _a;
|
|
152
|
+
const { deps } = context;
|
|
153
|
+
let hasAnyDeps = false;
|
|
154
|
+
const serializedDeps = {};
|
|
155
|
+
for (const [key, contextRoot] of deps) {
|
|
153
156
|
if (missingOptionalDependencies.has(contextRoot)) {
|
|
154
157
|
continue;
|
|
155
158
|
}
|
|
@@ -157,7 +160,8 @@ function createContextSerializer(missingOptionalDependencies, contexts, commonPa
|
|
|
157
160
|
if (!resolutionContext) {
|
|
158
161
|
throw new Error(`Missing context for ${contextRoot}!`);
|
|
159
162
|
}
|
|
160
|
-
|
|
163
|
+
serializedDeps[key] = resolutionContext.ordinal;
|
|
164
|
+
hasAnyDeps = true;
|
|
161
165
|
}
|
|
162
166
|
if (!context.name) {
|
|
163
167
|
throw new Error(`Missing name for ${descriptionFileRoot}`);
|
|
@@ -165,8 +169,8 @@ function createContextSerializer(missingOptionalDependencies, contexts, commonPa
|
|
|
165
169
|
const serializedContext = {
|
|
166
170
|
name: context.name,
|
|
167
171
|
root: descriptionFileRoot.slice(commonPathPrefix.length),
|
|
168
|
-
dirInfoFiles: context.
|
|
169
|
-
deps
|
|
172
|
+
dirInfoFiles: ((_a = context.nestedPackageDirs) === null || _a === void 0 ? void 0 : _a.length) ? context.nestedPackageDirs : undefined,
|
|
173
|
+
deps: hasAnyDeps ? serializedDeps : undefined
|
|
170
174
|
};
|
|
171
175
|
return serializedContext;
|
|
172
176
|
};
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,6CAAyC;AACzC,gDAAkC;AAMlC,MAAM,uBAAuB,GAAW,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,MAAM,GAAa,kCAAkC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAEtE,+GAA+G;AAC/G,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,MAAM,IAAI,GAAW,IAAA,wBAAU,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;IAE9D,MAAM,IAAI,GAAS,IAAI,CAAC;IACxB,IAAI,GAAG,GAAW,EAAE,CAAC;IAErB,IAAI,IAAI,GAAW,CAAC,CAAC,CAAC,yCAAyC;IAC/D,IAAI,MAAM,GAAW,CAAC,CAAC,CAAC,4CAA4C;IACpE,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7C,sCAAsC;QACtC,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAA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AAC,GAAG,EAAE,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAC9C,IAAI,2BAA2B,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gBACjD,SAAS;YACX,CAAC;YAED,MAAM,iBAAiB,GAAiC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAClF,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,WAAW,GAAG,CAAC,CAAC;YACzD,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC;QACxC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,oBAAoB,mBAAmB,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,iBAAiB,GAA8B;YACnD,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC;YACxD,YAAY,EAAE,OAAO,CAAC,KAAK;YAC3B,IAAI;SACL,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC;AAhCD,0DAgCC","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 { createHash } from 'node:crypto';\nimport * as path from 'node:path';\n\nimport type { ISerializedResolveContext } from '@rushstack/webpack-workspace-resolve-plugin';\n\nimport type { IDependencyEntry, IResolverContext } from './types';\n\nconst MAX_LENGTH_WITHOUT_HASH: number = 120 - 26 - 1;\nconst BASE32: string[] = 'abcdefghijklmnopqrstuvwxyz234567'.split('');\n\n// https://github.com/swansontec/rfc4648.js/blob/ead9c9b4b68e5d4a529f32925da02c02984e772c/src/codec.ts#L82-L118\nexport function createBase32Hash(input: string): string {\n const data: Buffer = createHash('md5').update(input).digest();\n\n const mask: 0x1f = 0x1f;\n let out: string = '';\n\n let bits: number = 0; // Number of bits currently in the buffer\n let buffer: number = 0; // Bits waiting to be written out, MSB first\n for (let i: number = 0; i < data.length; ++i) {\n // eslint-disable-next-line no-bitwise\n buffer = (buffer << 8) | (0xff & data[i]);\n bits += 8;\n\n // Write out as much as we can:\n while (bits > 5) {\n bits -= 5;\n // eslint-disable-next-line no-bitwise\n out += BASE32[mask & (buffer >> bits)];\n }\n }\n\n // Partial character:\n if (bits) {\n // eslint-disable-next-line no-bitwise\n out += BASE32[mask & (buffer << (5 - bits))];\n }\n\n return out;\n}\n\n// https://github.com/pnpm/pnpm/blob/f394cfccda7bc519ceee8c33fc9b68a0f4235532/packages/dependency-path/src/index.ts#L167-L189\nexport function depPathToFilename(depPath: string): string {\n let filename: string = depPathToFilenameUnescaped(depPath).replace(/[\\\\/:*?\"<>|]/g, '+');\n if (filename.includes('(')) {\n filename = filename.replace(/(\\)\\()|\\(/g, '_').replace(/\\)$/, '');\n }\n if (filename.length > 120 || (filename !== filename.toLowerCase() && !filename.startsWith('file+'))) {\n return `${filename.substring(0, MAX_LENGTH_WITHOUT_HASH)}_${createBase32Hash(filename)}`;\n }\n return filename;\n}\n\n/**\n * Computes the root folder for a dependency from a reference to it in another package\n * @param lockfileFolder - The folder that contains the lockfile\n * @param key - The key of the dependency\n * @param specifier - The specifier in the lockfile for the dependency\n * @param context - The owning package\n * @returns The identifier for the dependency\n */\nexport function resolveDependencyKey(\n lockfileFolder: string,\n key: string,\n specifier: string,\n context: IResolverContext\n): string {\n if (specifier.startsWith('/')) {\n return getDescriptionFileRootFromKey(lockfileFolder, specifier);\n } else if (specifier.startsWith('link:')) {\n if (context.isProject) {\n return path.posix.join(context.descriptionFileRoot, specifier.slice(5));\n } else {\n return path.posix.join(lockfileFolder, specifier.slice(5));\n }\n } else if (specifier.startsWith('file:')) {\n return getDescriptionFileRootFromKey(lockfileFolder, specifier, key);\n } else {\n return getDescriptionFileRootFromKey(lockfileFolder, `/${key}@${specifier}`);\n }\n}\n\n/**\n * Computes the physical path to a dependency based on its entry\n * @param lockfileFolder - The folder that contains the lockfile during installation\n * @param key - The key of the dependency\n * @param name - The name of the dependency, if provided\n * @returns The physical path to the dependency\n */\nexport function getDescriptionFileRootFromKey(lockfileFolder: string, key: string, name?: string): string {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (!key.startsWith('file:')) {\n name = key.slice(1, key.indexOf('@', 2));\n }\n if (!name) {\n throw new Error(`Missing package name for ${key}`);\n }\n\n const originFolder: string = `${lockfileFolder}/node_modules/.pnpm/${depPathToFilename(key)}/node_modules`;\n const descriptionFileRoot: string = `${originFolder}/${name}`;\n return descriptionFileRoot;\n}\n\nexport function resolveDependencies(\n lockfileFolder: string,\n collection: Record<string, IDependencyEntry>,\n context: IResolverContext\n): void {\n for (const [key, value] of Object.entries(collection)) {\n const version: string = typeof value === 'string' ? value : value.version;\n const resolved: string = resolveDependencyKey(lockfileFolder, key, version, context);\n\n context.deps.set(key, resolved);\n }\n}\n\n/**\n *\n * @param depPath - The path to the dependency\n * @returns The folder name for the dependency\n */\nexport function depPathToFilenameUnescaped(depPath: string): string {\n if (depPath.indexOf('file:') !== 0) {\n if (depPath.startsWith('/')) {\n depPath = depPath.slice(1);\n }\n return depPath;\n }\n return depPath.replace(':', '+');\n}\n\n/**\n *\n * @param missingOptionalDependencies - The set of optional dependencies that were not installed\n * @param contexts - The map of context roots to their respective contexts\n * @param commonPathPrefix - The common root path to trim\n * @returns A function that serializes a context into a format that can be written to disk\n */\nexport function createContextSerializer(\n missingOptionalDependencies: Set<string>,\n contexts: Map<string, IResolverContext>,\n commonPathPrefix: string\n): (entry: [string, IResolverContext]) => ISerializedResolveContext {\n return ([descriptionFileRoot, context]: [string, IResolverContext]): ISerializedResolveContext => {\n const deps: ISerializedResolveContext['deps'] = {};\n for (const [key, contextRoot] of context.deps) {\n if (missingOptionalDependencies.has(contextRoot)) {\n continue;\n }\n\n const resolutionContext: IResolverContext | undefined = contexts.get(contextRoot);\n if (!resolutionContext) {\n throw new Error(`Missing context for ${contextRoot}!`);\n }\n deps[key] = resolutionContext.ordinal;\n }\n\n if (!context.name) {\n throw new Error(`Missing name for ${descriptionFileRoot}`);\n }\n\n const serializedContext: ISerializedResolveContext = {\n name: context.name,\n root: descriptionFileRoot.slice(commonPathPrefix.length),\n dirInfoFiles: context.files,\n deps\n };\n\n return serializedContext;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,6CAAyC;AACzC,gDAAkC;AAMlC,MAAM,uBAAuB,GAAW,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,MAAM,GAAa,kCAAkC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAEtE,+GAA+G;AAC/G,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,MAAM,IAAI,GAAW,IAAA,wBAAU,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;IAE9D,MAAM,IAAI,GAAS,IAAI,CAAC;IACxB,IAAI,GAAG,GAAW,EAAE,CAAC;IAErB,IAAI,IAAI,GAAW,CAAC,CAAC,CAAC,yCAAyC;IAC/D,IAAI,MAAM,GAAW,CAAC,CAAC,CAAC,4CAA4C;IACpE,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7C,sCAAsC;QACtC,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,IAAI,IAAI,CAAC,CAAC;QAEV,+BAA+B;QAC/B,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC;YAChB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C,IAAI,IAAI,EAAE,CAAC;YACtC,IAAI,2BAA2B,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gBACjD,SAAS;YACX,CAAC;YAED,MAAM,iBAAiB,GAAiC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAClF,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,WAAW,GAAG,CAAC,CAAC;YACzD,CAAC;YACD,cAAc,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC;YAChD,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,oBAAoB,mBAAmB,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,iBAAiB,GAA8B;YACnD,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC;YACxD,YAAY,EAAE,CAAA,MAAA,OAAO,CAAC,iBAAiB,0CAAE,MAAM,EAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;YACvF,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC;AApCD,0DAoCC","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 { createHash } from 'node:crypto';\nimport * as path from 'node:path';\n\nimport type { ISerializedResolveContext } from '@rushstack/webpack-workspace-resolve-plugin';\n\nimport type { IDependencyEntry, IResolverContext } from './types';\n\nconst MAX_LENGTH_WITHOUT_HASH: number = 120 - 26 - 1;\nconst BASE32: string[] = 'abcdefghijklmnopqrstuvwxyz234567'.split('');\n\n// https://github.com/swansontec/rfc4648.js/blob/ead9c9b4b68e5d4a529f32925da02c02984e772c/src/codec.ts#L82-L118\nexport function createBase32Hash(input: string): string {\n const data: Buffer = createHash('md5').update(input).digest();\n\n const mask: 0x1f = 0x1f;\n let out: string = '';\n\n let bits: number = 0; // Number of bits currently in the buffer\n let buffer: number = 0; // Bits waiting to be written out, MSB first\n for (let i: number = 0; i < data.length; ++i) {\n // eslint-disable-next-line no-bitwise\n buffer = (buffer << 8) | (0xff & data[i]);\n bits += 8;\n\n // Write out as much as we can:\n while (bits > 5) {\n bits -= 5;\n // eslint-disable-next-line no-bitwise\n out += BASE32[mask & (buffer >> bits)];\n }\n }\n\n // Partial character:\n if (bits) {\n // eslint-disable-next-line no-bitwise\n out += BASE32[mask & (buffer << (5 - bits))];\n }\n\n return out;\n}\n\n// https://github.com/pnpm/pnpm/blob/f394cfccda7bc519ceee8c33fc9b68a0f4235532/packages/dependency-path/src/index.ts#L167-L189\nexport function depPathToFilename(depPath: string): string {\n let filename: string = depPathToFilenameUnescaped(depPath).replace(/[\\\\/:*?\"<>|]/g, '+');\n if (filename.includes('(')) {\n filename = filename.replace(/(\\)\\()|\\(/g, '_').replace(/\\)$/, '');\n }\n if (filename.length > 120 || (filename !== filename.toLowerCase() && !filename.startsWith('file+'))) {\n return `${filename.substring(0, MAX_LENGTH_WITHOUT_HASH)}_${createBase32Hash(filename)}`;\n }\n return filename;\n}\n\n/**\n * Computes the root folder for a dependency from a reference to it in another package\n * @param lockfileFolder - The folder that contains the lockfile\n * @param key - The key of the dependency\n * @param specifier - The specifier in the lockfile for the dependency\n * @param context - The owning package\n * @returns The identifier for the dependency\n */\nexport function resolveDependencyKey(\n lockfileFolder: string,\n key: string,\n specifier: string,\n context: IResolverContext\n): string {\n if (specifier.startsWith('/')) {\n return getDescriptionFileRootFromKey(lockfileFolder, specifier);\n } else if (specifier.startsWith('link:')) {\n if (context.isProject) {\n return path.posix.join(context.descriptionFileRoot, specifier.slice(5));\n } else {\n return path.posix.join(lockfileFolder, specifier.slice(5));\n }\n } else if (specifier.startsWith('file:')) {\n return getDescriptionFileRootFromKey(lockfileFolder, specifier, key);\n } else {\n return getDescriptionFileRootFromKey(lockfileFolder, `/${key}@${specifier}`);\n }\n}\n\n/**\n * Computes the physical path to a dependency based on its entry\n * @param lockfileFolder - The folder that contains the lockfile during installation\n * @param key - The key of the dependency\n * @param name - The name of the dependency, if provided\n * @returns The physical path to the dependency\n */\nexport function getDescriptionFileRootFromKey(lockfileFolder: string, key: string, name?: string): string {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (!key.startsWith('file:')) {\n name = key.slice(1, key.indexOf('@', 2));\n }\n if (!name) {\n throw new Error(`Missing package name for ${key}`);\n }\n\n const originFolder: string = `${lockfileFolder}/node_modules/.pnpm/${depPathToFilename(key)}/node_modules`;\n const descriptionFileRoot: string = `${originFolder}/${name}`;\n return descriptionFileRoot;\n}\n\nexport function resolveDependencies(\n lockfileFolder: string,\n collection: Record<string, IDependencyEntry>,\n context: IResolverContext\n): void {\n for (const [key, value] of Object.entries(collection)) {\n const version: string = typeof value === 'string' ? value : value.version;\n const resolved: string = resolveDependencyKey(lockfileFolder, key, version, context);\n\n context.deps.set(key, resolved);\n }\n}\n\n/**\n *\n * @param depPath - The path to the dependency\n * @returns The folder name for the dependency\n */\nexport function depPathToFilenameUnescaped(depPath: string): string {\n if (depPath.indexOf('file:') !== 0) {\n if (depPath.startsWith('/')) {\n depPath = depPath.slice(1);\n }\n return depPath;\n }\n return depPath.replace(':', '+');\n}\n\n/**\n *\n * @param missingOptionalDependencies - The set of optional dependencies that were not installed\n * @param contexts - The map of context roots to their respective contexts\n * @param commonPathPrefix - The common root path to trim\n * @returns A function that serializes a context into a format that can be written to disk\n */\nexport function createContextSerializer(\n missingOptionalDependencies: Set<string>,\n contexts: Map<string, IResolverContext>,\n commonPathPrefix: string\n): (entry: [string, IResolverContext]) => ISerializedResolveContext {\n return ([descriptionFileRoot, context]: [string, IResolverContext]): ISerializedResolveContext => {\n const { deps } = context;\n\n let hasAnyDeps: boolean = false;\n const serializedDeps: ISerializedResolveContext['deps'] = {};\n for (const [key, contextRoot] of deps) {\n if (missingOptionalDependencies.has(contextRoot)) {\n continue;\n }\n\n const resolutionContext: IResolverContext | undefined = contexts.get(contextRoot);\n if (!resolutionContext) {\n throw new Error(`Missing context for ${contextRoot}!`);\n }\n serializedDeps[key] = resolutionContext.ordinal;\n hasAnyDeps = true;\n }\n\n if (!context.name) {\n throw new Error(`Missing name for ${descriptionFileRoot}`);\n }\n\n const serializedContext: ISerializedResolveContext = {\n name: context.name,\n root: descriptionFileRoot.slice(commonPathPrefix.length),\n dirInfoFiles: context.nestedPackageDirs?.length ? context.nestedPackageDirs : undefined,\n deps: hasAnyDeps ? serializedDeps : undefined\n };\n\n return serializedContext;\n };\n}\n"]}
|
package/lib/types.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ export interface IResolverContext {
|
|
|
5
5
|
deps: Map<string, string>;
|
|
6
6
|
isProject: boolean;
|
|
7
7
|
ordinal: number;
|
|
8
|
+
parent?: IResolverContext | undefined;
|
|
8
9
|
optional?: boolean;
|
|
9
|
-
|
|
10
|
+
nestedPackageDirs?: string[];
|
|
10
11
|
}
|
|
11
12
|
export type IDependencyEntry = string | {
|
|
12
13
|
version: string;
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport interface IResolverContext {\n descriptionFileRoot: string;\n descriptionFileHash: string | undefined;\n name: string;\n deps: Map<string, string>;\n isProject: boolean;\n ordinal: number;\n optional?: boolean;\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport interface IResolverContext {\n descriptionFileRoot: string;\n descriptionFileHash: string | undefined;\n name: string;\n deps: Map<string, string>;\n isProject: boolean;\n ordinal: number;\n parent?: IResolverContext | undefined;\n optional?: boolean;\n nestedPackageDirs?: string[];\n}\n\nexport type IDependencyEntry =\n | string\n | {\n version: string;\n specifier: string;\n };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/rush-resolver-cache-plugin",
|
|
3
|
-
"version": "5.133.
|
|
3
|
+
"version": "5.133.1",
|
|
4
4
|
"description": "A Rush plugin that generates a resolver cache file after successful install.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"main": "lib-commonjs/index.js",
|
|
12
12
|
"types": "dist/rush-resolver-cache-plugin.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@rushstack/rush-sdk": "5.133.
|
|
14
|
+
"@rushstack/rush-sdk": "5.133.1"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/webpack-env": "1.18.0",
|
|
18
|
-
"@rushstack/lookup-by-path": "0.
|
|
19
|
-
"@rushstack/terminal": "0.14.0",
|
|
20
|
-
"@rushstack/node-core-library": "5.7.0",
|
|
18
|
+
"@rushstack/lookup-by-path": "0.2.0",
|
|
21
19
|
"@rushstack/heft": "0.67.0",
|
|
22
|
-
"
|
|
23
|
-
"@rushstack/
|
|
20
|
+
"@rushstack/webpack-workspace-resolve-plugin": "0.3.0",
|
|
21
|
+
"@rushstack/node-core-library": "5.7.0",
|
|
22
|
+
"@rushstack/terminal": "0.14.0",
|
|
23
|
+
"local-node-rig": "1.0.0"
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|