@putout/plugin-esm 9.10.0 → 9.11.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
@@ -137,7 +137,7 @@ Check out 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d8d428c2555b
137
137
  ```js
138
138
  import a from '../package.json';
139
139
 
140
- export __export from './package.json';
140
+ export * as x from './package.json';
141
141
 
142
142
  await import('./package.json');
143
143
  ```
@@ -149,10 +149,9 @@ import a from '../package.json' with {
149
149
  type: 'json',
150
150
  };
151
151
 
152
- export __export from './package.json' with {
153
- type: 'json',
152
+ export * from './package.json' with {
153
+ type: 'json',
154
154
  };
155
-
156
155
  await import('./package.json', {
157
156
  with: {
158
157
  type: 'json',
@@ -13,24 +13,19 @@ export const report = (path) => {
13
13
  };
14
14
 
15
15
  export const match = () => ({
16
- 'import __imports from "__a"': ({__a}) => {
17
- return __a.value.endsWith('.json');
18
- },
19
- 'export __exports from "__a"': ({__a}) => {
20
- return __a.value.endsWith('.json');
21
- },
22
- 'import(__a)': ({__a}) => {
23
- if (!isStringLiteral(__a))
24
- return false;
25
-
26
- return __a.value.endsWith('.json');
27
- },
16
+ 'import __imports from "__a"': isJSONSource,
17
+ 'export __exports from "__a"': isJSONSource,
18
+ 'export * from "__a"': isJSONSource,
19
+ 'import(__a)': isJSONSource,
28
20
  });
29
21
 
30
22
  export const replace = () => ({
31
23
  'import __imports from "__a"': `import __imports from "__a" with {
32
24
  type: 'json',
33
25
  }`,
26
+ 'export * from "__a"': `export * from "__a" with {
27
+ type: 'json',
28
+ }`,
34
29
  'export __exports from "__a"': `export __exports from "__a" with {
35
30
  type: 'json',
36
31
  }`,
@@ -40,3 +35,10 @@ export const replace = () => ({
40
35
  }
41
36
  })`,
42
37
  });
38
+
39
+ function isJSONSource({__a}) {
40
+ if (!isStringLiteral(__a))
41
+ return false;
42
+
43
+ return __a.value.endsWith('.json');
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-esm",
3
- "version": "9.10.0",
3
+ "version": "9.11.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",