@putout/plugin-esm 2.1.0 → 2.1.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
@@ -69,6 +69,7 @@ Group order:
69
69
 
70
70
  - ✅ builtins;
71
71
  - ✅ external;
72
+ - ✅ hashed;
72
73
  - ✅ internal;
73
74
 
74
75
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/3cc782acf95211f9d456d63a99032ee1/0674223d050bba572f5271ffdccf8616cb441af5).
@@ -82,6 +83,7 @@ import react from 'react';
82
83
  import d from '../hello.js';
83
84
  import ss from '../../bb/ss.js';
84
85
  import b from './ss.js';
86
+ import parse from '#parser';
85
87
 
86
88
  const c = 5;
87
89
  ```
@@ -92,6 +94,7 @@ const c = 5;
92
94
  import fs from 'node:fs';
93
95
  import react from 'react';
94
96
  import {lodash} from 'lodash';
97
+ import parse from '#parser';
95
98
  import b from './ss.js';
96
99
  import d from '../hello.js';
97
100
  import ss from '../../bb/ss.js';
@@ -29,7 +29,10 @@ module.exports.traverse = ({push}) => ({
29
29
  if (nextPath.node.specifiers.length !== 1)
30
30
  return;
31
31
 
32
- const is = isExcluded(source, nextPath, {
32
+ const first = source.value;
33
+ const second = nextPath.node.source.value;
34
+
35
+ const is = isExcluded(first, second, {
33
36
  direct: [
34
37
  ['node:', 'node:'],
35
38
  ['#', '#'],
@@ -50,14 +53,14 @@ module.exports.traverse = ({push}) => ({
50
53
  },
51
54
  });
52
55
 
53
- function isExcluded(source, nextPath, {direct, reversed}) {
56
+ function isExcluded(first, second, {direct, reversed}) {
54
57
  for (const [current, next] of direct) {
55
- if (source.value.startsWith(current) && !nextPath.node.source.value.startsWith(next))
58
+ if (first.startsWith(current) && !second.startsWith(next))
56
59
  return true;
57
60
  }
58
61
 
59
62
  for (const [current, next] of reversed) {
60
- if (!source.value.startsWith(current) && nextPath.node.source.value.startsWith(next))
63
+ if (!first.startsWith(current) && second.startsWith(next))
61
64
  return true;
62
65
  }
63
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-esm",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin improves ability to transform ESM code",