@component-compass/parser-vue 0.1.14 → 0.1.17
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/emit-template.d.ts +36 -6
- package/dist/emit-template.js +108 -6
- package/dist/emit-template.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/script-imports.js +11 -0
- package/dist/script-imports.js.map +1 -1
- package/package.json +4 -4
package/dist/emit-template.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import type { ResolveLazyManifest } from "@component-compass/plugin-core";
|
|
1
|
+
import type { DiagnosticCollector, ResolveLazyManifest } from "@component-compass/plugin-core";
|
|
2
2
|
import type { FileBuilder } from "@component-compass/reference-graph";
|
|
3
3
|
import type { VueParseWrapper } from "./parse-sfc.js";
|
|
4
|
+
/**
|
|
5
|
+
* Vue tag-form enumeration. A script-bound import resolves both via its
|
|
6
|
+
* lowercased exact form (`Card` → `card`) and its PascalCase→kebab form
|
|
7
|
+
* (`VBtn` → `v-btn`). Pre-computed once per import; ported from src/index.ts.
|
|
8
|
+
*/
|
|
9
|
+
export declare function vueTagForms(importName: string): string[];
|
|
10
|
+
/** One auto-import manifest entry: the synthetic import to emit for a tag. */
|
|
11
|
+
export type AutoImportComponent = {
|
|
12
|
+
specifier: string;
|
|
13
|
+
imported: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
4
16
|
/**
|
|
5
17
|
* Options threaded into the parse5-based Vue SFC emitter. Mirrors the legacy
|
|
6
18
|
* `walkVueTemplate` surface but consumes the reference-graph FileBuilder
|
|
@@ -15,13 +27,31 @@ export type EmitVueTemplateOpts = {
|
|
|
15
27
|
fileBuilder: FileBuilder;
|
|
16
28
|
/**
|
|
17
29
|
* Optional lazy-manifest priming hook. Vue SFCs commonly side-effect-import
|
|
18
|
-
* a WC's register entrypoint (`import "@pkg/components/button"`)
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
30
|
+
* a WC's register entrypoint (`import "@pkg/components/button"`), including
|
|
31
|
+
* through re-export barrels — the leaf package may sit below the static
|
|
32
|
+
* CemIndex's top-level `node_modules` glob. Calling `resolveLazyManifest`
|
|
33
|
+
* for each side-effect source walks the re-export chain and primes the
|
|
34
|
+
* lazy resolver's shared `byTag` cache, which the reference-graph engine's
|
|
35
|
+
* `tagIndex.externalByTag` consults so template tag references
|
|
36
|
+
* (`<x-button>`) can be resolved later. Optional — when undefined the
|
|
37
|
+
* priming loop is skipped (acceptable for synthetic test fixtures).
|
|
23
38
|
*/
|
|
24
39
|
resolveLazyManifest?: ResolveLazyManifest;
|
|
40
|
+
/**
|
|
41
|
+
* Optional auto-import lookup (#346). Consulted for template tags with no
|
|
42
|
+
* script binding, BEFORE the hyphenated custom-element lane. A hit emits a
|
|
43
|
+
* synthetic import + JsxUsage — exactly what an explicit script import of
|
|
44
|
+
* the same component would produce — so engine identity/composition
|
|
45
|
+
* behaviour is identical by construction. Keys are parse5's lowercased tag
|
|
46
|
+
* forms (see `vueTagForms`).
|
|
47
|
+
*/
|
|
48
|
+
resolveAutoImport?: (tagForm: string) => AutoImportComponent | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Optional diagnostic sink. Currently emits `unresolved-component-tag` for
|
|
51
|
+
* authored-uppercase tags that miss every resolution lane (#346 — replaces
|
|
52
|
+
* the silent drop).
|
|
53
|
+
*/
|
|
54
|
+
collector?: DiagnosticCollector;
|
|
25
55
|
/**
|
|
26
56
|
* Optional pre-resolved SFC component symbol. When omitted, emit-template
|
|
27
57
|
* falls back to the filename stem (e.g. `button` for `button.vue`). The CLI
|
package/dist/emit-template.js
CHANGED
|
@@ -10,13 +10,50 @@ import { extractScriptImports } from "./script-imports.js";
|
|
|
10
10
|
* lowercased exact form (`Card` → `card`) and its PascalCase→kebab form
|
|
11
11
|
* (`VBtn` → `v-btn`). Pre-computed once per import; ported from src/index.ts.
|
|
12
12
|
*/
|
|
13
|
-
function vueTagForms(importName) {
|
|
13
|
+
export function vueTagForms(importName) {
|
|
14
14
|
const lowercased = importName.toLowerCase();
|
|
15
15
|
const kebab = importName
|
|
16
16
|
.replace(/([A-Za-z0-9])([A-Z])/g, "$1-$2")
|
|
17
17
|
.toLowerCase();
|
|
18
18
|
return Array.from(new Set([lowercased, kebab]));
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Vue's own built-in components, as Vue itself seeds them into the type-level
|
|
22
|
+
* `GlobalComponents` interface: `Teleport`, `Suspense`, `KeepAlive` and
|
|
23
|
+
* `BaseTransition` from `@vue/runtime-core`, `Transition` and
|
|
24
|
+
* `TransitionGroup` from `@vue/runtime-dom`, plus the `<component :is>`
|
|
25
|
+
* special element the compiler handles inline. They are language constructs
|
|
26
|
+
* with no package and no definition file, so they are neither a component
|
|
27
|
+
* usage nor a resolution miss.
|
|
28
|
+
*/
|
|
29
|
+
const VUE_BUILTIN_TAGS = new Set([
|
|
30
|
+
"Teleport",
|
|
31
|
+
"Transition",
|
|
32
|
+
"TransitionGroup",
|
|
33
|
+
"KeepAlive",
|
|
34
|
+
"Suspense",
|
|
35
|
+
"BaseTransition",
|
|
36
|
+
"Component",
|
|
37
|
+
].flatMap(vueTagForms));
|
|
38
|
+
/**
|
|
39
|
+
* True for a parse5-lowercased tag naming a Vue built-in, in either the
|
|
40
|
+
* PascalCase (`<KeepAlive>` → `keepalive`) or kebab (`<keep-alive>`) form Vue
|
|
41
|
+
* accepts. `vueTagForms` also yields the all-lowercase squash (`keepalive`),
|
|
42
|
+
* which Vue itself does not accept — unreachable here, because parse5 has
|
|
43
|
+
* already lowercased the PascalCase spelling into the same string and an
|
|
44
|
+
* authored `<keepalive>` is diagnosed by neither branch below.
|
|
45
|
+
*
|
|
46
|
+
* Checked FIRST, ahead of every resolution lane, because that is what Vue
|
|
47
|
+
* does: `resolveComponentType` returns on
|
|
48
|
+
* `isCoreComponent(tag) || context.isBuiltInComponent(tag)` before it ever
|
|
49
|
+
* consults `resolveSetupReference` (`@vue/compiler-core`). A repo that
|
|
50
|
+
* imports a component named `Transition` and writes `<Transition>` renders
|
|
51
|
+
* Vue's built-in, not the import — so attributing that call site to the
|
|
52
|
+
* import would report usage of a component the page never mounts (#490).
|
|
53
|
+
*/
|
|
54
|
+
function isVueBuiltinTag(lowercasedTag) {
|
|
55
|
+
return VUE_BUILTIN_TAGS.has(lowercasedTag);
|
|
56
|
+
}
|
|
20
57
|
/**
|
|
21
58
|
* parse5-based emitter for Vue SFC templates. REPLACES the legacy
|
|
22
59
|
* `walkVueTemplate` pathway once Task 2.13 wires it into scan.ts. Until then
|
|
@@ -74,6 +111,7 @@ export function emitVueTemplate(opts) {
|
|
|
74
111
|
}
|
|
75
112
|
if (!parts.templateSource)
|
|
76
113
|
return;
|
|
114
|
+
const templateSource = parts.templateSource;
|
|
77
115
|
// SFC owner Reference. Every template-emitted usage attributes back to the
|
|
78
116
|
// SFC's own BindingDecl (declared above). Module-scope, no member chain.
|
|
79
117
|
// `originFile` is required by `resolveOwnerChain` to look up the owner's
|
|
@@ -104,12 +142,24 @@ export function emitVueTemplate(opts) {
|
|
|
104
142
|
}
|
|
105
143
|
}
|
|
106
144
|
const doc = parseFragment(parts.templateSource, { sourceCodeLocationInfo: true });
|
|
145
|
+
// Per-SFC dedup so a repeated auto-imported tag (`<FooCard>` used twice)
|
|
146
|
+
// emits its synthetic import once, matching how a real script import only
|
|
147
|
+
// appears once regardless of template usage count.
|
|
148
|
+
const syntheticImports = new Set();
|
|
107
149
|
function visit(node) {
|
|
108
150
|
let pushed = false;
|
|
109
151
|
if (isElement(node)) {
|
|
110
152
|
const rawTag = node.tagName;
|
|
111
|
-
const
|
|
112
|
-
|
|
153
|
+
const builtin = isVueBuiltinTag(rawTag);
|
|
154
|
+
const scriptSpec = builtin ? undefined : scriptBindings.get(rawTag);
|
|
155
|
+
const auto = builtin || scriptSpec ? undefined : opts.resolveAutoImport?.(rawTag);
|
|
156
|
+
if (builtin) {
|
|
157
|
+
// Vue built-in. Not a component reference and not a miss — emit
|
|
158
|
+
// nothing, diagnose nothing. Children still attribute to the next
|
|
159
|
+
// tracked ancestor (`pushed` stays false), so a component wrapped in
|
|
160
|
+
// a `<Transition>` keeps its real owner.
|
|
161
|
+
}
|
|
162
|
+
else if (scriptSpec) {
|
|
113
163
|
const loc = node.sourceCodeLocation;
|
|
114
164
|
const line = (loc?.startLine ?? 1) + lineOffset;
|
|
115
165
|
const column = loc?.startCol ?? 1;
|
|
@@ -136,6 +186,36 @@ export function emitVueTemplate(opts) {
|
|
|
136
186
|
});
|
|
137
187
|
pushed = true;
|
|
138
188
|
}
|
|
189
|
+
else if (auto) {
|
|
190
|
+
const loc = node.sourceCodeLocation;
|
|
191
|
+
const line = (loc?.startLine ?? 1) + lineOffset;
|
|
192
|
+
const column = loc?.startCol ?? 1;
|
|
193
|
+
if (!syntheticImports.has(auto.name)) {
|
|
194
|
+
syntheticImports.add(auto.name);
|
|
195
|
+
// Synthetic import: models the import the auto-import mechanism
|
|
196
|
+
// (e.g. Nuxt) inserts at build time. From here the usage is
|
|
197
|
+
// indistinguishable from an explicitly-imported component.
|
|
198
|
+
opts.fileBuilder.addImport({
|
|
199
|
+
specifier: auto.specifier,
|
|
200
|
+
imported: auto.imported,
|
|
201
|
+
local: auto.name,
|
|
202
|
+
loc: { line, column },
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
const { props, events } = readAttrs(node);
|
|
206
|
+
opts.fileBuilder.addJsxUsage({
|
|
207
|
+
ref: { symbol: auto.name, scope: MODULE_SCOPE, memberChain: [], loc: { line, column } },
|
|
208
|
+
loc: { line, column },
|
|
209
|
+
props,
|
|
210
|
+
events,
|
|
211
|
+
});
|
|
212
|
+
opts.fileBuilder.setOwner(sfcOwnerRef, {
|
|
213
|
+
kind: "vue-template",
|
|
214
|
+
specifier: auto.specifier,
|
|
215
|
+
import: auto.imported,
|
|
216
|
+
});
|
|
217
|
+
pushed = true;
|
|
218
|
+
}
|
|
139
219
|
else if (rawTag.includes("-")) {
|
|
140
220
|
// Hyphenated tag with no script binding. Vue's auto-import / runtime
|
|
141
221
|
// global-component convention (e.g. `<x-button>`, Vuetify's `<v-list>`
|
|
@@ -156,9 +236,31 @@ export function emitVueTemplate(opts) {
|
|
|
156
236
|
opts.fileBuilder.setTagOwner(sfcOwnerRef);
|
|
157
237
|
pushed = true;
|
|
158
238
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
239
|
+
else if (opts.collector) {
|
|
240
|
+
// parse5 lowercases tag names, so recover the authored spelling from
|
|
241
|
+
// the source: only an authored-uppercase tag is a component miss —
|
|
242
|
+
// lowercase unknowns are just non-standard HTML.
|
|
243
|
+
const off = node.sourceCodeLocation?.startOffset;
|
|
244
|
+
const authored = off !== undefined
|
|
245
|
+
? /^[A-Z][A-Za-z0-9]*/.exec(templateSource.slice(off + 1))?.[0]
|
|
246
|
+
: undefined;
|
|
247
|
+
if (authored !== undefined) {
|
|
248
|
+
const loc = node.sourceCodeLocation;
|
|
249
|
+
opts.collector.emit({
|
|
250
|
+
code: "unresolved-component-tag",
|
|
251
|
+
severity: "warning",
|
|
252
|
+
filePath: opts.file,
|
|
253
|
+
line: (loc?.startLine ?? 1) + lineOffset,
|
|
254
|
+
column: loc?.startCol ?? 1,
|
|
255
|
+
tagName: authored,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// Plain HTML (`<div>`, `<span>`) falls through without emission — never
|
|
260
|
+
// tracked, never diagnosed. A component-cased tag that misses every
|
|
261
|
+
// resolution lane above also emits an `unresolved-component-tag`
|
|
262
|
+
// diagnostic when a collector is present (see above), but even then
|
|
263
|
+
// there is no graph emission — the miss is surfaced, not resolved.
|
|
162
264
|
}
|
|
163
265
|
// Tracked elements push themselves as the lexical parent for their
|
|
164
266
|
// children; non-tracked elements (plain HTML, untracked tags) skip the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-template.js","sourceRoot":"","sources":["../src/emit-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK3D;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"emit-template.js","sourceRoot":"","sources":["../src/emit-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK3D;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAAkB;IAC5C,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAG,UAAU;SACrB,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,WAAW,EAAE,CAAC;IACjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC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AAI,CAAC,CAAC,GAAG,UAAU;wBACxC,MAAM,EAAE,GAAG,EAAE,QAAQ,IAAI,CAAC;wBAC1B,OAAO,EAAE,QAAQ;qBAClB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,wEAAwE;YACxE,oEAAoE;YACpE,iEAAiE;YACjE,oEAAoE;YACpE,mEAAmE;QACrE,CAAC;QACD,mEAAmE;QACnE,uEAAuE;QACvE,6DAA6D;QAC7D,8BAA8B;QAC9B,IAAI,MAAM;YAAE,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;QAC9C,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC;YAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,MAAM;YAAE,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,GAA4B,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { emitVueTemplate } from "./emit-template.js";
|
|
2
|
-
export type { EmitVueTemplateOpts } from "./emit-template.js";
|
|
1
|
+
export { emitVueTemplate, vueTagForms } from "./emit-template.js";
|
|
2
|
+
export type { EmitVueTemplateOpts, AutoImportComponent } from "./emit-template.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { emitVueTemplate } from "./emit-template.js";
|
|
1
|
+
export { emitVueTemplate, vueTagForms } from "./emit-template.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/script-imports.js
CHANGED
|
@@ -18,7 +18,18 @@ export function extractScriptImports(opts) {
|
|
|
18
18
|
sideEffectSources.push(source);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
+
// A type-only import has no runtime value, so it can never be the
|
|
22
|
+
// component a tag renders. Vue resolves template tags by NAME against
|
|
23
|
+
// these bindings, so keeping them lets `import type { Paginator }` claim
|
|
24
|
+
// every `<Paginator>` in the SFC — stealing the tag from the auto-import
|
|
25
|
+
// lane and minting a phantom component for the type's source module.
|
|
26
|
+
// Both spellings drop out: the whole declaration (`import type { A }`,
|
|
27
|
+
// `import type A`) and the inline specifier (`import { type B, C }`).
|
|
28
|
+
if (node.importKind === "type")
|
|
29
|
+
return;
|
|
21
30
|
for (const spec of node.specifiers) {
|
|
31
|
+
if (spec.type === "ImportSpecifier" && spec.importKind === "type")
|
|
32
|
+
continue;
|
|
22
33
|
const local = spec.local.name;
|
|
23
34
|
imports.push({
|
|
24
35
|
file: filePosix,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-imports.js","sourceRoot":"","sources":["../src/script-imports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA6BzD,MAAM,UAAU,oBAAoB,CAAC,IAAoB;IACvD,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,WAAW,GAAiB,EAAE,CAAC;IACrC,MAAM,iBAAiB,GAAa,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEvC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACjB,KAAK,CAAC,IAAI;YACR,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB;gBAAE,OAAO;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,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,KAAK;oBACf,MAAM;oBACN,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;iBAC7C,CAAC,CAAC;gBACH,IAAI,YAAoB,CAAC;gBACzB,IAAI,IAAI,CAAC,IAAI,KAAK,wBAAwB,EAAE,CAAC;oBAC3C,YAAY,GAAG,SAAS,CAAC;gBAC3B,CAAC;qBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;oBACpD,YAAY,GAAG,GAAG,CAAC;gBACrB,CAAC;qBAAM,CAAC;oBACN,+DAA+D;oBAC/D,iDAAiD;oBACjD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;oBAC1B,YAAY;wBACV,GAAG,CAAC,IAAI,KAAK,YAAY;4BACvB,CAAC,CAAC,GAAG,CAAC,IAAI;4BACV,CAAC,CAAE,GAAyB,CAAC,KAAK,CAAC;gBACzC,CAAC;gBACD,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@component-compass/parser-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Consumer-scan parser for Vue Single-File Components. Detects component usages in .vue files.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"clean": "rm -rf dist .turbo"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@component-compass/ast-utils": "0.1.
|
|
31
|
-
"@component-compass/plugin-core": "0.1.
|
|
32
|
-
"@component-compass/reference-graph": "0.1.
|
|
30
|
+
"@component-compass/ast-utils": "0.1.17",
|
|
31
|
+
"@component-compass/plugin-core": "0.1.17",
|
|
32
|
+
"@component-compass/reference-graph": "0.1.17",
|
|
33
33
|
"@oxc-project/types": "0.130.0",
|
|
34
34
|
"@vue/compiler-sfc": "3.5.33",
|
|
35
35
|
"oxc-walker": "1.0.0",
|