mountly-vite-plugin 1.3.0 → 1.6.0
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 +28 -0
- package/dist/docs.d.ts +31 -0
- package/dist/embed.d.ts +74 -0
- package/dist/externals.d.ts +11 -0
- package/dist/index.d.ts +5 -10
- package/dist/index.js +1064 -39
- package/dist/props.d.ts +61 -0
- package/package.json +11 -1
package/dist/props.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an attribute string becomes a prop value. Derived from the component's
|
|
3
|
+
* own TypeScript types, so `currency="GBP"` stays a string and `balance="1250"`
|
|
4
|
+
* becomes a number without either side declaring anything.
|
|
5
|
+
*
|
|
6
|
+
* `event` is a callback the component calls out (`onSave`), dispatched as a DOM
|
|
7
|
+
* event. `function` is one the host passes in (`getToken`, `formatPrice`): a
|
|
8
|
+
* property only, never an attribute, and its return value reaches the component.
|
|
9
|
+
*/
|
|
10
|
+
export type PropKind = "string" | "number" | "boolean" | "json" | "auto" | "event" | "function";
|
|
11
|
+
export interface PropSpec {
|
|
12
|
+
/** Prop name the component reads. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Attribute the consumer writes. Kebab-case of `name`; absent for events. */
|
|
15
|
+
attribute?: string;
|
|
16
|
+
kind: PropKind;
|
|
17
|
+
/** DOM event dispatched for a callback prop. */
|
|
18
|
+
event?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function kebab(name: string): string;
|
|
21
|
+
/** `onViewDetails` → `view-details`. */
|
|
22
|
+
export declare function eventName(prop: string): string;
|
|
23
|
+
export type Node = Record<string, any>;
|
|
24
|
+
/** Local `interface`/`type` declarations, so a `Props` reference can be resolved. */
|
|
25
|
+
export declare function localTypes(body: Node[]): Map<string, Node>;
|
|
26
|
+
/** The members of a type literal, an interface (with its bases), or a reference. */
|
|
27
|
+
export declare function membersOf(type: Node | undefined, types: Map<string, Node>, seen?: number): Node[] | null;
|
|
28
|
+
/** Find the declaration a build entry points at: `default`, or a named export. */
|
|
29
|
+
export declare function findExport(body: Node[], exportName: string): Node | null;
|
|
30
|
+
export declare function propsType(declaration: Node): Node | undefined;
|
|
31
|
+
/** The `<script>` halves of an SFC, which is where all the types live. */
|
|
32
|
+
export declare function scriptOf(code: string): string;
|
|
33
|
+
/** `label` or `'aria-label'` — both name a prop. */
|
|
34
|
+
export declare function keyOf(node: Node): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* `defineProps<T>()` / `defineEmits<T>()`, wherever it sits — including inside
|
|
37
|
+
* `withDefaults(defineProps<T>(), { … })`, which is how a Vue component with
|
|
38
|
+
* default values is normally written.
|
|
39
|
+
*/
|
|
40
|
+
export declare function macroCall(body: Node[], macro: string): Node | undefined;
|
|
41
|
+
/** Svelte 5: `let { … }: Props = $props()`. */
|
|
42
|
+
export declare function svelteProps(body: Node[]): Node | null;
|
|
43
|
+
export interface ExtractOptions {
|
|
44
|
+
/** Path or filename. Its extension selects the component dialect. */
|
|
45
|
+
file?: string;
|
|
46
|
+
/** Named export to read, for `.tsx`/`.ts` components. Defaults to the default export. */
|
|
47
|
+
exportName?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read a component's prop table from its source. This is what lets the element
|
|
51
|
+
* expose real attributes, real properties and real events without the author
|
|
52
|
+
* restating anything they already wrote — in React, Vue or Svelte.
|
|
53
|
+
*
|
|
54
|
+
* Returns `null` when the component takes props but none of them could be read —
|
|
55
|
+
* the caller must fail loudly rather than publish an element that silently
|
|
56
|
+
* ignores everything the consumer sets.
|
|
57
|
+
*
|
|
58
|
+
* Analysis is single-file. A props type imported from another module reads as
|
|
59
|
+
* `null`; declare `props` on the element entry for those.
|
|
60
|
+
*/
|
|
61
|
+
export declare function extractProps(code: string, options?: ExtractOptions): PropSpec[] | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mountly-vite-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Vite lib build plugin for mountly vertical widgets (dual ESM output)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,17 +24,27 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
28
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
27
29
|
"tsup": "^8.5.1",
|
|
28
30
|
"typescript": "^7.0.2",
|
|
29
31
|
"vite": "^8.1.5",
|
|
30
32
|
"mountly-manifest": "1.1.1"
|
|
31
33
|
},
|
|
32
34
|
"peerDependencies": {
|
|
35
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
36
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
33
37
|
"typescript": ">=7.0.0",
|
|
34
38
|
"vite": "^8.2.1",
|
|
35
39
|
"mountly-manifest": "1.1.1"
|
|
36
40
|
},
|
|
37
41
|
"peerDependenciesMeta": {
|
|
42
|
+
"@sveltejs/vite-plugin-svelte": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"@vitejs/plugin-vue": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
38
48
|
"typescript": {
|
|
39
49
|
"optional": true
|
|
40
50
|
}
|