vue-jsx-vapor 2.6.2 → 2.6.4

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.
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as esbuild13 from "esbuild";
2
+ import * as esbuild1 from "esbuild";
3
3
 
4
4
  //#region src/esbuild.d.ts
5
- declare const _default: (options?: Options | undefined) => esbuild13.Plugin;
5
+ declare const _default: (options?: Options | undefined) => esbuild1.Plugin;
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/esbuild.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as esbuild13 from "esbuild";
2
+ import * as esbuild1 from "esbuild";
3
3
 
4
4
  //#region src/esbuild.d.ts
5
- declare const _default: (options?: Options | undefined) => esbuild13.Plugin;
5
+ declare const _default: (options?: Options | undefined) => esbuild1.Plugin;
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/nuxt.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as _nuxt_schema0 from "@nuxt/schema";
2
+ import * as _nuxt_schema2 from "@nuxt/schema";
3
3
 
4
4
  //#region src/nuxt.d.ts
5
5
  interface ModuleOptions extends Options {}
6
- declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
6
+ declare const _default: _nuxt_schema2.NuxtModule<ModuleOptions, ModuleOptions, false>;
7
7
  //#endregion
8
8
  export { ModuleOptions, _default as default };
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as rollup5 from "rollup";
2
+ import * as rollup8 from "rollup";
3
3
 
4
4
  //#region src/rolldown.d.ts
5
- declare const _default: (options?: Options | undefined) => rollup5.Plugin<any> | rollup5.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => rollup8.Plugin<any> | rollup8.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as rollup2 from "rollup";
2
+ import * as rollup4 from "rollup";
3
3
 
4
4
  //#region src/rolldown.d.ts
5
- declare const _default: (options?: Options | undefined) => rollup2.Plugin<any> | rollup2.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => rollup4.Plugin<any> | rollup4.Plugin<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-jKAq0dFf.cjs";
2
- import * as rollup1 from "rollup";
2
+ import * as rollup11 from "rollup";
3
3
 
4
4
  //#region src/rollup.d.ts
5
- declare const _default: (options?: Options | undefined) => rollup1.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => rollup11.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/rollup.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as rollup8 from "rollup";
2
+ import * as rollup7 from "rollup";
3
3
 
4
4
  //#region src/rollup.d.ts
5
- declare const _default: (options?: Options | undefined) => rollup8.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => rollup7.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
@@ -1,9 +1,9 @@
1
1
  import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as unplugin7 from "unplugin";
2
+ import * as unplugin4 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
5
5
  //#region src/unplugin.d.ts
6
6
  declare const unpluginFactory: UnpluginFactory<Options | undefined, true>;
7
- declare const unplugin: unplugin7.UnpluginInstance<Options | undefined, true>;
7
+ declare const unplugin: unplugin4.UnpluginInstance<Options | undefined, true>;
8
8
  //#endregion
9
9
  export { Options, unplugin as default, unplugin, unpluginFactory };
@@ -1,9 +1,9 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as unplugin4 from "unplugin";
2
+ import * as unplugin9 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
5
5
  //#region src/unplugin.d.ts
6
6
  declare const unpluginFactory: UnpluginFactory<Options | undefined, true>;
7
- declare const unplugin: unplugin4.UnpluginInstance<Options | undefined, true>;
7
+ declare const unplugin: unplugin9.UnpluginInstance<Options | undefined, true>;
8
8
  //#endregion
9
9
  export { Options, unplugin as default, unplugin, unpluginFactory };
package/dist/vite.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as vite9 from "vite";
2
+ import * as vite6 from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => vite9.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => vite6.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as vite6 from "vite";
2
+ import * as vite11 from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => vite6.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => vite11.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/volar.cjs CHANGED
@@ -4,13 +4,57 @@ const __vue_jsx_vapor_macros_volar = require_chunk.__toESM(require("@vue-jsx-vap
4
4
  const __vue_macros_volar_jsx_directive = require_chunk.__toESM(require("@vue-macros/volar/jsx-directive"));
5
5
  const __vue_macros_volar_jsx_ref = require_chunk.__toESM(require("@vue-macros/volar/jsx-ref"));
6
6
  const ts_macro = require_chunk.__toESM(require("ts-macro"));
7
+ const __vue_shared = require_chunk.__toESM(require("@vue/shared"));
7
8
 
9
+ //#region src/volar/jsx-element.ts
10
+ var jsx_element_default = (0, ts_macro.createPlugin)(({ ts }) => {
11
+ return {
12
+ name: "@vue-jsx-vapor/jsx-element",
13
+ resolveVirtualCode({ ast, codes }) {
14
+ let transformed = false;
15
+ ast.forEachChild(function walk(node, parent = ast) {
16
+ if (!ts.isJsxElement(parent) && !ts.isJsxFragment(parent) && !ts.isJsxExpression(parent) && !(parent.parent ? isConditionalExpression(ts, parent) : false)) {
17
+ const openingElement = ts.isJsxElement(node) ? node.openingElement : ts.isJsxSelfClosingElement(node) ? node : null;
18
+ if (openingElement) {
19
+ const tagName = openingElement.tagName.getText(ast);
20
+ if (!tagName.includes("-")) {
21
+ transformed = true;
22
+ codes.replaceRange(node.getStart(ast), node.getStart(ast) + 1, "(<");
23
+ codes.replaceRange(node.end, node.end, " as unknown as __InferJsxElement<", (0, __vue_shared.isHTMLTag)(tagName) || (0, __vue_shared.isSVGTag)(tagName) ? `'${tagName}'` : `typeof ${tagName}`, ">)");
24
+ }
25
+ }
26
+ }
27
+ if (!ts.isCallExpression(node) || node.expression.getText(ast) !== "defineSlots") node.forEachChild((child) => walk(child, node));
28
+ });
29
+ transformed && codes.push(`
30
+ type __InferJsxElement<T> = T extends keyof HTMLElementTagNameMap
31
+ ? HTMLElementTagNameMap[T]
32
+ : T extends keyof SVGElementTagNameMap
33
+ ? SVGElementTagNameMap[T]
34
+ : T extends (props: infer Props, ctx: { slots: infer Slots, expose: (exposed: infer Exposed) => void, attrs: any, emit: any }) => infer TypeBlock
35
+ // @ts-ignore
36
+ ? import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
37
+ : T extends { new (...args: any[]): infer Instance }
38
+ ? Instance extends { $: any }
39
+ ? import('vue').VNode
40
+ : Instance
41
+ : JSX.Element
42
+ `);
43
+ }
44
+ };
45
+ });
46
+ function isConditionalExpression(ts, node) {
47
+ return !!(node && (ts.isBinaryExpression(node) || ts.isConditionalExpression(node)) && node.parent && (ts.isJsxExpression(node.parent) || isConditionalExpression(ts, node.parent)));
48
+ }
49
+
50
+ //#endregion
8
51
  //#region src/volar.ts
9
52
  const plugin = (0, ts_macro.createPlugin)((ctx, options = ctx.vueCompilerOptions?.["vue-jsx-vapor"]) => {
10
53
  return [
11
54
  (0, __vue_macros_volar_jsx_directive.default)()(ctx),
12
55
  options?.ref === false ? [] : (0, __vue_macros_volar_jsx_ref.default)(options?.ref === true ? void 0 : options?.ref)(ctx),
13
- options?.macros === false ? [] : options?.macros ? (0, __vue_jsx_vapor_macros_volar.default)(options.macros === true ? void 0 : options.macros)(ctx) : []
56
+ options?.macros === false ? [] : options?.macros ? (0, __vue_jsx_vapor_macros_volar.default)(options.macros === true ? void 0 : options.macros)(ctx) : [],
57
+ options?.interop ? [] : jsx_element_default()(ctx)
14
58
  ].flat();
15
59
  });
16
60
  var volar_default = plugin;
package/dist/volar.js CHANGED
@@ -2,13 +2,57 @@ import jsxMacros from "@vue-jsx-vapor/macros/volar";
2
2
  import jsxDirective from "@vue-macros/volar/jsx-directive";
3
3
  import jsxRef from "@vue-macros/volar/jsx-ref";
4
4
  import { createPlugin } from "ts-macro";
5
+ import { isHTMLTag, isSVGTag } from "@vue/shared";
5
6
 
7
+ //#region src/volar/jsx-element.ts
8
+ var jsx_element_default = createPlugin(({ ts }) => {
9
+ return {
10
+ name: "@vue-jsx-vapor/jsx-element",
11
+ resolveVirtualCode({ ast, codes }) {
12
+ let transformed = false;
13
+ ast.forEachChild(function walk(node, parent = ast) {
14
+ if (!ts.isJsxElement(parent) && !ts.isJsxFragment(parent) && !ts.isJsxExpression(parent) && !(parent.parent ? isConditionalExpression(ts, parent) : false)) {
15
+ const openingElement = ts.isJsxElement(node) ? node.openingElement : ts.isJsxSelfClosingElement(node) ? node : null;
16
+ if (openingElement) {
17
+ const tagName = openingElement.tagName.getText(ast);
18
+ if (!tagName.includes("-")) {
19
+ transformed = true;
20
+ codes.replaceRange(node.getStart(ast), node.getStart(ast) + 1, "(<");
21
+ codes.replaceRange(node.end, node.end, " as unknown as __InferJsxElement<", isHTMLTag(tagName) || isSVGTag(tagName) ? `'${tagName}'` : `typeof ${tagName}`, ">)");
22
+ }
23
+ }
24
+ }
25
+ if (!ts.isCallExpression(node) || node.expression.getText(ast) !== "defineSlots") node.forEachChild((child) => walk(child, node));
26
+ });
27
+ transformed && codes.push(`
28
+ type __InferJsxElement<T> = T extends keyof HTMLElementTagNameMap
29
+ ? HTMLElementTagNameMap[T]
30
+ : T extends keyof SVGElementTagNameMap
31
+ ? SVGElementTagNameMap[T]
32
+ : T extends (props: infer Props, ctx: { slots: infer Slots, expose: (exposed: infer Exposed) => void, attrs: any, emit: any }) => infer TypeBlock
33
+ // @ts-ignore
34
+ ? import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
35
+ : T extends { new (...args: any[]): infer Instance }
36
+ ? Instance extends { $: any }
37
+ ? import('vue').VNode
38
+ : Instance
39
+ : JSX.Element
40
+ `);
41
+ }
42
+ };
43
+ });
44
+ function isConditionalExpression(ts, node) {
45
+ return !!(node && (ts.isBinaryExpression(node) || ts.isConditionalExpression(node)) && node.parent && (ts.isJsxExpression(node.parent) || isConditionalExpression(ts, node.parent)));
46
+ }
47
+
48
+ //#endregion
6
49
  //#region src/volar.ts
7
50
  const plugin = createPlugin((ctx, options = ctx.vueCompilerOptions?.["vue-jsx-vapor"]) => {
8
51
  return [
9
52
  jsxDirective()(ctx),
10
53
  options?.ref === false ? [] : jsxRef(options?.ref === true ? void 0 : options?.ref)(ctx),
11
- options?.macros === false ? [] : options?.macros ? jsxMacros(options.macros === true ? void 0 : options.macros)(ctx) : []
54
+ options?.macros === false ? [] : options?.macros ? jsxMacros(options.macros === true ? void 0 : options.macros)(ctx) : [],
55
+ options?.interop ? [] : jsx_element_default()(ctx)
12
56
  ].flat();
13
57
  });
14
58
  var volar_default = plugin;
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as webpack11 from "webpack";
2
+ import * as webpack13 from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => webpack11.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => webpack13.WebpackPluginInstance;
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/webpack.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Options } from "./options-CBMw6D8V.js";
2
- import * as webpack10 from "webpack";
2
+ import * as webpack13 from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => webpack10.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => webpack13.WebpackPluginInstance;
6
6
  //#endregion
7
7
  export { _default as default };
@@ -1,15 +1,14 @@
1
1
  //#region rolldown:runtime
2
- var __create = Object.create
3
- var __defProp = Object.defineProperty
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor
5
- var __getOwnPropNames = Object.getOwnPropertyNames
6
- var __getProtoOf = Object.getPrototypeOf
7
- var __hasOwnProp = Object.prototype.hasOwnProperty
8
- var __copyProps = (to, from, except, desc) => {
2
+ const __create = Object.create
3
+ const __defProp = Object.defineProperty
4
+ const __getOwnPropDesc = Object.getOwnPropertyDescriptor
5
+ const __getOwnPropNames = Object.getOwnPropertyNames
6
+ const __getProtoOf = Object.getPrototypeOf
7
+ const __hasOwnProp = Object.prototype.hasOwnProperty
8
+ const __copyProps = (to, from, except, desc) => {
9
9
  if ((from && typeof from === 'object') || typeof from === 'function')
10
10
  for (
11
- // eslint-disable-next-line vars-on-top
12
- var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
11
+ let keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
13
12
  i < n;
14
13
  i++
15
14
  ) {
@@ -22,7 +21,7 @@ var __copyProps = (to, from, except, desc) => {
22
21
  }
23
22
  return to
24
23
  }
25
- var __toESM = (mod, isNodeMode, target) => (
24
+ const __toESM = (mod, isNodeMode, target) => (
26
25
  (target = mod != null ? __create(__getProtoOf(mod)) : {}),
27
26
  __copyProps(
28
27
  isNodeMode || !mod || !mod.__esModule
@@ -39,7 +38,7 @@ const vue = __toESM(require('vue'))
39
38
  const vue_jsx_vapor = __toESM(require('vue-jsx-vapor'))
40
39
 
41
40
  function jsx(type, props, key) {
42
- const { children, ['v-slots']: vSlots } = props
41
+ const { children, 'v-slots': vSlots } = props
43
42
  delete props.children
44
43
  delete props['v-slots']
45
44
  if (arguments.length > 2) props.key = key
@@ -4,7 +4,7 @@ import type { h, NativeElements, ReservedProps } from 'vue-jsx-vapor'
4
4
  declare function jsx(type: any, props: any, key: any): ReturnType<typeof h>
5
5
  declare global {
6
6
  namespace JSX {
7
- type Element = Block & VNode
7
+ type Element = VNode | Block | Element[]
8
8
  interface ElementAttributesProperty {
9
9
  $props
10
10
  }
@@ -2,7 +2,7 @@ import { Fragment } from 'vue'
2
2
  import { h } from 'vue-jsx-vapor'
3
3
 
4
4
  function jsx(type, props, key) {
5
- const { children, ['v-slots']: vSlots } = props
5
+ const { children, 'v-slots': vSlots } = props
6
6
  delete props.children
7
7
  delete props['v-slots']
8
8
  if (arguments.length > 2) props.key = key
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vue-jsx-vapor",
3
- "version": "2.6.2",
4
- "description": "Convert Vue JSX to Vapor",
3
+ "version": "2.6.4",
4
+ "description": "Vapor Mode of Vue JSX",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "unplugin",
@@ -161,24 +161,25 @@
161
161
  }
162
162
  },
163
163
  "dependencies": {
164
- "@babel/core": "^7.28.0",
164
+ "@babel/core": "^7.28.4",
165
165
  "@babel/plugin-transform-typescript": "^7.28.0",
166
- "@vue-macros/jsx-directive": "^3.0.0-beta.20",
167
- "@vue-macros/volar": "^3.0.0-beta.20",
168
- "@vue/babel-plugin-jsx": "^1.4.0",
166
+ "@vue-macros/jsx-directive": "^3.0.0-beta.23",
167
+ "@vue-macros/volar": "^3.0.0-beta.23",
168
+ "@vue/babel-plugin-jsx": "^1.5.0",
169
+ "@vue/shared": "3.6.0-alpha.2",
169
170
  "hash-sum": "^2.0.0",
170
171
  "pathe": "^2.0.3",
171
- "ts-macro": "^0.3.2",
172
- "unplugin": "^2.3.5",
173
- "unplugin-utils": "^0.2.4",
174
- "@vue-jsx-vapor/compiler": "2.6.2",
175
- "@vue-jsx-vapor/babel": "2.6.2",
176
- "@vue-jsx-vapor/macros": "2.6.2",
177
- "@vue-jsx-vapor/runtime": "2.6.2"
172
+ "ts-macro": "^0.3.4",
173
+ "unplugin": "^2.3.10",
174
+ "unplugin-utils": "^0.2.5",
175
+ "@vue-jsx-vapor/compiler": "2.6.4",
176
+ "@vue-jsx-vapor/babel": "2.6.4",
177
+ "@vue-jsx-vapor/macros": "2.6.4",
178
+ "@vue-jsx-vapor/runtime": "2.6.4"
178
179
  },
179
180
  "devDependencies": {
180
- "@nuxt/kit": "^3.18.1",
181
- "@nuxt/schema": "^3.18.1",
181
+ "@nuxt/kit": "^3.19.1",
182
+ "@nuxt/schema": "^3.19.1",
182
183
  "@types/babel__core": "^7.20.5",
183
184
  "@types/hash-sum": "^1.0.2"
184
185
  },