@jsenv/core 39.13.2 → 39.13.3

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/jsenv_core.js +41 -6
  2. package/package.json +2 -2
@@ -3226,6 +3226,27 @@ const readDirectory = async (url, { emfileMaxWait = 1000 } = {}) => {
3226
3226
  return attempt();
3227
3227
  };
3228
3228
 
3229
+ const generateWindowsEPERMErrorMessage = (
3230
+ error,
3231
+ { operation, path },
3232
+ ) => {
3233
+ const pathLengthIsExceedingUsualLimit = String(path).length >= 256;
3234
+ let message = "";
3235
+
3236
+ if (operation) {
3237
+ message += `error while trying to fix windows EPERM after ${operation} on ${path}`;
3238
+ }
3239
+
3240
+ if (pathLengthIsExceedingUsualLimit) {
3241
+ message += "\n";
3242
+ message += `Maybe because path length is exceeding the usual limit of 256 characters of windows OS?`;
3243
+ message += "\n";
3244
+ }
3245
+ message += "\n";
3246
+ message += error.stack;
3247
+ return message;
3248
+ };
3249
+
3229
3250
  const writeEntryPermissions = async (source, permissions) => {
3230
3251
  const sourceUrl = assertAndNormalizeFileUrl(source);
3231
3252
 
@@ -3296,7 +3317,10 @@ const readEntryStat = async (
3296
3317
  return stats;
3297
3318
  } catch (e) {
3298
3319
  console.error(
3299
- `error while trying to fix windows EPERM after stats on ${sourcePath}: ${e.stack}`,
3320
+ generateWindowsEPERMErrorMessage(e, {
3321
+ operation: "stats",
3322
+ path: sourcePath,
3323
+ }),
3300
3324
  );
3301
3325
  throw error;
3302
3326
  }
@@ -3398,7 +3422,10 @@ const readEntryStatSync = (
3398
3422
  return stats;
3399
3423
  } catch (e) {
3400
3424
  console.error(
3401
- `error while trying to fix windows EPERM after stats on ${sourcePath}: ${e.stack}`,
3425
+ generateWindowsEPERMErrorMessage(e, {
3426
+ operation: "stats",
3427
+ path: sourcePath,
3428
+ }),
3402
3429
  );
3403
3430
  throw error;
3404
3431
  }
@@ -3816,7 +3843,10 @@ const removeDirectorySync$1 = (
3816
3843
  return;
3817
3844
  }
3818
3845
  console.error(
3819
- `error while trying to fix windows EPERM after readir on ${directoryPath}: ${openOrCloseError.stack}`,
3846
+ generateWindowsEPERMErrorMessage(openOrCloseError, {
3847
+ path: directoryPath,
3848
+ operation: "readir",
3849
+ }),
3820
3850
  );
3821
3851
  throw error;
3822
3852
  }
@@ -4152,7 +4182,6 @@ const removeDirectory = async (
4152
4182
  console.error(
4153
4183
  `trying to fix windows EPERM after readir on ${directoryPath}`,
4154
4184
  );
4155
-
4156
4185
  let openOrCloseError;
4157
4186
  try {
4158
4187
  const fd = openSync(directoryPath);
@@ -4166,7 +4195,10 @@ const removeDirectory = async (
4166
4195
  return;
4167
4196
  }
4168
4197
  console.error(
4169
- `error while trying to fix windows EPERM after readir on ${directoryPath}: ${openOrCloseError.stack}`,
4198
+ generateWindowsEPERMErrorMessage(openOrCloseError, {
4199
+ operation: "readdir",
4200
+ path: directoryPath,
4201
+ }),
4170
4202
  );
4171
4203
  throw error;
4172
4204
  }
@@ -4305,7 +4337,10 @@ const createWatcher = (sourcePath, options) => {
4305
4337
  return;
4306
4338
  }
4307
4339
  console.error(
4308
- `error while trying to get rid of windows EPERM: ${e.stack}`,
4340
+ generateWindowsEPERMErrorMessage(error, {
4341
+ operation: "watch",
4342
+ path: sourcePath,
4343
+ }),
4309
4344
  );
4310
4345
  throw error;
4311
4346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "39.13.2",
3
+ "version": "39.13.3",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -70,7 +70,7 @@
70
70
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
71
71
  "@jsenv/abort": "4.3.0",
72
72
  "@jsenv/ast": "6.5.0",
73
- "@jsenv/filesystem": "4.13.3",
73
+ "@jsenv/filesystem": "4.13.4",
74
74
  "@jsenv/humanize": "1.2.8",
75
75
  "@jsenv/importmap": "1.2.1",
76
76
  "@jsenv/integrity": "0.0.2",