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 CHANGED
@@ -1,3 +1,13 @@
1
+ 2026.02.12, v7.2.0
2
+
3
+ feature:
4
+ - e8cb35f goldstein: import with attributes
5
+
6
+ 2026.02.12, v7.1.0
7
+
8
+ feature:
9
+ - a3adcd8 goldstein: export-default-from: add support
10
+
1
11
  2026.02.11, v7.0.4
2
12
 
3
13
  feature:
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.4",
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
- if (!this.type.keyword)
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
- node.specifiers = this.parseExportSpecifiers(exports);
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
@@ -18,6 +18,7 @@ export default function keywordImport(Parser) {
18
18
 
19
19
  if (this.type === tokTypes.string) {
20
20
  node.source = this.parseLiteral(this.value);
21
+ node.attributes = this.parseWithClause();
21
22
  } else if (this.type === tokTypes.name) {
22
23
  const {value} = this;
23
24