@elenajs/plugin-cem-tag 0.4.0 → 1.0.0-beta.2
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/README.md +109 -0
- package/package.json +12 -4
- package/src/index.js +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://elenajs.com/img/elena-dark.png" alt="Elena" width="558" height="220">
|
|
4
|
+
</source>
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://elenajs.com/img/elena-light.png" alt="Elena" width="558" height="220">
|
|
6
|
+
</source>
|
|
7
|
+
<img src="https://elenajs.com/img/elena-light.png" alt="Elena" width="558" height="220">
|
|
8
|
+
</picture>
|
|
9
|
+
|
|
10
|
+
### CEM analyzer plugin that copies custom Elena JSDoc tags into the manifest.
|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
|
|
14
|
+
<a href="https://arielsalminen.com"><img src="https://img.shields.io/badge/creator-@arielle-F95B1F" alt="Creator @arielle"/></a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@elenajs/plugin-cem-tag"><img src="https://img.shields.io/npm/v/@elenajs/plugin-cem-tag.svg" alt="Latest version on npm" /></a>
|
|
16
|
+
<a href="https://github.com/getelena/elena/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="Elena is released under the MIT license." /></a>
|
|
17
|
+
<a href="https://github.com/getelena/elena/actions/workflows/tests.yml"><img src="https://github.com/getelena/elena/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<br/>
|
|
22
|
+
|
|
23
|
+
<p align="center"><strong>@elenajs/plugin-cem-tag</strong> is a <a href="https://custom-elements-manifest.open-wc.org/">Custom Elements Manifest</a> analyzer plugin that copies custom JSDoc tags from <a href="https://elenajs.com">Elena</a> Progressive Web Component classes into the manifest.</p>
|
|
24
|
+
|
|
25
|
+
<br/>
|
|
26
|
+
|
|
27
|
+
## Table of contents
|
|
28
|
+
|
|
29
|
+
- **[Install](#install)**
|
|
30
|
+
- **[Usage](#usage)**
|
|
31
|
+
- **[How it works](#how-it-works)**
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install --save-dev @elenajs/plugin-cem-tag
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Peer dependency:** `@custom-elements-manifest/analyzer >= 0.10.0`
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Create one plugin instance per JSDoc tag you want to extract:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { elenaTagPlugin } from "@elenajs/plugin-cem-tag";
|
|
47
|
+
|
|
48
|
+
// In your CEM analyzer config
|
|
49
|
+
export default {
|
|
50
|
+
plugins: [
|
|
51
|
+
elenaTagPlugin("status"),
|
|
52
|
+
elenaTagPlugin("displayName"),
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or when using `@elenajs/bundler`, add it to the `analyze.plugins` array in `elena.config.mjs`:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
import { elenaTagPlugin } from "@elenajs/plugin-cem-tag";
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
analyze: {
|
|
64
|
+
plugins: [
|
|
65
|
+
elenaTagPlugin("status"),
|
|
66
|
+
elenaTagPlugin("displayName"),
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> [!NOTE]
|
|
73
|
+
> The `@elenajs/bundler` already includes this plugin by default for `@status` and `@displayName`. You only need to add it manually if you're using the CEM analyzer independently or want to extract additional custom tags.
|
|
74
|
+
|
|
75
|
+
## How it works
|
|
76
|
+
|
|
77
|
+
The plugin scans registered custom element classes for a specified JSDoc tag and writes its value onto the CEM class declaration. For example, given this component:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
/**
|
|
81
|
+
* Button component for interface actions.
|
|
82
|
+
*
|
|
83
|
+
* @displayName Button
|
|
84
|
+
* @status beta
|
|
85
|
+
*/
|
|
86
|
+
export default class Button extends Elena(HTMLElement, {
|
|
87
|
+
tagName: "elena-button",
|
|
88
|
+
}) {}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Using `elenaTagPlugin("status")` will add `"status": "beta"` to the component's CEM declaration, and `elenaTagPlugin("displayName")` will add `"displayName": "Button"`. This metadata is then available to IDEs, documentation generators, and other tools that consume the Custom Elements Manifest.
|
|
92
|
+
|
|
93
|
+
## API
|
|
94
|
+
|
|
95
|
+
### `elenaTagPlugin(tagName)`
|
|
96
|
+
|
|
97
|
+
Returns a CEM analyzer plugin that extracts the specified JSDoc tag.
|
|
98
|
+
|
|
99
|
+
| Parameter | Type | Description |
|
|
100
|
+
| --------- | -------- | ----------------------------------------------------------------- |
|
|
101
|
+
| `tagName` | `string` | The JSDoc tag name to extract (e.g. `"status"`, `"displayName"`). |
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
|
106
|
+
|
|
107
|
+
## Copyright
|
|
108
|
+
|
|
109
|
+
Copyright © 2026 [Ariel Salminen](https://arielsalminen.com)
|
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elenajs/plugin-cem-tag",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "CEM analyzer plugin that copies custom Elena JSDoc tags into the manifest.",
|
|
5
5
|
"author": "Elena <hi@elenajs.com>",
|
|
6
6
|
"homepage": "https://elenajs.com/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/getelena/elena.git",
|
|
10
|
+
"directory": "packages/plugin-cem-tag"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/getelena/elena/issues"
|
|
14
|
+
},
|
|
7
15
|
"license": "MIT",
|
|
8
16
|
"publishConfig": {
|
|
9
17
|
"access": "public"
|
|
@@ -26,8 +34,8 @@
|
|
|
26
34
|
},
|
|
27
35
|
"devDependencies": {
|
|
28
36
|
"@custom-elements-manifest/analyzer": "0.11.0",
|
|
29
|
-
"@elenajs/plugin-cem-define": "0.
|
|
30
|
-
"vitest": "4.0
|
|
37
|
+
"@elenajs/plugin-cem-define": "1.0.0-beta.2",
|
|
38
|
+
"vitest": "4.1.0"
|
|
31
39
|
},
|
|
32
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "18e13f305c8823f7633c739f2ec61cec2420267b"
|
|
33
41
|
}
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ██████████ ████
|
|
3
3
|
* ░░███░░░░░█░░███
|
|
4
|
-
* ░███ █ ░
|
|
5
|
-
* ░██████
|
|
6
|
-
* ░███░░█
|
|
7
|
-
* ░███ ░ █
|
|
4
|
+
* ░███ █ ░ ░███ ██████ ████████ ██████
|
|
5
|
+
* ░██████ ░███ ███░░███░░███░░███ ░░░░░███
|
|
6
|
+
* ░███░░█ ░███ ░███████ ░███ ░███ ███████
|
|
7
|
+
* ░███ ░ █ ░███ ░███░░░ ░███ ░███ ███░░███
|
|
8
8
|
* ██████████ █████░░██████ ████ █████░░████████
|
|
9
9
|
* ░░░░░░░░░░ ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░░░░░░░
|
|
10
10
|
*
|