unplugin-vue-components 0.25.2 → 0.27.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 (52) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +30 -15
  3. package/dist/chunk-5JVO2UWC.js +6 -6
  4. package/dist/{chunk-WRE7G5OD.js → chunk-5QHU6UOY.cjs} +5 -4
  5. package/dist/chunk-6F4PWJZI.js +0 -1
  6. package/dist/{chunk-5MUHROAQ.js → chunk-JGIUAMWP.cjs} +30 -33
  7. package/dist/{chunk-L2JFDMEX.mjs → chunk-SQHKCPM6.js} +5 -4
  8. package/dist/{chunk-XR5T4LZ3.mjs → chunk-TSU3OFN5.js} +8 -11
  9. package/dist/{chunk-T2FESLJY.mjs → chunk-WJIU4Q36.cjs} +6 -6
  10. package/dist/chunk-ZBPRDZS4.cjs +1 -0
  11. package/dist/esbuild.cjs +12 -0
  12. package/dist/{esbuild.d.mts → esbuild.d.cts} +1 -1
  13. package/dist/esbuild.js +10 -11
  14. package/dist/index.cjs +16 -0
  15. package/dist/{index.d.mts → index.d.cts} +2 -2
  16. package/dist/index.js +16 -16
  17. package/dist/nuxt.cjs +18 -0
  18. package/dist/{nuxt.d.mts → nuxt.d.cts} +1 -1
  19. package/dist/nuxt.js +13 -14
  20. package/dist/{resolvers.mjs → resolvers.cjs} +200 -124
  21. package/dist/{resolvers.d.mts → resolvers.d.cts} +17 -5
  22. package/dist/resolvers.d.ts +16 -4
  23. package/dist/resolvers.js +200 -125
  24. package/dist/rollup.cjs +12 -0
  25. package/dist/{rollup.d.mts → rollup.d.cts} +2 -2
  26. package/dist/rollup.d.ts +1 -1
  27. package/dist/rollup.js +10 -11
  28. package/dist/rspack.cjs +12 -0
  29. package/dist/{rspack.d.mts → rspack.d.cts} +1 -1
  30. package/dist/rspack.js +10 -11
  31. package/dist/{src-B32PW6M3.mjs → src-SFFAR3KJ.cjs} +5 -5
  32. package/dist/src-WIQNDB4Q.js +5 -6
  33. package/dist/types.cjs +1 -0
  34. package/dist/{types.d.mts → types.d.cts} +2 -2
  35. package/dist/types.d.ts +2 -2
  36. package/dist/types.js +1 -2
  37. package/dist/vite.cjs +12 -0
  38. package/dist/{vite.d.mts → vite.d.cts} +1 -1
  39. package/dist/vite.js +10 -11
  40. package/dist/webpack.cjs +12 -0
  41. package/dist/{webpack.d.mts → webpack.d.cts} +1 -1
  42. package/dist/webpack.js +10 -11
  43. package/package.json +55 -63
  44. package/dist/chunk-WBQAMGXK.mjs +0 -0
  45. package/dist/esbuild.mjs +0 -12
  46. package/dist/index.mjs +0 -16
  47. package/dist/nuxt.mjs +0 -18
  48. package/dist/rollup.mjs +0 -12
  49. package/dist/rspack.mjs +0 -12
  50. package/dist/types.mjs +0 -1
  51. package/dist/vite.mjs +0 -12
  52. package/dist/webpack.mjs +0 -12
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Anthony Fu<https://github.com/antfu>
3
+ Copyright (c) 2020-PRESENT Anthony Fu<https://github.com/antfu>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -65,7 +65,6 @@ export default {
65
65
 
66
66
  <br></details>
67
67
 
68
-
69
68
  <details>
70
69
  <summary>Webpack</summary><br>
71
70
 
@@ -74,7 +73,7 @@ export default {
74
73
  module.exports = {
75
74
  /* ... */
76
75
  plugins: [
77
- require('unplugin-vue-components/webpack')({ /* options */ }),
76
+ require('unplugin-vue-components/webpack').default({ /* options */ }),
78
77
  ],
79
78
  }
80
79
  ```
@@ -89,7 +88,7 @@ module.exports = {
89
88
  module.exports = {
90
89
  /* ... */
91
90
  plugins: [
92
- require('unplugin-vue-components/rspack')({ /* options */ }),
91
+ require('unplugin-vue-components/rspack').default({ /* options */ }),
93
92
  ],
94
93
  }
95
94
  ```
@@ -109,9 +108,23 @@ You might not need this plugin for Nuxt. Use [`@nuxt/components`](https://github
109
108
  ```ts
110
109
  // vue.config.js
111
110
  module.exports = {
111
+ /* ... */
112
+ plugins: [
113
+ require('unplugin-vue-components/webpack').default({ /* options */ }),
114
+ ],
115
+ }
116
+ ```
117
+
118
+ You can also rename the Vue configuration file to `vue.config.mjs` and use static import syntax (you should use latest `@vue/cli-service ^5.0.8`):
119
+
120
+ ```ts
121
+ // vue.config.mjs
122
+ import Components from 'unplugin-vue-components/webpack'
123
+
124
+ export default {
112
125
  configureWebpack: {
113
126
  plugins: [
114
- require('unplugin-vue-components/webpack')({ /* options */ }),
127
+ Components({ /* options */ }),
115
128
  ],
116
129
  },
117
130
  }
@@ -125,11 +138,12 @@ module.exports = {
125
138
  ```ts
126
139
  // esbuild.config.js
127
140
  import { build } from 'esbuild'
141
+ import Components from 'unplugin-vue-components/esbuild'
128
142
 
129
143
  build({
130
144
  /* ... */
131
145
  plugins: [
132
- require('unplugin-vue-components/esbuild')({
146
+ Components({
133
147
  /* options */
134
148
  }),
135
149
  ],
@@ -152,9 +166,9 @@ It will automatically turn this
152
166
  </template>
153
167
 
154
168
  <script>
155
- export default {
156
- name: 'App'
157
- }
169
+ export default {
170
+ name: 'App',
171
+ }
158
172
  </script>
159
173
  ```
160
174
 
@@ -168,16 +182,17 @@ into this
168
182
  </template>
169
183
 
170
184
  <script>
171
- import HelloWorld from './src/components/HelloWorld.vue'
185
+ import HelloWorld from './src/components/HelloWorld.vue'
172
186
 
173
- export default {
174
- name: 'App',
175
- components: {
176
- HelloWorld
187
+ export default {
188
+ name: 'App',
189
+ components: {
190
+ HelloWorld,
191
+ },
177
192
  }
178
- }
179
193
  </script>
180
194
  ```
195
+
181
196
  > **Note**
182
197
  > By default this plugin will import components in the `src/components` path. You can customize it using the `dirs` option.
183
198
 
@@ -404,4 +419,4 @@ Thanks to [@brattonross](https://github.com/brattonross), this project is heavil
404
419
 
405
420
  ## License
406
421
 
407
- MIT License © 2020-PRESENT [Anthony Fu](https://github.com/antfu)
422
+ [MIT](./LICENSE) License © 2020-PRESENT [Anthony Fu](https://github.com/antfu)
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
1
+ var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -25,8 +25,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
25
25
  throw Error('Dynamic require of "' + x + '" is not supported');
26
26
  });
27
27
 
28
-
29
-
30
-
31
-
32
- exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require;
28
+ export {
29
+ __spreadValues,
30
+ __spreadProps,
31
+ __require
32
+ };
@@ -122,17 +122,18 @@ function getNameFromFilePath(filePath, options) {
122
122
  for (const fileOrFolderName of namespaced) {
123
123
  let cumulativePrefix = "";
124
124
  let didCollapse = false;
125
+ const pascalCasedName = pascalCase(fileOrFolderName);
125
126
  for (const parentFolder of [...collapsed].reverse()) {
126
- cumulativePrefix = `${capitalize(parentFolder)}${cumulativePrefix}`;
127
- if (pascalCase(fileOrFolderName).startsWith(pascalCase(cumulativePrefix))) {
128
- const collapseSamePrefix = fileOrFolderName.slice(cumulativePrefix.length);
127
+ cumulativePrefix = `${parentFolder}${cumulativePrefix}`;
128
+ if (pascalCasedName.startsWith(cumulativePrefix)) {
129
+ const collapseSamePrefix = pascalCasedName.slice(cumulativePrefix.length);
129
130
  collapsed.push(collapseSamePrefix);
130
131
  didCollapse = true;
131
132
  break;
132
133
  }
133
134
  }
134
135
  if (!didCollapse)
135
- collapsed.push(fileOrFolderName);
136
+ collapsed.push(pascalCasedName);
136
137
  }
137
138
  namespaced = collapsed;
138
139
  }
@@ -1 +0,0 @@
1
- "use strict";
@@ -10,11 +10,11 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkWRE7G5ODjs = require('./chunk-WRE7G5OD.js');
13
+ var _chunk5QHU6UOYcjs = require('./chunk-5QHU6UOY.cjs');
14
14
 
15
15
 
16
16
 
17
- var _chunk5JVO2UWCjs = require('./chunk-5JVO2UWC.js');
17
+ var _chunkWJIU4Q36cjs = require('./chunk-WJIU4Q36.cjs');
18
18
 
19
19
  // src/core/unplugin.ts
20
20
  var _fs = require('fs');
@@ -178,7 +178,7 @@ function parseDeclaration(code) {
178
178
  function stringifyComponentInfo(filepath, { from: path, as: name, name: importName }, importPathTransform) {
179
179
  if (!name)
180
180
  return void 0;
181
- path = _chunkWRE7G5ODjs.getTransformedPath.call(void 0, path, importPathTransform);
181
+ path = _chunk5QHU6UOYcjs.getTransformedPath.call(void 0, path, importPathTransform);
182
182
  const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
183
183
  const entry = `typeof import('${_utils.slash.call(void 0, related)}')['${importName || "default"}']`;
184
184
  return [name, entry];
@@ -190,7 +190,7 @@ function stringifyComponentsInfo(filepath, components, importPathTransform) {
190
190
  }
191
191
  function getDeclarationImports(ctx, filepath) {
192
192
  const component = stringifyComponentsInfo(filepath, [
193
- ...Object.values(_chunk5JVO2UWCjs.__spreadValues.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, ctx.componentNameMap), ctx.componentCustomMap)),
193
+ ...Object.values(_chunkWJIU4Q36cjs.__spreadValues.call(void 0, _chunkWJIU4Q36cjs.__spreadValues.call(void 0, {}, ctx.componentNameMap), ctx.componentCustomMap)),
194
194
  ...resolveTypeImports(ctx.options.types)
195
195
  ], ctx.options.importPathTransform);
196
196
  const directive = stringifyComponentsInfo(
@@ -214,20 +214,17 @@ function getDeclaration(ctx, filepath, originalImports) {
214
214
  if (!imports)
215
215
  return;
216
216
  const declarations = {
217
- component: stringifyDeclarationImports(_chunk5JVO2UWCjs.__spreadValues.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, originalImports == null ? void 0 : originalImports.component), imports.component)),
218
- directive: stringifyDeclarationImports(_chunk5JVO2UWCjs.__spreadValues.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, originalImports == null ? void 0 : originalImports.directive), imports.directive))
217
+ component: stringifyDeclarationImports(_chunkWJIU4Q36cjs.__spreadValues.call(void 0, _chunkWJIU4Q36cjs.__spreadValues.call(void 0, {}, originalImports == null ? void 0 : originalImports.component), imports.component)),
218
+ directive: stringifyDeclarationImports(_chunkWJIU4Q36cjs.__spreadValues.call(void 0, _chunkWJIU4Q36cjs.__spreadValues.call(void 0, {}, originalImports == null ? void 0 : originalImports.directive), imports.directive))
219
219
  };
220
- const head = ctx.options.version === 2.7 ? `export {}
221
-
222
- declare module 'vue' {` : `export {}
223
-
224
- declare module 'vue' {`;
225
220
  let code = `/* eslint-disable */
226
- /* prettier-ignore */
227
221
  // @ts-nocheck
228
222
  // Generated by unplugin-vue-components
229
223
  // Read more: https://github.com/vuejs/core/pull/3399
230
- ${head}`;
224
+ export {}
225
+
226
+ /* prettier-ignore */
227
+ declare module 'vue' {`;
231
228
  if (Object.keys(declarations.component).length > 0) {
232
229
  code += `
233
230
  export interface GlobalComponents {
@@ -299,12 +296,12 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
299
296
  const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
300
297
  for (const { rawName, replace } of results) {
301
298
  debug2(`| ${rawName}`);
302
- const name = _chunkWRE7G5ODjs.pascalCase.call(void 0, rawName);
299
+ const name = _chunk5QHU6UOYcjs.pascalCase.call(void 0, rawName);
303
300
  ctx.updateUsageMap(sfcPath, [name]);
304
301
  const component = await ctx.findComponent(name, "component", [sfcPath]);
305
302
  if (component) {
306
303
  const varName = `__unplugin_components_${no}`;
307
- s.prepend(`${_chunkWRE7G5ODjs.stringifyComponentImport.call(void 0, _chunk5JVO2UWCjs.__spreadProps.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, component), { as: varName }), ctx)};
304
+ s.prepend(`${_chunk5QHU6UOYcjs.stringifyComponentImport.call(void 0, _chunkWJIU4Q36cjs.__spreadProps.call(void 0, _chunkWJIU4Q36cjs.__spreadValues.call(void 0, {}, component), { as: varName }), ctx)};
308
305
  `);
309
306
  no += 1;
310
307
  replace(varName);
@@ -337,7 +334,7 @@ async function resolveVue22(code, s) {
337
334
  sourceType: "module"
338
335
  });
339
336
  const nodes = [];
340
- const { walk } = await Promise.resolve().then(() => require("./src-WIQNDB4Q.js"));
337
+ const { walk } = await Promise.resolve().then(() => require("./src-SFFAR3KJ.cjs"));
341
338
  walk(program, {
342
339
  enter(node) {
343
340
  if (node.type === "CallExpression")
@@ -409,13 +406,13 @@ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
409
406
  const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
410
407
  for (const { rawName, replace } of results) {
411
408
  debug3(`| ${rawName}`);
412
- const name = `${_chunkWRE7G5ODjs.DIRECTIVE_IMPORT_PREFIX}${_chunkWRE7G5ODjs.pascalCase.call(void 0, rawName)}`;
409
+ const name = `${_chunk5QHU6UOYcjs.DIRECTIVE_IMPORT_PREFIX}${_chunk5QHU6UOYcjs.pascalCase.call(void 0, rawName)}`;
413
410
  ctx.updateUsageMap(sfcPath, [name]);
414
411
  const directive = await ctx.findComponent(name, "directive", [sfcPath]);
415
412
  if (!directive)
416
413
  continue;
417
414
  const varName = `__unplugin_directives_${no}`;
418
- s.prepend(`${_chunkWRE7G5ODjs.stringifyComponentImport.call(void 0, _chunk5JVO2UWCjs.__spreadProps.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, directive), { as: varName }), ctx)};
415
+ s.prepend(`${_chunk5QHU6UOYcjs.stringifyComponentImport.call(void 0, _chunkWJIU4Q36cjs.__spreadProps.call(void 0, _chunkWJIU4Q36cjs.__spreadValues.call(void 0, {}, directive), { as: varName }), ctx)};
419
416
  `);
420
417
  no += 1;
421
418
  replace(varName);
@@ -434,10 +431,10 @@ function transformer(ctx, transformer2) {
434
431
  await transformComponent(code, transformer2, s, ctx, sfcPath);
435
432
  if (ctx.options.directives)
436
433
  await transformDirective(code, transformer2, s, ctx, sfcPath);
437
- s.prepend(_chunkWRE7G5ODjs.DISABLE_COMMENT);
434
+ s.prepend(_chunk5QHU6UOYcjs.DISABLE_COMMENT);
438
435
  const result = { code: s.toString() };
439
436
  if (ctx.sourcemap)
440
- result.map = s.generateMap({ source: id, includeContent: true });
437
+ result.map = s.generateMap({ source: id, includeContent: true, hires: "boundary" });
441
438
  return result;
442
439
  };
443
440
  }
@@ -479,7 +476,7 @@ var Context = class {
479
476
  this.transformer = transformer(this, name || "vue3");
480
477
  }
481
478
  transform(code, id) {
482
- const { path, query } = _chunkWRE7G5ODjs.parseId.call(void 0, id);
479
+ const { path, query } = _chunk5QHU6UOYcjs.parseId.call(void 0, id);
483
480
  return this.transformer(code, id, path, query);
484
481
  }
485
482
  setupViteServer(server) {
@@ -491,14 +488,14 @@ var Context = class {
491
488
  setupWatcher(watcher) {
492
489
  const { globs } = this.options;
493
490
  watcher.on("unlink", (path) => {
494
- if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
491
+ if (!_chunk5QHU6UOYcjs.matchGlobs.call(void 0, path, globs))
495
492
  return;
496
493
  path = _utils.slash.call(void 0, path);
497
494
  this.removeComponents(path);
498
495
  this.onUpdate(path);
499
496
  });
500
497
  watcher.on("add", (path) => {
501
- if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
498
+ if (!_chunk5QHU6UOYcjs.matchGlobs.call(void 0, path, globs))
502
499
  return;
503
500
  path = _utils.slash.call(void 0, path);
504
501
  this.addComponents(path);
@@ -511,14 +508,14 @@ var Context = class {
511
508
  setupWatcherWebpack(watcher, emitUpdate) {
512
509
  const { globs } = this.options;
513
510
  watcher.on("unlink", (path) => {
514
- if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
511
+ if (!_chunk5QHU6UOYcjs.matchGlobs.call(void 0, path, globs))
515
512
  return;
516
513
  path = _utils.slash.call(void 0, path);
517
514
  this.removeComponents(path);
518
515
  emitUpdate(path, "unlink");
519
516
  });
520
517
  watcher.on("add", (path) => {
521
- if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
518
+ if (!_chunk5QHU6UOYcjs.matchGlobs.call(void 0, path, globs))
522
519
  return;
523
520
  path = _utils.slash.call(void 0, path);
524
521
  this.addComponents(path);
@@ -574,7 +571,7 @@ var Context = class {
574
571
  updates: []
575
572
  };
576
573
  const timestamp = +/* @__PURE__ */ new Date();
577
- const name = _chunkWRE7G5ODjs.pascalCase.call(void 0, _chunkWRE7G5ODjs.getNameFromFilePath.call(void 0, path, this.options));
574
+ const name = _chunk5QHU6UOYcjs.pascalCase.call(void 0, _chunk5QHU6UOYcjs.getNameFromFilePath.call(void 0, path, this.options));
578
575
  Object.entries(this._componentUsageMap).forEach(([key, values]) => {
579
576
  if (values.has(name)) {
580
577
  const r = `/${_utils.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
@@ -592,7 +589,7 @@ var Context = class {
592
589
  updateComponentNameMap() {
593
590
  this._componentNameMap = {};
594
591
  Array.from(this._componentPaths).forEach((path) => {
595
- const name = _chunkWRE7G5ODjs.pascalCase.call(void 0, _chunkWRE7G5ODjs.getNameFromFilePath.call(void 0, path, this.options));
592
+ const name = _chunk5QHU6UOYcjs.pascalCase.call(void 0, _chunk5QHU6UOYcjs.getNameFromFilePath.call(void 0, path, this.options));
596
593
  if (this._componentNameMap[name] && !this.options.allowOverrides) {
597
594
  console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`);
598
595
  return;
@@ -610,7 +607,7 @@ var Context = class {
610
607
  for (const resolver of this.options.resolvers) {
611
608
  if (resolver.type !== type)
612
609
  continue;
613
- const result = await resolver.resolve(type === "directive" ? name.slice(_chunkWRE7G5ODjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
610
+ const result = await resolver.resolve(type === "directive" ? name.slice(_chunk5QHU6UOYcjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
614
611
  if (!result)
615
612
  continue;
616
613
  if (typeof result === "string") {
@@ -619,9 +616,9 @@ var Context = class {
619
616
  from: result
620
617
  };
621
618
  } else {
622
- info = _chunk5JVO2UWCjs.__spreadValues.call(void 0, {
619
+ info = _chunkWJIU4Q36cjs.__spreadValues.call(void 0, {
623
620
  as: name
624
- }, _chunkWRE7G5ODjs.normalizeComponentInfo.call(void 0, result));
621
+ }, _chunk5QHU6UOYcjs.normalizeComponentInfo.call(void 0, result));
625
622
  }
626
623
  if (type === "component")
627
624
  this.addCustomComponents(info);
@@ -633,7 +630,7 @@ var Context = class {
633
630
  }
634
631
  normalizePath(path) {
635
632
  var _a, _b, _c;
636
- return _chunkWRE7G5ODjs.resolveAlias.call(void 0, path, ((_b = (_a = this.viteConfig) == null ? void 0 : _a.resolve) == null ? void 0 : _b.alias) || ((_c = this.viteConfig) == null ? void 0 : _c.alias) || []);
633
+ return _chunk5QHU6UOYcjs.resolveAlias.call(void 0, path, ((_b = (_a = this.viteConfig) == null ? void 0 : _a.resolve) == null ? void 0 : _b.alias) || ((_c = this.viteConfig) == null ? void 0 : _c.alias) || []);
637
634
  }
638
635
  relative(path) {
639
636
  if (path.startsWith("/") && !path.startsWith(this.root))
@@ -682,7 +679,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
682
679
  return await ctx.findComponent(name, "component", filename ? [filename] : []);
683
680
  },
684
681
  stringifyImport(info) {
685
- return _chunkWRE7G5ODjs.stringifyComponentImport.call(void 0, info, ctx);
682
+ return _chunk5QHU6UOYcjs.stringifyComponentImport.call(void 0, info, ctx);
686
683
  }
687
684
  };
688
685
  return {
@@ -693,7 +690,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
693
690
  return filter(id);
694
691
  },
695
692
  async transform(code, id) {
696
- if (!_chunkWRE7G5ODjs.shouldTransform.call(void 0, code))
693
+ if (!_chunk5QHU6UOYcjs.shouldTransform.call(void 0, code))
697
694
  return null;
698
695
  try {
699
696
  const result = await ctx.transform(code, id);
@@ -122,17 +122,18 @@ function getNameFromFilePath(filePath, options) {
122
122
  for (const fileOrFolderName of namespaced) {
123
123
  let cumulativePrefix = "";
124
124
  let didCollapse = false;
125
+ const pascalCasedName = pascalCase(fileOrFolderName);
125
126
  for (const parentFolder of [...collapsed].reverse()) {
126
- cumulativePrefix = `${capitalize(parentFolder)}${cumulativePrefix}`;
127
- if (pascalCase(fileOrFolderName).startsWith(pascalCase(cumulativePrefix))) {
128
- const collapseSamePrefix = fileOrFolderName.slice(cumulativePrefix.length);
127
+ cumulativePrefix = `${parentFolder}${cumulativePrefix}`;
128
+ if (pascalCasedName.startsWith(cumulativePrefix)) {
129
+ const collapseSamePrefix = pascalCasedName.slice(cumulativePrefix.length);
129
130
  collapsed.push(collapseSamePrefix);
130
131
  didCollapse = true;
131
132
  break;
132
133
  }
133
134
  }
134
135
  if (!didCollapse)
135
- collapsed.push(fileOrFolderName);
136
+ collapsed.push(pascalCasedName);
136
137
  }
137
138
  namespaced = collapsed;
138
139
  }
@@ -10,11 +10,11 @@ import {
10
10
  resolveAlias,
11
11
  shouldTransform,
12
12
  stringifyComponentImport
13
- } from "./chunk-L2JFDMEX.mjs";
13
+ } from "./chunk-SQHKCPM6.js";
14
14
  import {
15
15
  __spreadProps,
16
16
  __spreadValues
17
- } from "./chunk-T2FESLJY.mjs";
17
+ } from "./chunk-5JVO2UWC.js";
18
18
 
19
19
  // src/core/unplugin.ts
20
20
  import { existsSync as existsSync2 } from "fs";
@@ -217,17 +217,14 @@ function getDeclaration(ctx, filepath, originalImports) {
217
217
  component: stringifyDeclarationImports(__spreadValues(__spreadValues({}, originalImports == null ? void 0 : originalImports.component), imports.component)),
218
218
  directive: stringifyDeclarationImports(__spreadValues(__spreadValues({}, originalImports == null ? void 0 : originalImports.directive), imports.directive))
219
219
  };
220
- const head = ctx.options.version === 2.7 ? `export {}
221
-
222
- declare module 'vue' {` : `export {}
223
-
224
- declare module 'vue' {`;
225
220
  let code = `/* eslint-disable */
226
- /* prettier-ignore */
227
221
  // @ts-nocheck
228
222
  // Generated by unplugin-vue-components
229
223
  // Read more: https://github.com/vuejs/core/pull/3399
230
- ${head}`;
224
+ export {}
225
+
226
+ /* prettier-ignore */
227
+ declare module 'vue' {`;
231
228
  if (Object.keys(declarations.component).length > 0) {
232
229
  code += `
233
230
  export interface GlobalComponents {
@@ -337,7 +334,7 @@ async function resolveVue22(code, s) {
337
334
  sourceType: "module"
338
335
  });
339
336
  const nodes = [];
340
- const { walk } = await import("./src-B32PW6M3.mjs");
337
+ const { walk } = await import("./src-WIQNDB4Q.js");
341
338
  walk(program, {
342
339
  enter(node) {
343
340
  if (node.type === "CallExpression")
@@ -437,7 +434,7 @@ function transformer(ctx, transformer2) {
437
434
  s.prepend(DISABLE_COMMENT);
438
435
  const result = { code: s.toString() };
439
436
  if (ctx.sourcemap)
440
- result.map = s.generateMap({ source: id, includeContent: true });
437
+ result.map = s.generateMap({ source: id, includeContent: true, hires: "boundary" });
441
438
  return result;
442
439
  };
443
440
  }
@@ -1,4 +1,4 @@
1
- var __defProp = Object.defineProperty;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -25,8 +25,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
25
25
  throw Error('Dynamic require of "' + x + '" is not supported');
26
26
  });
27
27
 
28
- export {
29
- __spreadValues,
30
- __spreadProps,
31
- __require
32
- };
28
+
29
+
30
+
31
+
32
+ exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkJGIUAMWPcjs = require('./chunk-JGIUAMWP.cjs');
4
+ require('./chunk-5QHU6UOY.cjs');
5
+ require('./chunk-WJIU4Q36.cjs');
6
+ require('./chunk-ZBPRDZS4.cjs');
7
+
8
+ // src/esbuild.ts
9
+ var esbuild_default = _chunkJGIUAMWPcjs.unplugin_default.esbuild;
10
+
11
+
12
+ exports.default = esbuild_default;
@@ -1,5 +1,5 @@
1
1
  import * as esbuild from 'esbuild';
2
- import { Options } from './types.mjs';
2
+ import { Options } from './types.cjs';
3
3
  import '@rollup/pluginutils';
4
4
  import 'unplugin';
5
5
  import '@antfu/utils';
package/dist/esbuild.js CHANGED
@@ -1,13 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk5MUHROAQjs = require('./chunk-5MUHROAQ.js');
4
- require('./chunk-WRE7G5OD.js');
5
- require('./chunk-5JVO2UWC.js');
6
- require('./chunk-6F4PWJZI.js');
1
+ import {
2
+ unplugin_default
3
+ } from "./chunk-TSU3OFN5.js";
4
+ import "./chunk-SQHKCPM6.js";
5
+ import "./chunk-5JVO2UWC.js";
6
+ import "./chunk-6F4PWJZI.js";
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunk5MUHROAQjs.unplugin_default.esbuild;
10
-
11
-
12
- module.exports = esbuild_default;
13
- exports.default = module.exports;
9
+ var esbuild_default = unplugin_default.esbuild;
10
+ export {
11
+ esbuild_default as default
12
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkJGIUAMWPcjs = require('./chunk-JGIUAMWP.cjs');
4
+
5
+
6
+
7
+
8
+ var _chunk5QHU6UOYcjs = require('./chunk-5QHU6UOY.cjs');
9
+ require('./chunk-WJIU4Q36.cjs');
10
+ require('./chunk-ZBPRDZS4.cjs');
11
+
12
+
13
+
14
+
15
+
16
+ exports.camelCase = _chunk5QHU6UOYcjs.camelCase; exports.default = _chunkJGIUAMWPcjs.unplugin_default; exports.kebabCase = _chunk5QHU6UOYcjs.kebabCase; exports.pascalCase = _chunk5QHU6UOYcjs.pascalCase;
@@ -1,5 +1,5 @@
1
- import { Options } from './types.mjs';
2
- export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport } from './types.mjs';
1
+ import { Options } from './types.cjs';
2
+ export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport } from './types.cjs';
3
3
  import * as unplugin from 'unplugin';
4
4
  import '@rollup/pluginutils';
5
5
  import '@antfu/utils';
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk5MUHROAQjs = require('./chunk-5MUHROAQ.js');
4
-
5
-
6
-
7
-
8
- var _chunkWRE7G5ODjs = require('./chunk-WRE7G5OD.js');
9
- require('./chunk-5JVO2UWC.js');
10
- require('./chunk-6F4PWJZI.js');
11
-
12
-
13
-
14
-
15
-
16
- exports.camelCase = _chunkWRE7G5ODjs.camelCase; exports.default = _chunk5MUHROAQjs.unplugin_default; exports.kebabCase = _chunkWRE7G5ODjs.kebabCase; exports.pascalCase = _chunkWRE7G5ODjs.pascalCase;
1
+ import {
2
+ unplugin_default
3
+ } from "./chunk-TSU3OFN5.js";
4
+ import {
5
+ camelCase,
6
+ kebabCase,
7
+ pascalCase
8
+ } from "./chunk-SQHKCPM6.js";
9
+ import "./chunk-5JVO2UWC.js";
10
+ import "./chunk-6F4PWJZI.js";
11
+ export {
12
+ camelCase,
13
+ unplugin_default as default,
14
+ kebabCase,
15
+ pascalCase
16
+ };
package/dist/nuxt.cjs ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkJGIUAMWPcjs = require('./chunk-JGIUAMWP.cjs');
4
+ require('./chunk-5QHU6UOY.cjs');
5
+ require('./chunk-WJIU4Q36.cjs');
6
+ require('./chunk-ZBPRDZS4.cjs');
7
+
8
+ // src/nuxt.ts
9
+ var _kit = require('@nuxt/kit');
10
+ var nuxt_default = _kit.defineNuxtModule.call(void 0, {
11
+ setup(options) {
12
+ _kit.addWebpackPlugin.call(void 0, _chunkJGIUAMWPcjs.unplugin_default.webpack(options));
13
+ _kit.addVitePlugin.call(void 0, _chunkJGIUAMWPcjs.unplugin_default.vite(options));
14
+ }
15
+ });
16
+
17
+
18
+ exports.default = nuxt_default;
@@ -1,5 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { Options } from './types.mjs';
2
+ import { Options } from './types.cjs';
3
3
  import '@rollup/pluginutils';
4
4
  import 'unplugin';
5
5
  import '@antfu/utils';
package/dist/nuxt.js CHANGED
@@ -1,19 +1,18 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk5MUHROAQjs = require('./chunk-5MUHROAQ.js');
4
- require('./chunk-WRE7G5OD.js');
5
- require('./chunk-5JVO2UWC.js');
6
- require('./chunk-6F4PWJZI.js');
1
+ import {
2
+ unplugin_default
3
+ } from "./chunk-TSU3OFN5.js";
4
+ import "./chunk-SQHKCPM6.js";
5
+ import "./chunk-5JVO2UWC.js";
6
+ import "./chunk-6F4PWJZI.js";
7
7
 
8
8
  // src/nuxt.ts
9
- var _kit = require('@nuxt/kit');
10
- var nuxt_default = _kit.defineNuxtModule.call(void 0, {
9
+ import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
10
+ var nuxt_default = defineNuxtModule({
11
11
  setup(options) {
12
- _kit.addWebpackPlugin.call(void 0, _chunk5MUHROAQjs.unplugin_default.webpack(options));
13
- _kit.addVitePlugin.call(void 0, _chunk5MUHROAQjs.unplugin_default.vite(options));
12
+ addWebpackPlugin(unplugin_default.webpack(options));
13
+ addVitePlugin(unplugin_default.vite(options));
14
14
  }
15
15
  });
16
-
17
-
18
- module.exports = nuxt_default;
19
- exports.default = module.exports;
16
+ export {
17
+ nuxt_default as default
18
+ };