goldstein 7.0.4 → 7.2.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 +10 -0
- package/README.md +14 -0
- package/package.json +2 -1
- package/packages/keyword-export-no-const/index.js +17 -5
- package/packages/keyword-import/index.js +1 -0
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -520,6 +520,20 @@ The same as:
|
|
|
520
520
|
export const x = () => {};
|
|
521
521
|
```
|
|
522
522
|
|
|
523
|
+
### `export default from`
|
|
524
|
+
|
|
525
|
+
[ECMAScript Proposal: export default from](https://github.com/tc39/proposal-export-default-from).
|
|
526
|
+
|
|
527
|
+
```js
|
|
528
|
+
export hello from './x.js';
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
The same as:
|
|
532
|
+
|
|
533
|
+
```js
|
|
534
|
+
export {default} from './x.js';
|
|
535
|
+
```
|
|
536
|
+
|
|
523
537
|
### Wrong brace `)`
|
|
524
538
|
|
|
525
539
|
```diff
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goldstein",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "JavaScript with no limits",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@putout/plugin-try-catch": "^7.0.0",
|
|
36
36
|
"@putout/printer": "^17.0.0",
|
|
37
37
|
"acorn": "^8.7.1",
|
|
38
|
+
"acorn-loose": "^8.5.2",
|
|
38
39
|
"acorn-typescript": "^1.4.13",
|
|
39
40
|
"estree-to-babel": "^12.0.0",
|
|
40
41
|
"estree-util-attach-comments": "^3.0.0",
|
|
@@ -4,12 +4,16 @@ import {tokTypes as tt} from '#operator';
|
|
|
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,16 +57,24 @@ 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)
|
|
60
74
|
this.unexpected();
|
|
61
75
|
|
|
62
76
|
node.source = this.parseExprAtom();
|
|
63
|
-
|
|
64
|
-
if (this.options.ecmaVersion >= 16)
|
|
65
|
-
node.attributes = this.parseWithClause();
|
|
77
|
+
node.attributes = this.parseWithClause();
|
|
66
78
|
} else {
|
|
67
79
|
for (let i = 0, list = node.specifiers; i < list.length; ++i) {
|
|
68
80
|
// check for keywords used as local names
|