@putout/plugin-nodejs 2.0.0 → 2.0.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
@@ -18,7 +18,7 @@ npm i putout @putout/plugin-nodejs -D
18
18
  "rules": {
19
19
  "nodejs/convert-fs-promises": "on",
20
20
  "nodejs/convert-promisify-to-fs-promises": "on",
21
- "nodejs/convert-dirname-to-promises": "on"
21
+ "nodejs/convert-dirname-to-url": "on"
22
22
  }
23
23
  }
24
24
  ```
@@ -58,7 +58,7 @@ const readFile = promisify(fs.readFile);
58
58
  const {readFile} = require('fs/promises');
59
59
  ```
60
60
 
61
- # convert-dirname-to-promises
61
+ # convert-dirname-to-url
62
62
 
63
63
  Only for `EcmaScript Modules`.
64
64
 
@@ -8,6 +8,6 @@ module.exports.report = () => `Use 'import.meta.url' instead of '__dirname'`;
8
8
  module.exports.filter = isESM;
9
9
 
10
10
  module.exports.replace = () => ({
11
- 'join(__dirname, __a)': 'new URL(__a, import.meta.url)',
12
- 'path.join(__dirname, __a)': 'new URL(__a, import.meta.url)',
11
+ 'join(__dirname, __a)': 'new URL(__a, import.meta.url).pathname',
12
+ 'path.join(__dirname, __a)': 'new URL(__a, import.meta.url).pathname',
13
13
  });
package/lib/index.js CHANGED
@@ -7,5 +7,6 @@ const getRule = (a) => ({
7
7
  module.exports.rules = {
8
8
  ...getRule('convert-fs-promises'),
9
9
  ...getRule('convert-promisify-to-fs-promises'),
10
+ ...getRule('convert-dirname-to-url'),
10
11
  };
11
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-nodejs",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "putout plugin adds ability to transform code to new API of Node.js",