compmark-vue 0.2.1 → 0.2.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/cli.mjs +4 -10
- package/dist/index.mjs +4 -10
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -29,6 +29,10 @@ function parseSFC(source, filename) {
|
|
|
29
29
|
emits: []
|
|
30
30
|
};
|
|
31
31
|
const { descriptor } = parse(source, { filename });
|
|
32
|
+
if (descriptor.template?.ast) {
|
|
33
|
+
const templateSlots = extractTemplateSlots(descriptor.template.ast);
|
|
34
|
+
if (templateSlots.length > 0) doc.slots = templateSlots;
|
|
35
|
+
}
|
|
32
36
|
if (!descriptor.scriptSetup && !descriptor.script) return doc;
|
|
33
37
|
const compiled = compileScript(descriptor, { id: filename });
|
|
34
38
|
const componentJSDoc = extractComponentJSDoc(compiled.scriptSetupAst ?? compiled.scriptAst ?? []);
|
|
@@ -54,10 +58,6 @@ function parseSFC(source, filename) {
|
|
|
54
58
|
doc.props = optionsDoc.props;
|
|
55
59
|
doc.emits = optionsDoc.emits;
|
|
56
60
|
}
|
|
57
|
-
if (descriptor.template?.ast) {
|
|
58
|
-
const templateSlots = extractTemplateSlots(descriptor.template.ast);
|
|
59
|
-
doc.slots = mergeSlots(doc.slots ?? [], templateSlots);
|
|
60
|
-
}
|
|
61
61
|
return doc;
|
|
62
62
|
}
|
|
63
63
|
function extractComponentJSDoc(ast) {
|
|
@@ -377,12 +377,6 @@ function walkTemplate(children, slots) {
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
function mergeSlots(typedSlots, templateSlots) {
|
|
381
|
-
const merged = [...typedSlots];
|
|
382
|
-
const typedNames = new Set(typedSlots.map((s) => s.name));
|
|
383
|
-
for (const ts of templateSlots) if (!typedNames.has(ts.name)) merged.push(ts);
|
|
384
|
-
return merged;
|
|
385
|
-
}
|
|
386
380
|
function extractOptionsAPI(ast, source) {
|
|
387
381
|
let props = [];
|
|
388
382
|
let emits = [];
|
package/dist/index.mjs
CHANGED
|
@@ -28,6 +28,10 @@ function parseSFC(source, filename) {
|
|
|
28
28
|
emits: []
|
|
29
29
|
};
|
|
30
30
|
const { descriptor } = parse(source, { filename });
|
|
31
|
+
if (descriptor.template?.ast) {
|
|
32
|
+
const templateSlots = extractTemplateSlots(descriptor.template.ast);
|
|
33
|
+
if (templateSlots.length > 0) doc.slots = templateSlots;
|
|
34
|
+
}
|
|
31
35
|
if (!descriptor.scriptSetup && !descriptor.script) return doc;
|
|
32
36
|
const compiled = compileScript(descriptor, { id: filename });
|
|
33
37
|
const componentJSDoc = extractComponentJSDoc(compiled.scriptSetupAst ?? compiled.scriptAst ?? []);
|
|
@@ -53,10 +57,6 @@ function parseSFC(source, filename) {
|
|
|
53
57
|
doc.props = optionsDoc.props;
|
|
54
58
|
doc.emits = optionsDoc.emits;
|
|
55
59
|
}
|
|
56
|
-
if (descriptor.template?.ast) {
|
|
57
|
-
const templateSlots = extractTemplateSlots(descriptor.template.ast);
|
|
58
|
-
doc.slots = mergeSlots(doc.slots ?? [], templateSlots);
|
|
59
|
-
}
|
|
60
60
|
return doc;
|
|
61
61
|
}
|
|
62
62
|
function extractComponentJSDoc(ast) {
|
|
@@ -376,12 +376,6 @@ function walkTemplate(children, slots) {
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
function mergeSlots(typedSlots, templateSlots) {
|
|
380
|
-
const merged = [...typedSlots];
|
|
381
|
-
const typedNames = new Set(typedSlots.map((s) => s.name));
|
|
382
|
-
for (const ts of templateSlots) if (!typedNames.has(ts.name)) merged.push(ts);
|
|
383
|
-
return merged;
|
|
384
|
-
}
|
|
385
379
|
function extractOptionsAPI(ast, source) {
|
|
386
380
|
let props = [];
|
|
387
381
|
let emits = [];
|