@cssdoc/core 0.3.1 → 0.3.3
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/dist/index.d.mts +1 -1
- package/dist/index.mjs +13 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -516,7 +516,7 @@ interface ParseOptions {
|
|
|
516
516
|
//#endregion
|
|
517
517
|
//#region src/parse.d.ts
|
|
518
518
|
/**
|
|
519
|
-
* Parse a CSS string into a documentation model. Records are delimited by doc comments carrying a
|
|
519
|
+
* Parse a CSS string into a documentation model. Records are delimited by `/**` doc comments carrying a
|
|
520
520
|
* record tag (`@component`/`@name` by default; override via {@link ParseOptions.isRecordBoundary});
|
|
521
521
|
* everything from one boundary comment to the next belongs to that record.
|
|
522
522
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1063,7 +1063,18 @@ function buildEntry(name, doc, nodes, matcher) {
|
|
|
1063
1063
|
};
|
|
1064
1064
|
}
|
|
1065
1065
|
/**
|
|
1066
|
-
*
|
|
1066
|
+
* A cssdoc record is opened only by a JSDoc-style doc comment (its opener is `/**`) — never a plain
|
|
1067
|
+
* block comment. PostCSS doesn't distinguish the two, so an ordinary comment that merely mentions
|
|
1068
|
+
* `@component` (a TODO, a banner) would otherwise mint a phantom, summary-less record. We check the raw
|
|
1069
|
+
* source at the comment's offset for the `/**` opener, falling back to the leftover `*` that a `/**`
|
|
1070
|
+
* leaves at the start of the comment body when no offset is available.
|
|
1071
|
+
*/
|
|
1072
|
+
function isDocComment(node, source) {
|
|
1073
|
+
const offset = node.source?.start?.offset;
|
|
1074
|
+
return offset === void 0 ? node.text.startsWith("*") : source.startsWith("/**", offset);
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Parse a CSS string into a documentation model. Records are delimited by `/**` doc comments carrying a
|
|
1067
1078
|
* record tag (`@component`/`@name` by default; override via {@link ParseOptions.isRecordBoundary});
|
|
1068
1079
|
* everything from one boundary comment to the next belongs to that record.
|
|
1069
1080
|
*
|
|
@@ -1087,7 +1098,7 @@ function parseCssDocs(css, options = {}) {
|
|
|
1087
1098
|
const records = [];
|
|
1088
1099
|
let current = null;
|
|
1089
1100
|
for (const node of root.nodes) {
|
|
1090
|
-
if (node.type === "comment") {
|
|
1101
|
+
if (node.type === "comment" && isDocComment(node, css)) {
|
|
1091
1102
|
const name = boundary(node.text);
|
|
1092
1103
|
if (name) {
|
|
1093
1104
|
current = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cssdoc/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A generic CSS documentation extractor: parse doc-comments + the CSS AST into a serializable model (TSDoc, for CSS).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"postcss": "^8.5.16",
|
|
34
|
-
"@cssdoc/spec": "0.3.
|
|
34
|
+
"@cssdoc/spec": "0.3.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^24.13.3",
|