@nudojs/parser 0.1.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.md +12 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +14833 -0
- package/package.json +15 -0
- package/src/__tests__/directives-phase2.test.ts +113 -0
- package/src/__tests__/directives-phase3.test.ts +93 -0
- package/src/__tests__/directives.test.ts +129 -0
- package/src/directives.ts +312 -0
- package/src/index.ts +13 -0
- package/src/parse.ts +10 -0
- package/tsconfig.json +9 -0
package/CHANGELOG.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { File, Node } from '@babel/types';
|
|
2
|
+
import { TypeValue } from '@nudojs/core';
|
|
3
|
+
|
|
4
|
+
declare function parse(source: string): File;
|
|
5
|
+
|
|
6
|
+
type CaseDirective = {
|
|
7
|
+
kind: "case";
|
|
8
|
+
name: string;
|
|
9
|
+
args: TypeValue[];
|
|
10
|
+
expected?: TypeValue;
|
|
11
|
+
commentLine?: number;
|
|
12
|
+
};
|
|
13
|
+
type MockDirective = {
|
|
14
|
+
kind: "mock";
|
|
15
|
+
name: string;
|
|
16
|
+
expression?: string;
|
|
17
|
+
fromPath?: string;
|
|
18
|
+
};
|
|
19
|
+
type PureDirective = {
|
|
20
|
+
kind: "pure";
|
|
21
|
+
};
|
|
22
|
+
type SkipDirective = {
|
|
23
|
+
kind: "skip";
|
|
24
|
+
returns?: TypeValue;
|
|
25
|
+
};
|
|
26
|
+
type SampleDirective = {
|
|
27
|
+
kind: "sample";
|
|
28
|
+
count: number;
|
|
29
|
+
};
|
|
30
|
+
type ReturnsDirective = {
|
|
31
|
+
kind: "returns";
|
|
32
|
+
expected: TypeValue;
|
|
33
|
+
};
|
|
34
|
+
type Directive = CaseDirective | MockDirective | PureDirective | SkipDirective | SampleDirective | ReturnsDirective;
|
|
35
|
+
type FunctionWithDirectives = {
|
|
36
|
+
node: Node;
|
|
37
|
+
name: string;
|
|
38
|
+
directives: Directive[];
|
|
39
|
+
};
|
|
40
|
+
declare function parseTypeValueExpr(expr: string): TypeValue;
|
|
41
|
+
declare function extractDirectives(ast: Node): FunctionWithDirectives[];
|
|
42
|
+
|
|
43
|
+
export { type CaseDirective, type Directive, type FunctionWithDirectives, type MockDirective, type PureDirective, type ReturnsDirective, type SampleDirective, type SkipDirective, extractDirectives, parse, parseTypeValueExpr };
|