unplugin-vue-components 28.2.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.
@@ -197,6 +197,7 @@ var defaultOptions = {
197
197
  directoryAsNamespace: false,
198
198
  collapseSamePrefixes: false,
199
199
  globalNamespaces: [],
200
+ transformerUserResolveFunctions: true,
200
201
  resolvers: [],
201
202
  globsExclude: [],
202
203
  importPathTransform: (v) => v,
@@ -273,9 +274,12 @@ function resolveVue2(code, s) {
273
274
  }
274
275
  return results;
275
276
  }
276
- function resolveVue3(code, s) {
277
+ function resolveVue3(code, s, transformerUserResolveFunctions) {
277
278
  const results = [];
278
- 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
+ }
279
283
  const matchedName = match[1];
280
284
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
281
285
  const start = match.index;
@@ -290,7 +294,7 @@ function resolveVue3(code, s) {
290
294
  }
291
295
  async function transformComponent(code, transformer2, s, ctx, sfcPath) {
292
296
  let no = 0;
293
- const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
297
+ const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s, ctx.options.transformerUserResolveFunctions);
294
298
  for (const { rawName, replace } of results) {
295
299
  debug2(`| ${rawName}`);
296
300
  const name = _chunkCYD4VYHZcjs.pascalCase.call(void 0, rawName);
@@ -378,10 +382,13 @@ this.$options.directives["${name}"] = ${resolved};`);
378
382
  }
379
383
 
380
384
  // src/core/transforms/directive/vue3.ts
381
- function resolveVue32(code, s) {
385
+ function resolveVue32(code, s, transformerUserResolveFunctions) {
382
386
  const results = [];
383
- for (const match of code.matchAll(/_resolveDirective\("(.+?)"\)/g)) {
387
+ for (const match of code.matchAll(/_?resolveDirective\("(.+?)"\)/g)) {
384
388
  const matchedName = match[1];
389
+ if (!transformerUserResolveFunctions && !match[0].startsWith("_")) {
390
+ continue;
391
+ }
385
392
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
386
393
  const start = match.index;
387
394
  const end = start + match[0].length;
@@ -197,6 +197,7 @@ var defaultOptions = {
197
197
  directoryAsNamespace: false,
198
198
  collapseSamePrefixes: false,
199
199
  globalNamespaces: [],
200
+ transformerUserResolveFunctions: true,
200
201
  resolvers: [],
201
202
  globsExclude: [],
202
203
  importPathTransform: (v) => v,
@@ -273,9 +274,12 @@ function resolveVue2(code, s) {
273
274
  }
274
275
  return results;
275
276
  }
276
- function resolveVue3(code, s) {
277
+ function resolveVue3(code, s, transformerUserResolveFunctions) {
277
278
  const results = [];
278
- 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
+ }
279
283
  const matchedName = match[1];
280
284
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
281
285
  const start = match.index;
@@ -290,7 +294,7 @@ function resolveVue3(code, s) {
290
294
  }
291
295
  async function transformComponent(code, transformer2, s, ctx, sfcPath) {
292
296
  let no = 0;
293
- const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
297
+ const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s, ctx.options.transformerUserResolveFunctions);
294
298
  for (const { rawName, replace } of results) {
295
299
  debug2(`| ${rawName}`);
296
300
  const name = pascalCase(rawName);
@@ -378,10 +382,13 @@ this.$options.directives["${name}"] = ${resolved};`);
378
382
  }
379
383
 
380
384
  // src/core/transforms/directive/vue3.ts
381
- function resolveVue32(code, s) {
385
+ function resolveVue32(code, s, transformerUserResolveFunctions) {
382
386
  const results = [];
383
- for (const match of code.matchAll(/_resolveDirective\("(.+?)"\)/g)) {
387
+ for (const match of code.matchAll(/_?resolveDirective\("(.+?)"\)/g)) {
384
388
  const matchedName = match[1];
389
+ if (!transformerUserResolveFunctions && !match[0].startsWith("_")) {
390
+ continue;
391
+ }
385
392
  if (match.index != null && matchedName && !matchedName.startsWith("_")) {
386
393
  const start = match.index;
387
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 _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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 = _chunkDBJDTE6Jcjs.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-OSRKQKTH.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 _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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 = _chunkDBJDTE6Jcjs.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-OSRKQKTH.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 _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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, _chunkDBJDTE6Jcjs.unplugin_default.webpack(options));
13
- _kit.addVitePlugin.call(void 0, _chunkDBJDTE6Jcjs.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-OSRKQKTH.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 _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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 = _chunkDBJDTE6Jcjs.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-OSRKQKTH.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 _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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 = _chunkDBJDTE6Jcjs.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-OSRKQKTH.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
@@ -125,6 +125,15 @@ interface Options {
125
125
  * @default 'vue3'
126
126
  */
127
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;
128
137
  /**
129
138
  * Generate TypeScript declaration for global components
130
139
  *
package/dist/types.d.ts CHANGED
@@ -125,6 +125,15 @@ interface Options {
125
125
  * @default 'vue3'
126
126
  */
127
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;
128
137
  /**
129
138
  * Generate TypeScript declaration for global components
130
139
  *
package/dist/vite.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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 = _chunkDBJDTE6Jcjs.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-OSRKQKTH.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 _chunkDBJDTE6Jcjs = require('./chunk-DBJDTE6J.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 = _chunkDBJDTE6Jcjs.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-OSRKQKTH.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.2.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>",