Skip to content

Commit c56ae69

Browse files
committed
Test updating cem
1 parent a4318f9 commit c56ae69

File tree

4 files changed

+805
-730
lines changed

4 files changed

+805
-730
lines changed

custom-elements-manifest.config.js

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
import { jsdocFunctionPlugin } from "cem-plugin-jsdoc-function";
1+
/**
2+
* @return {import('@custom-elements-manifest/analyzer').Plugin}
3+
*/
4+
function jsdocFunctionPlugin() {
5+
return {
6+
name: "jsdoc-function",
7+
analyzePhase({ ts, node, moduleDoc }) {
8+
if (ts.isVariableStatement(node)) {
9+
// @ts-expect-error: it very well might
10+
const comments = node.jsDoc ?? [];
11+
const tags = comments.flatMap((x) => x.tags ?? []);
12+
if (tags.some((x) => x.tagName?.getText?.() === "function")) {
13+
const { declarations } = node.declarationList;
14+
if (declarations.length > 1) return;
15+
const [{ name }] = declarations;
16+
const doc = moduleDoc.declarations.find(
17+
(d) => d.name === name.getText()
18+
);
19+
doc.kind = "function";
20+
}
21+
}
22+
},
23+
};
24+
}
225

326
/** @type {{ plugins: import('@custom-elements-manifest/analyzer').Plugin[] }} */
427
export default {

custom-elements.json

+22-30
Original file line numberDiff line numberDiff line change
@@ -55,95 +55,95 @@
5555
"name": "useCallback",
5656
"declaration": {
5757
"name": "useCallback",
58-
"module": "./use-callback"
58+
"module": "\"./use-callback\""
5959
}
6060
},
6161
{
6262
"kind": "js",
6363
"name": "useEffect",
6464
"declaration": {
6565
"name": "useEffect",
66-
"module": "./use-effect"
66+
"module": "\"./use-effect\""
6767
}
6868
},
6969
{
7070
"kind": "js",
7171
"name": "useLayoutEffect",
7272
"declaration": {
7373
"name": "useLayoutEffect",
74-
"module": "./use-layout-effect"
74+
"module": "\"./use-layout-effect\""
7575
}
7676
},
7777
{
7878
"kind": "js",
7979
"name": "useState",
8080
"declaration": {
8181
"name": "useState",
82-
"module": "./use-state"
82+
"module": "\"./use-state\""
8383
}
8484
},
8585
{
8686
"kind": "js",
8787
"name": "useReducer",
8888
"declaration": {
8989
"name": "useReducer",
90-
"module": "./use-reducer"
90+
"module": "\"./use-reducer\""
9191
}
9292
},
9393
{
9494
"kind": "js",
9595
"name": "useMemo",
9696
"declaration": {
9797
"name": "useMemo",
98-
"module": "./use-memo"
98+
"module": "\"./use-memo\""
9999
}
100100
},
101101
{
102102
"kind": "js",
103103
"name": "useContext",
104104
"declaration": {
105105
"name": "useContext",
106-
"module": "./use-context"
106+
"module": "\"./use-context\""
107107
}
108108
},
109109
{
110110
"kind": "js",
111111
"name": "useRef",
112112
"declaration": {
113113
"name": "useRef",
114-
"module": "./use-ref"
114+
"module": "\"./use-ref\""
115115
}
116116
},
117117
{
118118
"kind": "js",
119119
"name": "hook",
120120
"declaration": {
121121
"name": "hook",
122-
"module": "./hook"
122+
"module": "\"./hook\""
123123
}
124124
},
125125
{
126126
"kind": "js",
127127
"name": "Hook",
128128
"declaration": {
129129
"name": "Hook",
130-
"module": "./hook"
130+
"module": "\"./hook\""
131131
}
132132
},
133133
{
134134
"kind": "js",
135135
"name": "BaseScheduler",
136136
"declaration": {
137137
"name": "BaseScheduler",
138-
"module": "./scheduler"
138+
"module": "\"./scheduler\""
139139
}
140140
},
141141
{
142142
"kind": "js",
143143
"name": "State",
144144
"declaration": {
145145
"name": "State",
146-
"module": "./state"
146+
"module": "\"./state\""
147147
}
148148
}
149149
]
@@ -208,55 +208,55 @@
208208
"name": "html",
209209
"declaration": {
210210
"name": "html",
211-
"module": "./lit-haunted"
211+
"module": "\"./lit-haunted\""
212212
}
213213
},
214214
{
215215
"kind": "js",
216216
"name": "render",
217217
"declaration": {
218218
"name": "render",
219-
"module": "./lit-haunted"
219+
"module": "\"./lit-haunted\""
220220
}
221221
},
222222
{
223223
"kind": "js",
224224
"name": "component",
225225
"declaration": {
226226
"name": "component",
227-
"module": "./lit-haunted"
227+
"module": "\"./lit-haunted\""
228228
}
229229
},
230230
{
231231
"kind": "js",
232232
"name": "createContext",
233233
"declaration": {
234234
"name": "createContext",
235-
"module": "./lit-haunted"
235+
"module": "\"./lit-haunted\""
236236
}
237237
},
238238
{
239239
"kind": "js",
240240
"name": "virtual",
241241
"declaration": {
242242
"name": "virtual",
243-
"module": "./lit-haunted"
243+
"module": "\"./lit-haunted\""
244244
}
245245
},
246246
{
247247
"kind": "js",
248248
"name": "*",
249249
"declaration": {
250250
"name": "*",
251-
"package": "./core"
251+
"package": "\"./core\""
252252
}
253253
},
254254
{
255255
"kind": "js",
256256
"name": "default",
257257
"declaration": {
258258
"name": "default",
259-
"module": "./core"
259+
"module": "\"./core\""
260260
}
261261
}
262262
]
@@ -638,7 +638,7 @@
638638
"type": {
639639
"text": "string"
640640
},
641-
"default": "'haunted.context'"
641+
"default": "\"haunted.context\""
642642
}
643643
],
644644
"exports": [
@@ -1013,17 +1013,9 @@
10131013
"name": "useRef",
10141014
"parameters": [
10151015
{
1016-
"name": "initialValue",
1017-
"type": {
1018-
"text": "T"
1019-
}
1016+
"name": "initialValue"
10201017
}
1021-
],
1022-
"return": {
1023-
"type": {
1024-
"text": "{ current: T }"
1025-
}
1026-
}
1018+
]
10271019
}
10281020
],
10291021
"exports": [

0 commit comments

Comments
 (0)