vue-jsx-vapor 2.6.7 → 2.7.3

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.
Files changed (71) hide show
  1. package/dist/api.cjs +1 -1
  2. package/dist/api.d.cts +4 -4
  3. package/dist/api.d.ts +4 -4
  4. package/dist/api.js +1 -1
  5. package/dist/astro.cjs +3 -3
  6. package/dist/astro.d.cts +2 -3
  7. package/dist/astro.d.ts +1 -1
  8. package/dist/astro.js +3 -3
  9. package/dist/core-BeuKLsFR.cjs +22 -0
  10. package/dist/core-CfhBppKN.js +15 -0
  11. package/dist/esbuild.cjs +3 -3
  12. package/dist/esbuild.d.cts +4 -5
  13. package/dist/esbuild.d.ts +3 -3
  14. package/dist/esbuild.js +3 -3
  15. package/dist/index.js +2 -0
  16. package/dist/nuxt.cjs +8 -7
  17. package/dist/nuxt.d.cts +3 -3
  18. package/dist/nuxt.d.ts +3 -3
  19. package/dist/nuxt.js +6 -6
  20. package/dist/{options-CBMw6D8V.d.ts → options-D6zn5V49.d.ts} +1 -1
  21. package/dist/{options-jKAq0dFf.d.cts → options-DxHQU8-_.d.cts} +1 -1
  22. package/dist/raw-D8DIsSla.js +119 -0
  23. package/dist/raw-sUsbkvbl.cjs +132 -0
  24. package/dist/raw.cjs +2 -2
  25. package/dist/raw.d.cts +2 -3
  26. package/dist/raw.d.ts +1 -1
  27. package/dist/raw.js +2 -2
  28. package/dist/rolldown.cjs +5 -4
  29. package/dist/rolldown.d.cts +4 -5
  30. package/dist/rolldown.d.ts +3 -3
  31. package/dist/rolldown.js +3 -3
  32. package/dist/rollup.cjs +3 -3
  33. package/dist/rollup.d.cts +4 -5
  34. package/dist/rollup.d.ts +3 -3
  35. package/dist/rollup.js +3 -3
  36. package/dist/rspack.cjs +3 -3
  37. package/dist/rspack.d.cts +2 -3
  38. package/dist/rspack.d.ts +1 -1
  39. package/dist/rspack.js +3 -3
  40. package/dist/{unplugin-CyifZGPt.js → unplugin-Bgf_17my.js} +2 -2
  41. package/dist/{unplugin-aKVZLoq9.cjs → unplugin-Drfn-i56.cjs} +3 -2
  42. package/dist/unplugin.cjs +3 -3
  43. package/dist/unplugin.d.cts +4 -4
  44. package/dist/unplugin.d.ts +4 -4
  45. package/dist/unplugin.js +3 -3
  46. package/dist/{vite-C63GJQHT.cjs → vite-D2tETSe2.cjs} +1 -1
  47. package/dist/vite-DJ6fWtCh.js +7 -0
  48. package/dist/vite.cjs +4 -4
  49. package/dist/vite.d.cts +4 -5
  50. package/dist/vite.d.ts +3 -3
  51. package/dist/vite.js +4 -4
  52. package/dist/volar.cjs +11 -6
  53. package/dist/volar.d.cts +1 -1
  54. package/dist/volar.d.ts +1 -1
  55. package/dist/volar.js +1 -1
  56. package/dist/webpack-BTWabvH7.js +7 -0
  57. package/dist/{webpack-CeAur76z.cjs → webpack-Cpgko_pp.cjs} +1 -1
  58. package/dist/webpack.cjs +4 -4
  59. package/dist/webpack.d.cts +4 -5
  60. package/dist/webpack.d.ts +3 -3
  61. package/dist/webpack.js +4 -4
  62. package/package.json +4 -5
  63. package/dist/core-C-41-Q2Y.cjs +0 -33
  64. package/dist/core-CJgJmh2O.js +0 -27
  65. package/dist/options.d.cjs +0 -0
  66. package/dist/options.d.cts +0 -2
  67. package/dist/options.d.ts +0 -2
  68. package/dist/raw-B2YMrqwY.cjs +0 -213
  69. package/dist/raw-CWZ5g7Vk.js +0 -207
  70. package/dist/vite-Djd6MAt9.js +0 -7
  71. package/dist/webpack-3fgVTA33.js +0 -7
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./core-CJgJmh2O.js";
2
- import "./raw-CWZ5g7Vk.js";
3
- import { unplugin_default } from "./unplugin-CyifZGPt.js";
1
+ import "./core-CfhBppKN.js";
2
+ import "./raw-D8DIsSla.js";
3
+ import { r as unplugin_default } from "./unplugin-Bgf_17my.js";
4
4
 
5
5
  //#region src/rollup.ts
6
6
  var rollup_default = unplugin_default.rollup;
package/dist/rspack.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-C-41-Q2Y.cjs');
3
- require('./raw-B2YMrqwY.cjs');
4
- const require_unplugin = require('./unplugin-aKVZLoq9.cjs');
2
+ require('./core-BeuKLsFR.cjs');
3
+ require('./raw-sUsbkvbl.cjs');
4
+ const require_unplugin = require('./unplugin-Drfn-i56.cjs');
5
5
 
6
6
  //#region src/rspack.ts
7
7
  var rspack_default = require_unplugin.unplugin_default.rspack;
package/dist/rspack.d.cts CHANGED
@@ -1,6 +1,5 @@
1
- import { Options } from "./options-jKAq0dFf.cjs";
1
+ import { t as Options } from "./options-DxHQU8-_.cjs";
2
2
 
3
3
  //#region src/rspack.d.ts
4
4
  declare const _default: (options?: Options | undefined) => RspackPluginInstance;
5
- //#endregion
6
- export { _default as default };
5
+ export = _default;
package/dist/rspack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Options } from "./options-CBMw6D8V.js";
1
+ import { t as Options } from "./options-D6zn5V49.js";
2
2
 
3
3
  //#region src/rspack.d.ts
4
4
  declare const _default: (options?: Options | undefined) => RspackPluginInstance;
package/dist/rspack.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./core-CJgJmh2O.js";
2
- import "./raw-CWZ5g7Vk.js";
3
- import { unplugin_default } from "./unplugin-CyifZGPt.js";
1
+ import "./core-CfhBppKN.js";
2
+ import "./raw-D8DIsSla.js";
3
+ import { r as unplugin_default } from "./unplugin-Bgf_17my.js";
4
4
 
5
5
  //#region src/rspack.ts
6
6
  var rspack_default = unplugin_default.rspack;
@@ -1,4 +1,4 @@
1
- import { raw_default } from "./raw-CWZ5g7Vk.js";
1
+ import { t as raw_default } from "./raw-D8DIsSla.js";
2
2
  import { createUnplugin } from "unplugin";
3
3
 
4
4
  //#region src/unplugin.ts
@@ -9,4 +9,4 @@ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
9
9
  var unplugin_default = unplugin;
10
10
 
11
11
  //#endregion
12
- export { unplugin, unpluginFactory, unplugin_default };
12
+ export { unpluginFactory as n, unplugin_default as r, unplugin as t };
@@ -1,6 +1,7 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_raw = require('./raw-B2YMrqwY.cjs');
3
- const unplugin = require_chunk.__toESM(require("unplugin"));
2
+ const require_raw = require('./raw-sUsbkvbl.cjs');
3
+ let unplugin = require("unplugin");
4
+ unplugin = require_chunk.__toESM(unplugin);
4
5
 
5
6
  //#region src/unplugin.ts
6
7
  const unpluginFactory = (options = {}) => {
package/dist/unplugin.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-C-41-Q2Y.cjs');
3
- require('./raw-B2YMrqwY.cjs');
4
- const require_unplugin = require('./unplugin-aKVZLoq9.cjs');
2
+ require('./core-BeuKLsFR.cjs');
3
+ require('./raw-sUsbkvbl.cjs');
4
+ const require_unplugin = require('./unplugin-Drfn-i56.cjs');
5
5
 
6
6
  exports.default = require_unplugin.unplugin_default;
7
7
  exports.unplugin = require_unplugin.unplugin;
@@ -1,9 +1,9 @@
1
- import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as unplugin11 from "unplugin";
1
+ import { t as Options } from "./options-DxHQU8-_.cjs";
2
+ import * as unplugin2 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: unplugin11.UnpluginInstance<Options | undefined, true>;
7
+ declare const unplugin: unplugin2.UnpluginInstance<Options | undefined, true>;
8
8
  //#endregion
9
- export { Options, unplugin as default, unplugin, unpluginFactory };
9
+ export { type Options, unplugin as default, unplugin, unpluginFactory };
@@ -1,9 +1,9 @@
1
- import { Options } from "./options-CBMw6D8V.js";
2
- import * as unplugin8 from "unplugin";
1
+ import { t as Options } from "./options-D6zn5V49.js";
2
+ import * as unplugin1 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: unplugin8.UnpluginInstance<Options | undefined, true>;
7
+ declare const unplugin: unplugin1.UnpluginInstance<Options | undefined, true>;
8
8
  //#endregion
9
- export { Options, unplugin as default, unplugin, unpluginFactory };
9
+ export { type Options, unplugin as default, unplugin, unpluginFactory };
package/dist/unplugin.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./core-CJgJmh2O.js";
2
- import "./raw-CWZ5g7Vk.js";
3
- import { unplugin, unpluginFactory, unplugin_default } from "./unplugin-CyifZGPt.js";
1
+ import "./core-CfhBppKN.js";
2
+ import "./raw-D8DIsSla.js";
3
+ import { n as unpluginFactory, r as unplugin_default, t as unplugin } from "./unplugin-Bgf_17my.js";
4
4
 
5
5
  export { unplugin_default as default, unplugin, unpluginFactory };
@@ -1,4 +1,4 @@
1
- const require_unplugin = require('./unplugin-aKVZLoq9.cjs');
1
+ const require_unplugin = require('./unplugin-Drfn-i56.cjs');
2
2
 
3
3
  //#region src/vite.ts
4
4
  var vite_default = require_unplugin.unplugin_default.vite;
@@ -0,0 +1,7 @@
1
+ import { r as unplugin_default } from "./unplugin-Bgf_17my.js";
2
+
3
+ //#region src/vite.ts
4
+ var vite_default = unplugin_default.vite;
5
+
6
+ //#endregion
7
+ export { vite_default as t };
package/dist/vite.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-C-41-Q2Y.cjs');
3
- require('./raw-B2YMrqwY.cjs');
4
- require('./unplugin-aKVZLoq9.cjs');
5
- const require_vite = require('./vite-C63GJQHT.cjs');
2
+ require('./core-BeuKLsFR.cjs');
3
+ require('./raw-sUsbkvbl.cjs');
4
+ require('./unplugin-Drfn-i56.cjs');
5
+ const require_vite = require('./vite-D2tETSe2.cjs');
6
6
 
7
7
  exports.default = require_vite.vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as vite9 from "vite";
1
+ import { t as Options } from "./options-DxHQU8-_.cjs";
2
+ import * as vite0 from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => vite9.Plugin<any>[];
6
- //#endregion
7
- export { _default as default };
5
+ declare const _default: (options?: Options | undefined) => vite0.Plugin<any>[];
6
+ export = _default;
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Options } from "./options-CBMw6D8V.js";
2
- import * as vite10 from "vite";
1
+ import { t as Options } from "./options-D6zn5V49.js";
2
+ import * as vite0 from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => vite10.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => vite0.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/vite.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./core-CJgJmh2O.js";
2
- import "./raw-CWZ5g7Vk.js";
3
- import "./unplugin-CyifZGPt.js";
4
- import { vite_default } from "./vite-Djd6MAt9.js";
1
+ import "./core-CfhBppKN.js";
2
+ import "./raw-D8DIsSla.js";
3
+ import "./unplugin-Bgf_17my.js";
4
+ import { t as vite_default } from "./vite-DJ6fWtCh.js";
5
5
 
6
6
  export { vite_default as default };
package/dist/volar.cjs CHANGED
@@ -1,10 +1,15 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_chunk = require('./chunk-CUT6urMc.cjs');
3
- const __vue_jsx_vapor_macros_volar = require_chunk.__toESM(require("@vue-jsx-vapor/macros/volar"));
4
- const __vue_macros_volar_jsx_directive = require_chunk.__toESM(require("@vue-macros/volar/jsx-directive"));
5
- const __vue_macros_volar_jsx_ref = require_chunk.__toESM(require("@vue-macros/volar/jsx-ref"));
6
- const ts_macro = require_chunk.__toESM(require("ts-macro"));
7
- const __vue_shared = require_chunk.__toESM(require("@vue/shared"));
3
+ let __vue_jsx_vapor_macros_volar = require("@vue-jsx-vapor/macros/volar");
4
+ __vue_jsx_vapor_macros_volar = require_chunk.__toESM(__vue_jsx_vapor_macros_volar);
5
+ let __vue_macros_volar_jsx_directive = require("@vue-macros/volar/jsx-directive");
6
+ __vue_macros_volar_jsx_directive = require_chunk.__toESM(__vue_macros_volar_jsx_directive);
7
+ let __vue_macros_volar_jsx_ref = require("@vue-macros/volar/jsx-ref");
8
+ __vue_macros_volar_jsx_ref = require_chunk.__toESM(__vue_macros_volar_jsx_ref);
9
+ let ts_macro = require("ts-macro");
10
+ ts_macro = require_chunk.__toESM(ts_macro);
11
+ let __vue_shared = require("@vue/shared");
12
+ __vue_shared = require_chunk.__toESM(__vue_shared);
8
13
 
9
14
  //#region src/volar/jsx-element.ts
10
15
  var jsx_element_default = (0, ts_macro.createPlugin)(({ ts }) => {
@@ -33,7 +38,7 @@ type __InferJsxElement<T> = T extends keyof HTMLElementTagNameMap
33
38
  ? SVGElementTagNameMap[T]
34
39
  : T extends (props: infer Props, ctx: { slots: infer Slots, expose: (exposed: infer Exposed) => void, attrs: any, emit: any }) => infer TypeBlock
35
40
  // @ts-ignore
36
- ? import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
41
+ ? TypeBlock extends import('vue').VNode ? TypeBlock : import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
37
42
  : T extends { new (...args: any[]): infer Instance }
38
43
  ? Instance extends { $: any }
39
44
  ? import('vue').VNode
package/dist/volar.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Options } from "./options-jKAq0dFf.cjs";
1
+ import { t as Options } from "./options-DxHQU8-_.cjs";
2
2
  import { PluginReturn } from "ts-macro";
3
3
 
4
4
  //#region src/volar.d.ts
package/dist/volar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Options } from "./options-CBMw6D8V.js";
1
+ import { t as Options } from "./options-D6zn5V49.js";
2
2
  import { PluginReturn } from "ts-macro";
3
3
 
4
4
  //#region src/volar.d.ts
package/dist/volar.js CHANGED
@@ -31,7 +31,7 @@ type __InferJsxElement<T> = T extends keyof HTMLElementTagNameMap
31
31
  ? SVGElementTagNameMap[T]
32
32
  : T extends (props: infer Props, ctx: { slots: infer Slots, expose: (exposed: infer Exposed) => void, attrs: any, emit: any }) => infer TypeBlock
33
33
  // @ts-ignore
34
- ? import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
34
+ ? TypeBlock extends import('vue').VNode ? TypeBlock : import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
35
35
  : T extends { new (...args: any[]): infer Instance }
36
36
  ? Instance extends { $: any }
37
37
  ? import('vue').VNode
@@ -0,0 +1,7 @@
1
+ import { r as unplugin_default } from "./unplugin-Bgf_17my.js";
2
+
3
+ //#region src/webpack.ts
4
+ var webpack_default = unplugin_default.webpack;
5
+
6
+ //#endregion
7
+ export { webpack_default as t };
@@ -1,4 +1,4 @@
1
- const require_unplugin = require('./unplugin-aKVZLoq9.cjs');
1
+ const require_unplugin = require('./unplugin-Drfn-i56.cjs');
2
2
 
3
3
  //#region src/webpack.ts
4
4
  var webpack_default = require_unplugin.unplugin_default.webpack;
package/dist/webpack.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-C-41-Q2Y.cjs');
3
- require('./raw-B2YMrqwY.cjs');
4
- require('./unplugin-aKVZLoq9.cjs');
5
- const require_webpack = require('./webpack-CeAur76z.cjs');
2
+ require('./core-BeuKLsFR.cjs');
3
+ require('./raw-sUsbkvbl.cjs');
4
+ require('./unplugin-Drfn-i56.cjs');
5
+ const require_webpack = require('./webpack-Cpgko_pp.cjs');
6
6
 
7
7
  exports.default = require_webpack.webpack_default;
@@ -1,7 +1,6 @@
1
- import { Options } from "./options-jKAq0dFf.cjs";
2
- import * as webpack13 from "webpack";
1
+ import { t as Options } from "./options-DxHQU8-_.cjs";
2
+ import * as webpack0 from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => webpack13.WebpackPluginInstance;
6
- //#endregion
7
- export { _default as default };
5
+ declare const _default: (options?: Options | undefined) => webpack0.WebpackPluginInstance;
6
+ export = _default;
package/dist/webpack.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Options } from "./options-CBMw6D8V.js";
2
- import * as webpack13 from "webpack";
1
+ import { t as Options } from "./options-D6zn5V49.js";
2
+ import * as webpack0 from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => webpack13.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => webpack0.WebpackPluginInstance;
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/webpack.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./core-CJgJmh2O.js";
2
- import "./raw-CWZ5g7Vk.js";
3
- import "./unplugin-CyifZGPt.js";
4
- import { webpack_default } from "./webpack-3fgVTA33.js";
1
+ import "./core-CfhBppKN.js";
2
+ import "./raw-D8DIsSla.js";
3
+ import "./unplugin-Bgf_17my.js";
4
+ import { t as webpack_default } from "./webpack-BTWabvH7.js";
5
5
 
6
6
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-jsx-vapor",
3
- "version": "2.6.7",
3
+ "version": "2.7.3",
4
4
  "description": "Vapor Mode of Vue JSX",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -172,10 +172,9 @@
172
172
  "ts-macro": "^0.3.6",
173
173
  "unplugin": "^2.3.10",
174
174
  "unplugin-utils": "^0.2.5",
175
- "@vue-jsx-vapor/compiler": "2.6.7",
176
- "@vue-jsx-vapor/runtime": "2.6.7",
177
- "@vue-jsx-vapor/babel": "2.6.7",
178
- "@vue-jsx-vapor/macros": "2.6.7"
175
+ "@vue-jsx-vapor/compiler-rs": "2.7.3",
176
+ "@vue-jsx-vapor/macros": "2.7.3",
177
+ "@vue-jsx-vapor/runtime": "2.7.3"
179
178
  },
180
179
  "devDependencies": {
181
180
  "@nuxt/kit": "^3.19.2",
@@ -1,33 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const __babel_core = require_chunk.__toESM(require("@babel/core"));
3
- const __babel_plugin_transform_typescript = require_chunk.__toESM(require("@babel/plugin-transform-typescript"));
4
- const __vue_jsx_vapor_babel = require_chunk.__toESM(require("@vue-jsx-vapor/babel"));
5
-
6
- //#region src/core/index.ts
7
- function transformVueJsxVapor(code, id, options, needSourceMap = false) {
8
- const params = new URLSearchParams(id);
9
- const vapor = params.get("vapor");
10
- return (0, __babel_core.transformSync)(code, {
11
- plugins: [[__vue_jsx_vapor_babel.default, {
12
- compile: options?.compile,
13
- interop: vapor ? false : options?.interop
14
- }], ...id.endsWith(".tsx") ? [[__babel_plugin_transform_typescript.default, {
15
- isTSX: true,
16
- allowExtensions: true
17
- }]] : []],
18
- filename: id,
19
- sourceMaps: needSourceMap,
20
- sourceFileName: id,
21
- babelrc: false,
22
- configFile: false,
23
- ast: true
24
- });
25
- }
26
-
27
- //#endregion
28
- Object.defineProperty(exports, 'transformVueJsxVapor', {
29
- enumerable: true,
30
- get: function () {
31
- return transformVueJsxVapor;
32
- }
33
- });
@@ -1,27 +0,0 @@
1
- import { transformSync } from "@babel/core";
2
- import babelTypescript from "@babel/plugin-transform-typescript";
3
- import jsx from "@vue-jsx-vapor/babel";
4
-
5
- //#region src/core/index.ts
6
- function transformVueJsxVapor(code, id, options, needSourceMap = false) {
7
- const params = new URLSearchParams(id);
8
- const vapor = params.get("vapor");
9
- return transformSync(code, {
10
- plugins: [[jsx, {
11
- compile: options?.compile,
12
- interop: vapor ? false : options?.interop
13
- }], ...id.endsWith(".tsx") ? [[babelTypescript, {
14
- isTSX: true,
15
- allowExtensions: true
16
- }]] : []],
17
- filename: id,
18
- sourceMaps: needSourceMap,
19
- sourceFileName: id,
20
- babelrc: false,
21
- configFile: false,
22
- ast: true
23
- });
24
- }
25
-
26
- //#endregion
27
- export { transformVueJsxVapor };
File without changes
@@ -1,2 +0,0 @@
1
- import { Options } from "./options-jKAq0dFf.cjs";
2
- export { Options };
package/dist/options.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Options } from "./options-CBMw6D8V.js";
2
- export { Options };
@@ -1,213 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_core = require('./core-C-41-Q2Y.cjs');
3
- const __babel_core = require_chunk.__toESM(require("@babel/core"));
4
- const __babel_plugin_transform_typescript = require_chunk.__toESM(require("@babel/plugin-transform-typescript"));
5
- const __vue_jsx_vapor_macros_raw = require_chunk.__toESM(require("@vue-jsx-vapor/macros/raw"));
6
- const __vue_macros_jsx_directive_api = require_chunk.__toESM(require("@vue-macros/jsx-directive/api"));
7
- const unplugin_utils = require_chunk.__toESM(require("unplugin-utils"));
8
- const __vue_jsx_vapor_macros_api = require_chunk.__toESM(require("@vue-jsx-vapor/macros/api"));
9
- const hash_sum = require_chunk.__toESM(require("hash-sum"));
10
- const pathe = require_chunk.__toESM(require("pathe"));
11
- const __vue_babel_plugin_jsx = require_chunk.__toESM(require("@vue/babel-plugin-jsx"));
12
-
13
- //#region src/core/ssr.ts
14
- const ssrRegisterHelperId = "/__vue-jsx-ssr-register-helper";
15
- const ssrRegisterHelperCode = `import { useSSRContext } from "vue"\nexport const ssrRegisterHelper = ${ssrRegisterHelper.toString()}`;
16
- /**
17
- * This function is serialized with toString() and evaluated as a virtual
18
- * module during SSR
19
- */
20
- function ssrRegisterHelper(comp, filename) {
21
- const setup = comp.setup;
22
- comp.setup = (props, ctx) => {
23
- const ssrContext = useSSRContext();
24
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);
25
- if (setup) return setup(props, ctx);
26
- };
27
- }
28
- function injectSSR(id, hotComponents, root = "") {
29
- const normalizedId = (0, unplugin_utils.normalizePath)((0, pathe.relative)(root, id));
30
- let ssrInjectCode = `\nimport { ssrRegisterHelper } from "${ssrRegisterHelperId}"\nconst __moduleId = ${JSON.stringify(normalizedId)}`;
31
- for (const { local } of hotComponents) ssrInjectCode += `\nssrRegisterHelper(${local}, __moduleId)`;
32
- return ssrInjectCode;
33
- }
34
-
35
- //#endregion
36
- //#region src/core/hmr.ts
37
- function injectHMRAndSSR(result, id, options) {
38
- const ssr = options?.ssr;
39
- const defineComponentNames = options?.defineComponentNames ?? ["defineComponent", "defineVaporComponent"];
40
- const { ast } = result;
41
- const declaredComponents = [];
42
- const hotComponents = [];
43
- let hasDefaultExport = false;
44
- for (const node of ast.program.body) {
45
- if (node.type === "VariableDeclaration") {
46
- const names = parseComponentDecls(node, defineComponentNames);
47
- if (names.length) declaredComponents.push(...names);
48
- }
49
- if (node.type === "ExportNamedDeclaration") {
50
- if (node.declaration && node.declaration.type === "VariableDeclaration") hotComponents.push(...parseComponentDecls(node.declaration, defineComponentNames).map((name) => ({
51
- local: name,
52
- exported: name,
53
- id: (0, hash_sum.default)(id + name)
54
- })));
55
- else if (node.specifiers.length) {
56
- for (const spec of node.specifiers) if (spec.type === "ExportSpecifier" && spec.exported.type === "Identifier") {
57
- const matched = declaredComponents.find((name) => name === spec.local.name);
58
- if (matched) hotComponents.push({
59
- local: spec.local.name,
60
- exported: spec.exported.name,
61
- id: (0, hash_sum.default)(id + spec.exported.name)
62
- });
63
- }
64
- }
65
- }
66
- if (node.type === "ExportDefaultDeclaration") {
67
- if (node.declaration.type === "Identifier") {
68
- const _name = node.declaration.name;
69
- const matched = declaredComponents.find((name) => name === _name);
70
- if (matched) hotComponents.push({
71
- local: _name,
72
- exported: "default",
73
- id: (0, hash_sum.default)(`${id}default`)
74
- });
75
- } else if (isDefineComponentCall(node.declaration, defineComponentNames) || (0, __vue_jsx_vapor_macros_api.isFunctionalNode)(node.declaration)) {
76
- hasDefaultExport = true;
77
- hotComponents.push({
78
- local: "__default__",
79
- exported: "default",
80
- id: (0, hash_sum.default)(`${id}default`)
81
- });
82
- }
83
- }
84
- }
85
- if (hotComponents.length) {
86
- if (hasDefaultExport || ssr) result.code = `${result.code.replaceAll(`export default `, `const __default__ = `)}\nexport default __default__;`;
87
- if (!ssr && !/\?vue&type=script/.test(id)) {
88
- let code = result.code;
89
- let callbackCode = ``;
90
- for (const { local, exported, id: id$1 } of hotComponents) {
91
- code += `\n${local}.__hmrId = "${id$1}";\n__VUE_HMR_RUNTIME__.createRecord("${id$1}", ${local});`;
92
- callbackCode += `
93
- __VUE_HMR_RUNTIME__[typeof mod['${exported}'] === 'function' ? 'rerender' : 'reload'](mod['${exported}'].__hmrId, mod['${exported}']);`;
94
- }
95
- code += `
96
- if (import.meta.hot) {
97
- import.meta.hot.accept(mod => {${callbackCode}\n });
98
- }`;
99
- result.code = code;
100
- }
101
- if (ssr) result.code += injectSSR(id, hotComponents, options?.root);
102
- }
103
- }
104
- function parseComponentDecls(node, fnNames) {
105
- const names = [];
106
- for (const decl of node.declarations) if (decl.id.type === "Identifier" && (isDefineComponentCall(decl.init, fnNames) || (0, __vue_jsx_vapor_macros_api.isFunctionalNode)(decl.init))) names.push(decl.id.name);
107
- return names;
108
- }
109
- function isDefineComponentCall(node, names) {
110
- return !!(node && node.type === "CallExpression" && node.callee.type === "Identifier" && names.includes(node.callee.name));
111
- }
112
-
113
- //#endregion
114
- //#region src/core/vue-jsx.ts
115
- function transformVueJsx(code, id, needSourceMap = false) {
116
- const result = (0, __babel_core.transformSync)(code, {
117
- plugins: [__vue_babel_plugin_jsx.default, ...id.endsWith(".tsx") ? [[__babel_plugin_transform_typescript.default, {
118
- isTSX: true,
119
- allowExtensions: true
120
- }]] : []],
121
- filename: id,
122
- sourceMaps: needSourceMap,
123
- sourceFileName: id,
124
- babelrc: false,
125
- configFile: false
126
- });
127
- if (result?.code && result.code !== code) return {
128
- code: result.code,
129
- map: result.map
130
- };
131
- }
132
-
133
- //#endregion
134
- //#region src/raw.ts
135
- const plugin = (options = {}) => {
136
- const transformInclude = (0, unplugin_utils.createFilter)(options?.include || /\.[cm]?[jt]sx$/, options?.exclude || /node_modules/);
137
- let root = "";
138
- let needHMR = false;
139
- let needSourceMap = options.sourceMap || false;
140
- return [
141
- {
142
- name: "vue-jsx-vapor",
143
- vite: {
144
- config(config) {
145
- return {
146
- esbuild: { include: /\.ts$/ },
147
- define: {
148
- __VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true,
149
- __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false,
150
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: config.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ ?? false
151
- }
152
- };
153
- },
154
- configResolved(config) {
155
- root = config.root;
156
- needHMR = config.command === "serve";
157
- needSourceMap ||= config.command === "serve" || !!config.build.sourcemap;
158
- }
159
- },
160
- resolveId(id) {
161
- if (id === ssrRegisterHelperId) return id;
162
- },
163
- loadInclude(id) {
164
- if (id === ssrRegisterHelperId) return true;
165
- },
166
- load(id) {
167
- if (id === ssrRegisterHelperId) return ssrRegisterHelperCode;
168
- },
169
- transformInclude,
170
- transform(code, id, opt) {
171
- const result = require_core.transformVueJsxVapor(code, id, options, needSourceMap);
172
- if (result?.code) {
173
- (needHMR || opt?.ssr) && injectHMRAndSSR(result, id, {
174
- ssr: opt?.ssr,
175
- root
176
- });
177
- return {
178
- code: result.code,
179
- map: result.map
180
- };
181
- }
182
- }
183
- },
184
- {
185
- name: "@vue-macros/jsx-directive",
186
- transformInclude,
187
- transform(code, id, opt) {
188
- if (options.interop || opt?.ssr) return (0, __vue_macros_jsx_directive_api.transformJsxDirective)(code, id, {
189
- lib: "vue",
190
- prefix: "v-",
191
- version: 3.6
192
- });
193
- }
194
- },
195
- {
196
- name: "@vitejs/plugin-vue-jsx",
197
- transformInclude,
198
- transform(code, id, opt) {
199
- if (options.interop || opt?.ssr) return transformVueJsx(code, id, needSourceMap);
200
- }
201
- },
202
- ...options.macros === false ? [] : options.macros ? [(0, __vue_jsx_vapor_macros_raw.default)(options.macros === true ? void 0 : options.macros)] : []
203
- ];
204
- };
205
- var raw_default = plugin;
206
-
207
- //#endregion
208
- Object.defineProperty(exports, 'raw_default', {
209
- enumerable: true,
210
- get: function () {
211
- return raw_default;
212
- }
213
- });