@vue-jsx-vapor/macros 2.6.0 → 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/api.cjs +1 -1
- package/dist/api.js +1 -1
- package/dist/astro.cjs +3 -3
- package/dist/astro.js +3 -3
- package/dist/{core-BnOBUOXo.cjs → core-BGMj1zaw.cjs} +6 -15
- package/dist/{core-CzkzlWGo.js → core-u2ydd_-y.js} +6 -15
- package/dist/esbuild.cjs +3 -3
- package/dist/esbuild.js +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/nuxt.cjs +5 -5
- package/dist/nuxt.d.cts +2 -2
- package/dist/nuxt.js +5 -5
- package/dist/{raw-Cs8E-0N5.js → raw-Dprh1tIQ.js} +1 -1
- package/dist/{raw-DKCRm2ff.cjs → raw-V1VJGrnC.cjs} +1 -1
- package/dist/raw.cjs +2 -2
- package/dist/raw.js +2 -2
- package/dist/rolldown.cjs +3 -3
- package/dist/rolldown.d.cts +2 -2
- package/dist/rolldown.js +3 -3
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +2 -2
- package/dist/rollup.js +3 -3
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.js +3 -3
- package/dist/{src-BMmuQ4rG.js → src-9_QEflZu.js} +1 -1
- package/dist/{src-DJK4pxUR.cjs → src-Zbpeaztk.cjs} +1 -1
- package/dist/{vite-DRkDbCPE.cjs → vite-BX_gYdbF.cjs} +1 -1
- package/dist/{vite-DbwHYLPn.js → vite-DMiSdzmA.js} +1 -1
- package/dist/vite.cjs +4 -4
- package/dist/vite.d.cts +2 -2
- package/dist/vite.js +4 -4
- package/dist/volar.cjs +42 -20
- package/dist/volar.js +42 -20
- package/dist/{webpack-CsAn2U-j.cjs → webpack-337kgHM4.cjs} +1 -1
- package/dist/{webpack-WGax0jDH.js → webpack-BijR4yVK.js} +1 -1
- package/dist/webpack.cjs +4 -4
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.js +4 -4
- package/package.json +6 -6
package/dist/api.cjs
CHANGED
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { getMacroExpression, isFunctionalNode, restructure, transformJsxMacros } from "./core-
|
|
1
|
+
import { getMacroExpression, isFunctionalNode, restructure, transformJsxMacros } from "./core-u2ydd_-y.js";
|
|
2
2
|
|
|
3
3
|
export { getMacroExpression, isFunctionalNode, restructure, transformJsxMacros };
|
package/dist/astro.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Zbpeaztk.cjs');
|
|
6
6
|
|
|
7
7
|
//#region src/astro.ts
|
|
8
8
|
var astro_default = (options) => ({
|
package/dist/astro.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import { src_default } from "./src-
|
|
4
|
+
import { src_default } from "./src-9_QEflZu.js";
|
|
5
5
|
|
|
6
6
|
//#region src/astro.ts
|
|
7
7
|
var astro_default = (options) => ({
|
|
@@ -221,26 +221,17 @@ function transformDefineComponent(root, propsName, macros, s, autoReturnFunction
|
|
|
221
221
|
transformDefineModel$1(s, macros.defineModel, props);
|
|
222
222
|
const propsString = Object.entries(props).map(([key, value]) => `'${key}': ${value}`).join(", \n");
|
|
223
223
|
if (propsString) {
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
s.appendLeft(prop.value.start, `{...${resolvedPropsString}, ...`);
|
|
231
|
-
s.appendRight(prop.value.end, "}");
|
|
232
|
-
}
|
|
233
|
-
if (hasRestProp) prependObjectExpression(argument, "inheritAttrs", "false", s);
|
|
224
|
+
const resolvedPropsString = `${hasRestProp ? "inheritAttrs: false, " : ""}props: {\n${propsString}\n}`;
|
|
225
|
+
const compOptions = macros.defineComponent.arguments[1];
|
|
226
|
+
if (!compOptions) s.appendRight(root.end, `, { ${resolvedPropsString} }`);
|
|
227
|
+
else if (compOptions.type === "ObjectExpression") {
|
|
228
|
+
s.appendLeft(compOptions.start, `{ ${resolvedPropsString}, ...`);
|
|
229
|
+
s.appendRight(compOptions.end, " }");
|
|
234
230
|
}
|
|
235
231
|
}
|
|
236
232
|
transformAwait(root, s);
|
|
237
233
|
if (autoReturnFunction) transformReturn(root, s);
|
|
238
234
|
}
|
|
239
|
-
function prependObjectExpression(argument, name, value, s) {
|
|
240
|
-
const prop = argument.properties?.find((prop$1) => prop$1.type === "ObjectProperty" && prop$1.key.type === "Identifier" && prop$1.key.name === name);
|
|
241
|
-
if (!prop) s.appendRight(argument.start + 1, `${name}: ${value},`);
|
|
242
|
-
return prop;
|
|
243
|
-
}
|
|
244
235
|
function getWalkedIds(root, propsName) {
|
|
245
236
|
const walkedIds = /* @__PURE__ */ new Set();
|
|
246
237
|
(0, __vue_macros_common.walkIdentifiers)(root.body, (id, parent) => {
|
|
@@ -220,26 +220,17 @@ function transformDefineComponent(root, propsName, macros, s, autoReturnFunction
|
|
|
220
220
|
transformDefineModel$1(s, macros.defineModel, props);
|
|
221
221
|
const propsString = Object.entries(props).map(([key, value]) => `'${key}': ${value}`).join(", \n");
|
|
222
222
|
if (propsString) {
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
s.appendLeft(prop.value.start, `{...${resolvedPropsString}, ...`);
|
|
230
|
-
s.appendRight(prop.value.end, "}");
|
|
231
|
-
}
|
|
232
|
-
if (hasRestProp) prependObjectExpression(argument, "inheritAttrs", "false", s);
|
|
223
|
+
const resolvedPropsString = `${hasRestProp ? "inheritAttrs: false, " : ""}props: {\n${propsString}\n}`;
|
|
224
|
+
const compOptions = macros.defineComponent.arguments[1];
|
|
225
|
+
if (!compOptions) s.appendRight(root.end, `, { ${resolvedPropsString} }`);
|
|
226
|
+
else if (compOptions.type === "ObjectExpression") {
|
|
227
|
+
s.appendLeft(compOptions.start, `{ ${resolvedPropsString}, ...`);
|
|
228
|
+
s.appendRight(compOptions.end, " }");
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
231
|
transformAwait(root, s);
|
|
236
232
|
if (autoReturnFunction) transformReturn(root, s);
|
|
237
233
|
}
|
|
238
|
-
function prependObjectExpression(argument, name, value, s) {
|
|
239
|
-
const prop = argument.properties?.find((prop$1) => prop$1.type === "ObjectProperty" && prop$1.key.type === "Identifier" && prop$1.key.name === name);
|
|
240
|
-
if (!prop) s.appendRight(argument.start + 1, `${name}: ${value},`);
|
|
241
|
-
return prop;
|
|
242
|
-
}
|
|
243
234
|
function getWalkedIds(root, propsName) {
|
|
244
235
|
const walkedIds = /* @__PURE__ */ new Set();
|
|
245
236
|
walkIdentifiers(root.body, (id, parent) => {
|
package/dist/esbuild.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Zbpeaztk.cjs');
|
|
6
6
|
|
|
7
7
|
//#region src/esbuild.ts
|
|
8
8
|
var esbuild_default = require_src.src_default.esbuild;
|
package/dist/esbuild.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import { src_default } from "./src-
|
|
4
|
+
import { src_default } from "./src-9_QEflZu.js";
|
|
5
5
|
|
|
6
6
|
//#region src/esbuild.ts
|
|
7
7
|
var esbuild_default = src_default.esbuild;
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
const require_options = require('./options-BejTnOdM.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Zbpeaztk.cjs');
|
|
6
6
|
|
|
7
7
|
exports.default = require_src.src_default;
|
|
8
8
|
exports.resolveOptions = require_options.resolveOptions;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import { resolveOptions } from "./options-BWRkHmm5.js";
|
|
4
|
-
import { src_default } from "./src-
|
|
4
|
+
import { src_default } from "./src-9_QEflZu.js";
|
|
5
5
|
|
|
6
6
|
export { src_default as default, resolveOptions };
|
package/dist/nuxt.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
3
|
-
require('./core-
|
|
4
|
-
require('./raw-
|
|
3
|
+
require('./core-BGMj1zaw.cjs');
|
|
4
|
+
require('./raw-V1VJGrnC.cjs');
|
|
5
5
|
require('./options-BejTnOdM.cjs');
|
|
6
|
-
require('./src-
|
|
7
|
-
const require_vite = require('./vite-
|
|
8
|
-
const require_webpack = require('./webpack-
|
|
6
|
+
require('./src-Zbpeaztk.cjs');
|
|
7
|
+
const require_vite = require('./vite-BX_gYdbF.cjs');
|
|
8
|
+
const require_webpack = require('./webpack-337kgHM4.cjs');
|
|
9
9
|
const __nuxt_kit = require_chunk.__toESM(require("@nuxt/kit"));
|
|
10
10
|
require("@nuxt/schema");
|
|
11
11
|
|
package/dist/nuxt.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Options } from "./options-Egmm6BVJ.cjs";
|
|
2
|
-
import * as
|
|
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:
|
|
6
|
+
declare const _default: _nuxt_schema8.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { ModuleOptions, _default as default };
|
package/dist/nuxt.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import "./src-
|
|
5
|
-
import { vite_default } from "./vite-
|
|
6
|
-
import { webpack_default } from "./webpack-
|
|
4
|
+
import "./src-9_QEflZu.js";
|
|
5
|
+
import { vite_default } from "./vite-DMiSdzmA.js";
|
|
6
|
+
import { webpack_default } from "./webpack-BijR4yVK.js";
|
|
7
7
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
8
8
|
import "@nuxt/schema";
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { helperPrefix, transformJsxMacros, useModelHelperId, use_model_default, withDefaultsHelperId, with_defaults_default } from "./core-
|
|
1
|
+
import { helperPrefix, transformJsxMacros, useModelHelperId, use_model_default, withDefaultsHelperId, with_defaults_default } from "./core-u2ydd_-y.js";
|
|
2
2
|
import { resolveOptions } from "./options-BWRkHmm5.js";
|
|
3
3
|
import { createFilter, normalizePath } from "@vue-macros/common";
|
|
4
4
|
import { compileStyleAsync } from "@vue/compiler-sfc";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_core = require('./core-
|
|
2
|
+
const require_core = require('./core-BGMj1zaw.cjs');
|
|
3
3
|
const require_options = require('./options-BejTnOdM.cjs');
|
|
4
4
|
const __vue_macros_common = require_chunk.__toESM(require("@vue-macros/common"));
|
|
5
5
|
const __vue_compiler_sfc = require_chunk.__toESM(require("@vue/compiler-sfc"));
|
package/dist/raw.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
const require_raw = require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
const require_raw = require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
5
|
|
|
6
6
|
exports.default = require_raw.raw_default;
|
package/dist/raw.js
CHANGED
package/dist/rolldown.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Zbpeaztk.cjs');
|
|
6
6
|
|
|
7
7
|
//#region src/rolldown.ts
|
|
8
8
|
var rolldown_default = require_src.src_default.rolldown;
|
package/dist/rolldown.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Options } from "./options-Egmm6BVJ.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as unplugin13 from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/rolldown.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
5
|
+
declare const _default: (options?: Options | undefined) => unplugin13.RolldownPlugin<any> | unplugin13.RolldownPlugin<any>[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/rolldown.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import { src_default } from "./src-
|
|
4
|
+
import { src_default } from "./src-9_QEflZu.js";
|
|
5
5
|
|
|
6
6
|
//#region src/rolldown.ts
|
|
7
7
|
var rolldown_default = src_default.rolldown;
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Zbpeaztk.cjs');
|
|
6
6
|
|
|
7
7
|
//#region src/rollup.ts
|
|
8
8
|
var rollup_default = require_src.src_default.rollup;
|
package/dist/rollup.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Options } from "./options-Egmm6BVJ.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as rollup3 from "rollup";
|
|
3
3
|
|
|
4
4
|
//#region src/rollup.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
5
|
+
declare const _default: (options?: Options | undefined) => rollup3.Plugin<any> | rollup3.Plugin<any>[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import { src_default } from "./src-
|
|
4
|
+
import { src_default } from "./src-9_QEflZu.js";
|
|
5
5
|
|
|
6
6
|
//#region src/rollup.ts
|
|
7
7
|
var rollup_default = src_default.rollup;
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
const require_src = require('./src-
|
|
5
|
+
const require_src = require('./src-Zbpeaztk.cjs');
|
|
6
6
|
|
|
7
7
|
//#region src/rspack.ts
|
|
8
8
|
var rspack_default = require_src.src_default.rspack;
|
package/dist/rspack.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import { src_default } from "./src-
|
|
4
|
+
import { src_default } from "./src-9_QEflZu.js";
|
|
5
5
|
|
|
6
6
|
//#region src/rspack.ts
|
|
7
7
|
var rspack_default = src_default.rspack;
|
package/dist/vite.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
require('./src-
|
|
6
|
-
const require_vite = require('./vite-
|
|
5
|
+
require('./src-Zbpeaztk.cjs');
|
|
6
|
+
const require_vite = require('./vite-BX_gYdbF.cjs');
|
|
7
7
|
|
|
8
8
|
exports.default = require_vite.vite_default;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Options } from "./options-Egmm6BVJ.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vite6 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) => vite6.Plugin<any> | vite6.Plugin<any>[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import "./src-
|
|
5
|
-
import { vite_default } from "./vite-
|
|
4
|
+
import "./src-9_QEflZu.js";
|
|
5
|
+
import { vite_default } from "./vite-DMiSdzmA.js";
|
|
6
6
|
|
|
7
7
|
export { vite_default as default };
|
package/dist/volar.cjs
CHANGED
|
@@ -8,22 +8,40 @@ const ts_macro = require_chunk.__toESM(require("ts-macro"));
|
|
|
8
8
|
function transformDefineComponent(node, parent, options) {
|
|
9
9
|
const { codes, ast, ts } = options;
|
|
10
10
|
const [comp, compOptions] = node.arguments;
|
|
11
|
+
const isVapor = node.expression.getText(ast) === "defineVaporComponent";
|
|
11
12
|
codes.replaceRange(comp.end, node.end - 1);
|
|
12
13
|
codes.replaceRange(node.getStart(ast), node.expression.end, ts.isExpressionStatement(parent) ? ";" : "", `(() => {
|
|
13
14
|
const __setup = `);
|
|
14
|
-
const result = (ts.isArrowFunction(comp) || ts.isFunctionExpression(comp)) && comp.typeParameters?.length ? ["__setup"] : [
|
|
15
|
-
[node.expression.getText(ast), node.expression.getStart(ast)],
|
|
16
|
-
`({
|
|
17
|
-
__typeProps: {} as Parameters<typeof __setup>[0],
|
|
18
|
-
...{} as Parameters<typeof __setup>[1] extends { slots?: infer S, expose?: infer E } | undefined ? {
|
|
19
|
-
setup: E extends (exposed: infer Exposed) => any ? () => Exposed : never,
|
|
20
|
-
slots: S extends Record<string, any> ? import('vue').SlotsType<S> : never
|
|
21
|
-
} : {},`,
|
|
22
|
-
...compOptions ? ["\n ...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [],
|
|
15
|
+
const result = (ts.isArrowFunction(comp) || ts.isFunctionExpression(comp)) && comp.typeParameters?.length ? ["\nreturn __setup"] : [
|
|
23
16
|
`
|
|
24
|
-
|
|
17
|
+
type __Props = Parameters<typeof __setup>[0]
|
|
18
|
+
type __Slots = Parameters<typeof __setup>[1] extends { slots?: infer Slots } | undefined ? Slots : {}
|
|
19
|
+
type __Exposed = Parameters<typeof __setup>[1] extends { expose?: (exposed: infer Exposed) => any } | undefined ? Exposed : {}`,
|
|
20
|
+
"\n const __component = ",
|
|
21
|
+
[node.expression.getText(ast), node.expression.getStart(ast)],
|
|
22
|
+
`({`,
|
|
23
|
+
isVapor ? "" : `...{} as {
|
|
24
|
+
setup: () => __Exposed,
|
|
25
|
+
slots: import('vue').SlotsType<__Slots>
|
|
26
|
+
},`,
|
|
27
|
+
...compOptions ? ["...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [],
|
|
28
|
+
`})
|
|
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
|
+
$props: __Props
|
|
31
|
+
}
|
|
32
|
+
return {} as {
|
|
33
|
+
__isFragment?: never
|
|
34
|
+
__isTeleport?: never
|
|
35
|
+
__isSuspense?: never
|
|
36
|
+
new (props: __Props): __Instance,
|
|
37
|
+
setup: (props: __Props, ctx?: {
|
|
38
|
+
attrs?: Record<string, any>
|
|
39
|
+
slots?: __Slots,
|
|
40
|
+
expose?: (exposed: keyof __Exposed extends never ? __Instance : __Exposed) => any
|
|
41
|
+
}) => {},
|
|
42
|
+
}`
|
|
25
43
|
];
|
|
26
|
-
codes.replaceRange(node.end, node.end,
|
|
44
|
+
codes.replaceRange(node.end, node.end, ...result, `\n})()`);
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
//#endregion
|
|
@@ -98,7 +116,7 @@ function transformJsxMacros(rootMap, options) {
|
|
|
98
116
|
if (!root?.body || Object.keys(macros).length === 1 && macros.defineStyle) continue;
|
|
99
117
|
const asyncModifier = root.modifiers?.find((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword);
|
|
100
118
|
if (asyncModifier && macros.defineComponent) codes.replaceRange(asyncModifier.pos, asyncModifier.end);
|
|
101
|
-
const result =
|
|
119
|
+
const result = macros.defineComponent && root.typeParameters?.length ? "({}) as JSX.Element" : "__ctx.render";
|
|
102
120
|
const propsType = root.parameters[0]?.type ? root.parameters[0].type.getText(ast) : "{}";
|
|
103
121
|
codes.replaceRange(root.parameters.pos, root.parameters.pos, ts.isArrowFunction(root) && root.parameters.pos === root.pos ? "(" : "", `__props: typeof __ctx.props & ${propsType}, `, `__context?: typeof __ctx.context, `, `__ctx = {} as Awaited<ReturnType<typeof __fn>>, `, `__fn = (${asyncModifier ? "async" : ""}(`);
|
|
104
122
|
if (ts.isArrowFunction(root)) codes.replaceRange(root.end, root.end, `))${root.pos === root.parameters.pos ? ")" : ""} => `, result);
|
|
@@ -116,9 +134,12 @@ function transformJsxMacros(rootMap, options) {
|
|
|
116
134
|
});
|
|
117
135
|
props.push(`${element.name.escapedText}${isRequired ? ":" : "?:"} typeof ${element.name.escapedText}`);
|
|
118
136
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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" : "", ` = `);
|
|
142
|
+
codes.replaceRange(node.expression.end, node.expression.end, `
|
|
122
143
|
return {} as {
|
|
123
144
|
props: {${props.join(", ")}},
|
|
124
145
|
context: {
|
|
@@ -167,6 +188,7 @@ function getMacro(node, ts, options) {
|
|
|
167
188
|
const expression = getMacroExpression(initializer);
|
|
168
189
|
if (expression) return {
|
|
169
190
|
expression,
|
|
191
|
+
variableDeclaration: decl,
|
|
170
192
|
initializer: decl.initializer,
|
|
171
193
|
isRequired: ts.isNonNullExpression(initializer)
|
|
172
194
|
};
|
|
@@ -200,13 +222,13 @@ function getRootMap(options) {
|
|
|
200
222
|
if (root && parents[2] && ts.isCallExpression(parents[2]) && !parents[2].typeArguments && options.defineComponent.alias.includes(parents[2].expression.getText(ast))) {
|
|
201
223
|
if (!rootMap.has(root)) rootMap.set(root, {});
|
|
202
224
|
if (!rootMap.get(root).defineComponent) {
|
|
203
|
-
rootMap.get(root).defineComponent =
|
|
225
|
+
rootMap.get(root).defineComponent = parents[2];
|
|
204
226
|
transformDefineComponent(parents[2], parents[3], options);
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
229
|
const macro = getMacro(node, ts, options);
|
|
208
230
|
if (macro) {
|
|
209
|
-
const { expression, initializer } = macro;
|
|
231
|
+
const { expression, initializer, variableDeclaration } = macro;
|
|
210
232
|
let isRequired = macro.isRequired;
|
|
211
233
|
if (!rootMap.has(root)) rootMap.set(root, {});
|
|
212
234
|
const macroName = expression.expression.getText(ast);
|
|
@@ -234,12 +256,12 @@ function getRootMap(options) {
|
|
|
234
256
|
const defineModel = rootMap.get(root).defineModel ??= [];
|
|
235
257
|
defineModel.push(`${modelName.includes("-") ? `'${modelName}'` : modelName}${isRequired ? ":" : "?:"} ${typeString}`, `'onUpdate:${modelName}'?: ($event: ${typeString}) => any`);
|
|
236
258
|
if (expression.typeArguments?.[1]) defineModel.push(`${modelName}Modifiers?: Partial<Record<${(0, ts_macro.getText)(expression.typeArguments[1], ast, ts)}, boolean>>`);
|
|
237
|
-
codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), `// @ts-ignore\n${id};\
|
|
259
|
+
codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), variableDeclaration ? `// @ts-ignore\n${id};\n` : "", `let ${id} = `);
|
|
238
260
|
} else if (options.defineSlots.alias.includes(macroName)) {
|
|
239
|
-
codes.replaceRange(expression.getStart(ast), expression.getStart(ast),
|
|
261
|
+
codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__slots;\n" : "", `const __slots = `);
|
|
240
262
|
rootMap.get(root).defineSlots = `Partial<typeof __slots>`;
|
|
241
263
|
} else if (options.defineExpose.alias.includes(macroName)) {
|
|
242
|
-
codes.replaceRange(expression.getStart(ast), expression.getStart(ast),
|
|
264
|
+
codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__exposed;\n" : "", `const __exposed = `);
|
|
243
265
|
rootMap.get(root).defineExpose = `typeof __exposed`;
|
|
244
266
|
}
|
|
245
267
|
}
|
package/dist/volar.js
CHANGED
|
@@ -6,22 +6,40 @@ import { allCodeFeatures, createPlugin, getText } from "ts-macro";
|
|
|
6
6
|
function transformDefineComponent(node, parent, options) {
|
|
7
7
|
const { codes, ast, ts } = options;
|
|
8
8
|
const [comp, compOptions] = node.arguments;
|
|
9
|
+
const isVapor = node.expression.getText(ast) === "defineVaporComponent";
|
|
9
10
|
codes.replaceRange(comp.end, node.end - 1);
|
|
10
11
|
codes.replaceRange(node.getStart(ast), node.expression.end, ts.isExpressionStatement(parent) ? ";" : "", `(() => {
|
|
11
12
|
const __setup = `);
|
|
12
|
-
const result = (ts.isArrowFunction(comp) || ts.isFunctionExpression(comp)) && comp.typeParameters?.length ? ["__setup"] : [
|
|
13
|
-
[node.expression.getText(ast), node.expression.getStart(ast)],
|
|
14
|
-
`({
|
|
15
|
-
__typeProps: {} as Parameters<typeof __setup>[0],
|
|
16
|
-
...{} as Parameters<typeof __setup>[1] extends { slots?: infer S, expose?: infer E } | undefined ? {
|
|
17
|
-
setup: E extends (exposed: infer Exposed) => any ? () => Exposed : never,
|
|
18
|
-
slots: S extends Record<string, any> ? import('vue').SlotsType<S> : never
|
|
19
|
-
} : {},`,
|
|
20
|
-
...compOptions ? ["\n ...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [],
|
|
13
|
+
const result = (ts.isArrowFunction(comp) || ts.isFunctionExpression(comp)) && comp.typeParameters?.length ? ["\nreturn __setup"] : [
|
|
21
14
|
`
|
|
22
|
-
|
|
15
|
+
type __Props = Parameters<typeof __setup>[0]
|
|
16
|
+
type __Slots = Parameters<typeof __setup>[1] extends { slots?: infer Slots } | undefined ? Slots : {}
|
|
17
|
+
type __Exposed = Parameters<typeof __setup>[1] extends { expose?: (exposed: infer Exposed) => any } | undefined ? Exposed : {}`,
|
|
18
|
+
"\n const __component = ",
|
|
19
|
+
[node.expression.getText(ast), node.expression.getStart(ast)],
|
|
20
|
+
`({`,
|
|
21
|
+
isVapor ? "" : `...{} as {
|
|
22
|
+
setup: () => __Exposed,
|
|
23
|
+
slots: import('vue').SlotsType<__Slots>
|
|
24
|
+
},`,
|
|
25
|
+
...compOptions ? ["...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [],
|
|
26
|
+
`})
|
|
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
|
+
$props: __Props
|
|
29
|
+
}
|
|
30
|
+
return {} as {
|
|
31
|
+
__isFragment?: never
|
|
32
|
+
__isTeleport?: never
|
|
33
|
+
__isSuspense?: never
|
|
34
|
+
new (props: __Props): __Instance,
|
|
35
|
+
setup: (props: __Props, ctx?: {
|
|
36
|
+
attrs?: Record<string, any>
|
|
37
|
+
slots?: __Slots,
|
|
38
|
+
expose?: (exposed: keyof __Exposed extends never ? __Instance : __Exposed) => any
|
|
39
|
+
}) => {},
|
|
40
|
+
}`
|
|
23
41
|
];
|
|
24
|
-
codes.replaceRange(node.end, node.end,
|
|
42
|
+
codes.replaceRange(node.end, node.end, ...result, `\n})()`);
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
//#endregion
|
|
@@ -96,7 +114,7 @@ function transformJsxMacros(rootMap, options) {
|
|
|
96
114
|
if (!root?.body || Object.keys(macros).length === 1 && macros.defineStyle) continue;
|
|
97
115
|
const asyncModifier = root.modifiers?.find((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword);
|
|
98
116
|
if (asyncModifier && macros.defineComponent) codes.replaceRange(asyncModifier.pos, asyncModifier.end);
|
|
99
|
-
const result =
|
|
117
|
+
const result = macros.defineComponent && root.typeParameters?.length ? "({}) as JSX.Element" : "__ctx.render";
|
|
100
118
|
const propsType = root.parameters[0]?.type ? root.parameters[0].type.getText(ast) : "{}";
|
|
101
119
|
codes.replaceRange(root.parameters.pos, root.parameters.pos, ts.isArrowFunction(root) && root.parameters.pos === root.pos ? "(" : "", `__props: typeof __ctx.props & ${propsType}, `, `__context?: typeof __ctx.context, `, `__ctx = {} as Awaited<ReturnType<typeof __fn>>, `, `__fn = (${asyncModifier ? "async" : ""}(`);
|
|
102
120
|
if (ts.isArrowFunction(root)) codes.replaceRange(root.end, root.end, `))${root.pos === root.parameters.pos ? ")" : ""} => `, result);
|
|
@@ -114,9 +132,12 @@ function transformJsxMacros(rootMap, options) {
|
|
|
114
132
|
});
|
|
115
133
|
props.push(`${element.name.escapedText}${isRequired ? ":" : "?:"} typeof ${element.name.escapedText}`);
|
|
116
134
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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" : "", ` = `);
|
|
140
|
+
codes.replaceRange(node.expression.end, node.expression.end, `
|
|
120
141
|
return {} as {
|
|
121
142
|
props: {${props.join(", ")}},
|
|
122
143
|
context: {
|
|
@@ -165,6 +186,7 @@ function getMacro(node, ts, options) {
|
|
|
165
186
|
const expression = getMacroExpression(initializer);
|
|
166
187
|
if (expression) return {
|
|
167
188
|
expression,
|
|
189
|
+
variableDeclaration: decl,
|
|
168
190
|
initializer: decl.initializer,
|
|
169
191
|
isRequired: ts.isNonNullExpression(initializer)
|
|
170
192
|
};
|
|
@@ -198,13 +220,13 @@ function getRootMap(options) {
|
|
|
198
220
|
if (root && parents[2] && ts.isCallExpression(parents[2]) && !parents[2].typeArguments && options.defineComponent.alias.includes(parents[2].expression.getText(ast))) {
|
|
199
221
|
if (!rootMap.has(root)) rootMap.set(root, {});
|
|
200
222
|
if (!rootMap.get(root).defineComponent) {
|
|
201
|
-
rootMap.get(root).defineComponent =
|
|
223
|
+
rootMap.get(root).defineComponent = parents[2];
|
|
202
224
|
transformDefineComponent(parents[2], parents[3], options);
|
|
203
225
|
}
|
|
204
226
|
}
|
|
205
227
|
const macro = getMacro(node, ts, options);
|
|
206
228
|
if (macro) {
|
|
207
|
-
const { expression, initializer } = macro;
|
|
229
|
+
const { expression, initializer, variableDeclaration } = macro;
|
|
208
230
|
let isRequired = macro.isRequired;
|
|
209
231
|
if (!rootMap.has(root)) rootMap.set(root, {});
|
|
210
232
|
const macroName = expression.expression.getText(ast);
|
|
@@ -232,12 +254,12 @@ function getRootMap(options) {
|
|
|
232
254
|
const defineModel = rootMap.get(root).defineModel ??= [];
|
|
233
255
|
defineModel.push(`${modelName.includes("-") ? `'${modelName}'` : modelName}${isRequired ? ":" : "?:"} ${typeString}`, `'onUpdate:${modelName}'?: ($event: ${typeString}) => any`);
|
|
234
256
|
if (expression.typeArguments?.[1]) defineModel.push(`${modelName}Modifiers?: Partial<Record<${getText(expression.typeArguments[1], ast, ts)}, boolean>>`);
|
|
235
|
-
codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), `// @ts-ignore\n${id};\
|
|
257
|
+
codes.replaceRange(initializer.getStart(ast), initializer.getStart(ast), variableDeclaration ? `// @ts-ignore\n${id};\n` : "", `let ${id} = `);
|
|
236
258
|
} else if (options.defineSlots.alias.includes(macroName)) {
|
|
237
|
-
codes.replaceRange(expression.getStart(ast), expression.getStart(ast),
|
|
259
|
+
codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__slots;\n" : "", `const __slots = `);
|
|
238
260
|
rootMap.get(root).defineSlots = `Partial<typeof __slots>`;
|
|
239
261
|
} else if (options.defineExpose.alias.includes(macroName)) {
|
|
240
|
-
codes.replaceRange(expression.getStart(ast), expression.getStart(ast),
|
|
262
|
+
codes.replaceRange(expression.getStart(ast), expression.getStart(ast), variableDeclaration ? "// @ts-ignore\n__exposed;\n" : "", `const __exposed = `);
|
|
241
263
|
rootMap.get(root).defineExpose = `typeof __exposed`;
|
|
242
264
|
}
|
|
243
265
|
}
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./core-
|
|
3
|
-
require('./raw-
|
|
2
|
+
require('./core-BGMj1zaw.cjs');
|
|
3
|
+
require('./raw-V1VJGrnC.cjs');
|
|
4
4
|
require('./options-BejTnOdM.cjs');
|
|
5
|
-
require('./src-
|
|
6
|
-
const require_webpack = require('./webpack-
|
|
5
|
+
require('./src-Zbpeaztk.cjs');
|
|
6
|
+
const require_webpack = require('./webpack-337kgHM4.cjs');
|
|
7
7
|
|
|
8
8
|
exports.default = require_webpack.webpack_default;
|
package/dist/webpack.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Options } from "./options-Egmm6BVJ.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as webpack10 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) => webpack10.WebpackPluginInstance;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/webpack.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./core-
|
|
2
|
-
import "./raw-
|
|
1
|
+
import "./core-u2ydd_-y.js";
|
|
2
|
+
import "./raw-Dprh1tIQ.js";
|
|
3
3
|
import "./options-BWRkHmm5.js";
|
|
4
|
-
import "./src-
|
|
5
|
-
import { webpack_default } from "./webpack-
|
|
4
|
+
import "./src-9_QEflZu.js";
|
|
5
|
+
import { webpack_default } from "./webpack-BijR4yVK.js";
|
|
6
6
|
|
|
7
7
|
export { webpack_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-jsx-vapor/macros",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "Macros for Vue JSX Vapor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -131,18 +131,18 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"@vue-macros/common": "^3.0.0-beta.
|
|
134
|
+
"@vue-macros/common": "^3.0.0-beta.20",
|
|
135
135
|
"@vue/compiler-sfc": "3.6.0-alpha.2",
|
|
136
136
|
"hash-sum": "^2.0.0",
|
|
137
|
-
"ts-macro": "^0.3.
|
|
137
|
+
"ts-macro": "^0.3.2",
|
|
138
138
|
"unplugin": "^2.3.5"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@babel/types": "^7.28.0",
|
|
142
|
-
"@nuxt/kit": "^3.18.
|
|
143
|
-
"@nuxt/schema": "^3.18.
|
|
142
|
+
"@nuxt/kit": "^3.18.1",
|
|
143
|
+
"@nuxt/schema": "^3.18.1",
|
|
144
144
|
"@types/hash-sum": "^1.0.2",
|
|
145
|
-
"@vue-macros/test-utils": "^3.0.0-beta.
|
|
145
|
+
"@vue-macros/test-utils": "^3.0.0-beta.20",
|
|
146
146
|
"vue": "3.6.0-alpha.2"
|
|
147
147
|
},
|
|
148
148
|
"scripts": {
|