unplugin-vue-components 29.2.0 → 31.0.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.
Files changed (70) hide show
  1. package/README.md +4 -36
  2. package/dist/esbuild.d.mts +7 -0
  3. package/dist/esbuild.mjs +9 -0
  4. package/dist/{index.d.cts → index.d.mts} +4 -2
  5. package/dist/index.mjs +4 -0
  6. package/dist/nuxt.d.mts +7 -0
  7. package/dist/{nuxt.js → nuxt.mjs} +4 -4
  8. package/dist/{resolvers.d.ts → resolvers.d.mts} +189 -218
  9. package/dist/{resolvers.js → resolvers.mjs} +28 -83
  10. package/dist/rolldown.d.mts +7 -0
  11. package/dist/rolldown.mjs +9 -0
  12. package/dist/rollup.d.mts +7 -0
  13. package/dist/rollup.mjs +9 -0
  14. package/dist/rspack.d.mts +6 -0
  15. package/dist/rspack.mjs +9 -0
  16. package/dist/{src-bfjkatac.js → src-pYuu2TZ_.mjs} +53 -141
  17. package/dist/types-CWfK8m_y.d.mts +217 -0
  18. package/dist/types.d.mts +2 -0
  19. package/dist/types.mjs +1 -0
  20. package/dist/utils-DuuqqWXg.mjs +234 -0
  21. package/dist/vite.d.mts +9 -0
  22. package/dist/vite.mjs +9 -0
  23. package/dist/webpack.d.mts +7 -0
  24. package/dist/webpack.mjs +9 -0
  25. package/package.json +40 -78
  26. package/dist/esbuild.cjs +0 -9
  27. package/dist/esbuild.d.cts +0 -6
  28. package/dist/esbuild.d.ts +0 -7
  29. package/dist/esbuild.js +0 -9
  30. package/dist/index.cjs +0 -9
  31. package/dist/index.d.ts +0 -13
  32. package/dist/index.js +0 -5
  33. package/dist/nuxt.cjs +0 -14
  34. package/dist/nuxt.d.cts +0 -6
  35. package/dist/nuxt.d.ts +0 -7
  36. package/dist/resolvers.cjs +0 -2074
  37. package/dist/resolvers.d.cts +0 -574
  38. package/dist/rolldown.cjs +0 -9
  39. package/dist/rolldown.d.cts +0 -6
  40. package/dist/rolldown.d.ts +0 -7
  41. package/dist/rolldown.js +0 -9
  42. package/dist/rollup.cjs +0 -9
  43. package/dist/rollup.d.cts +0 -6
  44. package/dist/rollup.d.ts +0 -7
  45. package/dist/rollup.js +0 -9
  46. package/dist/rspack.cjs +0 -9
  47. package/dist/rspack.d.cts +0 -5
  48. package/dist/rspack.d.ts +0 -6
  49. package/dist/rspack.js +0 -9
  50. package/dist/src-BTwFq3T3.cjs +0 -188
  51. package/dist/src-D2-JfLYq.js +0 -187
  52. package/dist/src-DAvVDVLg.cjs +0 -769
  53. package/dist/types-CBTc19th.cjs +0 -0
  54. package/dist/types-DSJ5r-ta.d.cts +0 -225
  55. package/dist/types-rC3290ja.d.ts +0 -225
  56. package/dist/types.cjs +0 -1
  57. package/dist/types.d.cts +0 -2
  58. package/dist/types.d.ts +0 -2
  59. package/dist/types.js +0 -3
  60. package/dist/utils-8UQ22cuO.cjs +0 -1689
  61. package/dist/utils-BoXu-4gQ.js +0 -1523
  62. package/dist/vite.cjs +0 -9
  63. package/dist/vite.d.cts +0 -8
  64. package/dist/vite.d.ts +0 -9
  65. package/dist/vite.js +0 -9
  66. package/dist/webpack.cjs +0 -9
  67. package/dist/webpack.d.cts +0 -6
  68. package/dist/webpack.d.ts +0 -7
  69. package/dist/webpack.js +0 -9
  70. /package/dist/{types-DQoXDiso.js → types--fVOUYBq.mjs} +0 -0
File without changes
@@ -1,225 +0,0 @@
1
- import { Awaitable } from "@antfu/utils";
2
- import { TransformResult } from "unplugin";
3
- import { FilterPattern } from "unplugin-utils";
4
-
5
- //#region src/types.d.ts
6
- interface ImportInfoLegacy {
7
- /**
8
- * @deprecated renamed to `as`
9
- */
10
- name?: string;
11
- /**
12
- * @deprecated renamed to `name`
13
- */
14
- importName?: string;
15
- /**
16
- * @deprecated renamed to `from`
17
- */
18
- path: string;
19
- sideEffects?: SideEffectsInfo;
20
- }
21
- interface ImportInfo {
22
- as?: string;
23
- name?: string;
24
- from: string;
25
- }
26
- type SideEffectsInfo = (ImportInfo | string)[] | ImportInfo | string | undefined;
27
- interface ComponentInfo extends ImportInfo {
28
- sideEffects?: SideEffectsInfo;
29
- }
30
- type ComponentResolveResult = Awaitable<string | ComponentInfo | null | undefined | void>;
31
- type ComponentResolverFunction = (name: string) => ComponentResolveResult;
32
- interface ComponentResolverObject {
33
- type: 'component' | 'directive';
34
- resolve: ComponentResolverFunction;
35
- }
36
- type ComponentResolver = ComponentResolverFunction | ComponentResolverObject;
37
- type Matcher = (id: string) => boolean | null | undefined;
38
- type Transformer = (code: string, id: string, path: string, query: Record<string, string>) => Awaitable<TransformResult | null>;
39
- type SupportedTransformer = 'vue3' | 'vue2';
40
- interface PublicPluginAPI {
41
- /**
42
- * Resolves a component using the configured resolvers.
43
- */
44
- findComponent: (name: string, filename?: string) => Promise<ComponentInfo | undefined>;
45
- /**
46
- * Obtain an import statement for a resolved component.
47
- */
48
- stringifyImport: (info: ComponentInfo) => string;
49
- }
50
- /**
51
- * Plugin options.
52
- */
53
- interface Options {
54
- /**
55
- * RegExp or glob to match files to be transformed
56
- */
57
- include?: FilterPattern;
58
- /**
59
- * RegExp or glob to match files to NOT be transformed
60
- */
61
- exclude?: FilterPattern;
62
- /**
63
- * RegExp or string to match component names that will NOT be imported
64
- */
65
- excludeNames?: FilterPattern;
66
- /**
67
- * Relative paths to the directory to search for components.
68
- * @default 'src/components'
69
- */
70
- dirs?: string | string[];
71
- /**
72
- * Valid file extensions for components.
73
- * @default ['vue']
74
- */
75
- extensions?: string | string[];
76
- /**
77
- * Glob patterns to match file names to be detected as components.
78
- *
79
- * When specified, the `dirs`, `extensions`, and `directoryAsNamespace` options will be ignored.
80
- */
81
- globs?: string | string[];
82
- /**
83
- * Negated glob patterns to exclude files from being detected as components.
84
- *
85
- * @default []
86
- */
87
- globsExclude?: string | string[];
88
- /**
89
- * Search for subdirectories
90
- * @default true
91
- */
92
- deep?: boolean;
93
- /**
94
- * Allow subdirectories as namespace prefix for components
95
- * @default false
96
- */
97
- directoryAsNamespace?: boolean;
98
- /**
99
- * Generate components with prefix.
100
- */
101
- prefix?: string;
102
- /**
103
- * Collapse same prefixes (camel-sensitive) of folders and components
104
- * to prevent duplication inside namespaced component name.
105
- *
106
- * Works when `directoryAsNamespace: true`
107
- * @default false
108
- */
109
- collapseSamePrefixes?: boolean;
110
- /**
111
- * Subdirectory paths for ignoring namespace prefixes
112
- *
113
- * Works when `directoryAsNamespace: true`
114
- * @default "[]"
115
- */
116
- globalNamespaces?: string[];
117
- /**
118
- * Pass a custom function to resolve the component importing path from the component name.
119
- *
120
- * The component names are always in PascalCase
121
- */
122
- resolvers?: (ComponentResolver | ComponentResolver[])[];
123
- /**
124
- * Apply custom transform over the path for importing
125
- */
126
- importPathTransform?: (path: string) => string | undefined;
127
- /**
128
- * Transformer to apply
129
- *
130
- * @default 'vue3'
131
- */
132
- transformer?: SupportedTransformer;
133
- /**
134
- * Tranform users' usage of resolveComponent/resolveDirective as well
135
- *
136
- * If disabled, only components inside templates (which compiles to `_resolveComponent` etc.)
137
- * will be transformed.
138
- *
139
- * @default true
140
- */
141
- transformerUserResolveFunctions?: boolean;
142
- /**
143
- * Generate TypeScript declaration for global components
144
- *
145
- * Accept boolean or a path related to project root
146
- *
147
- * @see https://github.com/vuejs/core/pull/3399
148
- * @see https://github.com/johnsoncodehk/volar#using
149
- * @default true
150
- */
151
- dts?: boolean | string;
152
- /**
153
- * Generate TypeScript declaration for global components
154
- * For TSX support
155
- *
156
- * @default true if `@vitejs/plugin-vue-jsx` is installed
157
- */
158
- dtsTsx?: boolean;
159
- /**
160
- * Do not emit warning on component overriding
161
- *
162
- * @default false
163
- */
164
- allowOverrides?: boolean;
165
- /**
166
- * auto import for directives.
167
- *
168
- * default: `true` for Vue 3, `false` for Vue 2
169
- *
170
- * Babel is needed to do the transformation for Vue 2, it's disabled by default for performance concerns.
171
- * To install Babel, run: `npm install -D @babel/parser`
172
- * @default undefined
173
- */
174
- directives?: boolean;
175
- /**
176
- * Only provide types of components in library (registered globally)
177
- */
178
- types?: TypeImport[];
179
- /**
180
- * Vue version of project. It will detect automatically if not specified.
181
- */
182
- version?: 2 | 2.7 | 3;
183
- /**
184
- * Generate sourcemap for the transformed code.
185
- *
186
- * @default true
187
- */
188
- sourcemap?: boolean;
189
- /**
190
- * Save component information into a JSON file for other tools to consume.
191
- * Provide a filepath to save the JSON file.
192
- *
193
- * When set to `true`, it will save to `./.components-info.json`
194
- *
195
- * @default false
196
- */
197
- dumpComponentsInfo?: boolean | string;
198
- /**
199
- * The mode for syncing the components.d.ts and .components-info.json file.
200
- * - `append`: only append the new components to the existing files.
201
- * - `overwrite`: overwrite the whole existing files with the current components.
202
- * - `default`: use `append` strategy when using dev server, `overwrite` strategy when using build.
203
- *
204
- * @default 'default'
205
- */
206
- syncMode?: 'default' | 'append' | 'overwrite';
207
- }
208
- type ResolvedOptions = Omit<Required<Options>, 'resolvers' | 'extensions' | 'dirs' | 'globalComponentsDeclaration'> & {
209
- resolvers: ComponentResolverObject[];
210
- extensions: string[];
211
- dirs: string[];
212
- resolvedDirs: string[];
213
- globs: string[];
214
- globsExclude: string[];
215
- dts: string | false;
216
- dtsTsx: boolean;
217
- root: string;
218
- };
219
- type ComponentsImportMap = Record<string, string[] | undefined>;
220
- interface TypeImport {
221
- from: string;
222
- names: string[];
223
- }
224
- //#endregion
225
- export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport };
@@ -1,225 +0,0 @@
1
- import { TransformResult } from "unplugin";
2
- import { FilterPattern } from "unplugin-utils";
3
- import { Awaitable } from "@antfu/utils";
4
-
5
- //#region src/types.d.ts
6
- interface ImportInfoLegacy {
7
- /**
8
- * @deprecated renamed to `as`
9
- */
10
- name?: string;
11
- /**
12
- * @deprecated renamed to `name`
13
- */
14
- importName?: string;
15
- /**
16
- * @deprecated renamed to `from`
17
- */
18
- path: string;
19
- sideEffects?: SideEffectsInfo;
20
- }
21
- interface ImportInfo {
22
- as?: string;
23
- name?: string;
24
- from: string;
25
- }
26
- type SideEffectsInfo = (ImportInfo | string)[] | ImportInfo | string | undefined;
27
- interface ComponentInfo extends ImportInfo {
28
- sideEffects?: SideEffectsInfo;
29
- }
30
- type ComponentResolveResult = Awaitable<string | ComponentInfo | null | undefined | void>;
31
- type ComponentResolverFunction = (name: string) => ComponentResolveResult;
32
- interface ComponentResolverObject {
33
- type: 'component' | 'directive';
34
- resolve: ComponentResolverFunction;
35
- }
36
- type ComponentResolver = ComponentResolverFunction | ComponentResolverObject;
37
- type Matcher = (id: string) => boolean | null | undefined;
38
- type Transformer = (code: string, id: string, path: string, query: Record<string, string>) => Awaitable<TransformResult | null>;
39
- type SupportedTransformer = 'vue3' | 'vue2';
40
- interface PublicPluginAPI {
41
- /**
42
- * Resolves a component using the configured resolvers.
43
- */
44
- findComponent: (name: string, filename?: string) => Promise<ComponentInfo | undefined>;
45
- /**
46
- * Obtain an import statement for a resolved component.
47
- */
48
- stringifyImport: (info: ComponentInfo) => string;
49
- }
50
- /**
51
- * Plugin options.
52
- */
53
- interface Options {
54
- /**
55
- * RegExp or glob to match files to be transformed
56
- */
57
- include?: FilterPattern;
58
- /**
59
- * RegExp or glob to match files to NOT be transformed
60
- */
61
- exclude?: FilterPattern;
62
- /**
63
- * RegExp or string to match component names that will NOT be imported
64
- */
65
- excludeNames?: FilterPattern;
66
- /**
67
- * Relative paths to the directory to search for components.
68
- * @default 'src/components'
69
- */
70
- dirs?: string | string[];
71
- /**
72
- * Valid file extensions for components.
73
- * @default ['vue']
74
- */
75
- extensions?: string | string[];
76
- /**
77
- * Glob patterns to match file names to be detected as components.
78
- *
79
- * When specified, the `dirs`, `extensions`, and `directoryAsNamespace` options will be ignored.
80
- */
81
- globs?: string | string[];
82
- /**
83
- * Negated glob patterns to exclude files from being detected as components.
84
- *
85
- * @default []
86
- */
87
- globsExclude?: string | string[];
88
- /**
89
- * Search for subdirectories
90
- * @default true
91
- */
92
- deep?: boolean;
93
- /**
94
- * Allow subdirectories as namespace prefix for components
95
- * @default false
96
- */
97
- directoryAsNamespace?: boolean;
98
- /**
99
- * Generate components with prefix.
100
- */
101
- prefix?: string;
102
- /**
103
- * Collapse same prefixes (camel-sensitive) of folders and components
104
- * to prevent duplication inside namespaced component name.
105
- *
106
- * Works when `directoryAsNamespace: true`
107
- * @default false
108
- */
109
- collapseSamePrefixes?: boolean;
110
- /**
111
- * Subdirectory paths for ignoring namespace prefixes
112
- *
113
- * Works when `directoryAsNamespace: true`
114
- * @default "[]"
115
- */
116
- globalNamespaces?: string[];
117
- /**
118
- * Pass a custom function to resolve the component importing path from the component name.
119
- *
120
- * The component names are always in PascalCase
121
- */
122
- resolvers?: (ComponentResolver | ComponentResolver[])[];
123
- /**
124
- * Apply custom transform over the path for importing
125
- */
126
- importPathTransform?: (path: string) => string | undefined;
127
- /**
128
- * Transformer to apply
129
- *
130
- * @default 'vue3'
131
- */
132
- transformer?: SupportedTransformer;
133
- /**
134
- * Tranform users' usage of resolveComponent/resolveDirective as well
135
- *
136
- * If disabled, only components inside templates (which compiles to `_resolveComponent` etc.)
137
- * will be transformed.
138
- *
139
- * @default true
140
- */
141
- transformerUserResolveFunctions?: boolean;
142
- /**
143
- * Generate TypeScript declaration for global components
144
- *
145
- * Accept boolean or a path related to project root
146
- *
147
- * @see https://github.com/vuejs/core/pull/3399
148
- * @see https://github.com/johnsoncodehk/volar#using
149
- * @default true
150
- */
151
- dts?: boolean | string;
152
- /**
153
- * Generate TypeScript declaration for global components
154
- * For TSX support
155
- *
156
- * @default true if `@vitejs/plugin-vue-jsx` is installed
157
- */
158
- dtsTsx?: boolean;
159
- /**
160
- * Do not emit warning on component overriding
161
- *
162
- * @default false
163
- */
164
- allowOverrides?: boolean;
165
- /**
166
- * auto import for directives.
167
- *
168
- * default: `true` for Vue 3, `false` for Vue 2
169
- *
170
- * Babel is needed to do the transformation for Vue 2, it's disabled by default for performance concerns.
171
- * To install Babel, run: `npm install -D @babel/parser`
172
- * @default undefined
173
- */
174
- directives?: boolean;
175
- /**
176
- * Only provide types of components in library (registered globally)
177
- */
178
- types?: TypeImport[];
179
- /**
180
- * Vue version of project. It will detect automatically if not specified.
181
- */
182
- version?: 2 | 2.7 | 3;
183
- /**
184
- * Generate sourcemap for the transformed code.
185
- *
186
- * @default true
187
- */
188
- sourcemap?: boolean;
189
- /**
190
- * Save component information into a JSON file for other tools to consume.
191
- * Provide a filepath to save the JSON file.
192
- *
193
- * When set to `true`, it will save to `./.components-info.json`
194
- *
195
- * @default false
196
- */
197
- dumpComponentsInfo?: boolean | string;
198
- /**
199
- * The mode for syncing the components.d.ts and .components-info.json file.
200
- * - `append`: only append the new components to the existing files.
201
- * - `overwrite`: overwrite the whole existing files with the current components.
202
- * - `default`: use `append` strategy when using dev server, `overwrite` strategy when using build.
203
- *
204
- * @default 'default'
205
- */
206
- syncMode?: 'default' | 'append' | 'overwrite';
207
- }
208
- type ResolvedOptions = Omit<Required<Options>, 'resolvers' | 'extensions' | 'dirs' | 'globalComponentsDeclaration'> & {
209
- resolvers: ComponentResolverObject[];
210
- extensions: string[];
211
- dirs: string[];
212
- resolvedDirs: string[];
213
- globs: string[];
214
- globsExclude: string[];
215
- dts: string | false;
216
- dtsTsx: boolean;
217
- root: string;
218
- };
219
- type ComponentsImportMap = Record<string, string[] | undefined>;
220
- interface TypeImport {
221
- from: string;
222
- names: string[];
223
- }
224
- //#endregion
225
- export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport };
package/dist/types.cjs DELETED
@@ -1 +0,0 @@
1
- require('./types-CBTc19th.cjs');
package/dist/types.d.cts DELETED
@@ -1,2 +0,0 @@
1
- import { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport } from "./types-DSJ5r-ta.cjs";
2
- export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport };
package/dist/types.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport } from "./types-rC3290ja.js";
2
- export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport };
package/dist/types.js DELETED
@@ -1,3 +0,0 @@
1
- import "./types-DQoXDiso.js";
2
-
3
- export { };