@rushstack/rush-resolver-cache-plugin 5.157.0-pr5280.0 → 5.158.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/dist/tsdoc-metadata.json
CHANGED
|
@@ -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;
|
|
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;AAwC7B;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CA8Lf"}
|
package/lib/afterInstallAsync.js
CHANGED
|
@@ -23,6 +23,8 @@ function getPlatformInfo() {
|
|
|
23
23
|
libc
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
const END_TOKEN = '/package.json":';
|
|
27
|
+
const SUBPACKAGE_CACHE_FILE_VERSION = 1;
|
|
26
28
|
/**
|
|
27
29
|
* Plugin entry point for after install.
|
|
28
30
|
* @param rushSession - The Rush Session
|
|
@@ -35,8 +37,6 @@ async function afterInstallAsync(rushSession, rushConfiguration, subspace, varia
|
|
|
35
37
|
const { terminal } = logger;
|
|
36
38
|
const rushRoot = `${rushConfiguration.rushJsonFolder}/`;
|
|
37
39
|
const lockFilePath = subspace.getCommittedShrinkwrapFilePath(variant);
|
|
38
|
-
const workspaceRoot = subspace.getSubspaceTempFolderPath();
|
|
39
|
-
const projectByImporterPath = rushConfiguration.getProjectLookupForRoot(workspaceRoot);
|
|
40
40
|
const pnpmStoreDir = `${rushConfiguration.pnpmOptions.pnpmStorePath}/v3/files/`;
|
|
41
41
|
terminal.writeLine(`Using pnpm-lock from: ${lockFilePath}`);
|
|
42
42
|
terminal.writeLine(`Using pnpm store folder: ${pnpmStoreDir}`);
|
|
@@ -46,21 +46,40 @@ async function afterInstallAsync(rushSession, rushConfiguration, subspace, varia
|
|
|
46
46
|
if (!lockFile) {
|
|
47
47
|
throw new Error(`Failed to load shrinkwrap file: ${lockFilePath}`);
|
|
48
48
|
}
|
|
49
|
+
const workspaceRoot = subspace.getSubspaceTempFolderPath();
|
|
50
|
+
const projectByImporterPath = rushConfiguration.getProjectLookupForRoot(workspaceRoot);
|
|
49
51
|
const cacheFilePath = `${workspaceRoot}/resolver-cache.json`;
|
|
52
|
+
const subPackageCacheFilePath = `${workspaceRoot}/subpackage-entry-cache.json`;
|
|
50
53
|
terminal.writeLine(`Resolver cache will be written at ${cacheFilePath}`);
|
|
54
|
+
let oldSubPackagesByIntegrity;
|
|
55
|
+
const subPackagesByIntegrity = new Map();
|
|
56
|
+
try {
|
|
57
|
+
const cacheContent = await externals_1.FileSystem.readFileAsync(subPackageCacheFilePath);
|
|
58
|
+
const cacheJson = JSON.parse(cacheContent);
|
|
59
|
+
if (cacheJson.version !== SUBPACKAGE_CACHE_FILE_VERSION) {
|
|
60
|
+
terminal.writeLine(`Expected subpackage cache version ${SUBPACKAGE_CACHE_FILE_VERSION}, got ${cacheJson.version}`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
oldSubPackagesByIntegrity = new Map(cacheJson.subPackagesByIntegrity);
|
|
64
|
+
terminal.writeLine(`Loaded subpackage cache from ${subPackageCacheFilePath}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
// Ignore
|
|
69
|
+
}
|
|
51
70
|
async function afterExternalPackagesAsync(contexts, missingOptionalDependencies) {
|
|
52
71
|
/**
|
|
53
72
|
* Loads the index file from the pnpm store to discover nested package.json files in an external package
|
|
54
73
|
* For internal packages, assumes there are no nested package.json files.
|
|
55
74
|
* @param context - The context to find nested package.json files for
|
|
56
|
-
* @returns A promise that resolves
|
|
75
|
+
* @returns A promise that resolves to the nested package.json paths, false if the package fails to load, or true if the package has no nested package.json files.
|
|
57
76
|
*/
|
|
58
|
-
async function
|
|
77
|
+
async function tryFindNestedPackageJsonsForContextAsync(context) {
|
|
59
78
|
const { descriptionFileRoot, descriptionFileHash } = context;
|
|
60
79
|
if (descriptionFileHash === undefined) {
|
|
61
80
|
// Assume this package has no nested package json files for now.
|
|
62
|
-
terminal.writeDebugLine(`Package at ${descriptionFileRoot} does not
|
|
63
|
-
return;
|
|
81
|
+
terminal.writeDebugLine(`Package at ${descriptionFileRoot} does not have a file list. Assuming no nested "package.json" files.`);
|
|
82
|
+
return true;
|
|
64
83
|
}
|
|
65
84
|
// Convert an integrity hash like
|
|
66
85
|
// sha512-C6uiGQJ+Gt4RyHXXYt+v9f+SN1v83x68URwgxNQ98cvH8kxiuywWGP4XeNZ1paOzZ63aY3cTciCEQJNFUljlLw==
|
|
@@ -74,25 +93,61 @@ async function afterInstallAsync(rushSession, rushConfiguration, subspace, varia
|
|
|
74
93
|
const indexPath = `${pnpmStoreDir}${hash.slice(0, 2)}/${hash.slice(2)}-index.json`;
|
|
75
94
|
try {
|
|
76
95
|
const indexContent = await externals_1.FileSystem.readFileAsync(indexPath);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
let endIndex = indexContent.lastIndexOf(END_TOKEN);
|
|
97
|
+
if (endIndex > 0) {
|
|
98
|
+
const nestedPackageDirs = [];
|
|
99
|
+
do {
|
|
100
|
+
const startIndex = indexContent.lastIndexOf('"', endIndex);
|
|
101
|
+
if (startIndex < 0) {
|
|
102
|
+
throw new Error(`Malformed index file at ${indexPath}: missing starting quote for nested package.json path`);
|
|
103
|
+
}
|
|
104
|
+
const nestedPath = indexContent.slice(startIndex + 1, endIndex);
|
|
105
|
+
nestedPackageDirs.push(nestedPath);
|
|
106
|
+
endIndex = indexContent.lastIndexOf(END_TOKEN, startIndex - 1);
|
|
107
|
+
} while (endIndex > 0);
|
|
108
|
+
return nestedPackageDirs;
|
|
85
109
|
}
|
|
110
|
+
return true;
|
|
86
111
|
}
|
|
87
112
|
catch (error) {
|
|
88
113
|
if (!context.optional) {
|
|
89
|
-
throw new Error(`Error reading index file for: "${context.descriptionFileRoot}" (${descriptionFileHash})`);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
terminal.writeLine(`Trimming missing optional dependency at: ${descriptionFileRoot}`);
|
|
93
|
-
contexts.delete(descriptionFileRoot);
|
|
94
|
-
missingOptionalDependencies.add(descriptionFileRoot);
|
|
114
|
+
throw new Error(`Error reading index file for: "${context.descriptionFileRoot}" (${descriptionFileHash}): ${error.toString()}`);
|
|
95
115
|
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Loads the index file from the pnpm store to discover nested package.json files in an external package
|
|
121
|
+
* For internal packages, assumes there are no nested package.json files.
|
|
122
|
+
* @param context - The context to find nested package.json files for
|
|
123
|
+
* @returns A promise that resolves when the nested package.json files are found, if applicable
|
|
124
|
+
*/
|
|
125
|
+
async function findNestedPackageJsonsForContextAsync(context) {
|
|
126
|
+
var _a;
|
|
127
|
+
const { descriptionFileRoot, descriptionFileHash } = context;
|
|
128
|
+
if (descriptionFileHash === undefined) {
|
|
129
|
+
// Assume this package has no nested package json files for now.
|
|
130
|
+
terminal.writeDebugLine(`Package at ${descriptionFileRoot} does not have a file list. Assuming no nested "package.json" files.`);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
let result = (_a = oldSubPackagesByIntegrity === null || oldSubPackagesByIntegrity === void 0 ? void 0 : oldSubPackagesByIntegrity.get(descriptionFileHash)) !== null && _a !== void 0 ? _a : subPackagesByIntegrity.get(descriptionFileHash);
|
|
134
|
+
if (result === undefined) {
|
|
135
|
+
result = await tryFindNestedPackageJsonsForContextAsync(context);
|
|
136
|
+
}
|
|
137
|
+
subPackagesByIntegrity.set(descriptionFileHash, result);
|
|
138
|
+
if (result === true) {
|
|
139
|
+
// Default case. Do nothing.
|
|
140
|
+
}
|
|
141
|
+
else if (result === false) {
|
|
142
|
+
terminal.writeLine(`Trimming missing optional dependency at: ${descriptionFileRoot}`);
|
|
143
|
+
contexts.delete(descriptionFileRoot);
|
|
144
|
+
missingOptionalDependencies.add(descriptionFileRoot);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
terminal.writeDebugLine(`Nested "package.json" files found for package at ${descriptionFileRoot}: ${result.join(', ')}`);
|
|
148
|
+
// Clone this array to ensure that mutations don't affect the subpackage cache.
|
|
149
|
+
// eslint-disable-next-line require-atomic-updates
|
|
150
|
+
context.nestedPackageDirs = [...result];
|
|
96
151
|
}
|
|
97
152
|
}
|
|
98
153
|
// For external packages, update the contexts with data from the pnpm store
|
|
@@ -102,6 +157,16 @@ async function afterInstallAsync(rushSession, rushConfiguration, subspace, varia
|
|
|
102
157
|
concurrency: 20
|
|
103
158
|
});
|
|
104
159
|
}
|
|
160
|
+
// Serialize this before `computeResolverCacheFromLockfileAsync` because bundledDependencies get removed
|
|
161
|
+
// from the `nestedPackageDirs` array. We clone above for safety, but this is making doubly sure.
|
|
162
|
+
const newSubPackageCache = {
|
|
163
|
+
version: SUBPACKAGE_CACHE_FILE_VERSION,
|
|
164
|
+
subPackagesByIntegrity: Array.from(subPackagesByIntegrity)
|
|
165
|
+
};
|
|
166
|
+
const serializedSubpackageCache = JSON.stringify(newSubPackageCache);
|
|
167
|
+
const writeSubPackageCachePromise = externals_1.FileSystem.writeFileAsync(subPackageCacheFilePath, serializedSubpackageCache, {
|
|
168
|
+
ensureFolderExists: true
|
|
169
|
+
});
|
|
105
170
|
const cacheFile = await (0, computeResolverCacheFromLockfileAsync_1.computeResolverCacheFromLockfileAsync)({
|
|
106
171
|
workspaceRoot,
|
|
107
172
|
commonPrefixToTrim: rushRoot,
|
|
@@ -111,8 +176,12 @@ async function afterInstallAsync(rushSession, rushConfiguration, subspace, varia
|
|
|
111
176
|
afterExternalPackagesAsync
|
|
112
177
|
});
|
|
113
178
|
const serialized = JSON.stringify(cacheFile);
|
|
114
|
-
await
|
|
115
|
-
|
|
116
|
-
|
|
179
|
+
await Promise.all([
|
|
180
|
+
externals_1.FileSystem.writeFileAsync(cacheFilePath, serialized, {
|
|
181
|
+
ensureFolderExists: true
|
|
182
|
+
}),
|
|
183
|
+
writeSubPackageCachePromise
|
|
184
|
+
]);
|
|
185
|
+
terminal.writeLine(`Resolver cache written.`);
|
|
117
186
|
}
|
|
118
187
|
//# sourceMappingURL=afterInstallAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afterInstallAsync.js","sourceRoot":"","sources":["../src/afterInstallAsync.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAiD3D,8CAmHC;AAxJD,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;;;;;;;GAOG;A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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","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 variant - The variant 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 variant: string | undefined,\n logger: ILogger\n): Promise<void> {\n const { terminal } = logger;\n const rushRoot: string = `${rushConfiguration.rushJsonFolder}/`;\n\n const lockFilePath: string = subspace.getCommittedShrinkwrapFilePath(variant);\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) =>\n x.slice(0, /* -'/package.json'.length */ -13)\n );\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
|
+
{"version":3,"file":"afterInstallAsync.js","sourceRoot":"","sources":["../src/afterInstallAsync.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAyD3D,8CAoMC;AAjPD,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,MAAM,SAAS,GAAW,iBAA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IACxG,iGAAiG;IACjG,MAAM,kBAAkB,GAA4B;QAClD,OAAO,EAAE,6BAA6B;QACtC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC;KAC3D,CAAC;IACF,MAAM,yBAAyB,GAAW,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;IAC7E,MAAM,2BAA2B,GAAkB,sBAAU,CAAC,cAAc,CAC1E,uBAAuB,EACvB,yBAAyB,EACzB;QACE,kBAAkB,EAAE,IAAI;KACzB,CACF,CAAC;IAEF,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,OAAO,CAAC,GAAG,CAAC;QAChB,sBAAU,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAE;YACnD,kBAAkB,EAAE,IAAI;SACzB,CAAC;QACF,2BAA2B;KAC5B,CAAC,CAAC;IAEH,QAAQ,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAChD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport 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\nconst END_TOKEN: string = '/package.json\":';\nconst SUBPACKAGE_CACHE_FILE_VERSION: 1 = 1;\n\ninterface INestedPackageJsonCache {\n subPackagesByIntegrity: [string, string[] | boolean][];\n version: number;\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 variant - The variant 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 variant: string | undefined,\n logger: ILogger\n): Promise<void> {\n const { terminal } = logger;\n const rushRoot: string = `${rushConfiguration.rushJsonFolder}/`;\n\n const lockFilePath: string = subspace.getCommittedShrinkwrapFilePath(variant);\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 workspaceRoot: string = subspace.getSubspaceTempFolderPath();\n\n const projectByImporterPath: LookupByPath<RushConfigurationProject> =\n rushConfiguration.getProjectLookupForRoot(workspaceRoot);\n\n const cacheFilePath: string = `${workspaceRoot}/resolver-cache.json`;\n const subPackageCacheFilePath: string = `${workspaceRoot}/subpackage-entry-cache.json`;\n\n terminal.writeLine(`Resolver cache will be written at ${cacheFilePath}`);\n\n let oldSubPackagesByIntegrity: Map<string, string[] | boolean> | undefined;\n const subPackagesByIntegrity: Map<string, string[] | boolean> = new Map();\n try {\n const cacheContent: string = await FileSystem.readFileAsync(subPackageCacheFilePath);\n const cacheJson: INestedPackageJsonCache = JSON.parse(cacheContent);\n if (cacheJson.version !== SUBPACKAGE_CACHE_FILE_VERSION) {\n terminal.writeLine(\n `Expected subpackage cache version ${SUBPACKAGE_CACHE_FILE_VERSION}, got ${cacheJson.version}`\n );\n } else {\n oldSubPackagesByIntegrity = new Map(cacheJson.subPackagesByIntegrity);\n terminal.writeLine(`Loaded subpackage cache from ${subPackageCacheFilePath}`);\n }\n } catch (err) {\n // Ignore\n }\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 to the nested package.json paths, false if the package fails to load, or true if the package has no nested package.json files.\n */\n async function tryFindNestedPackageJsonsForContextAsync(\n context: IResolverContext\n ): Promise<string[] | boolean> {\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 have a file list. Assuming no nested \"package.json\" files.`\n );\n return true;\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 let endIndex: number = indexContent.lastIndexOf(END_TOKEN);\n if (endIndex > 0) {\n const nestedPackageDirs: string[] = [];\n do {\n const startIndex: number = indexContent.lastIndexOf('\"', endIndex);\n if (startIndex < 0) {\n throw new Error(\n `Malformed index file at ${indexPath}: missing starting quote for nested package.json path`\n );\n }\n const nestedPath: string = indexContent.slice(startIndex + 1, endIndex);\n nestedPackageDirs.push(nestedPath);\n endIndex = indexContent.lastIndexOf(END_TOKEN, startIndex - 1);\n } while (endIndex > 0);\n return nestedPackageDirs;\n }\n return true;\n } catch (error) {\n if (!context.optional) {\n throw new Error(\n `Error reading index file for: \"${context.descriptionFileRoot}\" (${descriptionFileHash}): ${error.toString()}`\n );\n }\n return false;\n }\n }\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 have a file list. Assuming no nested \"package.json\" files.`\n );\n return;\n }\n\n let result: string[] | boolean | undefined =\n oldSubPackagesByIntegrity?.get(descriptionFileHash) ??\n subPackagesByIntegrity.get(descriptionFileHash);\n if (result === undefined) {\n result = await tryFindNestedPackageJsonsForContextAsync(context);\n }\n subPackagesByIntegrity.set(descriptionFileHash, result);\n if (result === true) {\n // Default case. Do nothing.\n } else if (result === false) {\n terminal.writeLine(`Trimming missing optional dependency at: ${descriptionFileRoot}`);\n contexts.delete(descriptionFileRoot);\n missingOptionalDependencies.add(descriptionFileRoot);\n } else {\n terminal.writeDebugLine(\n `Nested \"package.json\" files found for package at ${descriptionFileRoot}: ${result.join(', ')}`\n );\n // Clone this array to ensure that mutations don't affect the subpackage cache.\n // eslint-disable-next-line require-atomic-updates\n context.nestedPackageDirs = [...result];\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 // Serialize this before `computeResolverCacheFromLockfileAsync` because bundledDependencies get removed\n // from the `nestedPackageDirs` array. We clone above for safety, but this is making doubly sure.\n const newSubPackageCache: INestedPackageJsonCache = {\n version: SUBPACKAGE_CACHE_FILE_VERSION,\n subPackagesByIntegrity: Array.from(subPackagesByIntegrity)\n };\n const serializedSubpackageCache: string = JSON.stringify(newSubPackageCache);\n const writeSubPackageCachePromise: Promise<void> = FileSystem.writeFileAsync(\n subPackageCacheFilePath,\n serializedSubpackageCache,\n {\n ensureFolderExists: true\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 Promise.all([\n FileSystem.writeFileAsync(cacheFilePath, serialized, {\n ensureFolderExists: true\n }),\n writeSubPackageCachePromise\n ]);\n\n terminal.writeLine(`Resolver cache written.`);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/rush-resolver-cache-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.158.0",
|
|
4
4
|
"description": "A Rush plugin that generates a resolver cache file after successful install.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,17 +11,17 @@
|
|
|
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.
|
|
14
|
+
"@rushstack/rush-sdk": "5.158.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/webpack-env": "1.18.8",
|
|
18
18
|
"eslint": "~9.25.1",
|
|
19
|
-
"@rushstack/heft": "0.74.1",
|
|
20
|
-
"@rushstack/terminal": "0.15.4",
|
|
21
19
|
"@rushstack/node-core-library": "5.14.0",
|
|
22
|
-
"@rushstack/
|
|
23
|
-
"@rushstack/lookup-by-path": "0.7.
|
|
24
|
-
"
|
|
20
|
+
"@rushstack/terminal": "0.15.4",
|
|
21
|
+
"@rushstack/lookup-by-path": "0.7.4",
|
|
22
|
+
"@rushstack/webpack-workspace-resolve-plugin": "0.4.28",
|
|
23
|
+
"local-node-rig": "1.0.0",
|
|
24
|
+
"@rushstack/heft": "0.74.3"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|