pkgprn-internal 0.5.2 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -5
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -695,7 +695,7 @@ async function prunePkg(pkg, options, logger) {
695
695
  }
696
696
 
697
697
  if (options.flatten) {
698
- await flatten(pkg, options.flatten, logger);
698
+ await flatten(pkg, options.flatten, logger, options.removeSourcemaps);
699
699
  }
700
700
 
701
701
  if (options.removeSourcemaps) {
@@ -714,6 +714,11 @@ async function prunePkg(pkg, options, logger) {
714
714
 
715
715
  await rm(sourceMap);
716
716
  }
717
+
718
+ if (pkg.files && sourceMaps.length > 0) {
719
+ const removedMaps = new Set(sourceMaps.map(f => normalizePath(path.relative('.', f))));
720
+ pkg.files = pkg.files.filter(f => !removedMaps.has(normalizePath(f)));
721
+ }
717
722
  }
718
723
 
719
724
  if (options.stripComments) {
@@ -851,7 +856,7 @@ async function prunePkg(pkg, options, logger) {
851
856
  }
852
857
  }
853
858
 
854
- async function flatten(pkg, flatten, logger) {
859
+ async function flatten(pkg, flatten, logger, skipSourcemapAdjust) {
855
860
 
856
861
  const allReferences = extractReferences(pkg);
857
862
 
@@ -977,7 +982,7 @@ async function flatten(pkg, flatten, logger) {
977
982
 
978
983
  await Promise.all(renamePromises);
979
984
 
980
- if (typeof flatten === 'string') {
985
+ if (typeof flatten === 'string' && !skipSourcemapAdjust) {
981
986
 
982
987
  const oldToNew = new Map();
983
988
  for (const [newPath, oldPath] of movedFiles) {
@@ -1125,8 +1130,15 @@ async function isEmptyDir(dir) {
1125
1130
  }
1126
1131
 
1127
1132
  async function isDirectory(file) {
1128
- const fileStat = await stat(file);
1129
- return fileStat.isDirectory();
1133
+ try {
1134
+ const fileStat = await stat(file);
1135
+ return fileStat.isDirectory();
1136
+ } catch (e) {
1137
+ if (typeof e === 'object' && e != null && 'code' in e && e.code === 'ENOENT') {
1138
+ return false;
1139
+ }
1140
+ throw e;
1141
+ }
1130
1142
  }
1131
1143
 
1132
1144
  async function walkDir(dir, ignoreDirs = []) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.2",
2
+ "version": "0.5.4",
3
3
  "name": "pkgprn-internal",
4
4
  "description": "Special version of pkgprn to install it in MY workspace-enabled repositories to build in-house packages",
5
5
  "license": "MIT",