pkgprn 0.5.3 → 0.5.4
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/package.json +1 -1
- package/prune.js +8 -3
package/package.json
CHANGED
package/prune.js
CHANGED
|
@@ -53,7 +53,7 @@ export async function prunePkg(pkg, options, logger) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (options.flatten) {
|
|
56
|
-
await flatten(pkg, options.flatten, logger);
|
|
56
|
+
await flatten(pkg, options.flatten, logger, options.removeSourcemaps);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
if (options.removeSourcemaps) {
|
|
@@ -72,6 +72,11 @@ export async function prunePkg(pkg, options, logger) {
|
|
|
72
72
|
|
|
73
73
|
await rm(sourceMap);
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
if (pkg.files && sourceMaps.length > 0) {
|
|
77
|
+
const removedMaps = new Set(sourceMaps.map(f => normalizePath(path.relative('.', f))));
|
|
78
|
+
pkg.files = pkg.files.filter(f => !removedMaps.has(normalizePath(f)));
|
|
79
|
+
}
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
if (options.stripComments) {
|
|
@@ -209,7 +214,7 @@ export async function prunePkg(pkg, options, logger) {
|
|
|
209
214
|
}
|
|
210
215
|
}
|
|
211
216
|
|
|
212
|
-
async function flatten(pkg, flatten, logger) {
|
|
217
|
+
async function flatten(pkg, flatten, logger, skipSourcemapAdjust) {
|
|
213
218
|
|
|
214
219
|
const allReferences = extractReferences(pkg);
|
|
215
220
|
|
|
@@ -339,7 +344,7 @@ async function flatten(pkg, flatten, logger) {
|
|
|
339
344
|
|
|
340
345
|
await Promise.all(renamePromises);
|
|
341
346
|
|
|
342
|
-
if (typeof flatten === 'string') {
|
|
347
|
+
if (typeof flatten === 'string' && !skipSourcemapAdjust) {
|
|
343
348
|
|
|
344
349
|
const oldToNew = new Map();
|
|
345
350
|
for (const [newPath, oldPath] of movedFiles) {
|