@wc-toolkit/vuejs-types 1.0.1 → 1.0.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 CHANGED
@@ -19,10 +19,11 @@ Types are generated from a Custom Elements Manifest (CEM) and include documentat
19
19
 
20
20
  ## Usage
21
21
 
22
- Two primary ways to generate types:
22
+ Three primary ways to generate types:
23
23
 
24
24
  1. Programmatically, from a build script
25
25
  2. As a plugin for the Custom Elements Manifest Analyzer
26
+ 3. As a plugin for `@wc-toolkit/cem-generator`
26
27
 
27
28
  ### Install
28
29
 
@@ -65,6 +66,17 @@ export default {
65
66
  };
66
67
  ```
67
68
 
69
+ ### cem-generator Plugin
70
+
71
+ ```ts
72
+ import { generateCem } from "@wc-toolkit/cem-generator";
73
+ import { vuejsTypesGeneratorPlugin } from "@wc-toolkit/vuejs-types";
74
+
75
+ generateCem({
76
+ plugins: [vuejsTypesGeneratorPlugin({ outdir: "./dist/types" })],
77
+ });
78
+ ```
79
+
68
80
  ## Implementation / Integrating generated types
69
81
 
70
82
  There are two common ways consumers can include the generated types in their Vue projects.
package/dist/index.cjs CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  generateVuejsTypes: () => generateVuejsTypes,
34
+ vuejsTypesGeneratorPlugin: () => vuejsTypesGeneratorPlugin,
34
35
  vuejsTypesPlugin: () => vuejsTypesPlugin
35
36
  });
36
37
  module.exports = __toCommonJS(index_exports);
@@ -746,8 +747,17 @@ function vuejsTypesPlugin(options = {}) {
746
747
  }
747
748
  };
748
749
  }
750
+ function vuejsTypesGeneratorPlugin(options = {}) {
751
+ return {
752
+ name: "@wc-toolkit/vuejs-types:cem-generator",
753
+ afterGenerate(manifest2) {
754
+ generateVuejsTypes(manifest2, options);
755
+ }
756
+ };
757
+ }
749
758
  // Annotate the CommonJS export names for ESM import in node:
750
759
  0 && (module.exports = {
751
760
  generateVuejsTypes,
761
+ vuejsTypesGeneratorPlugin,
752
762
  vuejsTypesPlugin
753
763
  });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ComponentDescriptionOptions } from '@wc-toolkit/cem-utilities';
2
+ import { Plugin } from '@wc-toolkit/cem-generator';
2
3
 
3
4
  type VuejsTypesOptions = {
4
5
  /** Used to get a specific path for a given component */
@@ -55,6 +56,8 @@ declare function vuejsTypesPlugin(options?: VuejsTypesOptions): {
55
56
  name: string;
56
57
  packageLinkPhase({ customElementsManifest }: any): void;
57
58
  };
59
+ /** Plugin for @wc-toolkit/cem-generator that generates Vue.js types from the finalized CEM. */
60
+ declare function vuejsTypesGeneratorPlugin(options?: VuejsTypesOptions): Plugin;
58
61
 
59
62
  /**
60
63
  * @license
@@ -811,4 +814,4 @@ interface Demo {
811
814
  */
812
815
  declare function generateVuejsTypes(manifest: Package, options?: VuejsTypesOptions): string | undefined;
813
816
 
814
- export { generateVuejsTypes, vuejsTypesPlugin };
817
+ export { generateVuejsTypes, vuejsTypesGeneratorPlugin, vuejsTypesPlugin };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ComponentDescriptionOptions } from '@wc-toolkit/cem-utilities';
2
+ import { Plugin } from '@wc-toolkit/cem-generator';
2
3
 
3
4
  type VuejsTypesOptions = {
4
5
  /** Used to get a specific path for a given component */
@@ -55,6 +56,8 @@ declare function vuejsTypesPlugin(options?: VuejsTypesOptions): {
55
56
  name: string;
56
57
  packageLinkPhase({ customElementsManifest }: any): void;
57
58
  };
59
+ /** Plugin for @wc-toolkit/cem-generator that generates Vue.js types from the finalized CEM. */
60
+ declare function vuejsTypesGeneratorPlugin(options?: VuejsTypesOptions): Plugin;
58
61
 
59
62
  /**
60
63
  * @license
@@ -811,4 +814,4 @@ interface Demo {
811
814
  */
812
815
  declare function generateVuejsTypes(manifest: Package, options?: VuejsTypesOptions): string | undefined;
813
816
 
814
- export { generateVuejsTypes, vuejsTypesPlugin };
817
+ export { generateVuejsTypes, vuejsTypesGeneratorPlugin, vuejsTypesPlugin };
package/dist/index.js CHANGED
@@ -709,7 +709,16 @@ function vuejsTypesPlugin(options = {}) {
709
709
  }
710
710
  };
711
711
  }
712
+ function vuejsTypesGeneratorPlugin(options = {}) {
713
+ return {
714
+ name: "@wc-toolkit/vuejs-types:cem-generator",
715
+ afterGenerate(manifest2) {
716
+ generateVuejsTypes(manifest2, options);
717
+ }
718
+ };
719
+ }
712
720
  export {
713
721
  generateVuejsTypes,
722
+ vuejsTypesGeneratorPlugin,
714
723
  vuejsTypesPlugin
715
724
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wc-toolkit/vuejs-types",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "This package generates Vue.js types for custom elements / web components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,6 +50,7 @@
50
50
  "vitest": "^3.0.4"
51
51
  },
52
52
  "dependencies": {
53
+ "@wc-toolkit/cem-generator": "^0.1.1",
53
54
  "@prettier/sync": "^0.6.1"
54
55
  },
55
56
  "keywords": [