goldstein 7.3.2 → 7.4.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 +11 -0
- package/README.md +0 -9
- package/package.json +6 -7
- package/packages/goldstein/index.js +1 -2
- package/packages/internal-parse-maybe-assign/index.js +1 -1
- package/packages/keyword-add-array/index.js +3 -1
- package/packages/keyword-arrow/index.js +1 -0
- package/packages/keyword-broken-string/index.js +1 -0
- package/packages/keyword-export-no-const/index.js +2 -0
- package/packages/keyword-import/index.js +4 -1
- package/packages/keyword-missing-initializer/index.js +1 -1
- package/packages/keyword-useless-comma/index.js +4 -1
- package/packages/string-interpolation/index.js +5 -0
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2026.07.12, v7.4.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 6e867b7 goldstein: import type
|
|
5
|
+
- a478fab goldstein: runsome: drop
|
|
6
|
+
- fb9c10d goldstein: supertape v13.4.1
|
|
7
|
+
- 4e8f208 goldstein: typescript v6.0.3
|
|
8
|
+
- a4a2304 goldstein: montag v2.0.1
|
|
9
|
+
- ea853f7 goldstein: esbuild v0.28.0
|
|
10
|
+
- c6c41d6 goldstein: check-dts v1.0.0
|
|
11
|
+
|
|
1
12
|
2026.03.04, v7.3.2
|
|
2
13
|
|
|
3
14
|
feature:
|
package/README.md
CHANGED
|
@@ -31,7 +31,6 @@ $ cat > 1.gs
|
|
|
31
31
|
export fn hello() {
|
|
32
32
|
return 'world';
|
|
33
33
|
}
|
|
34
|
-
|
|
35
34
|
$ gs 1.gs
|
|
36
35
|
$ cat 1.js
|
|
37
36
|
function hello() {
|
|
@@ -46,7 +45,6 @@ Let's do a bit more!
|
|
|
46
45
|
|
|
47
46
|
```gs
|
|
48
47
|
const a = () => throw 'hello';
|
|
49
|
-
|
|
50
48
|
if a > 2 {
|
|
51
49
|
log('hello');
|
|
52
50
|
}
|
|
@@ -82,7 +80,6 @@ compile(`
|
|
|
82
80
|
return "Hello " + text
|
|
83
81
|
}
|
|
84
82
|
`);
|
|
85
|
-
|
|
86
83
|
// returns
|
|
87
84
|
`
|
|
88
85
|
function hello() {
|
|
@@ -127,7 +124,6 @@ compile(source, {
|
|
|
127
124
|
}],
|
|
128
125
|
},
|
|
129
126
|
});
|
|
130
|
-
|
|
131
127
|
// returns
|
|
132
128
|
`
|
|
133
129
|
const id = (a) => a;
|
|
@@ -156,7 +152,6 @@ parse(`
|
|
|
156
152
|
return "Hello " + text
|
|
157
153
|
}
|
|
158
154
|
`);
|
|
159
|
-
|
|
160
155
|
// returns Babel AST
|
|
161
156
|
```
|
|
162
157
|
|
|
@@ -250,7 +245,6 @@ fn hello() {
|
|
|
250
245
|
guard text !== "world" else {
|
|
251
246
|
return ""
|
|
252
247
|
}
|
|
253
|
-
|
|
254
248
|
return "Hello " + text
|
|
255
249
|
}
|
|
256
250
|
```
|
|
@@ -397,7 +391,6 @@ Similar to [partial application](https://github.com/tc39/proposal-partial-applic
|
|
|
397
391
|
```gs
|
|
398
392
|
const sum = (a, b) => a + b;
|
|
399
393
|
const inc = sum~(1);
|
|
400
|
-
|
|
401
394
|
inc(5);
|
|
402
395
|
// returns
|
|
403
396
|
6
|
|
@@ -410,7 +403,6 @@ When you import `.gs` files during compile step it will be replaced with `.js`:
|
|
|
410
403
|
```gs
|
|
411
404
|
// hello.js
|
|
412
405
|
export const hello = () => 'world';
|
|
413
|
-
|
|
414
406
|
// index.js1
|
|
415
407
|
import hello from './hello.gs';
|
|
416
408
|
```
|
|
@@ -489,7 +481,6 @@ const a = {
|
|
|
489
481
|
- b;
|
|
490
482
|
+ b,
|
|
491
483
|
};
|
|
492
|
-
|
|
493
484
|
const a = {
|
|
494
485
|
- b(){},
|
|
495
486
|
+ b(){}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goldstein",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "JavaScript with no limits",
|
|
@@ -47,20 +47,19 @@
|
|
|
47
47
|
"@putout/eslint-flat": "^4.0.0",
|
|
48
48
|
"@putout/plugin-goldstein": "./rules/goldstein",
|
|
49
49
|
"@putout/test": "^15.0.0",
|
|
50
|
-
"check-dts": "^0.
|
|
51
|
-
"esbuild": "^0.
|
|
50
|
+
"check-dts": "^1.0.0",
|
|
51
|
+
"esbuild": "^0.28.0",
|
|
52
52
|
"esbuild-node-builtins": "^0.1.0",
|
|
53
53
|
"eslint": "^10.0.0",
|
|
54
54
|
"eslint-plugin-putout": "^31.0.0",
|
|
55
55
|
"madrun": "^13.0.0",
|
|
56
56
|
"mock-require": "^3.0.3",
|
|
57
|
-
"montag": "^
|
|
57
|
+
"montag": "^2.0.1",
|
|
58
58
|
"nodemon": "^3.0.1",
|
|
59
59
|
"redlint": "^6.0.0",
|
|
60
|
-
"runsome": "^1.0.0",
|
|
61
60
|
"superc8": "^12.2.4",
|
|
62
|
-
"supertape": "^
|
|
63
|
-
"typescript": "^
|
|
61
|
+
"supertape": "^13.4.1",
|
|
62
|
+
"typescript": "^6.0.3"
|
|
64
63
|
},
|
|
65
64
|
"engines": {
|
|
66
65
|
"node": ">=22"
|
|
@@ -4,12 +4,11 @@ import * as tryCatchPlugin from '@putout/plugin-try-catch';
|
|
|
4
4
|
import * as declarePlugin from '@putout/plugin-declare';
|
|
5
5
|
import * as logicalExpressionsPlugin from '@putout/plugin-logical-expressions';
|
|
6
6
|
import {parse} from './parser.js';
|
|
7
|
+
import * as removeUnnamedObjectProperty from '../keyword-useless-comma/remove-unnamed-object-property/index.js';
|
|
7
8
|
|
|
8
9
|
export {convert} from '../convert/index.js';
|
|
9
10
|
export {print} from '../printer/index.js';
|
|
10
11
|
export * from './parser.js';
|
|
11
|
-
import * as removeUnnamedObjectProperty from '../keyword-useless-comma/remove-unnamed-object-property/index.js';
|
|
12
|
-
|
|
13
12
|
export const compile = (source, options = {}) => {
|
|
14
13
|
const ast = parse(source, options);
|
|
15
14
|
const {rules} = options;
|
|
@@ -28,7 +28,7 @@ export function parseMaybeAssign(forInit, refDestructuringErrors, afterLeftParse
|
|
|
28
28
|
|
|
29
29
|
// The tokenizer will assume an expression is allowed after
|
|
30
30
|
// `yield`, but this isn't that kind of yield
|
|
31
|
-
this.exprAllowed = false
|
|
31
|
+
this.exprAllowed = false;/* c8 ignore end */
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
let ownDestructuringErrors = false;
|
|
@@ -20,7 +20,9 @@ export default function keywordAddArray(Parser) {
|
|
|
20
20
|
|
|
21
21
|
assign(node, {
|
|
22
22
|
callee: memberExpression(left, identifier('push')),
|
|
23
|
-
arguments: [
|
|
23
|
+
arguments: [
|
|
24
|
+
spreadElement(right),
|
|
25
|
+
],
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
return this.finishNode(node, 'CallExpression');
|
|
@@ -23,6 +23,7 @@ export default function keywordExportNoConst(Parser) {
|
|
|
23
23
|
this.next();
|
|
24
24
|
|
|
25
25
|
/* c8 ignore start */
|
|
26
|
+
|
|
26
27
|
// export * from '...'
|
|
27
28
|
if (this.eat(tt.star))
|
|
28
29
|
return this.parseExportAllDeclaration(node, exports);
|
|
@@ -81,6 +82,7 @@ export default function keywordExportNoConst(Parser) {
|
|
|
81
82
|
const spec = list[i];
|
|
82
83
|
|
|
83
84
|
this.checkUnreserved(spec.local);
|
|
85
|
+
|
|
84
86
|
// check if export is defined
|
|
85
87
|
this.checkLocalExport(spec.local);
|
|
86
88
|
|
|
@@ -6,12 +6,15 @@ export default function keywordImport(Parser) {
|
|
|
6
6
|
return class extends Parser {
|
|
7
7
|
parseImport(node) {
|
|
8
8
|
this.next();
|
|
9
|
+
|
|
9
10
|
// import '...'
|
|
11
|
+
if (super.eatContextual('type'))
|
|
12
|
+
node.importKind = 'type';
|
|
10
13
|
|
|
11
14
|
/* c8 ignore start */
|
|
12
15
|
if (this.type === tokTypes.string) {
|
|
13
16
|
node.specifiers = empty;
|
|
14
|
-
node.source = this.parseExprAtom()
|
|
17
|
+
node.source = this.parseExprAtom();/* c8 ignore end */
|
|
15
18
|
} else {
|
|
16
19
|
node.specifiers = this.parseImportSpecifiers();
|
|
17
20
|
this.expectContextual('from');
|
|
@@ -14,7 +14,7 @@ export default function keywordMissingInitializer(Parser) {
|
|
|
14
14
|
if (!this.parseSafeAssignment)
|
|
15
15
|
this.raise(this.lastTokEnd, `Enable 'operator-safe-assignment' to have ability to use '?='`);
|
|
16
16
|
|
|
17
|
-
decl.init = this.parseSafeAssignment()
|
|
17
|
+
decl.init = this.parseSafeAssignment();/* c8 ignore start */
|
|
18
18
|
} else if (this.eat(tt.eq)) {
|
|
19
19
|
decl.init = this.parseMaybeAssign(isFor);
|
|
20
20
|
} else if (!allowMissingInitializer && kind === 'const' && this.type !== tt._in && !(this.options.ecmaVersion >= 6 && this.isContextual('of'))) {
|
|
@@ -12,13 +12,16 @@ export default function fn(Parser) {
|
|
|
12
12
|
node.name = this.type.keyword;
|
|
13
13
|
|
|
14
14
|
// To fix https://github.com/acornjs/acorn/issues/575
|
|
15
|
+
|
|
15
16
|
// `class` and `function` keywords push new context into this.context.
|
|
17
|
+
|
|
16
18
|
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
19
|
+
|
|
17
20
|
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
18
21
|
if ((node.name === 'class' || node.name === 'function') && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46))
|
|
19
22
|
this.context.pop();
|
|
20
23
|
|
|
21
|
-
this.type = tt.name
|
|
24
|
+
this.type = tt.name;/* c8 ignore end */
|
|
22
25
|
} else {
|
|
23
26
|
node.name = this.value;
|
|
24
27
|
}
|
|
@@ -20,16 +20,20 @@ export default function stringInterpolation(Parser) {
|
|
|
20
20
|
if (char === '(') {
|
|
21
21
|
// keep count of parenthesis
|
|
22
22
|
parenthesis++;
|
|
23
|
+
|
|
23
24
|
// check if previous token was "/" (only if literal is not opened yet)
|
|
24
25
|
const prev = index - 1;
|
|
25
26
|
|
|
26
27
|
if (chars[prev] === '/' && !literalOpened) {
|
|
27
28
|
// set previous char to "$"
|
|
28
29
|
out[prev] = '$';
|
|
30
|
+
|
|
29
31
|
// set current char to "{"
|
|
30
32
|
char = '{';
|
|
33
|
+
|
|
31
34
|
// set literalOpened to true
|
|
32
35
|
literalOpened = true;
|
|
36
|
+
|
|
33
37
|
// match TemplateLiteral instead of StringLiteral
|
|
34
38
|
isTemplateLiteral = true;
|
|
35
39
|
}
|
|
@@ -38,6 +42,7 @@ export default function stringInterpolation(Parser) {
|
|
|
38
42
|
|
|
39
43
|
if (!parenthesis && literalOpened) {
|
|
40
44
|
char = '}';
|
|
45
|
+
|
|
41
46
|
// reset literalOpened to false
|
|
42
47
|
literalOpened = false;
|
|
43
48
|
}
|