goldstein 4.0.1 → 4.0.2

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,8 @@
1
+ 2023.08.30, v4.0.2
2
+
3
+ feature:
4
+ - 6f46703 parser options
5
+
1
6
  2023.08.29, v4.0.1
2
7
 
3
8
  fix:
package/bin/gs.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  writeFileSync,
7
7
  unlinkSync,
8
8
  } from 'node:fs';
9
+ import process from 'node:process';
9
10
  import {compile} from '../packages/goldstein/index.js';
10
11
 
11
12
  const [arg] = process.argv.slice(2);
package/build/parser.cjs CHANGED
@@ -5365,17 +5365,23 @@ var extendParser = (keywords3) => {
5365
5365
  };
5366
5366
  };
5367
5367
  var createParse = (parser) => (source) => {
5368
+ const comments = [];
5368
5369
  const options = {
5369
5370
  ecmaVersion: "latest",
5370
5371
  sourceType: "module",
5371
5372
  locations: true,
5372
- comment: true
5373
+ comment: true,
5374
+ ranges: true,
5375
+ onComment: (a) => {
5376
+ comments.push(a);
5377
+ }
5373
5378
  };
5374
5379
  const result = parser.parse(source, options);
5375
5380
  const tokens = Array.from(parser.tokenizer(source, options));
5376
5381
  return {
5377
5382
  ...result,
5378
- tokens
5383
+ tokens,
5384
+ comments
5379
5385
  };
5380
5386
  };
5381
5387
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goldstein",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "JavaScript with no limits",
@@ -46,7 +46,7 @@
46
46
  "c8": "^8.0.0",
47
47
  "check-dts": "^0.7.1",
48
48
  "escover": "^3.4.0",
49
- "eslint": "^8.0.0-beta.1",
49
+ "eslint": "^8.48.0",
50
50
  "eslint-plugin-n": "^16.0.1",
51
51
  "eslint-plugin-putout": "^19.0.3",
52
52
  "madrun": "^9.0.0",
@@ -2,7 +2,6 @@ import {Parser} from 'acorn';
2
2
 
3
3
  export const extendParser = (keywords) => {
4
4
  const parser = Parser.extend(...keywords);
5
-
6
5
  const parse = createParse(parser);
7
6
 
8
7
  return {
@@ -11,11 +10,16 @@ export const extendParser = (keywords) => {
11
10
  };
12
11
 
13
12
  const createParse = (parser) => (source) => {
13
+ const comments = [];
14
14
  const options = {
15
15
  ecmaVersion: 'latest',
16
16
  sourceType: 'module',
17
17
  locations: true,
18
18
  comment: true,
19
+ ranges: true,
20
+ onComment: (a) => {
21
+ comments.push(a);
22
+ },
19
23
  };
20
24
 
21
25
  const result = parser.parse(source, options);
@@ -24,5 +28,6 @@ const createParse = (parser) => (source) => {
24
28
  return {
25
29
  ...result,
26
30
  tokens,
31
+ comments,
27
32
  };
28
33
  };