File tree Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
+ * .d.ts
2
3
* .log
3
4
coverage /
4
5
node_modules /
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @typedef {import('unist').Position } Position
3
+ * @typedef {import('unist').Point } Point
4
+ *
5
+ * @typedef {Partial<Point> } PointLike
6
+ *
7
+ * @typedef {Object } PositionLike
8
+ * @property {PointLike } [start]
9
+ * @property {PointLike } [end]
10
+ *
11
+ * @typedef {Object } NodeLike
12
+ * @property {PositionLike } [position]
13
+ */
14
+
1
15
export var pointStart = point ( 'start' )
2
16
export var pointEnd = point ( 'end' )
3
17
18
+ /**
19
+ * Get the positional info of `node`.
20
+ *
21
+ * @param {NodeLike } [node]
22
+ * @returns {Position }
23
+ */
4
24
export function position ( node ) {
5
25
return { start : pointStart ( node ) , end : pointEnd ( node ) }
6
26
}
7
27
28
+ /**
29
+ * Get the positional info of `node`.
30
+ *
31
+ * @param {'start'|'end' } type
32
+ */
8
33
function point ( type ) {
9
34
point . displayName = type
10
35
11
36
return point
12
37
38
+ /**
39
+ * Get the positional info of `node`.
40
+ *
41
+ * @param {NodeLike } [node]
42
+ * @returns {Point }
43
+ */
13
44
function point ( node ) {
45
+ /** @type {Point } */
46
+ // @ts -ignore looks like a point
14
47
var point = ( node && node . position && node . position [ type ] ) || { }
15
48
16
49
return {
Original file line number Diff line number Diff line change 25
25
"sideEffects" : false ,
26
26
"type" : " module" ,
27
27
"main" : " index.js" ,
28
+ "types" : " index.d.ts" ,
28
29
"files" : [
30
+ " index.d.ts" ,
29
31
" index.js"
30
32
],
31
33
"devDependencies" : {
34
+ "@types/tape" : " ^4.0.0" ,
32
35
"c8" : " ^7.0.0" ,
33
36
"prettier" : " ^2.0.0" ,
34
37
"remark-cli" : " ^9.0.0" ,
35
38
"remark-preset-wooorm" : " ^8.0.0" ,
39
+ "rimraf" : " ^3.0.0" ,
36
40
"tape" : " ^5.0.0" ,
41
+ "type-coverage" : " ^2.0.0" ,
42
+ "typescript" : " ^4.0.0" ,
37
43
"xo" : " ^0.38.0"
38
44
},
39
45
"scripts" : {
46
+ "prepack" : " npm run build && npm run format" ,
47
+ "build" : " rimraf \" *.d.ts\" && tsc && type-coverage" ,
40
48
"format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
41
49
"test-api" : " node test.js" ,
42
50
"test-coverage" : " c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js" ,
43
- "test" : " npm run format && npm run test-coverage"
51
+ "test" : " npm run build && npm run format && npm run test-coverage"
44
52
},
45
53
"prettier" : {
46
54
"tabWidth" : 2 ,
62
70
"plugins" : [
63
71
" preset-wooorm"
64
72
]
73
+ },
74
+ "typeCoverage" : {
75
+ "atLeast" : 100 ,
76
+ "detail" : true ,
77
+ "strict" : true
65
78
}
66
79
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "include" : [" *.js" ],
3
+ "compilerOptions" : {
4
+ "target" : " ES2020" ,
5
+ "lib" : [" ES2020" ],
6
+ "module" : " ES2020" ,
7
+ "moduleResolution" : " node" ,
8
+ "allowJs" : true ,
9
+ "checkJs" : true ,
10
+ "declaration" : true ,
11
+ "emitDeclarationOnly" : true ,
12
+ "allowSyntheticDefaultImports" : true ,
13
+ "skipLibCheck" : true
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments