blob: e399b5432ca454255fe1a2d0d5d5632a6ac7b513 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Custom element manifest analyzer plugin to remove static and private
* properties from custom-elements.json that we don't want to document in our
* Storybook props tables.
*/
function removePrivateAndStaticFields() {
return {
packageLinkPhase({ customElementsManifest }) {
customElementsManifest?.modules?.forEach(module => {
module?.declarations?.forEach(declaration => {
if (declaration.members != null) {
declaration.members = declaration.members.filter(member => {
return (
!member.kind === "field" ||
(!member.static && !member.name.startsWith("#"))
);
});
}
});
});
},
};
}
/**
* Custom element manifest config. Controls how we parse directories for custom
* elements to populate custom-elements.json, which is used by Storybook to
* generate docs.
*/
const config = {
globs: ["../../../toolkit/content/widgets/**/*.mjs"],
exclude: [
"../../../toolkit/content/widgets/**/*.stories.mjs",
"../../../toolkit/content/widgets/vendor/**",
"../../../toolkit/content/widgets/lit-utils.mjs",
],
outdir: ".",
litelement: true,
plugins: [removePrivateAndStaticFields()],
};
export default config;
|