unplugin-vue-components 28.1.0 → 28.3.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.
@@ -175,7 +175,7 @@ function searchComponents(ctx) {
175
175
  debug(`started with: [${ctx.options.globs.join(", ")}]`);
176
176
  const root = ctx.root;
177
177
  const files = _tinyglobby.globSync.call(void 0, ctx.options.globs, {
178
- ignore: ["node_modules"],
178
+ ignore: ctx.options.globsExclude,
179
179
  onlyFiles: true,
180
180
  cwd: root,
181
181
  absolute: true
@@ -197,7 +197,9 @@ var defaultOptions = {
197
197
  directoryAsNamespace: false,
198
198
  collapseSamePrefixes: false,
199
199
  globalNamespaces: [],
200
+ transformerUserResolveFunctions: true,
200
201
  resolvers: [],
202
+ globsExclude: [],
201
203
  importPathTransform: (v) => v,
202
204
  allowOverrides: false
203
205
  };
@@ -272,9 +274,12 @@ function resolveVue2(code, s) {
272
274
  }
273
275
  return results;
274
276
  }
275
- function resolveVue3(code, s) {
277
+ function resolveVue3(code, s, transformerUserResolveFunctions) {
276
278
  const results = [];
277
- for (const match of code.matchAll(/_resolveComponent\d*\("(.+?)"\)/g)) {
279
+ for (const match of code.matchAll(/_?resolveComponent\d*\("(.+?)"\)/g)) {
280
+ if (!transformerUserResolveFunctions && !match[0].startsWith("_")) {
281
+ continue;
282
+ }
278
283
  const matchedName = match[1];
279
284
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
280
285
  const start = match.index;
@@ -289,7 +294,7 @@ function resolveVue3(code, s) {
289
294
  }
290
295
  async function transformComponent(code, transformer2, s, ctx, sfcPath) {
291
296
  let no = 0;
292
- const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
297
+ const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s, ctx.options.transformerUserResolveFunctions);
293
298
  for (const { rawName, replace } of results) {
294
299
  debug2(`| ${rawName}`);
295
300
  const name = _chunkCYD4VYHZcjs.pascalCase.call(void 0, rawName);
@@ -377,10 +382,13 @@ this.$options.directives["${name}"] = ${resolved};`);
377
382
  }
378
383
 
379
384
  // src/core/transforms/directive/vue3.ts
380
- function resolveVue32(code, s) {
385
+ function resolveVue32(code, s, transformerUserResolveFunctions) {
381
386
  const results = [];
382
- for (const match of code.matchAll(/_resolveDirective\("(.+?)"\)/g)) {
387
+ for (const match of code.matchAll(/_?resolveDirective\("(.+?)"\)/g)) {
383
388
  const matchedName = match[1];
389
+ if (!transformerUserResolveFunctions && !match[0].startsWith("_")) {
390
+ continue;
391
+ }
384
392
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
385
393
  const start = match.index;
386
394
  const end = start + match[0].length;
@@ -175,7 +175,7 @@ function searchComponents(ctx) {
175
175
  debug(`started with: [${ctx.options.globs.join(", ")}]`);
176
176
  const root = ctx.root;
177
177
  const files = globSync(ctx.options.globs, {
178
- ignore: ["node_modules"],
178
+ ignore: ctx.options.globsExclude,
179
179
  onlyFiles: true,
180
180
  cwd: root,
181
181
  absolute: true
@@ -197,7 +197,9 @@ var defaultOptions = {
197
197
  directoryAsNamespace: false,
198
198
  collapseSamePrefixes: false,
199
199
  globalNamespaces: [],
200
+ transformerUserResolveFunctions: true,
200
201
  resolvers: [],
202
+ globsExclude: [],
201
203
  importPathTransform: (v) => v,
202
204
  allowOverrides: false
203
205
  };
@@ -272,9 +274,12 @@ function resolveVue2(code, s) {
272
274
  }
273
275
  return results;
274
276
  }
275
- function resolveVue3(code, s) {
277
+ function resolveVue3(code, s, transformerUserResolveFunctions) {
276
278
  const results = [];
277
- for (const match of code.matchAll(/_resolveComponent\d*\("(.+?)"\)/g)) {
279
+ for (const match of code.matchAll(/_?resolveComponent\d*\("(.+?)"\)/g)) {
280
+ if (!transformerUserResolveFunctions && !match[0].startsWith("_")) {
281
+ continue;
282
+ }
278
283
  const matchedName = match[1];
279
284
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
280
285
  const start = match.index;
@@ -289,7 +294,7 @@ function resolveVue3(code, s) {
289
294
  }
290
295
  async function transformComponent(code, transformer2, s, ctx, sfcPath) {
291
296
  let no = 0;
292
- const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
297
+ const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s, ctx.options.transformerUserResolveFunctions);
293
298
  for (const { rawName, replace } of results) {
294
299
  debug2(`| ${rawName}`);
295
300
  const name = pascalCase(rawName);
@@ -377,10 +382,13 @@ this.$options.directives["${name}"] = ${resolved};`);
377
382
  }
378
383
 
379
384
  // src/core/transforms/directive/vue3.ts
380
- function resolveVue32(code, s) {
385
+ function resolveVue32(code, s, transformerUserResolveFunctions) {
381
386
  const results = [];
382
- for (const match of code.matchAll(/_resolveDirective\("(.+?)"\)/g)) {
387
+ for (const match of code.matchAll(/_?resolveDirective\("(.+?)"\)/g)) {
383
388
  const matchedName = match[1];
389
+ if (!transformerUserResolveFunctions && !match[0].startsWith("_")) {
390
+ continue;
391
+ }
384
392
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
385
393
  const start = match.index;
386
394
  const end = start + match[0].length;
package/dist/esbuild.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
  require('./chunk-CYD4VYHZ.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunkHIFTV3XMcjs.unplugin_default.esbuild;
9
+ var esbuild_default = _chunkQKHJKWZTcjs.unplugin_default.esbuild;
10
10
 
11
11
 
12
12
  exports.default = esbuild_default;
package/dist/esbuild.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import "./chunk-UZ5LIG7M.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
 
5
5
 
6
6
 
@@ -13,4 +13,4 @@ require('./chunk-ZBPRDZS4.cjs');
13
13
 
14
14
 
15
15
 
16
- exports.camelCase = _chunkCYD4VYHZcjs.camelCase; exports.default = _chunkHIFTV3XMcjs.unplugin_default; exports.kebabCase = _chunkCYD4VYHZcjs.kebabCase; exports.pascalCase = _chunkCYD4VYHZcjs.pascalCase;
16
+ exports.camelCase = _chunkCYD4VYHZcjs.camelCase; exports.default = _chunkQKHJKWZTcjs.unplugin_default; exports.kebabCase = _chunkCYD4VYHZcjs.kebabCase; exports.pascalCase = _chunkCYD4VYHZcjs.pascalCase;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import {
5
5
  camelCase,
6
6
  kebabCase,
package/dist/nuxt.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
  require('./chunk-CYD4VYHZ.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
@@ -9,8 +9,8 @@ require('./chunk-ZBPRDZS4.cjs');
9
9
  var _kit = require('@nuxt/kit');
10
10
  var nuxt_default = _kit.defineNuxtModule.call(void 0, {
11
11
  setup(options) {
12
- _kit.addWebpackPlugin.call(void 0, _chunkHIFTV3XMcjs.unplugin_default.webpack(options));
13
- _kit.addVitePlugin.call(void 0, _chunkHIFTV3XMcjs.unplugin_default.vite(options));
12
+ _kit.addWebpackPlugin.call(void 0, _chunkQKHJKWZTcjs.unplugin_default.webpack(options));
13
+ _kit.addVitePlugin.call(void 0, _chunkQKHJKWZTcjs.unplugin_default.vite(options));
14
14
  }
15
15
  });
16
16
 
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import "./chunk-UZ5LIG7M.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
package/dist/rollup.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
  require('./chunk-CYD4VYHZ.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/rollup.ts
9
- var rollup_default = _chunkHIFTV3XMcjs.unplugin_default.rollup;
9
+ var rollup_default = _chunkQKHJKWZTcjs.unplugin_default.rollup;
10
10
 
11
11
 
12
12
  exports.default = rollup_default;
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import "./chunk-UZ5LIG7M.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
package/dist/rspack.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
  require('./chunk-CYD4VYHZ.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/rspack.ts
9
- var rspack_default = _chunkHIFTV3XMcjs.unplugin_default.rspack;
9
+ var rspack_default = _chunkQKHJKWZTcjs.unplugin_default.rspack;
10
10
 
11
11
 
12
12
  exports.default = rspack_default;
package/dist/rspack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import "./chunk-UZ5LIG7M.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
package/dist/types.d.cts CHANGED
@@ -78,6 +78,12 @@ interface Options {
78
78
  * When specified, the `dirs`, `extensions`, and `directoryAsNamespace` options will be ignored.
79
79
  */
80
80
  globs?: string | string[];
81
+ /**
82
+ * Negated glob patterns to exclude files from being detected as components.
83
+ *
84
+ * @default []
85
+ */
86
+ globsExclude?: string | string[];
81
87
  /**
82
88
  * Search for subdirectories
83
89
  * @default true
@@ -119,6 +125,15 @@ interface Options {
119
125
  * @default 'vue3'
120
126
  */
121
127
  transformer?: SupportedTransformer;
128
+ /**
129
+ * Tranform users' usage of resolveComponent/resolveDirective as well
130
+ *
131
+ * If disabled, only components inside templates (which compiles to `_resolveComponent` etc.)
132
+ * will be transformed.
133
+ *
134
+ * @default true
135
+ */
136
+ transformerUserResolveFunctions?: boolean;
122
137
  /**
123
138
  * Generate TypeScript declaration for global components
124
139
  *
package/dist/types.d.ts CHANGED
@@ -78,6 +78,12 @@ interface Options {
78
78
  * When specified, the `dirs`, `extensions`, and `directoryAsNamespace` options will be ignored.
79
79
  */
80
80
  globs?: string | string[];
81
+ /**
82
+ * Negated glob patterns to exclude files from being detected as components.
83
+ *
84
+ * @default []
85
+ */
86
+ globsExclude?: string | string[];
81
87
  /**
82
88
  * Search for subdirectories
83
89
  * @default true
@@ -119,6 +125,15 @@ interface Options {
119
125
  * @default 'vue3'
120
126
  */
121
127
  transformer?: SupportedTransformer;
128
+ /**
129
+ * Tranform users' usage of resolveComponent/resolveDirective as well
130
+ *
131
+ * If disabled, only components inside templates (which compiles to `_resolveComponent` etc.)
132
+ * will be transformed.
133
+ *
134
+ * @default true
135
+ */
136
+ transformerUserResolveFunctions?: boolean;
122
137
  /**
123
138
  * Generate TypeScript declaration for global components
124
139
  *
package/dist/vite.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
  require('./chunk-CYD4VYHZ.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/vite.ts
9
- var vite_default = _chunkHIFTV3XMcjs.unplugin_default.vite;
9
+ var vite_default = _chunkQKHJKWZTcjs.unplugin_default.vite;
10
10
 
11
11
 
12
12
  exports.default = vite_default;
package/dist/vite.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import "./chunk-UZ5LIG7M.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
package/dist/webpack.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHIFTV3XMcjs = require('./chunk-HIFTV3XM.cjs');
3
+ var _chunkQKHJKWZTcjs = require('./chunk-QKHJKWZT.cjs');
4
4
  require('./chunk-CYD4VYHZ.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/webpack.ts
9
- var webpack_default = _chunkHIFTV3XMcjs.unplugin_default.webpack;
9
+ var webpack_default = _chunkQKHJKWZTcjs.unplugin_default.webpack;
10
10
 
11
11
 
12
12
  exports.default = webpack_default;
package/dist/webpack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-KK5H744T.js";
3
+ } from "./chunk-ZEYMMBWZ.js";
4
4
  import "./chunk-UZ5LIG7M.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-vue-components",
3
3
  "type": "module",
4
- "version": "28.1.0",
4
+ "version": "28.3.0",
5
5
  "packageManager": "pnpm@10.4.0",
6
6
  "description": "Components auto importing for Vue",
7
7
  "author": "antfu <anthonyfu117@hotmail.com>",