@vue-jsx-vapor/macros 2.6.1 → 2.6.2

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/nuxt.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Options } from "./options-Egmm6BVJ.cjs";
2
- import * as _nuxt_schema2 from "@nuxt/schema";
2
+ import * as _nuxt_schema8 from "@nuxt/schema";
3
3
 
4
4
  //#region src/nuxt.d.ts
5
5
  interface ModuleOptions extends Options {}
6
- declare const _default: _nuxt_schema2.NuxtModule<ModuleOptions, ModuleOptions, false>;
6
+ declare const _default: _nuxt_schema8.NuxtModule<ModuleOptions, ModuleOptions, false>;
7
7
  //#endregion
8
8
  export { ModuleOptions, _default as default };
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-Egmm6BVJ.cjs";
2
- import * as unplugin4 from "unplugin";
2
+ import * as unplugin13 from "unplugin";
3
3
 
4
4
  //#region src/rolldown.d.ts
5
- declare const _default: (options?: Options | undefined) => unplugin4.RolldownPlugin<any> | unplugin4.RolldownPlugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => unplugin13.RolldownPlugin<any> | unplugin13.RolldownPlugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/rollup.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-Egmm6BVJ.cjs";
2
- import * as rollup7 from "rollup";
2
+ import * as rollup3 from "rollup";
3
3
 
4
4
  //#region src/rollup.d.ts
5
- declare const _default: (options?: Options | undefined) => rollup7.Plugin<any> | rollup7.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => rollup3.Plugin<any> | rollup3.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/vite.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-Egmm6BVJ.cjs";
2
- import * as vite11 from "vite";
2
+ import * as vite6 from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => vite11.Plugin<any> | vite11.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => vite6.Plugin<any> | vite6.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/volar.cjs CHANGED
@@ -26,10 +26,13 @@ const __setup = `);
26
26
  },`,
27
27
  ...compOptions ? ["...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [],
28
28
  `})
29
- type __Instance = {${isVapor ? "\n/** @deprecated This is only a type when used in Vapor Instances. */" : ""}
29
+ type __Instance = (typeof __component extends new (...args: any) => any ? InstanceType<typeof __component> : typeof __component) & {${isVapor ? "\n/** @deprecated This is only a type when used in Vapor Instances. */" : ""}
30
30
  $props: __Props
31
- } & (typeof __component extends new (...args: any) => any ? InstanceType<typeof __component> : typeof __component)
31
+ }
32
32
  return {} as {
33
+ __isFragment?: never
34
+ __isTeleport?: never
35
+ __isSuspense?: never
33
36
  new (props: __Props): __Instance,
34
37
  setup: (props: __Props, ctx?: {
35
38
  attrs?: Record<string, any>
@@ -131,7 +134,11 @@ function transformJsxMacros(rootMap, options) {
131
134
  });
132
135
  props.push(`${element.name.escapedText}${isRequired ? ":" : "?:"} typeof ${element.name.escapedText}`);
133
136
  }
134
- codes.replaceRange(node.getStart(ast), node.expression.getStart(ast), `const __render`, macros.defineComponent ? macros.defineComponent?.expression.getText(ast) === "defineVaporComponent" ? ": import(\"vue-jsx-vapor\").NodeChild" : ": () => import(\"vue\").VNodeChild" : "", ` = `);
137
+ codes.replaceRange(node.getStart(ast), node.expression.getStart(ast), "const ", [
138
+ `__render`,
139
+ node.getStart(ast),
140
+ { verification: true }
141
+ ], macros.defineComponent ? macros.defineComponent?.expression.getText(ast) === "defineVaporComponent" ? ": import(\"vue-jsx-vapor\").NodeChild" : ": () => import(\"vue\").VNodeChild" : "", ` = `);
135
142
  codes.replaceRange(node.expression.end, node.expression.end, `
136
143
  return {} as {
137
144
  props: {${props.join(", ")}},
@@ -181,6 +188,7 @@ function getMacro(node, ts, options) {
181
188
  const expression = getMacroExpression(initializer);
182
189
  if (expression) return {
183
190
  expression,
191
+ variableDeclaration: decl,
184
192
  initializer: decl.initializer,
185
193
  isRequired: ts.isNonNullExpression(initializer)
186
194
  };
@@ -220,7 +228,7 @@ function getRootMap(options) {
220
228
  }
221
229
  const macro = getMacro(node, ts, options);
222
230
  if (macro) {
223
- const { expression, initializer } = macro;
231
+ const { expression, initializer, variableDeclaration } = macro;
224
232
  let isRequired = macro.isRequired;
225
233
  if (!rootMap.has(root)) rootMap.set(root, {});
226
234
  const macroName = expression.expression.getText(ast);
@@ -248,12 +256,12 @@ function getRootMap(options) {
248
256
  const defineModel = rootMap.get(root).defineModel ??= [];
249
257
  defineModel.push(`${modelName.includes("-") ? `'${modelName}'` : modelName}${isRequired ? ":" : "?:"} ${typeString}`, `'onUpdate:${modelName}'?: ($event: ${typeString}) => any`);
250
258
  if (expression.typeArguments?.[1]) defineModel.push(`${modelName}Modifiers?: Partial<Record<${(0, ts_macro.getText)(expression.typeArguments[1], ast, ts)}, boolean>>`);
251
- codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), `// @ts-ignore\n${id};\nlet ${id} = `);
259
+ codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), variableDeclaration ? `// @ts-ignore\n${id};\n` : "", `let ${id} = `);
252
260
  } else if (options.defineSlots.alias.includes(macroName)) {
253
- codes.replaceRange(expression.getStart(ast), expression.getStart(ast), `// @ts-ignore\n__slots;\nconst __slots = `);
261
+ codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__slots;\n" : "", `const __slots = `);
254
262
  rootMap.get(root).defineSlots = `Partial<typeof __slots>`;
255
263
  } else if (options.defineExpose.alias.includes(macroName)) {
256
- codes.replaceRange(expression.getStart(ast), expression.getStart(ast), `// @ts-ignore\n__exposed;\nconst __exposed = `);
264
+ codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__exposed;\n" : "", `const __exposed = `);
257
265
  rootMap.get(root).defineExpose = `typeof __exposed`;
258
266
  }
259
267
  }
package/dist/volar.js CHANGED
@@ -24,10 +24,13 @@ const __setup = `);
24
24
  },`,
25
25
  ...compOptions ? ["...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [],
26
26
  `})
27
- type __Instance = {${isVapor ? "\n/** @deprecated This is only a type when used in Vapor Instances. */" : ""}
27
+ type __Instance = (typeof __component extends new (...args: any) => any ? InstanceType<typeof __component> : typeof __component) & {${isVapor ? "\n/** @deprecated This is only a type when used in Vapor Instances. */" : ""}
28
28
  $props: __Props
29
- } & (typeof __component extends new (...args: any) => any ? InstanceType<typeof __component> : typeof __component)
29
+ }
30
30
  return {} as {
31
+ __isFragment?: never
32
+ __isTeleport?: never
33
+ __isSuspense?: never
31
34
  new (props: __Props): __Instance,
32
35
  setup: (props: __Props, ctx?: {
33
36
  attrs?: Record<string, any>
@@ -129,7 +132,11 @@ function transformJsxMacros(rootMap, options) {
129
132
  });
130
133
  props.push(`${element.name.escapedText}${isRequired ? ":" : "?:"} typeof ${element.name.escapedText}`);
131
134
  }
132
- codes.replaceRange(node.getStart(ast), node.expression.getStart(ast), `const __render`, macros.defineComponent ? macros.defineComponent?.expression.getText(ast) === "defineVaporComponent" ? ": import(\"vue-jsx-vapor\").NodeChild" : ": () => import(\"vue\").VNodeChild" : "", ` = `);
135
+ codes.replaceRange(node.getStart(ast), node.expression.getStart(ast), "const ", [
136
+ `__render`,
137
+ node.getStart(ast),
138
+ { verification: true }
139
+ ], macros.defineComponent ? macros.defineComponent?.expression.getText(ast) === "defineVaporComponent" ? ": import(\"vue-jsx-vapor\").NodeChild" : ": () => import(\"vue\").VNodeChild" : "", ` = `);
133
140
  codes.replaceRange(node.expression.end, node.expression.end, `
134
141
  return {} as {
135
142
  props: {${props.join(", ")}},
@@ -179,6 +186,7 @@ function getMacro(node, ts, options) {
179
186
  const expression = getMacroExpression(initializer);
180
187
  if (expression) return {
181
188
  expression,
189
+ variableDeclaration: decl,
182
190
  initializer: decl.initializer,
183
191
  isRequired: ts.isNonNullExpression(initializer)
184
192
  };
@@ -218,7 +226,7 @@ function getRootMap(options) {
218
226
  }
219
227
  const macro = getMacro(node, ts, options);
220
228
  if (macro) {
221
- const { expression, initializer } = macro;
229
+ const { expression, initializer, variableDeclaration } = macro;
222
230
  let isRequired = macro.isRequired;
223
231
  if (!rootMap.has(root)) rootMap.set(root, {});
224
232
  const macroName = expression.expression.getText(ast);
@@ -246,12 +254,12 @@ function getRootMap(options) {
246
254
  const defineModel = rootMap.get(root).defineModel ??= [];
247
255
  defineModel.push(`${modelName.includes("-") ? `'${modelName}'` : modelName}${isRequired ? ":" : "?:"} ${typeString}`, `'onUpdate:${modelName}'?: ($event: ${typeString}) => any`);
248
256
  if (expression.typeArguments?.[1]) defineModel.push(`${modelName}Modifiers?: Partial<Record<${getText(expression.typeArguments[1], ast, ts)}, boolean>>`);
249
- codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), `// @ts-ignore\n${id};\nlet ${id} = `);
257
+ codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), variableDeclaration ? `// @ts-ignore\n${id};\n` : "", `let ${id} = `);
250
258
  } else if (options.defineSlots.alias.includes(macroName)) {
251
- codes.replaceRange(expression.getStart(ast), expression.getStart(ast), `// @ts-ignore\n__slots;\nconst __slots = `);
259
+ codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__slots;\n" : "", `const __slots = `);
252
260
  rootMap.get(root).defineSlots = `Partial<typeof __slots>`;
253
261
  } else if (options.defineExpose.alias.includes(macroName)) {
254
- codes.replaceRange(expression.getStart(ast), expression.getStart(ast), `// @ts-ignore\n__exposed;\nconst __exposed = `);
262
+ codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__exposed;\n" : "", `const __exposed = `);
255
263
  rootMap.get(root).defineExpose = `typeof __exposed`;
256
264
  }
257
265
  }
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-Egmm6BVJ.cjs";
2
- import * as webpack14 from "webpack";
2
+ import * as webpack10 from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => webpack14.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => webpack10.WebpackPluginInstance;
6
6
  //#endregion
7
7
  export { _default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/macros",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "Macros for Vue JSX Vapor",
5
5
  "type": "module",
6
6
  "keywords": [