Skip to content

Commit ff6ec1d

Browse files
committed
chore: add playground
1 parent 30bdf92 commit ff6ec1d

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,5 @@ lib
112112

113113
test262/yarn.lock
114114
test262/package-lock.json
115-
index.js
115+
/index.js
116+
/playground/output.json

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"test:test262": "pnpm run build && node ./test/run_test262.js",
1919
"changeset:version": "changeset version && git add --all",
2020
"changeset:release": "changeset publish",
21-
"prepublishOnly": "pnpm build"
21+
"prepublishOnly": "pnpm build",
22+
"playground": "pnpm build && node ./playground/index.js"
2223
},
2324
"exports": {
2425
".": {

playground/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as fs from 'fs';
2+
import * as acorn from 'acorn';
3+
import { tsPlugin } from '../index.js';
4+
5+
const parser = acorn.Parser.extend(tsPlugin());
6+
7+
const content = fs.readFileSync('playground/input.ts', 'utf8');
8+
const output = parser.parse(content, {
9+
sourceType: 'module',
10+
ecmaVersion: 'latest',
11+
locations: true
12+
});
13+
14+
fs.writeFileSync('playground/output.json', JSON.stringify(output, null, 4));

playground/input.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)