gulp-prettier 4.0.0 → 5.0.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/README.md +3 -3
- package/index.js +6 -6
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# gulp-prettier  [](https://www.npmjs.com/package/gulp-prettier) [](https://github.com/semantic-release/semantic-release)
|
|
2
2
|
|
|
3
3
|
> Format files with [Prettier](https://github.com/prettier/prettier)
|
|
4
4
|
|
|
@@ -49,7 +49,7 @@ Type: `Object`
|
|
|
49
49
|
|
|
50
50
|
Consult the Prettier [options](https://prettier.io/docs/en/options.html).
|
|
51
51
|
|
|
52
|
-
`editorconfig: true` can also be passed to enable [EditorConfig support](https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath
|
|
52
|
+
`editorconfig: true` can also be passed to enable [EditorConfig support](https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath--options).
|
|
53
53
|
|
|
54
54
|
### prettier.check([options])
|
|
55
55
|
|
|
@@ -61,7 +61,7 @@ Type: `Object`
|
|
|
61
61
|
|
|
62
62
|
Consult the Prettier [options](https://prettier.io/docs/en/options.html).
|
|
63
63
|
|
|
64
|
-
`editorconfig: true` can also be passed to enable [EditorConfig support](https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath
|
|
64
|
+
`editorconfig: true` can also be passed to enable [EditorConfig support](https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath--options).
|
|
65
65
|
|
|
66
66
|
## License
|
|
67
67
|
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const PLUGIN_NAME = 'gulp-prettier';
|
|
|
9
9
|
module.exports = function (options) {
|
|
10
10
|
options = options || {};
|
|
11
11
|
|
|
12
|
-
return through.obj(function (file, encoding, callback) {
|
|
12
|
+
return through.obj(async function (file, encoding, callback) {
|
|
13
13
|
if (file.isNull()) {
|
|
14
14
|
return callback(null, file);
|
|
15
15
|
}
|
|
@@ -18,13 +18,13 @@ module.exports = function (options) {
|
|
|
18
18
|
return callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const config = prettier.resolveConfig
|
|
21
|
+
const config = await prettier.resolveConfig(file.path, options);
|
|
22
22
|
const fileOptions = { ...config, ...options, filepath: file.path };
|
|
23
23
|
|
|
24
24
|
const unformattedCode = file.contents.toString('utf8');
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
|
-
const formattedCode = prettier.format(unformattedCode, fileOptions);
|
|
27
|
+
const formattedCode = await prettier.format(unformattedCode, fileOptions);
|
|
28
28
|
|
|
29
29
|
if (formattedCode !== unformattedCode) {
|
|
30
30
|
file.isPrettier = true;
|
|
@@ -49,7 +49,7 @@ module.exports.check = function (options) {
|
|
|
49
49
|
const unformattedFiles = [];
|
|
50
50
|
|
|
51
51
|
return through.obj(
|
|
52
|
-
function (file, encoding, callback) {
|
|
52
|
+
async function (file, encoding, callback) {
|
|
53
53
|
if (file.isNull()) {
|
|
54
54
|
return callback(null, file);
|
|
55
55
|
}
|
|
@@ -60,13 +60,13 @@ module.exports.check = function (options) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const config = prettier.resolveConfig
|
|
63
|
+
const config = await prettier.resolveConfig(file.path, options);
|
|
64
64
|
const fileOptions = { ...config, ...options, filepath: file.path };
|
|
65
65
|
|
|
66
66
|
const unformattedCode = file.contents.toString('utf8');
|
|
67
67
|
|
|
68
68
|
try {
|
|
69
|
-
const isFormatted = prettier.check(unformattedCode, fileOptions);
|
|
69
|
+
const isFormatted = await prettier.check(unformattedCode, fileOptions);
|
|
70
70
|
|
|
71
71
|
if (!isFormatted) {
|
|
72
72
|
const filename = path
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gulp-prettier",
|
|
3
3
|
"description": "Format files with Prettier",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,21 +20,22 @@
|
|
|
20
20
|
"gulpplugin"
|
|
21
21
|
],
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=16"
|
|
24
24
|
},
|
|
25
25
|
"author": "Thomas Vantuycom",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"plugin-error": "^
|
|
29
|
-
"prettier": "^
|
|
28
|
+
"plugin-error": "^2.0.0",
|
|
29
|
+
"prettier": "^3.0.0",
|
|
30
30
|
"through2": "^4.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@semantic-release/changelog": "^5.0.0",
|
|
34
34
|
"@semantic-release/git": "^9.0.0",
|
|
35
|
-
"ava": "^
|
|
35
|
+
"ava": "^5.1.0",
|
|
36
|
+
"p-event": "4.2.0",
|
|
36
37
|
"semantic-release": "^17.2.3",
|
|
37
|
-
"vinyl": "^
|
|
38
|
+
"vinyl": "^3.0.0"
|
|
38
39
|
},
|
|
39
40
|
"release": {
|
|
40
41
|
"plugins": [
|