vue-jsx-vapor 2.6.8 → 2.7.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.
- package/dist/api.cjs +1 -1
- package/dist/api.d.cts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.js +1 -1
- package/dist/astro.cjs +3 -3
- package/dist/astro.d.cts +2 -3
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +3 -3
- package/dist/core-BeuKLsFR.cjs +22 -0
- package/dist/core-CfhBppKN.js +15 -0
- package/dist/esbuild.cjs +3 -3
- package/dist/esbuild.d.cts +4 -5
- package/dist/esbuild.d.ts +3 -3
- package/dist/esbuild.js +3 -3
- package/dist/index.js +2 -0
- package/dist/nuxt.cjs +7 -6
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +3 -3
- package/dist/nuxt.js +5 -5
- package/dist/{options-CBMw6D8V.d.ts → options-D6zn5V49.d.ts} +1 -1
- package/dist/{options-jKAq0dFf.d.cts → options-DxHQU8-_.d.cts} +1 -1
- package/dist/raw-B3KlYN7X.js +119 -0
- package/dist/raw-DG3OYbEe.cjs +132 -0
- package/dist/raw.cjs +2 -2
- package/dist/raw.d.cts +2 -3
- package/dist/raw.d.ts +1 -1
- package/dist/raw.js +2 -2
- package/dist/rolldown.cjs +5 -4
- package/dist/rolldown.d.cts +4 -5
- package/dist/rolldown.d.ts +3 -3
- package/dist/rolldown.js +3 -3
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +4 -5
- package/dist/rollup.d.ts +3 -3
- package/dist/rollup.js +3 -3
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.d.cts +2 -3
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +3 -3
- package/dist/{unplugin-aKVZLoq9.cjs → unplugin-6bs2zQro.cjs} +3 -2
- package/dist/{unplugin-CyifZGPt.js → unplugin-BPAlTDcQ.js} +2 -2
- package/dist/unplugin.cjs +3 -3
- package/dist/unplugin.d.cts +4 -4
- package/dist/unplugin.d.ts +4 -4
- package/dist/unplugin.js +3 -3
- package/dist/{vite-C63GJQHT.cjs → vite-D8MCYNCu.cjs} +1 -1
- package/dist/vite-EGcRF3B5.js +7 -0
- package/dist/vite.cjs +4 -4
- package/dist/vite.d.cts +4 -5
- package/dist/vite.d.ts +3 -3
- package/dist/vite.js +4 -4
- package/dist/volar.cjs +10 -5
- package/dist/volar.d.cts +1 -1
- package/dist/volar.d.ts +1 -1
- package/dist/{webpack-CeAur76z.cjs → webpack-CAtjl4UN.cjs} +1 -1
- package/dist/webpack-DdK9_Sb1.js +7 -0
- package/dist/webpack.cjs +4 -4
- package/dist/webpack.d.cts +4 -5
- package/dist/webpack.d.ts +3 -3
- package/dist/webpack.js +4 -4
- package/package.json +4 -5
- package/dist/core-C-41-Q2Y.cjs +0 -33
- package/dist/core-CJgJmh2O.js +0 -27
- package/dist/options.d.cjs +0 -0
- package/dist/options.d.cts +0 -2
- package/dist/options.d.ts +0 -2
- package/dist/raw-B2YMrqwY.cjs +0 -213
- package/dist/raw-CWZ5g7Vk.js +0 -207
- package/dist/vite-Djd6MAt9.js +0 -7
- package/dist/webpack-3fgVTA33.js +0 -7
package/dist/rspack.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Options } from "./options-
|
|
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
|
-
|
|
6
|
-
export { _default as default };
|
|
5
|
+
export = _default;
|
package/dist/rspack.d.ts
CHANGED
package/dist/rspack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
3
|
-
import { unplugin_default } from "./unplugin-
|
|
1
|
+
import "./core-CfhBppKN.js";
|
|
2
|
+
import "./raw-B3KlYN7X.js";
|
|
3
|
+
import { r as unplugin_default } from "./unplugin-BPAlTDcQ.js";
|
|
4
4
|
|
|
5
5
|
//#region src/rspack.ts
|
|
6
6
|
var rspack_default = unplugin_default.rspack;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_raw = require('./raw-
|
|
3
|
-
|
|
2
|
+
const require_raw = require('./raw-DG3OYbEe.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 = {}) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { raw_default } from "./raw-
|
|
1
|
+
import { t as raw_default } from "./raw-B3KlYN7X.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 {
|
|
12
|
+
export { unpluginFactory as n, unplugin_default as r, unplugin as t };
|
package/dist/unplugin.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
4
|
-
const require_unplugin = require('./unplugin-
|
|
2
|
+
require('./core-BeuKLsFR.cjs');
|
|
3
|
+
require('./raw-DG3OYbEe.cjs');
|
|
4
|
+
const require_unplugin = require('./unplugin-6bs2zQro.cjs');
|
|
5
5
|
|
|
6
6
|
exports.default = require_unplugin.unplugin_default;
|
|
7
7
|
exports.unplugin = require_unplugin.unplugin;
|
package/dist/unplugin.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Options } from "./options-
|
|
2
|
-
import * as
|
|
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:
|
|
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 };
|
package/dist/unplugin.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Options } from "./options-
|
|
2
|
-
import * as
|
|
1
|
+
import { t as Options } from "./options-D6zn5V49.js";
|
|
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:
|
|
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 };
|
package/dist/unplugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
3
|
-
import {
|
|
1
|
+
import "./core-CfhBppKN.js";
|
|
2
|
+
import "./raw-B3KlYN7X.js";
|
|
3
|
+
import { n as unpluginFactory, r as unplugin_default, t as unplugin } from "./unplugin-BPAlTDcQ.js";
|
|
4
4
|
|
|
5
5
|
export { unplugin_default as default, unplugin, unpluginFactory };
|
package/dist/vite.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
4
|
-
require('./unplugin-
|
|
5
|
-
const require_vite = require('./vite-
|
|
2
|
+
require('./core-BeuKLsFR.cjs');
|
|
3
|
+
require('./raw-DG3OYbEe.cjs');
|
|
4
|
+
require('./unplugin-6bs2zQro.cjs');
|
|
5
|
+
const require_vite = require('./vite-D8MCYNCu.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-
|
|
2
|
-
import * as
|
|
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) =>
|
|
6
|
-
|
|
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-
|
|
2
|
-
import * as
|
|
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) =>
|
|
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-
|
|
2
|
-
import "./raw-
|
|
3
|
-
import "./unplugin-
|
|
4
|
-
import { vite_default } from "./vite-
|
|
1
|
+
import "./core-CfhBppKN.js";
|
|
2
|
+
import "./raw-B3KlYN7X.js";
|
|
3
|
+
import "./unplugin-BPAlTDcQ.js";
|
|
4
|
+
import { t as vite_default } from "./vite-EGcRF3B5.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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 }) => {
|
package/dist/volar.d.cts
CHANGED
package/dist/volar.d.ts
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
4
|
-
require('./unplugin-
|
|
5
|
-
const require_webpack = require('./webpack-
|
|
2
|
+
require('./core-BeuKLsFR.cjs');
|
|
3
|
+
require('./raw-DG3OYbEe.cjs');
|
|
4
|
+
require('./unplugin-6bs2zQro.cjs');
|
|
5
|
+
const require_webpack = require('./webpack-CAtjl4UN.cjs');
|
|
6
6
|
|
|
7
7
|
exports.default = require_webpack.webpack_default;
|
package/dist/webpack.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Options } from "./options-
|
|
2
|
-
import * as
|
|
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) =>
|
|
6
|
-
|
|
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-
|
|
2
|
-
import * as
|
|
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) =>
|
|
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-
|
|
2
|
-
import "./raw-
|
|
3
|
-
import "./unplugin-
|
|
4
|
-
import { webpack_default } from "./webpack-
|
|
1
|
+
import "./core-CfhBppKN.js";
|
|
2
|
+
import "./raw-B3KlYN7X.js";
|
|
3
|
+
import "./unplugin-BPAlTDcQ.js";
|
|
4
|
+
import { t as webpack_default } from "./webpack-DdK9_Sb1.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.
|
|
3
|
+
"version": "2.7.4",
|
|
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/
|
|
176
|
-
"@vue-jsx-vapor/
|
|
177
|
-
"@vue-jsx-vapor/
|
|
178
|
-
"@vue-jsx-vapor/compiler": "2.6.8"
|
|
175
|
+
"@vue-jsx-vapor/macros": "2.7.4",
|
|
176
|
+
"@vue-jsx-vapor/runtime": "2.7.4",
|
|
177
|
+
"@vue-jsx-vapor/compiler-rs": "2.7.4"
|
|
179
178
|
},
|
|
180
179
|
"devDependencies": {
|
|
181
180
|
"@nuxt/kit": "^3.19.2",
|
package/dist/core-C-41-Q2Y.cjs
DELETED
|
@@ -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
|
-
});
|
package/dist/core-CJgJmh2O.js
DELETED
|
@@ -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 };
|
package/dist/options.d.cjs
DELETED
|
File without changes
|
package/dist/options.d.cts
DELETED
package/dist/options.d.ts
DELETED
package/dist/raw-B2YMrqwY.cjs
DELETED
|
@@ -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
|
-
});
|