Skip to content

Commit

Permalink
fix: 馃悰 added snapshots and fixed readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yousifalraheem committed Jan 2, 2021
1 parent 499b99b commit 1c95cbd
Show file tree
Hide file tree
Showing 6 changed files with 2,675 additions and 15 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ node_modules/

# testing
coverage/
__snapshots__/

# typescript
build/
Expand Down
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,28 @@
This package is a TypeScript and ECMAScript parser. It uses the underlying typescript parser to generate
a more or less human readable AST out of .js or .ts files.

[![Build Status](https://travis-ci.org/buehler/node-typescript-parser.svg)](https://travis-ci.org/buehler/node-typescript-parser)
[![Build Status Windows](https://ci.appveyor.com/api/projects/status/j06bqjc4tkdt7sej?svg=true)](https://ci.appveyor.com/project/buehler/node-typescript-parser)
[![Build Status](https://travis-ci.org/yousifalraheem/browser-typescript-parser.svg)](https://travis-ci.org/yousifalraheem/browser-typescript-parser)
[![Build Status Windows](https://ci.appveyor.com/api/projects/status/j06bqjc4tkdt7sej?svg=true)](https://ci.appveyor.com/project/yousifalraheem/browser-typescript-parser)
[![npm](https://img.shields.io/npm/v/typescript-parser.svg?maxAge=3600)](https://www.npmjs.com/package/typescript-parser)
[![codecov](https://codecov.io/gh/buehler/node-typescript-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/buehler/node-typescript-parser)
[![codecov](https://codecov.io/gh/yousifalraheem/browser-typescript-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/yousifalraheem/browser-typescript-parser)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Greenkeeper badge](https://badges.greenkeeper.io/buehler/node-typescript-parser.svg)](https://greenkeeper.io/)
[![Gitter](https://img.shields.io/gitter/room/node-typescript-parser/Lobby.svg)](https://gitter.im/node-typescript-parser/Lobby)
[![Greenkeeper badge](https://badges.greenkeeper.io/yousifalraheem/browser-typescript-parser.svg)](https://greenkeeper.io/)
[![Gitter](https://img.shields.io/gitter/room/browser-typescript-parser/Lobby.svg)](https://gitter.im/browser-typescript-parser/Lobby)

## How to use

After you install the package via:

[![NPM](https://nodei.co/npm/typescript-parser.png?downloads=true&stars=true)](https://nodei.co/npm/typescript-parser/)

### [View Source Docs](https://buehler.github.io/node-typescript-parser/)
### [View Source Docs](https://yousifalraheem.github.io/browser-typescript-parser/)

You can use the parser with:

```typescript
const parser = new TypescriptParser();

// either:
const parsed = await parser.parseSource(/* typescript source code as string */);

// or a filepath
const parsed = await parser.parseFile('/user/myfile.ts', 'workspace root');
```

You can also parse multiple files at ones.
Expand All @@ -44,7 +40,7 @@ Keep in mind, that the index'll only contain exported declarations.
## Changelog

The changelog is generated by [semantic release](https://github.com/semantic-release/semantic-release) and is located under the
[release section](https://github.com/buehler/node-typescript-parser/releases).
[release section](https://github.com/yousifalraheem/browser-typescript-parser/releases).

## Licence

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/yousifalraheem/node-typescript-parser.git"
"url": "https://github.com/yousifalraheem/browser-typescript-parser.git"
},
"keywords": [
"typescript",
Expand All @@ -31,9 +31,9 @@
"author": "Yousif Al-Raheem <yousifalraheem@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/yousifalraheem/node-typescript-parser/issues"
"url": "https://github.com/yousifalraheem/browser-typescript-parser/issues"
},
"homepage": "https://github.com/yousifalraheem/node-typescript-parser#readme",
"homepage": "https://github.com/yousifalraheem/browser-typescript-parser#readme",
"dependencies": {
"lodash": "^4.17.20",
"lodash-es": "^4.17.20"
Expand Down
63 changes: 63 additions & 0 deletions test/__snapshots__/SpecificUsageCases.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Specific usage cases get usage for directly reexported elements should contain imported default elements in usages 1`] = `Array []`;

exports[`Specific usage cases get usage for directly reexported elements should contain imported default elements in usages 2`] = `
Array [
"Test",
]
`;

exports[`Specific usage cases get usage for directly reexported elements should contain imported elements in usages 1`] = `
Array [
NamedExport {
"end": 189,
"from": "inline",
"specifiers": Array [
SymbolSpecifier {
"alias": undefined,
"specifier": "colors",
},
SymbolSpecifier {
"alias": undefined,
"specifier": "helpers",
},
SymbolSpecifier {
"alias": undefined,
"specifier": "theme",
},
SymbolSpecifier {
"alias": undefined,
"specifier": "icons",
},
],
"start": 148,
},
]
`;

exports[`Specific usage cases get usage for directly reexported elements should contain imported elements in usages 2`] = `
Array [
"colors",
"helpers",
"theme",
"icons",
]
`;

exports[`Specific usage cases i18next with and without destructure should contain i18next reference in not destructured way 1`] = `
Array [
"MyComponent",
"p",
"i18next",
"",
]
`;

exports[`Specific usage cases i18next with and without destructure should contain t reference in destructured way 1`] = `
Array [
"MyComponent",
"p",
"",
]
`;

0 comments on commit 1c95cbd

Please sign in to comment.