@vue-jsx-vapor/macros 2.1.8 → 2.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.
package/dist/api.cjs CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkLPH34H6Ocjs = require('./chunk-LPH34H6O.cjs');
7
+ var _chunkZQ4GVJKXcjs = require('./chunk-ZQ4GVJKX.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
- exports.getMacroExpression = _chunkLPH34H6Ocjs.getMacroExpression; exports.getParamsStart = _chunkLPH34H6Ocjs.getParamsStart; exports.isFunctionalNode = _chunkLPH34H6Ocjs.isFunctionalNode; exports.restructure = _chunkLPH34H6Ocjs.restructure; exports.transformJsxMacros = _chunkLPH34H6Ocjs.transformJsxMacros;
14
+ exports.getMacroExpression = _chunkZQ4GVJKXcjs.getMacroExpression; exports.getParamsStart = _chunkZQ4GVJKXcjs.getParamsStart; exports.isFunctionalNode = _chunkZQ4GVJKXcjs.isFunctionalNode; exports.restructure = _chunkZQ4GVJKXcjs.restructure; exports.transformJsxMacros = _chunkZQ4GVJKXcjs.transformJsxMacros;
package/dist/api.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  isFunctionalNode,
5
5
  restructure,
6
6
  transformJsxMacros
7
- } from "./chunk-TWP2JCYQ.js";
7
+ } from "./chunk-SMWNQXL7.js";
8
8
  export {
9
9
  getMacroExpression,
10
10
  getParamsStart,
package/dist/astro.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
4
- require('./chunk-35H4MC4N.cjs');
5
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
+ require('./chunk-UAWFIGPX.cjs');
5
+ require('./chunk-ZQ4GVJKX.cjs');
6
6
  require('./chunk-53TNKVYD.cjs');
7
7
 
8
8
  // src/astro.ts
@@ -11,7 +11,7 @@ var astro_default = (options) => ({
11
11
  hooks: {
12
12
  "astro:config:setup": (astro) => {
13
13
  astro.config.vite.plugins ||= [];
14
- astro.config.vite.plugins.push(_chunkJWJVYLYIcjs.index_default.vite(options));
14
+ astro.config.vite.plugins.push(_chunkL26STXZKcjs.index_default.vite(options));
15
15
  }
16
16
  }
17
17
  });
package/dist/astro.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
4
- import "./chunk-WOWB5VHY.js";
5
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
+ import "./chunk-E5WGUCGE.js";
5
+ import "./chunk-SMWNQXL7.js";
6
6
  import "./chunk-DANY2WQD.js";
7
7
 
8
8
  // src/astro.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raw_default
3
- } from "./chunk-WOWB5VHY.js";
3
+ } from "./chunk-E5WGUCGE.js";
4
4
 
5
5
  // src/index.ts
6
6
  import { createUnplugin } from "unplugin";
@@ -5,7 +5,7 @@ import {
5
5
  use_model_default,
6
6
  withDefaultsHelperId,
7
7
  with_defaults_default
8
- } from "./chunk-TWP2JCYQ.js";
8
+ } from "./chunk-SMWNQXL7.js";
9
9
  import {
10
10
  resolveOptions
11
11
  } from "./chunk-DANY2WQD.js";
@@ -52,7 +52,10 @@ var plugin = (userOptions = {}) => {
52
52
  if (importMap.get(id)) return true;
53
53
  return filter(id);
54
54
  },
55
- transform(code, id) {
55
+ transform(code, id, opt) {
56
+ if (opt?.ssr) {
57
+ options.defineComponent.autoReturnFunction = true;
58
+ }
56
59
  if (importMap.get(id)) return transformStyle(code, id, options);
57
60
  return transformJsxMacros(code, id, importMap, options);
58
61
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
4
 
5
5
  // src/webpack.ts
6
6
  var webpack_default = index_default.webpack;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
4
 
5
5
  // src/vite.ts
6
- var vite_default = _chunkJWJVYLYIcjs.index_default.vite;
6
+ var vite_default = _chunkL26STXZKcjs.index_default.vite;
7
7
 
8
8
 
9
9
 
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk35H4MC4Ncjs = require('./chunk-35H4MC4N.cjs');
3
+ var _chunkUAWFIGPXcjs = require('./chunk-UAWFIGPX.cjs');
4
4
 
5
5
  // src/index.ts
6
6
  var _unplugin = require('unplugin');
7
- var unplugin = _unplugin.createUnplugin.call(void 0, _chunk35H4MC4Ncjs.raw_default);
7
+ var unplugin = _unplugin.createUnplugin.call(void 0, _chunkUAWFIGPXcjs.raw_default);
8
8
  var index_default = unplugin;
9
9
 
10
10
 
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
4
 
5
5
  // src/webpack.ts
6
- var webpack_default = _chunkJWJVYLYIcjs.index_default.webpack;
6
+ var webpack_default = _chunkL26STXZKcjs.index_default.webpack;
7
7
 
8
8
 
9
9
 
@@ -240,8 +240,18 @@ function processAwait(s, node, needSemi, isStatement) {
240
240
  );
241
241
  }
242
242
 
243
+ // src/core/define-component/return.ts
244
+ function transformReturn(root, s) {
245
+ const node = root.body.type === "BlockStatement" ? root.body.body.find((node2) => node2.type === "ReturnStatement")?.argument : root.body;
246
+ if (!node || isFunctionalNode(node)) return;
247
+ s.appendRight(
248
+ node.extra?.parenthesized ? node.extra.parenStart : node.start,
249
+ "() => "
250
+ );
251
+ }
252
+
243
253
  // src/core/define-component/index.ts
244
- function transformDefineComponent(root, propsName, map, s) {
254
+ function transformDefineComponent(root, propsName, map, s, autoReturnFunction = false) {
245
255
  if (!map.defineComponent) return;
246
256
  const defineComponentName = s.sliceNode(map.defineComponent.callee);
247
257
  if (defineComponentName && !["defineComponent", "defineVaporComponent"].includes(defineComponentName)) {
@@ -299,6 +309,9 @@ function transformDefineComponent(root, propsName, map, s) {
299
309
  }
300
310
  }
301
311
  transformAwait(root, s);
312
+ if (autoReturnFunction) {
313
+ transformReturn(root, s);
314
+ }
302
315
  }
303
316
  function prependObjectExpression(argument, name, value, s) {
304
317
  if (!argument.properties?.find(
@@ -463,7 +476,13 @@ function transformJsxMacros(code, id, importMap, options) {
463
476
  s.appendRight(getParamsStart(root, s.original), propsName);
464
477
  }
465
478
  if (map.defineComponent) {
466
- transformDefineComponent(root, propsName, map, s);
479
+ transformDefineComponent(
480
+ root,
481
+ propsName,
482
+ map,
483
+ s,
484
+ options.defineComponent?.autoReturnFunction
485
+ );
467
486
  }
468
487
  if (map.defineModel?.length) {
469
488
  map.defineModel.forEach(({ expression }) => {
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkLPH34H6Ocjs = require('./chunk-LPH34H6O.cjs');
8
+ var _chunkZQ4GVJKXcjs = require('./chunk-ZQ4GVJKX.cjs');
9
9
 
10
10
 
11
11
  var _chunk53TNKVYDcjs = require('./chunk-53TNKVYD.cjs');
@@ -37,24 +37,27 @@ var plugin = (userOptions = {}) => {
37
37
  name,
38
38
  enforce: "pre",
39
39
  resolveId(id) {
40
- if (_common.normalizePath.call(void 0, id).startsWith(_chunkLPH34H6Ocjs.helperPrefix)) return id;
40
+ if (_common.normalizePath.call(void 0, id).startsWith(_chunkZQ4GVJKXcjs.helperPrefix)) return id;
41
41
  },
42
42
  loadInclude(id) {
43
- return _common.normalizePath.call(void 0, id).startsWith(_chunkLPH34H6Ocjs.helperPrefix);
43
+ return _common.normalizePath.call(void 0, id).startsWith(_chunkZQ4GVJKXcjs.helperPrefix);
44
44
  },
45
45
  load(_id) {
46
46
  const id = _common.normalizePath.call(void 0, _id);
47
- if (id === _chunkLPH34H6Ocjs.useModelHelperId) return _chunkLPH34H6Ocjs.use_model_default;
48
- else if (id === _chunkLPH34H6Ocjs.withDefaultsHelperId) return _chunkLPH34H6Ocjs.with_defaults_default;
47
+ if (id === _chunkZQ4GVJKXcjs.useModelHelperId) return _chunkZQ4GVJKXcjs.use_model_default;
48
+ else if (id === _chunkZQ4GVJKXcjs.withDefaultsHelperId) return _chunkZQ4GVJKXcjs.with_defaults_default;
49
49
  else if (importMap.get(id)) return importMap.get(id);
50
50
  },
51
51
  transformInclude(id) {
52
52
  if (importMap.get(id)) return true;
53
53
  return filter(id);
54
54
  },
55
- transform(code, id) {
55
+ transform(code, id, opt) {
56
+ if (_optionalChain([opt, 'optionalAccess', _ => _.ssr])) {
57
+ options.defineComponent.autoReturnFunction = true;
58
+ }
56
59
  if (importMap.get(id)) return transformStyle(code, id, options);
57
- return _chunkLPH34H6Ocjs.transformJsxMacros.call(void 0, code, id, importMap, options);
60
+ return _chunkZQ4GVJKXcjs.transformJsxMacros.call(void 0, code, id, importMap, options);
58
61
  }
59
62
  };
60
63
  };
@@ -240,8 +240,18 @@ function processAwait(s, node, needSemi, isStatement) {
240
240
  );
241
241
  }
242
242
 
243
+ // src/core/define-component/return.ts
244
+ function transformReturn(root, s) {
245
+ const node = root.body.type === "BlockStatement" ? _optionalChain([root, 'access', _13 => _13.body, 'access', _14 => _14.body, 'access', _15 => _15.find, 'call', _16 => _16((node2) => node2.type === "ReturnStatement"), 'optionalAccess', _17 => _17.argument]) : root.body;
246
+ if (!node || isFunctionalNode(node)) return;
247
+ s.appendRight(
248
+ _optionalChain([node, 'access', _18 => _18.extra, 'optionalAccess', _19 => _19.parenthesized]) ? node.extra.parenStart : node.start,
249
+ "() => "
250
+ );
251
+ }
252
+
243
253
  // src/core/define-component/index.ts
244
- function transformDefineComponent(root, propsName, map, s) {
254
+ function transformDefineComponent(root, propsName, map, s, autoReturnFunction = false) {
245
255
  if (!map.defineComponent) return;
246
256
  const defineComponentName = s.sliceNode(map.defineComponent.callee);
247
257
  if (defineComponentName && !["defineComponent", "defineVaporComponent"].includes(defineComponentName)) {
@@ -270,15 +280,15 @@ function transformDefineComponent(root, propsName, map, s) {
270
280
  }
271
281
  }
272
282
  for (const { expression, isRequired } of map.defineModel || []) {
273
- const modelOptions = _optionalChain([expression, 'access', _13 => _13.arguments, 'access', _14 => _14[0], 'optionalAccess', _15 => _15.type]) === "ObjectExpression" ? expression.arguments[0] : _optionalChain([expression, 'access', _16 => _16.arguments, 'access', _17 => _17[1], 'optionalAccess', _18 => _18.type]) === "ObjectExpression" ? expression.arguments[1] : void 0;
283
+ const modelOptions = _optionalChain([expression, 'access', _20 => _20.arguments, 'access', _21 => _21[0], 'optionalAccess', _22 => _22.type]) === "ObjectExpression" ? expression.arguments[0] : _optionalChain([expression, 'access', _23 => _23.arguments, 'access', _24 => _24[1], 'optionalAccess', _25 => _25.type]) === "ObjectExpression" ? expression.arguments[1] : void 0;
274
284
  const options = {};
275
285
  if (isRequired) options.required = true;
276
- for (const prop of _optionalChain([modelOptions, 'optionalAccess', _19 => _19.properties]) || []) {
286
+ for (const prop of _optionalChain([modelOptions, 'optionalAccess', _26 => _26.properties]) || []) {
277
287
  if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && ["validator", "type", "required"].includes(prop.key.name)) {
278
288
  options[prop.key.name] = s.sliceNode(prop.value);
279
289
  }
280
290
  }
281
- const propName = _optionalChain([expression, 'access', _20 => _20.arguments, 'access', _21 => _21[0], 'optionalAccess', _22 => _22.type]) === "StringLiteral" ? expression.arguments[0].value : "modelValue";
291
+ const propName = _optionalChain([expression, 'access', _27 => _27.arguments, 'access', _28 => _28[0], 'optionalAccess', _29 => _29.type]) === "StringLiteral" ? expression.arguments[0].value : "modelValue";
282
292
  props[propName] = Object.keys(options).length ? `{ ${Object.entries(options).map(([key, value]) => `${key}: ${value}`).join(", ")} }` : null;
283
293
  props[`onUpdate:${propName}`] = null;
284
294
  props[`${propName === "modelValue" ? "model" : propName}Modifiers`] = null;
@@ -299,9 +309,12 @@ function transformDefineComponent(root, propsName, map, s) {
299
309
  }
300
310
  }
301
311
  transformAwait(root, s);
312
+ if (autoReturnFunction) {
313
+ transformReturn(root, s);
314
+ }
302
315
  }
303
316
  function prependObjectExpression(argument, name, value, s) {
304
- if (!_optionalChain([argument, 'access', _23 => _23.properties, 'optionalAccess', _24 => _24.find, 'call', _25 => _25(
317
+ if (!_optionalChain([argument, 'access', _30 => _30.properties, 'optionalAccess', _31 => _31.find, 'call', _32 => _32(
305
318
  (prop) => prop.type === "ObjectProperty" && prop.key.type === "Identifier" && prop.key.name === name
306
319
  )])) {
307
320
  s.appendRight(argument.start + 1, `${name}: ${value},`);
@@ -312,7 +325,7 @@ function getWalkedIds(root, propsName) {
312
325
  _compilersfc.walkIdentifiers.call(void 0,
313
326
  root.body,
314
327
  (id, parent) => {
315
- if (id.name === propsName && (_optionalChain([parent, 'optionalAccess', _26 => _26.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _27 => _27.type]) === "OptionalMemberExpression")) {
328
+ if (id.name === propsName && (_optionalChain([parent, 'optionalAccess', _33 => _33.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _34 => _34.type]) === "OptionalMemberExpression")) {
316
329
  const prop = parent.property.type === "Identifier" ? parent.property.name : parent.property.type === "StringLiteral" ? parent.property.value : "";
317
330
  if (prop) walkedIds.add(prop);
318
331
  }
@@ -327,7 +340,7 @@ function getWalkedIds(root, propsName) {
327
340
  function transformDefineExpose(node, s, version) {
328
341
  s.overwriteNode(node.callee, ";");
329
342
  s.appendRight(
330
- _optionalChain([node, 'access', _28 => _28.arguments, 'access', _29 => _29[0], 'optionalAccess', _30 => _30.start]) || node.end - 1,
343
+ _optionalChain([node, 'access', _35 => _35.arguments, 'access', _36 => _36[0], 'optionalAccess', _37 => _37.start]) || node.end - 1,
331
344
  version >= 3.6 ? `${_common.importHelperFn.call(void 0, s, 0, "currentInstance")}.exposed = ` : `${_common.importHelperFn.call(void 0, s, 0, "getCurrentInstance")}().exposed = `
332
345
  );
333
346
  }
@@ -340,8 +353,8 @@ function transformDefineModel(node, propsName, s) {
340
353
  _common.importHelperFn.call(void 0, s, 0, "useModel", void 0, useModelHelperId)
341
354
  );
342
355
  s.appendRight(
343
- _optionalChain([node, 'access', _31 => _31.arguments, 'access', _32 => _32[0], 'optionalAccess', _33 => _33.start]) || node.end - 1,
344
- `${propsName}, ${_optionalChain([node, 'access', _34 => _34.arguments, 'access', _35 => _35[0], 'optionalAccess', _36 => _36.type]) !== "StringLiteral" ? `'modelValue',` : ""}`
356
+ _optionalChain([node, 'access', _38 => _38.arguments, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.start]) || node.end - 1,
357
+ `${propsName}, ${_optionalChain([node, 'access', _41 => _41.arguments, 'access', _42 => _42[0], 'optionalAccess', _43 => _43.type]) !== "StringLiteral" ? `'modelValue',` : ""}`
345
358
  );
346
359
  }
347
360
 
@@ -350,7 +363,7 @@ function transformDefineModel(node, propsName, s) {
350
363
  function transformDefineSlots(node, s) {
351
364
  s.overwrite(
352
365
  node.start,
353
- _optionalChain([node, 'access', _37 => _37.arguments, 'access', _38 => _38[0], 'optionalAccess', _39 => _39.start]) && node.arguments[0].start - 1 || _optionalChain([node, 'access', _40 => _40.typeArguments, 'optionalAccess', _41 => _41.end]) || node.callee.end,
366
+ _optionalChain([node, 'access', _44 => _44.arguments, 'access', _45 => _45[0], 'optionalAccess', _46 => _46.start]) && node.arguments[0].start - 1 || _optionalChain([node, 'access', _47 => _47.typeArguments, 'optionalAccess', _48 => _48.end]) || node.callee.end,
354
367
  `Object.assign`
355
368
  );
356
369
  const slots = `${_common.importHelperFn.call(void 0, s, 0, "useSlots")}()`;
@@ -362,7 +375,7 @@ function transformDefineSlots(node, s) {
362
375
  var _hashsum = require('hash-sum'); var _hashsum2 = _interopRequireDefault(_hashsum);
363
376
  function transformDefineStyle(defineStyle, index, root, s, importMap) {
364
377
  const { expression, lang, isDeclaration } = defineStyle;
365
- if (_optionalChain([expression, 'access', _42 => _42.arguments, 'access', _43 => _43[0], 'optionalAccess', _44 => _44.type]) !== "TemplateLiteral") return;
378
+ if (_optionalChain([expression, 'access', _49 => _49.arguments, 'access', _50 => _50[0], 'optionalAccess', _51 => _51.type]) !== "TemplateLiteral") return;
366
379
  let css = s.sliceNode(expression.arguments[0]).slice(1, -1);
367
380
  const scopeId = _hashsum2.default.call(void 0, css);
368
381
  const vars = /* @__PURE__ */ new Map();
@@ -389,7 +402,7 @@ function transformDefineStyle(defineStyle, index, root, s, importMap) {
389
402
  }
390
403
  }
391
404
  let scoped = !!root;
392
- if (_optionalChain([expression, 'access', _45 => _45.arguments, 'access', _46 => _46[1], 'optionalAccess', _47 => _47.type]) === "ObjectExpression") {
405
+ if (_optionalChain([expression, 'access', _52 => _52.arguments, 'access', _53 => _53[1], 'optionalAccess', _54 => _54.type]) === "ObjectExpression") {
393
406
  for (const prop of expression.arguments[1].properties) {
394
407
  if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && prop.key.name === "scoped" && prop.value.type === "BooleanLiteral") {
395
408
  scoped = prop.value.value;
@@ -440,7 +453,7 @@ function transformJsxMacros(code, id, importMap, options) {
440
453
  const rootMap = getRootMap(ast, s, options);
441
454
  let defineStyleIndex = 0;
442
455
  for (const [root, map] of rootMap) {
443
- _optionalChain([map, 'access', _48 => _48.defineStyle, 'optionalAccess', _49 => _49.forEach, 'call', _50 => _50((defineStyle) => {
456
+ _optionalChain([map, 'access', _55 => _55.defineStyle, 'optionalAccess', _56 => _56.forEach, 'call', _57 => _57((defineStyle) => {
444
457
  transformDefineStyle(defineStyle, defineStyleIndex++, root, s, importMap);
445
458
  })]);
446
459
  if (root === void 0) continue;
@@ -450,12 +463,12 @@ function transformJsxMacros(code, id, importMap, options) {
450
463
  propsName = root.params[0].name;
451
464
  } else if (root.params[0].type === "ObjectPattern") {
452
465
  const lastProp = root.params[0].properties.at(-1);
453
- if (!map.defineComponent && _optionalChain([lastProp, 'optionalAccess', _51 => _51.type]) === "RestElement" && lastProp.argument.type === "Identifier") {
466
+ if (!map.defineComponent && _optionalChain([lastProp, 'optionalAccess', _58 => _58.type]) === "RestElement" && lastProp.argument.type === "Identifier") {
454
467
  propsName = lastProp.argument.name;
455
468
  } else {
456
469
  s.appendRight(
457
- _optionalChain([root, 'access', _52 => _52.params, 'access', _53 => _53[0], 'access', _54 => _54.extra, 'optionalAccess', _55 => _55.trailingComma]) ? _optionalChain([root, 'access', _56 => _56.params, 'access', _57 => _57[0], 'access', _58 => _58.extra, 'optionalAccess', _59 => _59.trailingComma]) + 1 : _optionalChain([lastProp, 'optionalAccess', _60 => _60.end]) || root.params[0].end - 1,
458
- `${!_optionalChain([root, 'access', _61 => _61.params, 'access', _62 => _62[0], 'access', _63 => _63.extra, 'optionalAccess', _64 => _64.trailingComma]) && root.params[0].properties.length ? "," : ""} ...${_common.HELPER_PREFIX}props`
470
+ _optionalChain([root, 'access', _59 => _59.params, 'access', _60 => _60[0], 'access', _61 => _61.extra, 'optionalAccess', _62 => _62.trailingComma]) ? _optionalChain([root, 'access', _63 => _63.params, 'access', _64 => _64[0], 'access', _65 => _65.extra, 'optionalAccess', _66 => _66.trailingComma]) + 1 : _optionalChain([lastProp, 'optionalAccess', _67 => _67.end]) || root.params[0].end - 1,
471
+ `${!_optionalChain([root, 'access', _68 => _68.params, 'access', _69 => _69[0], 'access', _70 => _70.extra, 'optionalAccess', _71 => _71.trailingComma]) && root.params[0].properties.length ? "," : ""} ...${_common.HELPER_PREFIX}props`
459
472
  );
460
473
  }
461
474
  }
@@ -463,9 +476,15 @@ function transformJsxMacros(code, id, importMap, options) {
463
476
  s.appendRight(getParamsStart(root, s.original), propsName);
464
477
  }
465
478
  if (map.defineComponent) {
466
- transformDefineComponent(root, propsName, map, s);
479
+ transformDefineComponent(
480
+ root,
481
+ propsName,
482
+ map,
483
+ s,
484
+ _optionalChain([options, 'access', _72 => _72.defineComponent, 'optionalAccess', _73 => _73.autoReturnFunction])
485
+ );
467
486
  }
468
- if (_optionalChain([map, 'access', _65 => _65.defineModel, 'optionalAccess', _66 => _66.length])) {
487
+ if (_optionalChain([map, 'access', _74 => _74.defineModel, 'optionalAccess', _75 => _75.length])) {
469
488
  map.defineModel.forEach(({ expression }) => {
470
489
  transformDefineModel(expression, propsName, s);
471
490
  });
@@ -486,13 +505,13 @@ function getRootMap(ast, s, options) {
486
505
  enter(node, parent) {
487
506
  parents.unshift(parent);
488
507
  const root = isFunctionalNode(parents[1]) ? parents[1] : void 0;
489
- if (root && _optionalChain([parents, 'access', _67 => _67[2], 'optionalAccess', _68 => _68.type]) === "CallExpression" && options.defineComponent.alias.includes(s.sliceNode(parents[2].callee))) {
508
+ if (root && _optionalChain([parents, 'access', _76 => _76[2], 'optionalAccess', _77 => _77.type]) === "CallExpression" && options.defineComponent.alias.includes(s.sliceNode(parents[2].callee))) {
490
509
  if (!rootMap.has(root)) rootMap.set(root, {});
491
510
  if (!rootMap.get(root).defineComponent) {
492
511
  rootMap.get(root).defineComponent = parents[2];
493
512
  }
494
513
  }
495
- const expression = node.type === "VariableDeclaration" ? _optionalChain([node, 'access', _69 => _69.declarations, 'access', _70 => _70[0], 'access', _71 => _71.init, 'optionalAccess', _72 => _72.type]) === "CallExpression" && s.sliceNode(node.declarations[0].init.callee) === "$" ? node.declarations[0].init.arguments[0] : node.declarations[0].init : node.type === "ExpressionStatement" ? node.expression : void 0;
514
+ const expression = node.type === "VariableDeclaration" ? _optionalChain([node, 'access', _78 => _78.declarations, 'access', _79 => _79[0], 'access', _80 => _80.init, 'optionalAccess', _81 => _81.type]) === "CallExpression" && s.sliceNode(node.declarations[0].init.callee) === "$" ? node.declarations[0].init.arguments[0] : node.declarations[0].init : node.type === "ExpressionStatement" ? node.expression : void 0;
496
515
  if (!expression) return;
497
516
  const macroExpression = getMacroExpression(expression, options);
498
517
  if (!macroExpression) return;
@@ -549,7 +568,7 @@ function getMacroExpression(node, options) {
549
568
  }
550
569
  }
551
570
  function getParamsStart(node, code) {
552
- return node.params[0] ? node.params[0].start : node.start + (_optionalChain([code, 'access', _73 => _73.slice, 'call', _74 => _74(node.start, node.body.start), 'access', _75 => _75.match, 'call', _76 => _76(/\(\s*\)/), 'optionalAccess', _77 => _77.index]) || 0) + 1;
571
+ return node.params[0] ? node.params[0].start : node.start + (_optionalChain([code, 'access', _82 => _82.slice, 'call', _83 => _83(node.start, node.body.start), 'access', _84 => _84.match, 'call', _85 => _85(/\(\s*\)/), 'optionalAccess', _86 => _86.index]) || 0) + 1;
553
572
  }
554
573
 
555
574
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
4
 
5
5
  // src/vite.ts
6
6
  var vite_default = index_default.vite;
package/dist/esbuild.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
4
- require('./chunk-35H4MC4N.cjs');
5
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
+ require('./chunk-UAWFIGPX.cjs');
5
+ require('./chunk-ZQ4GVJKX.cjs');
6
6
  require('./chunk-53TNKVYD.cjs');
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunkJWJVYLYIcjs.index_default.esbuild;
9
+ var esbuild_default = _chunkL26STXZKcjs.index_default.esbuild;
10
10
 
11
11
 
12
12
  exports.default = esbuild_default;
package/dist/esbuild.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
4
- import "./chunk-WOWB5VHY.js";
5
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
+ import "./chunk-E5WGUCGE.js";
5
+ import "./chunk-SMWNQXL7.js";
6
6
  import "./chunk-DANY2WQD.js";
7
7
 
8
8
  // src/esbuild.ts
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
4
- require('./chunk-35H4MC4N.cjs');
5
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
+ require('./chunk-UAWFIGPX.cjs');
5
+ require('./chunk-ZQ4GVJKX.cjs');
6
6
 
7
7
 
8
8
  var _chunk53TNKVYDcjs = require('./chunk-53TNKVYD.cjs');
9
9
 
10
10
 
11
11
 
12
- exports.default = _chunkJWJVYLYIcjs.index_default; exports.resolveOptions = _chunk53TNKVYDcjs.resolveOptions;
12
+ exports.default = _chunkL26STXZKcjs.index_default; exports.resolveOptions = _chunk53TNKVYDcjs.resolveOptions;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
4
- import "./chunk-WOWB5VHY.js";
5
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
+ import "./chunk-E5WGUCGE.js";
5
+ import "./chunk-SMWNQXL7.js";
6
6
  import {
7
7
  resolveOptions
8
8
  } from "./chunk-DANY2WQD.js";
package/dist/nuxt.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkYCL7HGD4cjs = require('./chunk-YCL7HGD4.cjs');
3
+ var _chunkKUKYWPEKcjs = require('./chunk-KUKYWPEK.cjs');
4
4
 
5
5
 
6
- var _chunkNL4CWOW2cjs = require('./chunk-NL4CWOW2.cjs');
7
- require('./chunk-JWJVYLYI.cjs');
8
- require('./chunk-35H4MC4N.cjs');
9
- require('./chunk-LPH34H6O.cjs');
6
+ var _chunkPWA6BBMQcjs = require('./chunk-PWA6BBMQ.cjs');
7
+ require('./chunk-L26STXZK.cjs');
8
+ require('./chunk-UAWFIGPX.cjs');
9
+ require('./chunk-ZQ4GVJKX.cjs');
10
10
  require('./chunk-53TNKVYD.cjs');
11
11
 
12
12
  // src/nuxt.ts
@@ -18,8 +18,8 @@ var nuxt_default = _kit.defineNuxtModule.call(void 0, {
18
18
  configKey: "unpluginStarter"
19
19
  },
20
20
  setup(options) {
21
- _kit.addVitePlugin.call(void 0, () => _chunkYCL7HGD4cjs.vite_default.call(void 0, options));
22
- _kit.addWebpackPlugin.call(void 0, () => _chunkNL4CWOW2cjs.webpack_default.call(void 0, options));
21
+ _kit.addVitePlugin.call(void 0, () => _chunkKUKYWPEKcjs.vite_default.call(void 0, options));
22
+ _kit.addWebpackPlugin.call(void 0, () => _chunkPWA6BBMQcjs.webpack_default.call(void 0, options));
23
23
  }
24
24
  });
25
25
 
package/dist/nuxt.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-RC5ZHWIN.js";
3
+ } from "./chunk-ZXJQCFZZ.js";
4
4
  import {
5
5
  webpack_default
6
- } from "./chunk-WZIZSQGW.js";
7
- import "./chunk-LVZNHMZC.js";
8
- import "./chunk-WOWB5VHY.js";
9
- import "./chunk-TWP2JCYQ.js";
6
+ } from "./chunk-HBVQYNJJ.js";
7
+ import "./chunk-AUE5EAQA.js";
8
+ import "./chunk-E5WGUCGE.js";
9
+ import "./chunk-SMWNQXL7.js";
10
10
  import "./chunk-DANY2WQD.js";
11
11
 
12
12
  // src/nuxt.ts
@@ -3,6 +3,7 @@ import { MarkRequired, BaseOptions } from '@vue-macros/common';
3
3
  type Options = BaseOptions & {
4
4
  defineComponent?: {
5
5
  alias: string[];
6
+ autoReturnFunction?: boolean;
6
7
  };
7
8
  defineModel?: {
8
9
  alias: string[];
package/dist/options.d.ts CHANGED
@@ -3,6 +3,7 @@ import { MarkRequired, BaseOptions } from '@vue-macros/common';
3
3
  type Options = BaseOptions & {
4
4
  defineComponent?: {
5
5
  alias: string[];
6
+ autoReturnFunction?: boolean;
6
7
  };
7
8
  defineModel?: {
8
9
  alias: string[];
package/dist/raw.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk35H4MC4Ncjs = require('./chunk-35H4MC4N.cjs');
4
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkUAWFIGPXcjs = require('./chunk-UAWFIGPX.cjs');
4
+ require('./chunk-ZQ4GVJKX.cjs');
5
5
  require('./chunk-53TNKVYD.cjs');
6
6
 
7
7
 
8
- exports.default = _chunk35H4MC4Ncjs.raw_default;
8
+ exports.default = _chunkUAWFIGPXcjs.raw_default;
9
9
 
10
10
  module.exports = exports.default;
package/dist/raw.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raw_default
3
- } from "./chunk-WOWB5VHY.js";
4
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-E5WGUCGE.js";
4
+ import "./chunk-SMWNQXL7.js";
5
5
  import "./chunk-DANY2WQD.js";
6
6
  export {
7
7
  raw_default as default
package/dist/rolldown.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
4
- require('./chunk-35H4MC4N.cjs');
5
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
+ require('./chunk-UAWFIGPX.cjs');
5
+ require('./chunk-ZQ4GVJKX.cjs');
6
6
  require('./chunk-53TNKVYD.cjs');
7
7
 
8
8
  // src/rolldown.ts
9
- var rolldown_default = _chunkJWJVYLYIcjs.index_default.rolldown;
9
+ var rolldown_default = _chunkL26STXZKcjs.index_default.rolldown;
10
10
 
11
11
 
12
12
  exports.default = rolldown_default;
package/dist/rolldown.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
4
- import "./chunk-WOWB5VHY.js";
5
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
+ import "./chunk-E5WGUCGE.js";
5
+ import "./chunk-SMWNQXL7.js";
6
6
  import "./chunk-DANY2WQD.js";
7
7
 
8
8
  // src/rolldown.ts
package/dist/rollup.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
4
- require('./chunk-35H4MC4N.cjs');
5
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
+ require('./chunk-UAWFIGPX.cjs');
5
+ require('./chunk-ZQ4GVJKX.cjs');
6
6
  require('./chunk-53TNKVYD.cjs');
7
7
 
8
8
  // src/rollup.ts
9
- var rollup_default = _chunkJWJVYLYIcjs.index_default.rollup;
9
+ var rollup_default = _chunkL26STXZKcjs.index_default.rollup;
10
10
 
11
11
 
12
12
  exports.default = rollup_default;
package/dist/rollup.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
4
- import "./chunk-WOWB5VHY.js";
5
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
+ import "./chunk-E5WGUCGE.js";
5
+ import "./chunk-SMWNQXL7.js";
6
6
  import "./chunk-DANY2WQD.js";
7
7
 
8
8
  // src/rollup.ts
package/dist/rspack.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJWJVYLYIcjs = require('./chunk-JWJVYLYI.cjs');
4
- require('./chunk-35H4MC4N.cjs');
5
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkL26STXZKcjs = require('./chunk-L26STXZK.cjs');
4
+ require('./chunk-UAWFIGPX.cjs');
5
+ require('./chunk-ZQ4GVJKX.cjs');
6
6
  require('./chunk-53TNKVYD.cjs');
7
7
 
8
8
  // src/rspack.ts
9
- var rspack_default = _chunkJWJVYLYIcjs.index_default.rspack;
9
+ var rspack_default = _chunkL26STXZKcjs.index_default.rspack;
10
10
 
11
11
 
12
12
  exports.default = rspack_default;
package/dist/rspack.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  index_default
3
- } from "./chunk-LVZNHMZC.js";
4
- import "./chunk-WOWB5VHY.js";
5
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-AUE5EAQA.js";
4
+ import "./chunk-E5WGUCGE.js";
5
+ import "./chunk-SMWNQXL7.js";
6
6
  import "./chunk-DANY2WQD.js";
7
7
 
8
8
  // src/rspack.ts
package/dist/vite.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkYCL7HGD4cjs = require('./chunk-YCL7HGD4.cjs');
4
- require('./chunk-JWJVYLYI.cjs');
5
- require('./chunk-35H4MC4N.cjs');
6
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkKUKYWPEKcjs = require('./chunk-KUKYWPEK.cjs');
4
+ require('./chunk-L26STXZK.cjs');
5
+ require('./chunk-UAWFIGPX.cjs');
6
+ require('./chunk-ZQ4GVJKX.cjs');
7
7
  require('./chunk-53TNKVYD.cjs');
8
8
 
9
9
 
10
- exports.default = _chunkYCL7HGD4cjs.vite_default;
10
+ exports.default = _chunkKUKYWPEKcjs.vite_default;
11
11
 
12
12
  module.exports = exports.default;
package/dist/vite.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-RC5ZHWIN.js";
4
- import "./chunk-LVZNHMZC.js";
5
- import "./chunk-WOWB5VHY.js";
6
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-ZXJQCFZZ.js";
4
+ import "./chunk-AUE5EAQA.js";
5
+ import "./chunk-E5WGUCGE.js";
6
+ import "./chunk-SMWNQXL7.js";
7
7
  import "./chunk-DANY2WQD.js";
8
8
  export {
9
9
  vite_default as default
package/dist/webpack.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkNL4CWOW2cjs = require('./chunk-NL4CWOW2.cjs');
4
- require('./chunk-JWJVYLYI.cjs');
5
- require('./chunk-35H4MC4N.cjs');
6
- require('./chunk-LPH34H6O.cjs');
3
+ var _chunkPWA6BBMQcjs = require('./chunk-PWA6BBMQ.cjs');
4
+ require('./chunk-L26STXZK.cjs');
5
+ require('./chunk-UAWFIGPX.cjs');
6
+ require('./chunk-ZQ4GVJKX.cjs');
7
7
  require('./chunk-53TNKVYD.cjs');
8
8
 
9
9
 
10
- exports.default = _chunkNL4CWOW2cjs.webpack_default;
10
+ exports.default = _chunkPWA6BBMQcjs.webpack_default;
11
11
 
12
12
  module.exports = exports.default;
package/dist/webpack.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-WZIZSQGW.js";
4
- import "./chunk-LVZNHMZC.js";
5
- import "./chunk-WOWB5VHY.js";
6
- import "./chunk-TWP2JCYQ.js";
3
+ } from "./chunk-HBVQYNJJ.js";
4
+ import "./chunk-AUE5EAQA.js";
5
+ import "./chunk-E5WGUCGE.js";
6
+ import "./chunk-SMWNQXL7.js";
7
7
  import "./chunk-DANY2WQD.js";
8
8
  export {
9
9
  webpack_default as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/macros",
3
- "version": "2.1.8",
3
+ "version": "2.3.0",
4
4
  "description": "Macros for Vue JSX Vapor",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -172,7 +172,7 @@
172
172
  "@vue/language-core": "^2.2.8",
173
173
  "hash-sum": "^2.0.0",
174
174
  "ts-macro": "^0.1.25",
175
- "unplugin": "^1.16.1"
175
+ "unplugin": "^2.2.2"
176
176
  },
177
177
  "devDependencies": {
178
178
  "@babel/types": "^7.26.8",