@putout/plugin-esm 7.4.2 → 7.5.0
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/lib/apply-js-imported-file/index.js +4 -1
- package/lib/resolve-imported-file/change-imports/index.js +1 -0
- package/lib/resolve-imported-file/get-imports/index.js +2 -1
- package/lib/resolve-imported-file/index.js +1 -0
- package/lib/shorten-imported-file/get-imports/index.js +1 -0
- package/package.json +1 -1
|
@@ -54,7 +54,10 @@ export const scan = (rootPath, {push, trackFile}) => {
|
|
|
54
54
|
if (!content.includes('import'))
|
|
55
55
|
continue;
|
|
56
56
|
|
|
57
|
-
const ast = parse
|
|
57
|
+
const [error, ast] = tryCatch(parse, content);
|
|
58
|
+
|
|
59
|
+
if (error)
|
|
60
|
+
continue;
|
|
58
61
|
|
|
59
62
|
const places = transform(ast, content, {
|
|
60
63
|
plugins: [
|
|
@@ -4,6 +4,7 @@ export const fix = () => {};
|
|
|
4
4
|
|
|
5
5
|
export const include = () => [
|
|
6
6
|
'ImportDeclaration',
|
|
7
|
+
'ImportExpression',
|
|
7
8
|
];
|
|
8
9
|
|
|
9
10
|
export const filter = (path) => {
|
|
@@ -12,5 +13,5 @@ export const filter = (path) => {
|
|
|
12
13
|
if (!value.startsWith('.'))
|
|
13
14
|
return false;
|
|
14
15
|
|
|
15
|
-
return !/\.[
|
|
16
|
+
return !/\.[mc]?js/.test(value);
|
|
16
17
|
};
|
|
@@ -59,6 +59,7 @@ export const scan = (rootPath, {push, trackFile}) => {
|
|
|
59
59
|
const imports = places.map(getMessage);
|
|
60
60
|
const filename = getFilename(file);
|
|
61
61
|
const dir = dirname(filename);
|
|
62
|
+
|
|
62
63
|
const importsTuples = buildImports(dir, imports);
|
|
63
64
|
const resolvedTuples = buildResolved(rootPath, importsTuples);
|
|
64
65
|
|
package/package.json
CHANGED