@putout/plugin-esm 8.4.0 β†’ 8.5.1

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/README.md CHANGED
@@ -74,6 +74,10 @@ npm i putout @putout/plugin-esm -D
74
74
 
75
75
  ### add-index-to-import
76
76
 
77
+ > `import` a directory URL is unsupported. Instead
78
+ >
79
+ > (c) [nodejs.org](https://nodejs.org/api/errors.html#err_unsupported_dir_import)
80
+
77
81
  ESM doesn't add `index.js`, so it can be left after [`@putout/plugin-convert-esm-to-commonjs`](https://github.com/coderaiser/putout/blob/master/packages/plugin-convert-esm-to-commonjs#readme).
78
82
 
79
83
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/b7c489710767efee95ecf3dd16e232a2/9f974f0a345ef4d0cb39b011097dff82e6c32b75).
@@ -84,6 +88,8 @@ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/b7c4897107
84
88
  import insertRust from './insert-rust';
85
89
  import addAction from './add-action';
86
90
 
91
+ export * as read from './vfs/read';
92
+
87
93
  export const rules = {};
88
94
  ```
89
95
 
@@ -93,6 +99,8 @@ export const rules = {};
93
99
  import insertRust from './insert-rust/index.js';
94
100
  import addAction from './add-action/index.js';
95
101
 
102
+ export * as read from './vfs/read/index.js';
103
+
96
104
  export const rules = {};
97
105
  ```
98
106
 
@@ -470,7 +478,7 @@ import a from './a.js';
470
478
  import {a} from './a.js';
471
479
  ```
472
480
 
473
- ### apply-privately-imported-to-file
481
+ ### apply-privately-imported-file
474
482
 
475
483
  > Entries in the imports field must be strings starting with `#`.
476
484
  > Package imports permit mapping to external packages.
@@ -16,8 +16,14 @@ export const fix = (path) => {
16
16
  };
17
17
 
18
18
  export const traverse = ({push}) => ({
19
- ImportDeclaration: (path) => {
20
- const {value} = path.node.source;
19
+ 'ImportDeclaration|ExportNamedDeclaration': (path) => {
20
+ const {node} = path;
21
+ const {source} = node;
22
+
23
+ if (!source)
24
+ return;
25
+
26
+ const {value} = source;
21
27
  const ext = extname(value);
22
28
 
23
29
  if (ext)
package/lib/index.js CHANGED
@@ -19,7 +19,7 @@ import * as resolveImportedFile from './resolve-imported-file/index.js';
19
19
  import * as shortenImportedFile from './shorten-imported-file/index.js';
20
20
 
21
21
  export const rules = {
22
- 'add-index-to-import': ['off', addIndexToImport],
22
+ 'add-index-to-import': addIndexToImport,
23
23
  'apply-export-from': applyExportFrom,
24
24
  'convert-assert-to-with': convertAssertToWith,
25
25
  'declare-imports-first': declareImportsFirst,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-esm",
3
- "version": "8.4.0",
3
+ "version": "8.5.1",
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",