@putout/plugin-esm 6.3.0 → 6.3.2

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.
@@ -1,4 +1,5 @@
1
1
  import {join, dirname} from 'node:path';
2
+ import tryCatch from 'try-catch';
2
3
  import putout, {
3
4
  parse,
4
5
  print,
@@ -52,7 +53,13 @@ export const scan = (rootPath, {push, trackFile}) => {
52
53
 
53
54
  for (const file of trackFile(rootPath, mask)) {
54
55
  const content = readFileContent(file);
55
- const ast = parse(content);
56
+ const [error, ast] = tryCatch(parse, content);
57
+
58
+ if (error) {
59
+ error.message += `\n${content}\n`;
60
+ throw error;
61
+ }
62
+
56
63
  const importsTuples = getImports(file, content, ast);
57
64
 
58
65
  for (const [name, source, importedFilename] of importsTuples) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-esm",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin improves ability to transform ESM code",
@@ -28,7 +28,8 @@
28
28
  "report": "madrun report"
29
29
  },
30
30
  "dependencies": {
31
- "parse-import-specifiers": "^1.0.3"
31
+ "parse-import-specifiers": "^1.0.3",
32
+ "try-catch": "^4.0.0"
32
33
  },
33
34
  "keywords": [
34
35
  "putout",