@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 ADDED
@@ -0,0 +1,12 @@
1
+ # @nudojs/parser
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Conceptual design and basic implementation.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @nudojs/core@0.1.0
@@ -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 };