lockfile-subset 1.3.0 → 1.3.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/dist/index.mjs +19 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -201,6 +201,7 @@ async function extractPnpmSubset({ projectPath, packageNames, includeOptional =
|
|
|
201
201
|
//#endregion
|
|
202
202
|
//#region src/extract-yarn.ts
|
|
203
203
|
const { parse: parseYarnLockV1, stringify: stringifyYarnLockV1 } = createRequire(import.meta.url)("@yarnpkg/lockfile");
|
|
204
|
+
const OUTPUT_PACKAGE_NAME = "lockfile-subset-output";
|
|
204
205
|
function detectYarnVersion(content) {
|
|
205
206
|
return content.includes("# yarn lockfile v1") ? 1 : 2;
|
|
206
207
|
}
|
|
@@ -256,7 +257,7 @@ function extractV1({ projectPath, packageNames, includeOptional, lockfileContent
|
|
|
256
257
|
type: "yarn",
|
|
257
258
|
yarnVersion: 1,
|
|
258
259
|
packageJson: {
|
|
259
|
-
name:
|
|
260
|
+
name: OUTPUT_PACKAGE_NAME,
|
|
260
261
|
version: "1.0.0",
|
|
261
262
|
dependencies
|
|
262
263
|
},
|
|
@@ -325,7 +326,22 @@ function extractBerry({ projectPath, packageNames, includeOptional, lockfileCont
|
|
|
325
326
|
if (metadata.cacheKey) lines.push(` cacheKey: ${metadata.cacheKey}`);
|
|
326
327
|
lines.push("");
|
|
327
328
|
}
|
|
328
|
-
|
|
329
|
+
const rootWorkspaceKey = `${OUTPUT_PACKAGE_NAME}@workspace:.`;
|
|
330
|
+
const sortedKeys = [...keepOriginalKeys, rootWorkspaceKey].sort();
|
|
331
|
+
for (const originalKey of sortedKeys) {
|
|
332
|
+
if (originalKey === rootWorkspaceKey) {
|
|
333
|
+
lines.push(`"${originalKey}":`);
|
|
334
|
+
lines.push(" version: 0.0.0-use.local");
|
|
335
|
+
lines.push(` resolution: "${originalKey}"`);
|
|
336
|
+
if (Object.keys(dependencies).length > 0) {
|
|
337
|
+
lines.push(" dependencies:");
|
|
338
|
+
for (const [k, v] of Object.entries(dependencies)) lines.push(` ${k}: "npm:${v}"`);
|
|
339
|
+
}
|
|
340
|
+
lines.push(" languageName: unknown");
|
|
341
|
+
lines.push(" linkType: soft");
|
|
342
|
+
lines.push("");
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
329
345
|
const entry = lockfile[originalKey];
|
|
330
346
|
lines.push(`"${originalKey}":`);
|
|
331
347
|
lines.push(` version: ${entry.version}`);
|
|
@@ -366,7 +382,7 @@ function extractBerry({ projectPath, packageNames, includeOptional, lockfileCont
|
|
|
366
382
|
type: "yarn",
|
|
367
383
|
yarnVersion: 2,
|
|
368
384
|
packageJson: {
|
|
369
|
-
name:
|
|
385
|
+
name: OUTPUT_PACKAGE_NAME,
|
|
370
386
|
version: "1.0.0",
|
|
371
387
|
dependencies
|
|
372
388
|
},
|
package/package.json
CHANGED