goldstein 2.4.1 → 2.5.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,16 @@
1
+ 2022.11.14, v2.5.0
2
+
3
+ feature:
4
+ - goldsten: export parse
5
+
6
+ 2022.10.20, v2.4.2
7
+
8
+ feature:
9
+ - package: putout v28.0.0
10
+ - package: esbuild v0.15.7
11
+ - package: @types/acorn v6.0.0
12
+ - package: supertape v8.0.1
13
+
1
14
  2022.07.20, v2.4.1
2
15
 
3
16
  feature:
package/README.md CHANGED
@@ -35,7 +35,6 @@ export fn hello() {
35
35
 
36
36
  $ gs 1.gs
37
37
  $ cat 1.js
38
- // ~1.js
39
38
  function hello() {
40
39
  return "world";
41
40
  }
@@ -46,6 +45,10 @@ export {
46
45
 
47
46
  ## API
48
47
 
48
+ ### `compile(source)`
49
+
50
+ When you need to compile **Goldstein** to **JavaScript** use:
51
+
49
52
  ```js
50
53
  import {compile} from 'goldstein';
51
54
 
@@ -70,6 +73,25 @@ function hello() {
70
73
  `;
71
74
  ```
72
75
 
76
+ ### `parse(source)`
77
+
78
+ When you need to get **JavaScript** ESTree AST use `parse`:
79
+
80
+ ```js
81
+ import {parse} from 'goldstein';
82
+
83
+ parse(`
84
+ fn hello() {
85
+ guard text !== "world" else {
86
+ return ""
87
+ }
88
+
89
+ return "Hello " + text
90
+ }
91
+ `);
92
+ // returns ESTree AST
93
+ ```
94
+
73
95
  ## Keywords
74
96
 
75
97
  **Goldstein** is absolutely compatible with JavaScript, and it has extensions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goldstein",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "type": "module",
5
5
  "commitType": "colon",
6
6
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
@@ -27,27 +27,25 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "acorn": "^8.7.1",
30
- "esbuild": "^0.14.47",
31
- "putout": "^27.0.1",
30
+ "esbuild": "^0.15.7",
31
+ "putout": "^28.0.0",
32
32
  "try-catch": "^3.0.1"
33
33
  },
34
34
  "license": "MIT",
35
35
  "devDependencies": {
36
36
  "@cloudcmd/stub": "^4.0.1",
37
- "@types/acorn": "^4.0.6",
38
37
  "c8": "^7.5.0",
39
38
  "check-dts": "^0.6.3",
40
39
  "escover": "^2.0.2",
41
40
  "eslint": "^8.0.0-beta.1",
42
41
  "eslint-plugin-n": "^15.2.4",
43
- "eslint-plugin-node": "^11.0.0",
44
42
  "eslint-plugin-putout": "^16.0.0",
45
43
  "madrun": "^9.0.0",
46
44
  "mock-require": "^3.0.3",
47
45
  "montag": "^1.2.1",
48
46
  "nodemon": "^2.0.2",
49
47
  "runsome": "^1.0.0",
50
- "supertape": "^7.0.0",
48
+ "supertape": "^8.0.1",
51
49
  "typescript": "^4.4.4",
52
50
  "zenload": "^2.0.0"
53
51
  },
@@ -11,7 +11,7 @@ import stringInterpolation from '../string-interpolation/index.js';
11
11
  import keywordCurry from '../keyword-curry/index.js';
12
12
  import keywordFreeze from '../keyword-freeze/index.js';
13
13
 
14
- export const compile = (source) => {
14
+ export const parse = (source) => {
15
15
  const {parse} = extendParser([
16
16
  keywordFn,
17
17
  keywordGuard,
@@ -23,8 +23,11 @@ export const compile = (source) => {
23
23
  stringInterpolation,
24
24
  ]);
25
25
 
26
+ return parse(source);
27
+ };
28
+
29
+ export const compile = (source) => {
26
30
  const ast = parse(source);
27
-
28
31
  const jsCode = print(ast);
29
32
  const {code} = putout(jsCode, {
30
33
  plugins: [