putout 36.2.1 → 36.3.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/ChangeLog
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
2024.08.25, v36.3.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- b519d78c8 putout: @putout/engine-loader v14.0.0
|
|
5
|
+
- 3bd6fbf36 putout: validationError: throw -> return in places
|
|
6
|
+
- 285b3e496 @putout/printer: validateRules: export and move out from loadPlugins
|
|
7
|
+
|
|
1
8
|
2024.08.24, v36.2.1
|
|
2
9
|
|
|
3
10
|
feature:
|
package/lib/cli/process-file.js
CHANGED
|
@@ -8,7 +8,7 @@ const merge = require('../merge');
|
|
|
8
8
|
const parseMatch = require('../parse-options/parse-match');
|
|
9
9
|
|
|
10
10
|
const {simpleImport} = require('./simple-import');
|
|
11
|
-
const parseError = require('
|
|
11
|
+
const parseError = require('../parse-error');
|
|
12
12
|
|
|
13
13
|
const getMatchedOptions = (name, options) => {
|
|
14
14
|
if (!name.includes('{'))
|
package/lib/cli/runner/reader.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const tryToCatch = require('try-to-catch');
|
|
4
4
|
const {runProcessors} = require('@putout/engine-processor');
|
|
5
5
|
|
|
6
|
-
const parseError = require('
|
|
6
|
+
const parseError = require('../../parse-error.js');
|
|
7
7
|
const {simpleImport} = require('../simple-import');
|
|
8
8
|
const ignores = require('../../ignores.js');
|
|
9
9
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = (e) => {
|
|
3
|
+
module.exports = (e, type = 'parser') => {
|
|
4
4
|
const {line, column} = e.loc || {
|
|
5
5
|
line: 1,
|
|
6
6
|
column: 1,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const rule = e.rule ? `${e.rule} (parser)` :
|
|
9
|
+
const rule = e.rule ? `${e.rule} (parser)` : type;
|
|
10
10
|
const message = cutBrackets(e.message);
|
|
11
11
|
|
|
12
12
|
return [{
|
package/lib/transform.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const tryCatch = require('try-catch');
|
|
3
4
|
const {defaultOptions} = require('./default-options');
|
|
4
5
|
const {cutShebang} = require('./shebang');
|
|
6
|
+
const parseError = require('./parse-error');
|
|
7
|
+
const {validateRules} = require('@putout/engine-loader');
|
|
8
|
+
|
|
9
|
+
const maybeParseError = (a) => !a ? [] : parseError(a, 'loader');
|
|
5
10
|
|
|
6
11
|
// why we pass 'source' to 'transform()'?
|
|
7
12
|
// because we need to calculate position in a right way
|
|
8
|
-
// and determine is shebang is
|
|
13
|
+
// and determine is shebang is existing
|
|
9
14
|
//
|
|
10
15
|
// 25 return {¬
|
|
11
16
|
// 26 line: shebang ? line + 1 : line,¬
|
|
@@ -28,6 +33,11 @@ module.exports.transform = (ast, source, opts) => {
|
|
|
28
33
|
|
|
29
34
|
const [, shebang] = cutShebang(source);
|
|
30
35
|
|
|
36
|
+
const [validationError] = tryCatch(validateRules, {
|
|
37
|
+
rules,
|
|
38
|
+
pluginNames,
|
|
39
|
+
});
|
|
40
|
+
|
|
31
41
|
const plugins = loadPlugins({
|
|
32
42
|
pluginNames,
|
|
33
43
|
cache,
|
|
@@ -43,7 +53,10 @@ module.exports.transform = (ast, source, opts) => {
|
|
|
43
53
|
progress,
|
|
44
54
|
});
|
|
45
55
|
|
|
46
|
-
return
|
|
56
|
+
return [
|
|
57
|
+
...maybeParseError(validationError),
|
|
58
|
+
...places,
|
|
59
|
+
];
|
|
47
60
|
};
|
|
48
61
|
|
|
49
62
|
module.exports.transformAsync = async (ast, source, opts) => {
|
|
@@ -62,6 +75,11 @@ module.exports.transformAsync = async (ast, source, opts) => {
|
|
|
62
75
|
|
|
63
76
|
const [, shebang] = cutShebang(source);
|
|
64
77
|
|
|
78
|
+
const [validationError] = tryCatch(validateRules, {
|
|
79
|
+
rules,
|
|
80
|
+
pluginNames,
|
|
81
|
+
});
|
|
82
|
+
|
|
65
83
|
const plugins = await loadPluginsAsync({
|
|
66
84
|
pluginNames,
|
|
67
85
|
cache,
|
|
@@ -77,5 +95,8 @@ module.exports.transformAsync = async (ast, source, opts) => {
|
|
|
77
95
|
progress,
|
|
78
96
|
});
|
|
79
97
|
|
|
80
|
-
return
|
|
98
|
+
return [
|
|
99
|
+
...maybeParseError(validationError),
|
|
100
|
+
...places,
|
|
101
|
+
];
|
|
81
102
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.3.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@putout/cli-staged": "^1.0.0",
|
|
61
61
|
"@putout/cli-validate-args": "^2.0.0",
|
|
62
62
|
"@putout/compare": "^14.0.0",
|
|
63
|
-
"@putout/engine-loader": "^
|
|
63
|
+
"@putout/engine-loader": "^14.0.0",
|
|
64
64
|
"@putout/engine-parser": "^10.0.0",
|
|
65
65
|
"@putout/engine-processor": "^11.0.0",
|
|
66
66
|
"@putout/engine-reporter": "^1.0.0",
|