goldstein 7.0.3 → 7.1.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 +14 -0
- package/README.md +14 -0
- package/bun.lock +3094 -0
- package/package.json +8 -5
- package/packages/goldstein/index.js +2 -3
- package/packages/internal-parse-maybe-assign/index.js +1 -1
- package/packages/keyword-assign-from/index.js +1 -1
- package/packages/keyword-broken-string/index.js +1 -1
- package/packages/keyword-curry/index.js +1 -1
- package/packages/keyword-export-no-const/index.js +17 -3
- package/packages/keyword-fn/index.js +1 -1
- package/packages/keyword-freeze/index.js +1 -1
- package/packages/keyword-guard/index.js +1 -1
- package/packages/keyword-if/index.js +1 -1
- package/packages/keyword-import/index.js +1 -1
- package/packages/keyword-missing-initializer/index.js +1 -1
- package/packages/keyword-should/index.js +1 -1
- package/packages/keyword-try/index.js +2 -2
- package/packages/operator-safe-assignment/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goldstein",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "JavaScript with no limits",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./packages/goldstein/index.js"
|
|
9
9
|
},
|
|
10
|
+
"imports": {
|
|
11
|
+
"#operator": "./packages/operator/index.js"
|
|
12
|
+
},
|
|
10
13
|
"bin": {
|
|
11
14
|
"gs": "bin/gs.js"
|
|
12
15
|
},
|
|
@@ -32,6 +35,7 @@
|
|
|
32
35
|
"@putout/plugin-try-catch": "^7.0.0",
|
|
33
36
|
"@putout/printer": "^17.0.0",
|
|
34
37
|
"acorn": "^8.7.1",
|
|
38
|
+
"acorn-loose": "^8.5.2",
|
|
35
39
|
"acorn-typescript": "^1.4.13",
|
|
36
40
|
"estree-to-babel": "^12.0.0",
|
|
37
41
|
"estree-util-attach-comments": "^3.0.0",
|
|
@@ -40,16 +44,15 @@
|
|
|
40
44
|
},
|
|
41
45
|
"license": "MIT",
|
|
42
46
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@putout/eslint-flat": "^3.0.0",
|
|
47
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
45
48
|
"@putout/plugin-goldstein": "./rules/goldstein",
|
|
46
49
|
"@putout/test": "^15.0.0",
|
|
47
50
|
"c8": "^10.0.0",
|
|
48
51
|
"check-dts": "^0.9.0",
|
|
49
52
|
"esbuild": "^0.27.0",
|
|
50
53
|
"esbuild-node-builtins": "^0.1.0",
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-plugin-putout": "^
|
|
54
|
+
"eslint": "^10.0.0",
|
|
55
|
+
"eslint-plugin-putout": "^30.0.1",
|
|
53
56
|
"madrun": "^12.0.0",
|
|
54
57
|
"mock-require": "^3.0.3",
|
|
55
58
|
"montag": "^1.2.1",
|
|
@@ -12,11 +12,10 @@ import * as removeUnnamedObjectProperty from '../keyword-useless-comma/remove-un
|
|
|
12
12
|
|
|
13
13
|
export const compile = (source, options = {}) => {
|
|
14
14
|
const ast = parse(source, options);
|
|
15
|
+
const {rules} = options;
|
|
15
16
|
|
|
16
17
|
transform(ast, source, {
|
|
17
|
-
rules
|
|
18
|
-
...options.rules,
|
|
19
|
-
},
|
|
18
|
+
rules,
|
|
20
19
|
plugins: [
|
|
21
20
|
['try-catch', tryCatchPlugin],
|
|
22
21
|
['declare', declarePlugin],
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import {types} from 'putout';
|
|
2
|
-
import {tokTypes as tt} from '
|
|
2
|
+
import {tokTypes as tt} from '#operator';
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
5
|
variableDeclarator,
|
|
6
6
|
variableDeclaration,
|
|
7
|
+
exportDefaultSpecifier,
|
|
8
|
+
identifier,
|
|
7
9
|
} = types;
|
|
8
10
|
|
|
9
11
|
export default function keywordExportNoConst(Parser) {
|
|
10
12
|
return class extends Parser {
|
|
11
13
|
shouldParseExportStatement() {
|
|
12
|
-
|
|
14
|
+
const keyword = this.input.slice(this.pos + 1, this.pos + ' from'.length);
|
|
15
|
+
|
|
16
|
+
if (!this.type.keyword && keyword !== 'from')
|
|
13
17
|
return true;
|
|
14
18
|
|
|
15
19
|
return super.shouldParseExportStatement();
|
|
@@ -53,7 +57,17 @@ export default function keywordExportNoConst(Parser) {
|
|
|
53
57
|
} else {
|
|
54
58
|
// export { x, y as z } [from '...']
|
|
55
59
|
node.declaration = null;
|
|
56
|
-
|
|
60
|
+
|
|
61
|
+
if (this.type.label === 'name') {
|
|
62
|
+
const {value} = this;
|
|
63
|
+
|
|
64
|
+
node.specifiers = [
|
|
65
|
+
exportDefaultSpecifier(identifier(value)),
|
|
66
|
+
];
|
|
67
|
+
this.next();
|
|
68
|
+
} else {
|
|
69
|
+
node.specifiers = this.parseExportSpecifiers(exports);
|
|
70
|
+
}
|
|
57
71
|
|
|
58
72
|
if (this.eatContextual('from')) {
|
|
59
73
|
if (this.type !== tt.string)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {types} from 'putout';
|
|
2
|
-
import {setGoldsteinTry} from '../types/try.js';
|
|
3
2
|
import {
|
|
4
3
|
BIND_LEXICAL,
|
|
5
4
|
BIND_SIMPLE_CATCH,
|
|
6
5
|
SCOPE_SIMPLE_CATCH,
|
|
7
6
|
tokTypes as tt,
|
|
8
|
-
} from '
|
|
7
|
+
} from '#operator';
|
|
8
|
+
import {setGoldsteinTry} from '../types/try.js';
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
11
|
isCallExpression,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {types} from 'putout';
|
|
2
|
+
import {tokTypes as tt} from '#operator';
|
|
2
3
|
import {setGoldsteinTry} from '../types/try.js';
|
|
3
4
|
import {MissingInitializer} from '../keyword-missing-initializer/index.js';
|
|
4
|
-
import {tokTypes as tt} from '../operator/index.js';
|
|
5
5
|
|
|
6
6
|
const {assign} = Object;
|
|
7
7
|
|